Team Ai
Datasetpublic

RazinAleks/SO-Python_QA-GUI_Desktop_Applications_class

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes11downloads
train.json1 linesDownload Raw Back to root
1[{"Question":"A researcher has created a small simulation in MATLAB and we want to make it accessible to others. My plan is to take the simulation, clean up a few things and turn it into a set of functions. Then I plan to compile it into a C library and use SWIG to create a Python wrapper. At that point, I should be able to call the simulation from a small Django app. At least I hope so.\nDo I have the right plan? Has anyone else done something similar? Can you let me know if there are any serious pitfalls that I'm not aware of at the moment?","AnswerCount":4,"Available Count":3,"Score":0.2449186624,"is_accepted":false,"ViewCount":2313,"Q_Id":5136,"Users Score":5,"Answer":"One thing to remember is that the Matlab compiler does not actually compile the Matlab code into native machine instructions.  It simply wraps it into a standalone executable or a library with its own runtime engine that runs it.  You would be able to run your code without Matlab installed, and you would be able to interface it with other languages, but it will still be interpreted Matlab code, so there would be no speedup.","Q_Score":14,"Tags":"python,c,matlab","A_Id":1659332,"CreationDate":"2008-08-07T18:47:00.000","Title":"Does anyone have experience creating a shared library in MATLAB?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A researcher has created a small simulation in MATLAB and we want to make it accessible to others. My plan is to take the simulation, clean up a few things and turn it into a set of functions. Then I plan to compile it into a C library and use SWIG to create a Python wrapper. At that point, I should be able to call the simulation from a small Django app. At least I hope so.\nDo I have the right plan? Has anyone else done something similar? Can you let me know if there are any serious pitfalls that I'm not aware of at the moment?","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":2313,"Q_Id":5136,"Users Score":2,"Answer":"I'd also try ctypes first. \n\nUse the Matlab compiler to compile the code into C. \nCompile the C code into a DLL.\nUse ctypes to load and call code from this DLL\n\nThe hardest step is probably 1, but if you already know Matlab and have used the Matlab compiler, you should not have serious problems with it.","Q_Score":14,"Tags":"python,c,matlab","A_Id":138534,"CreationDate":"2008-08-07T18:47:00.000","Title":"Does anyone have experience creating a shared library in MATLAB?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A researcher has created a small simulation in MATLAB and we want to make it accessible to others. My plan is to take the simulation, clean up a few things and turn it into a set of functions. Then I plan to compile it into a C library and use SWIG to create a Python wrapper. At that point, I should be able to call the simulation from a small Django app. At least I hope so.\nDo I have the right plan? Has anyone else done something similar? Can you let me know if there are any serious pitfalls that I'm not aware of at the moment?","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":2313,"Q_Id":5136,"Users Score":3,"Answer":"I won't help much but I remember that I was able to wrap a MATLAB simulation into DLL and then call it from a Delphi app. It worked really well.","Q_Score":14,"Tags":"python,c,matlab","A_Id":5302,"CreationDate":"2008-08-07T18:47:00.000","Title":"Does anyone have experience creating a shared library in MATLAB?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is a difficult and open-ended question I know, but I thought I'd throw it to the floor and see if anyone had any interesting suggestions.\nI have developed a code-generator that takes our python interface to our C++ code (generated via SWIG) and generates code needed to expose this as WebServices.  When I developed this code I did it using TDD, but I've found my tests to be brittle as hell.  Because each test essentially wanted to verify that for a given bit of input code (which happens to be a C++ header) I'd get a given bit of outputted code I wrote a small engine that reads test definitions from XML input files and generates test cases from these expectations.\nThe problem is I dread going in to modify the code at all.  That and the fact that the unit tests themselves are a: complex, and b: brittle.\nSo I'm trying to think of alternative approaches to this problem, and it strikes me I'm perhaps tackling it the wrong way.  Maybe I need to focus more on the outcome, IE: does the code I generate actually run and do what I want it to, rather than, does the code look the way I want it to.\nHas anyone got any experiences of something similar to this they would care to share?","AnswerCount":8,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":7527,"Q_Id":11060,"Users Score":0,"Answer":"My recommendation would be to figure out a set of known input-output results, such as some simpler cases that you already have in place, and unit test the code that is produced. It's entirely possible that as you change the generator that the exact string that is produced may be slightly different... but what you really care is whether it is interpreted in the same way. Thus, if you test the results as you would test that code if it were your feature, you will find out if it succeeds in the ways you want.\nBasically, what you really want to know is whether your generator will produce what you expect without physically testing every possible combination (also: impossible). By ensuring that your generator is consistent in the ways you expect, you can feel better that the generator will succeed in ever-more-complex situations.\nIn this way, you can also build up a suite of regression tests (unit tests that need to keep working correctly). This will help you make sure that changes to your generator aren't breaking other forms of code. When you encounter a bug that your unit tests didn't catch, you may want to include it to prevent similar breakage.","Q_Score":29,"Tags":"c++,python,unit-testing,code-generation,swig","A_Id":3331503,"CreationDate":"2008-08-14T13:59:00.000","Title":"How should I unit test a code-generator?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is a difficult and open-ended question I know, but I thought I'd throw it to the floor and see if anyone had any interesting suggestions.\nI have developed a code-generator that takes our python interface to our C++ code (generated via SWIG) and generates code needed to expose this as WebServices.  When I developed this code I did it using TDD, but I've found my tests to be brittle as hell.  Because each test essentially wanted to verify that for a given bit of input code (which happens to be a C++ header) I'd get a given bit of outputted code I wrote a small engine that reads test definitions from XML input files and generates test cases from these expectations.\nThe problem is I dread going in to modify the code at all.  That and the fact that the unit tests themselves are a: complex, and b: brittle.\nSo I'm trying to think of alternative approaches to this problem, and it strikes me I'm perhaps tackling it the wrong way.  Maybe I need to focus more on the outcome, IE: does the code I generate actually run and do what I want it to, rather than, does the code look the way I want it to.\nHas anyone got any experiences of something similar to this they would care to share?","AnswerCount":8,"Available Count":5,"Score":0.1243530018,"is_accepted":false,"ViewCount":7527,"Q_Id":11060,"Users Score":5,"Answer":"Recall that \"unit testing\" is only one kind of testing.  You should be able to unit test the internal pieces of your code generator.  What you're really looking at here is system level testing (a.k.a. regression testing).  It's not just semantics... there are different mindsets, approaches, expectations, etc.  It's certainly more work, but you probably need to bite the bullet and set up an end-to-end regression test suite: fixed C++ files -> SWIG interfaces -> python modules -> known output.  You really want to check the known input (fixed C++ code) against expected output (what comes out of the final Python program).  Checking the code generator results directly would be like diffing object files...","Q_Score":29,"Tags":"c++,python,unit-testing,code-generation,swig","A_Id":11443,"CreationDate":"2008-08-14T13:59:00.000","Title":"How should I unit test a code-generator?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is a difficult and open-ended question I know, but I thought I'd throw it to the floor and see if anyone had any interesting suggestions.\nI have developed a code-generator that takes our python interface to our C++ code (generated via SWIG) and generates code needed to expose this as WebServices.  When I developed this code I did it using TDD, but I've found my tests to be brittle as hell.  Because each test essentially wanted to verify that for a given bit of input code (which happens to be a C++ header) I'd get a given bit of outputted code I wrote a small engine that reads test definitions from XML input files and generates test cases from these expectations.\nThe problem is I dread going in to modify the code at all.  That and the fact that the unit tests themselves are a: complex, and b: brittle.\nSo I'm trying to think of alternative approaches to this problem, and it strikes me I'm perhaps tackling it the wrong way.  Maybe I need to focus more on the outcome, IE: does the code I generate actually run and do what I want it to, rather than, does the code look the way I want it to.\nHas anyone got any experiences of something similar to this they would care to share?","AnswerCount":8,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":7527,"Q_Id":11060,"Users Score":0,"Answer":"Yes, results are the ONLY thing that matters. The real chore is writing a framework that allows your generated code to run independently... spend your time there.","Q_Score":29,"Tags":"c++,python,unit-testing,code-generation,swig","A_Id":11128,"CreationDate":"2008-08-14T13:59:00.000","Title":"How should I unit test a code-generator?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is a difficult and open-ended question I know, but I thought I'd throw it to the floor and see if anyone had any interesting suggestions.\nI have developed a code-generator that takes our python interface to our C++ code (generated via SWIG) and generates code needed to expose this as WebServices.  When I developed this code I did it using TDD, but I've found my tests to be brittle as hell.  Because each test essentially wanted to verify that for a given bit of input code (which happens to be a C++ header) I'd get a given bit of outputted code I wrote a small engine that reads test definitions from XML input files and generates test cases from these expectations.\nThe problem is I dread going in to modify the code at all.  That and the fact that the unit tests themselves are a: complex, and b: brittle.\nSo I'm trying to think of alternative approaches to this problem, and it strikes me I'm perhaps tackling it the wrong way.  Maybe I need to focus more on the outcome, IE: does the code I generate actually run and do what I want it to, rather than, does the code look the way I want it to.\nHas anyone got any experiences of something similar to this they would care to share?","AnswerCount":8,"Available Count":5,"Score":1.2,"is_accepted":true,"ViewCount":7527,"Q_Id":11060,"Users Score":14,"Answer":"I started writing up a summary of my experience with my own code generator, then went back and re-read your question and found you had already touched upon the same issues yourself, focus on the execution results instead of the code layout\/look.\nProblem is, this is hard to test, the generated code might not be suited to actually run in the environment of the unit test system, and how do you encode the expected results?\nI've found that you need to break down the code generator into smaller pieces and unit test those. Unit testing a full code generator is more like integration testing than unit testing if you ask me.","Q_Score":29,"Tags":"c++,python,unit-testing,code-generation,swig","A_Id":11074,"CreationDate":"2008-08-14T13:59:00.000","Title":"How should I unit test a code-generator?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is a difficult and open-ended question I know, but I thought I'd throw it to the floor and see if anyone had any interesting suggestions.\nI have developed a code-generator that takes our python interface to our C++ code (generated via SWIG) and generates code needed to expose this as WebServices.  When I developed this code I did it using TDD, but I've found my tests to be brittle as hell.  Because each test essentially wanted to verify that for a given bit of input code (which happens to be a C++ header) I'd get a given bit of outputted code I wrote a small engine that reads test definitions from XML input files and generates test cases from these expectations.\nThe problem is I dread going in to modify the code at all.  That and the fact that the unit tests themselves are a: complex, and b: brittle.\nSo I'm trying to think of alternative approaches to this problem, and it strikes me I'm perhaps tackling it the wrong way.  Maybe I need to focus more on the outcome, IE: does the code I generate actually run and do what I want it to, rather than, does the code look the way I want it to.\nHas anyone got any experiences of something similar to this they would care to share?","AnswerCount":8,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":7527,"Q_Id":11060,"Users Score":0,"Answer":"If you are running on *nux you might consider dumping the unittest framework in favor of a bash script or makefile. on windows you might consider building a shell app\/function that runs the generator and then uses the code (as another process) and unittest that.\nA third option would be to generate the code and then build an app from it that includes nothing but a unittest. Again you would need a shell script or whatnot to run this for each input. As to how to encode the expected behavior, it occurs to me that it could be done in much the same way as you would for the C++ code just using the generated interface rather than the C++ one.","Q_Score":29,"Tags":"c++,python,unit-testing,code-generation,swig","A_Id":11235,"CreationDate":"2008-08-14T13:59:00.000","Title":"How should I unit test a code-generator?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the best way to use PyGame (SDL) within a PyGTK application?\nI'm searching for a method that allows me to have a drawing area in the GTK window and at the same time being able to manage both GTK and SDL events.","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":4838,"Q_Id":25661,"Users Score":0,"Answer":"I tried doing this myself a while ago, and I never got it to work perfectly. Actually I never got it to work at all under Windows, as it kept crashing the entire OS and I ran out of patience. I continued to use it though as it was only important it ran on Linux, and was only a small project. I'd strongly recommend you investigate alternatives. It always felt like a nasty hack, and made me feel dirty.","Q_Score":9,"Tags":"python,gtk,pygtk,sdl,pygame","A_Id":88457,"CreationDate":"2008-08-25T04:36:00.000","Title":"pyGame within a pyGTK application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the best way to use PyGame (SDL) within a PyGTK application?\nI'm searching for a method that allows me to have a drawing area in the GTK window and at the same time being able to manage both GTK and SDL events.","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":4838,"Q_Id":25661,"Users Score":0,"Answer":"There's a simple solution that might work for you.  \nWrite the PyGTK stuff and PyGame stuff as separate applications.  Then from the PyGTK application call the PyGame application, using os.system to call the PyGame application.  If you need to share data between the two then either use a database, pipes or IPC.","Q_Score":9,"Tags":"python,gtk,pygtk,sdl,pygame","A_Id":199288,"CreationDate":"2008-08-25T04:36:00.000","Title":"pyGame within a pyGTK application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a bit perplexed by drag and drop in wxPython (but perhaps this questions pertains to drag and drop in other GUI frameworks as well). The frameworks provides a couple of callbacks (OnEnter and OnDragOver) that purportedly allow me to inform the system whether the current mouse position is a valid place to drop whatever it is that is being dragged. From these methods I can return wx.DragNone, wx.DragCopy, etc. What baffles me is that from within these methods I am not allowed to call GetData, which means I am not allowed to examine the data that the user is dragging. If I cannot see the data, how am I supposed to know whether it is OK for the user to drop here?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":584,"Q_Id":26706,"Users Score":1,"Answer":"There is no way to see dragged data in OnEnter and OnDragOver methods.\nThe only solution I found is to store the dragged item in some instance variable that is then readable inside these methods.","Q_Score":6,"Tags":"python,user-interface,drag-and-drop,wxpython,wxwidgets","A_Id":139047,"CreationDate":"2008-08-25T19:43:00.000","Title":"wxpython: How do I examine dragged data in OnDragOver?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a bit perplexed by drag and drop in wxPython (but perhaps this questions pertains to drag and drop in other GUI frameworks as well). The frameworks provides a couple of callbacks (OnEnter and OnDragOver) that purportedly allow me to inform the system whether the current mouse position is a valid place to drop whatever it is that is being dragged. From these methods I can return wx.DragNone, wx.DragCopy, etc. What baffles me is that from within these methods I am not allowed to call GetData, which means I am not allowed to examine the data that the user is dragging. If I cannot see the data, how am I supposed to know whether it is OK for the user to drop here?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":584,"Q_Id":26706,"Users Score":1,"Answer":"One solution, which is a hack of limited usefulness, is when a drag is initiated, store the dragged data in a global or static reference somewhere. This way, in the OnEnter and OnDragOver handlers, it is possible to get a reference to the data being dragged. This is of course only useful for drags within the same application (the same instance of the application, actually).","Q_Score":6,"Tags":"python,user-interface,drag-and-drop,wxpython,wxwidgets","A_Id":26707,"CreationDate":"2008-08-25T19:43:00.000","Title":"wxpython: How do I examine dragged data in OnDragOver?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've played around with GTK, TK, wxPython, Cocoa, curses and others. They are are fairly horrible to use.. GTK\/TK\/wx\/curses all seem to basically be direct-ports of the appropriate C libraries, and Cocoa basically mandates using both PyObjC and Interface Builder, both of which I dislike..\nThe Shoes GUI library for Ruby is great.. It's very sensibly designed, and very \"rubyish\", and borrows some nice-to-use things from web development (like using hex colours codes, or :color => rgb(128,0,0))\nAs the title says: are there any nice, \"Pythonic\" GUI toolkits?","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":10824,"Q_Id":35922,"Users Score":1,"Answer":"I use pyGtk. I think wxPython is nice but it's too limited, and PyQt is, well, Qt. =)","Q_Score":19,"Tags":"python,user-interface","A_Id":36761,"CreationDate":"2008-08-30T12:19:00.000","Title":"Are there any \"nice to program\" GUI toolkits for Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.\nThe thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.\nI was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).","AnswerCount":11,"Available Count":8,"Score":0.0181798149,"is_accepted":false,"ViewCount":8539,"Q_Id":48123,"Users Score":1,"Answer":"Personally I would recommend coding it out instead of using Glade. I'm still learning python and pyGtk but I will say that writing out the UI by hand gave me a lot of insight on how things work under the hood. \nOnce you have it learned I'd say to give glade, or other UI designers a try but definitely learn how to do it the \"hard\" way first.","Q_Score":32,"Tags":"python,gtk,pygtk,glade,gtk2","A_Id":751707,"CreationDate":"2008-09-07T04:00:00.000","Title":"Glade or no glade: What is the best way to use PyGtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.\nThe thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.\nI was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).","AnswerCount":11,"Available Count":8,"Score":0.0181798149,"is_accepted":false,"ViewCount":8539,"Q_Id":48123,"Users Score":1,"Answer":"For quick and simple screens I use Glade.  But for anything that needs finer levels of control, I create a custom classes for what I actually need (this is important, because it's too easy to get carried away with generalisations).\nWith a skinny applications specific classes, I can rapidly change the look and feel application wide from a single place.  Rather like using CSS to mantain consistency for web sites.","Q_Score":32,"Tags":"python,gtk,pygtk,glade,gtk2","A_Id":199167,"CreationDate":"2008-09-07T04:00:00.000","Title":"Glade or no glade: What is the best way to use PyGtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.\nThe thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.\nI was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).","AnswerCount":11,"Available Count":8,"Score":0.0906594778,"is_accepted":false,"ViewCount":8539,"Q_Id":48123,"Users Score":5,"Answer":"I started out using glade, but soon moved to just doing everything in code. Glade is nice for simple things, and it's good when you're learning how GTK organizes the widgets (how things are packed, etc). Constructing everything in code, however, you have much more flexibility. Plus, you don't have the glade dependency.","Q_Score":32,"Tags":"python,gtk,pygtk,glade,gtk2","A_Id":106889,"CreationDate":"2008-09-07T04:00:00.000","Title":"Glade or no glade: What is the best way to use PyGtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.\nThe thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.\nI was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).","AnswerCount":11,"Available Count":8,"Score":0.0363476168,"is_accepted":false,"ViewCount":8539,"Q_Id":48123,"Users Score":2,"Answer":"I recommend using Glade for rapid development, but not for learning. Why? because some times you will need to tune up some widgets in order to work as you want they to work, and if you don't really know\/understand the properties attributes of every widget then you will be in troubles.","Q_Score":32,"Tags":"python,gtk,pygtk,glade,gtk2","A_Id":305667,"CreationDate":"2008-09-07T04:00:00.000","Title":"Glade or no glade: What is the best way to use PyGtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.\nThe thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.\nI was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).","AnswerCount":11,"Available Count":8,"Score":0.072599319,"is_accepted":false,"ViewCount":8539,"Q_Id":48123,"Users Score":4,"Answer":"I usually start with Glade until I come to a point where it doesn't have the features I need, e.g. creating a wizard. As long as I'm using the standard widgets that Glade provides, there's really no reason to hand-code the GUI.\nThe more comfortable I become with how Glade formats the code, the better my hand-coding becomes. Not to mention, it's real easy to use Glade to make the underlying framework so you don't have to worry about all the initializations.","Q_Score":32,"Tags":"python,gtk,pygtk,glade,gtk2","A_Id":107959,"CreationDate":"2008-09-07T04:00:00.000","Title":"Glade or no glade: What is the best way to use PyGtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.\nThe thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.\nI was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).","AnswerCount":11,"Available Count":8,"Score":0.0363476168,"is_accepted":false,"ViewCount":8539,"Q_Id":48123,"Users Score":2,"Answer":"First, start to put this in perspective.\nYou will be using GTK.  This is a huge C library built in 1993 using the best traditions of 1970s coding style.  It was built to help implement the GIMP, a Photoshop competitor wanna-be with user interface blunders of legend.  A typical gui field might have forty or more parameters, mostly repetitive, having getters and setters.  There will be pain.\nThe GTK itself manages a complete dynamic type system in C using GObject.  This makes debugging a special joy that requires manually walking through arrays of pointers to methods full of generic argument lists with implicit inheritance.  You will also be jumping through Pango libraries when you least expect it, e.g., using a Pango constant for where in a label the ellipsis go when the page is small.  Expect more pain.\nBy now, you are probably vowing to wrap all your GTK interactions in a Model-View-Controller architecture specific to your application.  This is good.\nUsing Glade, or gtkBuilder, or Stetic, will help coral the huge coupling problem of forty parameters to a function.  Glade provides a basic GUI builder to drag and drop components together.  The parameters and inherited parameters are somewhat separated out.  The output of Glade is .glade XML file which you will then read in, attach your callbacks (\"signal handlers\") to identically named functions, and query or update the in-memory version of that XML to get widgets that you then use pyGTK to manipulate. Glade itself is a creaky and not well maintained.  \nUsing pyGTK gives you annoyingly fine grained control in order to build your GUI.  This will be verbose, copy-and-paste code.   Each attribute will be a separate function call.  The attribute setter does not return anything, so chaining the calls is out of the question.  Usually, your IDE will give only minimal help on what functions mean and you will be constantly referring to DevHelp or some other tool.\nOne would almost expect GTK GUIs were meant to fail.","Q_Score":32,"Tags":"python,gtk,pygtk,glade,gtk2","A_Id":2149087,"CreationDate":"2008-09-07T04:00:00.000","Title":"Glade or no glade: What is the best way to use PyGtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.\nThe thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.\nI was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).","AnswerCount":11,"Available Count":8,"Score":0.0906594778,"is_accepted":false,"ViewCount":8539,"Q_Id":48123,"Users Score":5,"Answer":"Glade is very useful for creating interfaces, it means you can easily change the GUI without doing much coding. You'll find that if you want to do anything useful (e.g. build a treeview) you will have to get familiar with various parts of the GTK documentation  - in practice finding a good tutorial\/examples.","Q_Score":32,"Tags":"python,gtk,pygtk,glade,gtk2","A_Id":54313,"CreationDate":"2008-09-07T04:00:00.000","Title":"Glade or no glade: What is the best way to use PyGtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.\nThe thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.\nI was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).","AnswerCount":11,"Available Count":8,"Score":1.0,"is_accepted":false,"ViewCount":8539,"Q_Id":48123,"Users Score":12,"Answer":"Use GtkBuilder instead of Glade, it's integrated into Gtk itself instead of a separate library.\nThe main benefit of Glade is that it's much, much easier to create the interface. It's a bit more work to connect signal handlers, but I've never felt that matters much.","Q_Score":32,"Tags":"python,gtk,pygtk,glade,gtk2","A_Id":48136,"CreationDate":"2008-09-07T04:00:00.000","Title":"Glade or no glade: What is the best way to use PyGtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance?","AnswerCount":4,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":7815,"Q_Id":60446,"Users Score":9,"Answer":"(I used to write customer apps for Windows Mobile.)\nForget about python. Even if it's technically possible:\n\nyour app will be big (you'll have to bundle the whole python runtime with your app)\nyour app will use lots of memory (python is a memory hog, relative to C\/C++)\nyour app will be slow\nyou wont find any documentation or discussion groups to help you when you (inevitably) encounter problems\n\nGo with C\/C++ (or C#). Visual Studio 2005\/2008 have decent tools for those (SDK for winmo built-in, debugging on the emulator or device connected through USB), the best documentation is for those technologies plus there are active forums\/discussion groups\/mailing lists where you can ask for help.","Q_Score":4,"Tags":"python,windows-mobile","A_Id":60945,"CreationDate":"2008-09-13T09:56:00.000","Title":"Windows Mobile development in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code such as C++ or Delphi?\nFor example, we have an application written in Delphi that is being moved to C#.NET  We'd like to provide Ruby or Python scripting in our new application to replace VBSCRIPT.  However, we would need to provide Ruby\/Python scripting in the old Delphi application.  Is it possible to use the managed dlls provided by IronRuby\/IronPython from Delphi code?","AnswerCount":6,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":877,"Q_Id":74386,"Users Score":3,"Answer":"Why not embed CPython instead, which has an API intended to be used directly from C\/C++. You lose the multiple language advantage but probably gain simplicity.","Q_Score":5,"Tags":".net,delphi,ironpython,unmanaged,ironruby","A_Id":934717,"CreationDate":"2008-09-16T16:44:00.000","Title":"Using DLR from Unmanaged Code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know it's possible to place a PyCairo surface inside a Gtk Drawing Area. But I think Qt is a lot better to work with, so I've been wondering if there's anyway to place a PyCairo surface inside some Qt component?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2526,"Q_Id":82180,"Users Score":0,"Answer":"For plotting with you should also consider matplotlib, which provides a higher level API and integrates well with PyQT.","Q_Score":2,"Tags":"python,qt,gtk,pyqt","A_Id":453179,"CreationDate":"2008-09-17T11:28:00.000","Title":"PyQt and PyCairo","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0114280739,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":2,"Answer":"Towards answering the updated question, its a chicken\/egg problem.  The best way to justify an expense is to show how it reduces a cost somewhere else, so you may need to spend some extra\/personal time to learn something first to build some kind of functional prototype.\nShow your boss a demo like \"hey, i did this thing, and it saves me this much time [or better yet, this much $$], imagine if everyone could use this how much money we would save\"\nand then after they agree, explain how it is some other technology and that it is worth the expense to get more training, and training for others on how to do it better.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":87121,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"Personally I work on a Java app, but I couldn't get by without perl for some supporting scripts. \nI've got scripts to quickly flip what db I'm pointing at, scripts to run build scripts, scripts to scrape data & compare stuff. \nSure I could do all that with java, or maybe shell scripts (I've got some of those too), but who wants to compile a class (making sure the classpath is set right etc) when you just need something quick and dirty. Knowing a scripting language can remove 90% of those boring\/repetitive manual tasks.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84456,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"They're useful for the \"Quick Hack\" that is for plugging a gap in your main language for a quick (and potentially dirty) fix faster than it would take to develop the same in your main language. An example: a simple script in perl to go through a large text file and replace all instances of an email address with another is trivial with an amount of time taken in the 10 minute range. Hacking a console app together to do the same in your main language would take multiples of that.\nYou also have the benefit that exposing yourself to additional languages broadens your abilities and learning to attack problems from a different languages perspective can be as valuable as the language itself.\nFinally, scripting languages are very useful in the realm of extension. Take LUA as an example. You can bolt a lua interpreter into your app with very little overhead and you now have a way to create rich scripting functionality that can be exposed to end users or altered and distributed quickly without requiring a rebuild of the entire app. This is used to great effect in many games most notably World of Warcraft.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84443,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"Im not sure if this is what you are looking for, but we write our main application with Java at the small company I work for, but have used python to write smaller scripts quickly.  Backup software, temporary scripts to manipulate data and push out results.  It just seems easier sometimes to sit down with python and write a quick script than mess with classes and stuff in java.  \nTemp scripts that aren't going to stick around don't need a lot of design time wasted on them.\nAnd I am lazy, but it is good to just learn as much as you can of course and see what features exist in other languages.  Knowing more never hurts you in future career changes :)","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84423,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"You should also consider learning a functional programming language like Scala.  It has many of the advantages of Ruby, including a concise syntax, and powerful features like closures.  But it compiles to Java class files and and integrate seamlessly into a Java stack, which may make it much easier for your employer to swallow.\nScala isn't dynamically typed, but its \"implicit conversion\" feature gives many, perhaps even all of the benefits of dynamic typing, while retaining many of the advantages of static typing.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84584,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"Learning something with a flexible OOP system, like Lisp or Perl (see Moose), will allow you to better expand and understand your thoughts on software engineering.  Ideally, every language has some unique facet (whether it be CLOS or some other technique) that enhances, extends and grows your abilities as a programmer.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":85167,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"If all you have is a hammer, every problem begins to look like a nail.\nThere are times when having a screwdriver or pair of pliers makes a complicated problem trivial.\nNobody asks contractors, carpenters, etc, \"Why learn to use a screwdriver if i already have a hammer?\".  Really good contractors\/carpenters have tons of tools and know how to use them well.  All programmers should be doing the same thing, learning to use new tools and use them well.\n\nBut before we use any power tools, lets\n  take a moment to talk about shop safety.  Be sure\n  to read, understand, and follow all the\n  safety rules that come with your power\n  tools.  Doing so will greatly reduce\n  the risk of personal injury.  And remember\n  this: there is no more important rule\n  than to wear these: safety glasses\n  -- Norm","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":85733,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"Dynamic languages are fantastic for prototyping ideas. Often for performance reasons they won't work for permanent solutions or products. But, with languages like Python, which allow you to embed standard C\/C++\/Java inside them or visa versa, you can speed up the really critical bits but leave it glued together with the flexibility of a dynamic language.\n...and so you get the best of both worlds. If you need to justify this in terms of why more people should learn these languages, just point out much faster you can develop the same software and how much more robust the solution is (because debugging\/fixing problems in dynamic languages is in my experience, considerably easier!).","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":85789,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"Knowing grep and ruby made it possible to narrow down a problem, and verify the fix for, an issue involving tons of java exceptions on some production servers. Because I threw the solution together in ruby, it was done (designed, implemented, tested, run, bug-fixed, re-run, enhanced, results analyzed) in an afternoon instead of a couple of days. I could have solved the same problem using an all-java solution or a C# solution, but it most likely would have taken me longer.\nHaving dynamic language expertise also sometimes leads you to simpler solutions in less dynamic languages. In ruby, perl or python, you just intuitively reach for associative arrays (hashes, dictionaries, whatever word you want to use) for the smallest things, where you might be tempted to create a complex class hierarchy in a statically typed language when the problem doesn't necessarily demand it.\nPlus you can plug in most scripting languages into most runtimes. So it doesn't have to be either\/or.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":85891,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0114280739,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":2,"Answer":"Learning a new language is a long-term process. In a couple of days you'll learn the basics, yes. But! As you probably know, the real practical applicability of any language is tied to the standard library and other available components. Learning how to use the efficiently requires a lot of hands-on experience. \nPerhaps the only immediate short-term benefit is that developers learn to distinguish the nails that need a Python\/Perl\/Ruby -hammer. And, if they are any good, they can then study some more (online, perhaps!) and become real experts.\nThe long-term benefits are easier to imagine:\n\nThe employee becomes a better developer. Better developer => better quality. We are living in a knowledge economy these days. It's wiser to invest in those brains that already work for you.\nIt is easier to adapt when the next big language emerges. It is very likely that the NBL will have many of the features present in today's scripting languages: first-class functions, closures, streams\/generators, etc. \nNew market possibilities and ability to respond more quickly. Even if you are not writing Python, other people are. Your clients? Another vendor in the project? Perhaps a critical component was written in some other language? It will cost money and time, if you do not have people who can understand the code and interface with it.\nRecruitment. If your company has a reputation of teaching new and interesting stuff to people, it will be easier to recruit the top people. Everyone is doing Java\/C#\/C++. It is not a very effective way to differentiate yourself in the job market.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":85898,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"The \"real benefit\" that an employer could see is a better programmer who can implement solutions faster; however, you will not be able to provide any hard numbers to justify the expense and an employer will most likely have you work on what makes money now as opposed to having you work on things that make the future better. \nThe only time you can get training on the employer's dime, is when they perceive a need for it and it's cheaper than hiring a new person who already has that skill-set.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":85910,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"Testing.\nIt's often quicker and easier to test your C#\/Java application by using a dynamic language. You can do exploratory testing at the interactive prompt and quickly create automated test scripts.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":86366,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"I think the main benefits of dynamic languages can be boiled down to\n\nRapid development\nGlue\n\nThe short design-code-test cycle time makes dynamic languages ideal for prototyping, tools, and quick & dirty one-off scripts. IMHO, the latter two can make a huge impact on a programmer's productivity. It amazes me how many people trudge through things manually instead of whipping up a tool to do it for them. I think it's because they don't have something like Perl in their toolbox.\nThe ability to interface with just about anything (other programs or languages, databases, etc.) makes it easy to reuse existing work and automate tasks that would otherwise need to be done manually.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":86657,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"Others have already explained why learning more languages makes you a better programmer.\nAs for convincing your boss it's worth it, this is probably just your company's culture.  Some places make career and skill progress a policy (move up or out), some places value it but leave it up to the employee's initiative, and some places are very focused on the bottom line.\nIf you have to explain why learning a language is a good thing to your boss, my advice would be to stay at work only as long as necessary, then go home and study new things on your own.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":86738,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"For after work work, for freelance jobs...:) and final to be programming literate as possible as...;)","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":87164,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.017141178,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":3,"Answer":"Edit: I wrote this before reading the update to the original question. See my other answer for a better answer to the updated question. I will leave this as is as a warning against being the fastest gun in the west =)\nOver a decade ago, when I was learning the ways of the Computer, the Old Wise Men With Beards explained how C and C++ are the tools of the industry. No one used Pascal and only the foolhardy would risk their companies with assembler.\nAnd of course, no one would even mention the awful slow ugly thing called Java. It will not be a tool for serious business.\nSo. Um. Replace the languages in the above story and perhaps you can predict the future. Perhaps you can't. Point is, Java will not be the Last Programming Language ever and also you will most likely switch employers as well. The future is charging at you 24 hours per day. Be prepared.\nLearning new languages is good for you. Also, in some cases it can give you bragging rights for a long time. My first university course was in Scheme. So when people talk to me about the new language du jour, my response is something like \"First-class functions? That's so last century.\"\nAnd of course, you get more stuff done with a high-level language.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84571,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":1.2,"is_accepted":true,"ViewCount":32287,"Q_Id":84340,"Users Score":80,"Answer":"A lot of times some quick task comes up that isn't part of the main software you are developing.  Sometimes the task is one off ie compare this file to the database and let me know the differences.  It is a lot easier to do text parsing in Perl\/Ruby\/Python than it is in Java or C# (partially because it is a lot easier to use regular expressions).  It will probably take a lot less time to parse the text file using Perl\/Ruby\/Python (or maybe even vbscript cringe and then load it into the database than it would to create a Java\/C# program to do it or to do it by hand.\nAlso, due to the ease at which most of the dynamic languages parse text, they are great for code generation.  Sure your final project must be in C#\/Java\/Transact SQL but instead of cutting and pasting 100 times, finding errors, and cutting and pasting another 100 times it is often (but not always) easier just to use a code generator.\nA recent example at work is we needed to get data from one accounting system into our accounting system.  The system has an import format, but the old system had a completely different format (fixed width although some things had to be matched).  The task is not to create a program to migrate the data over and over again.  It is to shove the data into our system and then maintain it there going forward.  So even though we are a C# and SQL Server shop, I used Python to convert the data into the format that could be imported by our application.  Ultimately it doesn't matter that I used python, it matters that the data is in the system.  My boss was pretty impressed.\nWhere I often see the dynamic languages used for is testing.  It is much easier to create a Python\/Perl\/Ruby program to link to a web service and throw some data against it than it is to create the equivalent Java program.  You can also use python to hit against command line programs, generate a ton of garbage (but still valid) test data, etc.. quite easily.\nThe other thing that dynamic languages are big on is code generation.  Creating the C#\/C++\/Java code.  Some examples follow:\nThe first code generation task I often see is people using dynamic languages to maintain constants in the system.  Instead of hand coding a bunch of enums, a dynamic language can be used to fairly easily parse a text file and create the Java\/C# code with the enums.\nSQL is a whole other ball game but often you get better performance by cut and pasting 100 times instead of trying to do a function (due to caching of execution plans or putting complicated logic in a function causing you to go row by row instead of in a set).  In fact it is quite useful to use the table definition to create certain stored procedures automatically.\nIt is always better to get buy in for a code generator.  But even if you don't, is it more fun to spend time cutting\/pasting or is it more fun to create a Perl\/Python\/Ruby script once and then have that generate the code?  If it takes you hours to hand code something but less time to create a code generator, then even if you use it once you have saved time and hence money.  If it takes you longer to create a code generator than it takes to hand code once but you know you will have to update the code more than once, it may still make sense.  If it takes you 2 hours to hand code, 4 hours to do the generator but you know you'll have to hand code equivalent work another 5 or 6 times than it is obviously better to create the generator.\nAlso some things are easier with dynamic languages than Java\/C#\/C\/C++.  In particular regular expressions come to mind.  If you start using regular expressions in Perl and realize their value, you may suddenly start making use of the Java regular expression library if you haven't before.  If you have then there may be something else.\nI will leave you with one last example of a task that would have been great for a dynamic language.  My work mate had to take a directory full of files and burn them to various cd's for various customers.  There were a few customers but a lot of files and you had to look in them to see what they were.  He did this task by hand....A Java\/C# program would have saved time, but for one time and with all the development overhead it isn't worth it.  However slapping something together in Perl\/Python\/Ruby probably would have been worth it.  He spent several hours doing it.  It would have taken less than one to create the Python script to inspect each file, match which customer it goes to, and then move the file to the appropriate place.....Again, not part of the standard job.  But the task came up as a one off.  Is it better to do it yourself, spend the larger amount of time to make Java\/C# do the task, or spend a much smaller amount of time doing it in Python\/Perl\/Ruby.  If you are using C or C++ the point is even more dramatic due to the extra concerns of programming in C or C++ (pointers, no array bounds checking, etc.).","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84943,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"Often, dynamc languages (especially python and lua) are embedded in programs to add a more plugin-like functionality and because they are high-level languages that make it easy to add certain behavior, where a low\/mid-level language is not needed.\nLua specificially lacks all the low-level system calls because it was designed for easeof-use to add functionality within the program, not as a general programming language.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84400,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"It's all about broadening your horizons as a developer. If you limit yourself to only strong-typed languages, you may not end up the best programmer you could.\nAs for tasks, Python\/Lua\/Ruby\/Perl are great for small simple tasks, like finding some files and renaming them. They also work great when paired with a framework (e.g. Rails, Django, Lua for Windows) for developing simple apps quickly. Hell, 37Signals is based on creating simple yet very useful apps in Ruby on Rails.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84441,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"Philosophical issues aside, I know that I have gotten value from writing quick-and-dirty Ruby scripts to solve brute-force problems that Java was just too big for.  Last year I had three separate directory structures that were all more-or-less the same, but with lots of differences among the files (the client hadn't heard of version control and I'll leave the rest to your imagination).  \nIt would have taken a great deal of overhead to write an analyzer in Java, but in Ruby I had one working in about 40 minutes.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84383,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"Given the increasing focus to running dynamic languages (da-vinci vm etc.) on the JVM and the increasing number of dynamic languages that do run on it (JRuby, Grrovy, Jython) I think the usecases are just increasing. Some of the scenarios I found really benifited are\n\nPrototyping- use RoR or Grails to build quick prototypes with advantage of being able to runn it on the standard app server and (maybe) reuse existing services etc.\nTesting- right unit tests much much faster in dynamic languages\nPerformance\/automation test scripting- some of these tools are starting to allow the use standard dynamic language of choice to write the test scripts instead of proprietary script languages. Side benefit might be to the able to reuse some unit test code you've already written.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":90403,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"Don't tell your employer that you want to learn Ruby. Tell him you want to learn about the state-of-the-art in web framework technologies. it just happens that the hottest ones are Django and Ruby on Rails.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":98291,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"Don't bother your employer, spend ~$40 on a book, download some software, and devote some time each day to read\/do exercises. In no time you'll be trained :)","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":114875,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0285636566,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":5,"Answer":"A good hockey player plays where the puck is. A great hockey player plays where the puck is going to be.\n- Wayne Gretzky\nOur industry is always changing. No language can be mainstream forever. To me Java, C++, .Net is where the puck is right now. And python, ruby, perl is where the puck is going to be. Decide for yourself if you wanna be good or great!","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":92642,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"I have often found that learning another language, especially a dynamically typed language, can teach you things about other languages and make you an overall better programmer.  Learning ruby, for example, will teach you Object Oriented programming in ways Java wont, and vice versa.  All in all, I believe that it is better to be a well rounded programmer than stuck in a single language.  It makes you more valuable to the companies\/clients you work for.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84382,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":0,"Answer":"Dynamic languages are a different way to think and sometimes the practices you learn from a dynamic or functional language can transfer to the more statically typed languages but if you never take the time to learn different languages, you'll never get the benefit of having a knew way to think when you are coding.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":90005,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":1.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":21,"Answer":"Let me turn your question on its head by asking what use it is to an American English speaker to learn another language?\nThe languages we speak (and those we program in) inform the way we think. This can happen on a fundamental level, such as c++ versus javascript versus lisp, or on an implementation level, in which a ruby construct provides a eureka moment for a solution in your \"real job.\"\nSpeaking of your real job, if the market goes south and your employer decides to \"right size\" you, how do you think you'll stack up against a guy who is flexible because he's written software in tens of languages, instead of your limited exposure? All things being equal, I think the answer is clear.\nFinally, you program for a living because you love programming... right?","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84362,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":1.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":9,"Answer":"I primarily program in Java and C# but use dynamic languages (ruby\/perl) to support smoother deployment, kicking off OS tasks, automated reporting, some log parsing, etc.\nAfter a short time learning and experimenting with ruby or perl you should be able to write some regex manipulating scripts that can alter data formats or grab information from logs.   An example of a small ruby\/perl script that could be written quickly would be a script to parse a very large log file and report out only a few events of interest in either a human readable format or a csv format. \nAlso, having experience with a variety of different programming languages should help you think of new ways to tackle problems in more structured languages like Java, C++, and C#.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84437,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":1.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":7,"Answer":"One big reason to learn Perl or Ruby is to help you automate any complicated tasks that you have to do over and over.\nOr if you have to analyse contents of log files and you need more mungeing than available using grep, sed, etc.\nAlso using other languages, e.g. Ruby, that don't have much \"setup cost\" will let you quickly prototype ideas before implementing them in C++, Java, etc.\nHTH\ncheers,\nRob","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":84535,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":0.0057142235,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":1,"Answer":"I have found the more that I play with Ruby, the better I understand C#. \n1) As you switch between these languages that each of them has their own constructs and philosophies behind the problems that they try to solve. This will help you when finding the right tool for the job or the domain of a problem.\n2) The role of the compiler (or interpreter for some languages) becomes more prominent. Why is Ruby's type system differ from the .Net\/C# system? What problems do each of these solve? You'll find yourself understanding at a lower level the constructs of the compiler and its influence on the language\n3) Switching between Ruby and C# really helped me to understand Design Patterns better. I really suggest implementing common design patterns in a language like C# and then in a language like Ruby. It often helped me see through some of the compiler ceremony to the philosophy of a particular pattern.\n4) A different community. C#, Java, Ruby, Python, etc all have different communities that can help engage your abilities. It is a great way to take your craft to the next level.\n5) Last, but not least, because new languages are fun :)","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":2870953,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++\/C#\/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages faster or better after only a few days of learning than with the static language that you have been using for several years?\nUpdate\nAfter seeing the first few responses it is clear that there are two issues.\nMy main interest would be something that is justifiable to the employer as an expense.\nThat is, I am looking for justifications for the employer to finance the learning of a dynamic language. Aside from the obvious that the employee will have broader view, the\nemployers are usually looking for some \"real\" benefit.","AnswerCount":35,"Available Count":31,"Score":1.0,"is_accepted":false,"ViewCount":32287,"Q_Id":84340,"Users Score":14,"Answer":"I don't think anyone has mentioned this yet. Learning a new language can be fun! Surely that's a good enough reason to try something new.","Q_Score":66,"Tags":"c#,java,python,ruby,perl","A_Id":89272,"CreationDate":"2008-09-17T15:16:00.000","Title":"Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Looking for an open source library, for C++, Java, C# or Python, for reading the data from Quicken .qdf files.\n@Swati:  Quicken .qif format is for transfer only and is not kept up to date by the application  like the .qdf file is.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":11880,"Q_Id":91890,"Users Score":5,"Answer":"QDF is proprietary and not really meant for reading other than my Quicken, probably for a reason as it is messy.  \nI would recommend finding a way to export the qdf into an OFX (Open Financial Exchange) or qif file.  I have done some financial and quickbooks automation and I did something similar.  The problem is if you don't export to an exchange format, each version differs and strange things happen for many conditions that since they aren't documented (QDF) it becomes a bad situation for the programmer.\nOFX is what allows online banking, brokerages and apps like mint.com securely get financial data.  It is a standard and consistent.  Finding a way to this is much better if at all possible.","Q_Score":12,"Tags":"c#,java,python,file-format,quicken","A_Id":2278316,"CreationDate":"2008-09-18T12:02:00.000","Title":"Reading quicken data files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to put a Canvas with an image in my window, and then I want to pack widgets on top of it, so the Canvas acts as a background. \nIs it possible to have two states for the pack manager: one for one set of widgets and another for another set?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3016,"Q_Id":112263,"Users Score":2,"Answer":"The answer to your specific question is no. You can't have two states or otherwise use pack two different ways in the same parent. \nHowever, what I think you want to accomplish is simple. Use the built-in features of the canvas to create an image item that is part of the canvas, then pack things into the canvas as if it were a frame. \nYou can accomplish a similar thing by creating a label widget with an image, then pack your other widgets into the label.\nOne advantage to using a canvas is you can easily tile an image to fill the whole canvas with a repeating background image so as the window grows the image will continue to fill the window (of course you can just use a sufficiently large original image...)","Q_Score":2,"Tags":"python,tkinter,geometry,pack","A_Id":112337,"CreationDate":"2008-09-21T21:45:00.000","Title":"How do I overlap widgets with the Tkinter pack geometry manager?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to put a Canvas with an image in my window, and then I want to pack widgets on top of it, so the Canvas acts as a background. \nIs it possible to have two states for the pack manager: one for one set of widgets and another for another set?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3016,"Q_Id":112263,"Users Score":0,"Answer":"Not without swapping widget trees in and out, which I don't think can be done cleanly with Tk.  Other toolkits can do this a little more elegantly.\n\nCOM\/VB\/MFC can do this with an ActiveX control - you can hide\/show multiple ActiveX controls in the same region.  Any of the containers will let you do this by changing the child around.  If you're doing a windows-specific program you may be able to accomplish it this way.\nQT will also let you do this in a similar manner.\nGTK is slightly harder.","Q_Score":2,"Tags":"python,tkinter,geometry,pack","A_Id":112432,"CreationDate":"2008-09-21T21:45:00.000","Title":"How do I overlap widgets with the Tkinter pack geometry manager?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm specifically looking for one that lets me display a map of US states with each one as it's own \"object\" in the sense that I can control the color, on click, and on mouseover of each one individually.  GTK is my personal preference, but at this point I'd settle for just about anything.  The application itself will be written in Python, FWIW.","AnswerCount":5,"Available Count":3,"Score":0.0399786803,"is_accepted":false,"ViewCount":906,"Q_Id":112483,"Users Score":1,"Answer":"If you consider Qt, consider also throwing in kdelibs dependency, \n  then you'll have marble widget, which handles maps in neat way.\n\nThanks for advertizing Marble. But you are incorrect: \nThe Marble Widget doesn't depend on kdelibs at all. It just depends on Qt (>=4.3).\nAdditionally Marble also has just received Python bindings.\nI think that the given problem can be solved using Marble. Would just take a few days of work at max. If you have questions about Marble, feel free to ask us on our mailing list or IRC.","Q_Score":1,"Tags":"python,qt,gtk,desktop","A_Id":302298,"CreationDate":"2008-09-21T23:10:00.000","Title":"Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm specifically looking for one that lets me display a map of US states with each one as it's own \"object\" in the sense that I can control the color, on click, and on mouseover of each one individually.  GTK is my personal preference, but at this point I'd settle for just about anything.  The application itself will be written in Python, FWIW.","AnswerCount":5,"Available Count":3,"Score":0.0798297691,"is_accepted":false,"ViewCount":906,"Q_Id":112483,"Users Score":2,"Answer":"If you consider Qt, consider also throwing in kdelibs dependency, then you'll have marble widget, which handles maps in neat way.\nIf you stick only to Qt, then QGraphicsView is a framework to go.\n(note: kdelibs != running whole kde desktop)","Q_Score":1,"Tags":"python,qt,gtk,desktop","A_Id":146015,"CreationDate":"2008-09-21T23:10:00.000","Title":"Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm specifically looking for one that lets me display a map of US states with each one as it's own \"object\" in the sense that I can control the color, on click, and on mouseover of each one individually.  GTK is my personal preference, but at this point I'd settle for just about anything.  The application itself will be written in Python, FWIW.","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":906,"Q_Id":112483,"Users Score":0,"Answer":"Quick tip, if you color each state differently you can identify which one to pick from the color under mouse cursor rather than doing a complex point in polygon routine.","Q_Score":1,"Tags":"python,qt,gtk,desktop","A_Id":122701,"CreationDate":"2008-09-21T23:10:00.000","Title":"Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Dear Stacktoverflow, can you show me an example of how to use a QScrollBar? Thanks.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3106,"Q_Id":139005,"Users Score":1,"Answer":"It will come down to you using the QScrollArea, it is a widget that implements showing something that is larger than the available space. You will not need to use QScrollBar directly. I don't have a PyQt example but there is a C++ example in the QT distribution it is called the \"Image Viewer\". The object hierarchy will still be the same","Q_Score":0,"Tags":"python,pyqt","A_Id":139056,"CreationDate":"2008-09-26T12:05:00.000","Title":"PyQt - QScrollBar","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've written code for communication between my phone and comp thru TCP sockets. When I type out the code line by line in the interactive console it works fine. However, when i try running the script directly through filebrowser.py it just wont work. I'm using Nokia N95. Is there anyway I can run this script directly without using filebrowser.py?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1588,"Q_Id":141647,"Users Score":0,"Answer":"If the code is working in the interactive interpreter when typed, but not when run directly then I would suggest seeing if your code has reached a deadlock on the socket, for example both ends are waiting for data from the other.  When typing into the interactive interpreter there is a longer delay between the execution of each line on code.","Q_Score":1,"Tags":"python,sockets,mobile","A_Id":142502,"CreationDate":"2008-09-26T20:07:00.000","Title":"Socket programming for mobile phones in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've written code for communication between my phone and comp thru TCP sockets. When I type out the code line by line in the interactive console it works fine. However, when i try running the script directly through filebrowser.py it just wont work. I'm using Nokia N95. Is there anyway I can run this script directly without using filebrowser.py?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1588,"Q_Id":141647,"Users Score":0,"Answer":"Don't you have the \"Run script\" menu in your interactive Python shell?","Q_Score":1,"Tags":"python,sockets,mobile","A_Id":215001,"CreationDate":"2008-09-26T20:07:00.000","Title":"Socket programming for mobile phones in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've written code for communication between my phone and comp thru TCP sockets. When I type out the code line by line in the interactive console it works fine. However, when i try running the script directly through filebrowser.py it just wont work. I'm using Nokia N95. Is there anyway I can run this script directly without using filebrowser.py?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1588,"Q_Id":141647,"Users Score":0,"Answer":"Well, it doesn't appear to be a deadlock situation. It throws an error saying remote server refused connection. However, like I said before, if i type the very same code into the interactive interpreter it works just fine. I'm wondering if the error is because the script is run through filebrowser.py?","Q_Score":1,"Tags":"python,sockets,mobile","A_Id":142786,"CreationDate":"2008-09-26T20:07:00.000","Title":"Socket programming for mobile phones in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a Python gui project that needs to duplicate the look of a Windows gui environment (ie Explorer).  I have my own custom icons to draw but they should be selectable by the same methods as usual; click, ctrl-click, drag box etc.  Are any of the gui toolkits going to help with this or will I have to implement it all myself.  If there aren't any tools to help with this advice would be greatly appreciated.\nedit I am not trying to recreate explorer, that would be madness.  I simply want to be able to take icons and lay them out in a scrollable window.  Any number of them may be selected at once.  It would be great if there was something that could select\/deselect them in the same (appearing at least) way that Windows does.  Then all I would need is a list of all the selected icons.","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":547,"Q_Id":145155,"Users Score":2,"Answer":"In wxPython there's a plethora of ready-made list and tree controls (CustomTreeCtrl, TreeListCtrl, and others), a mixture of which you can use to create a simple explorer in minutes. The wxPython demo even has a few relevant examples (see the demo of MVCTree).","Q_Score":1,"Tags":"python,user-interface","A_Id":145174,"CreationDate":"2008-09-28T03:39:00.000","Title":"Something like Explorer's icon grid view in a Python GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I could not find any pointers on how to create a menubar icon on OSX using wx. I originally thought that the wxTaskBarIcon class would do, but it actually creates an icon on the Dock. On Windows, wxTaskBarIcon creates a Systray icon and associated menu, and I would think that on mac osx it would create a menubar icon, I guess not.","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":4972,"Q_Id":145894,"Users Score":1,"Answer":"As of wxPython 2.9.2.0 wx.TaskBarIcon will create a menubar icon now instead on OSX, so long as you call SetIcon.","Q_Score":6,"Tags":"macos,wxpython,wxwidgets","A_Id":25845284,"CreationDate":"2008-09-28T14:02:00.000","Title":"how to set a menubar icon on mac osx using wx","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I need to develop a small-medium sized desktop GUI application, preferably with Python as a language of choice because of time constraints.\nWhat GUI library choices do I have which allow me to redistribute my application standalone, assuming that the users don't have a working Python installation and obviously don't have the GUI libraries I'm using either?\nAlso, how would I go about packaging everything up in binaries of reasonable size for each target OS? (my main targets are Windows and Mac OS X)\nAddition:\nI've been looking at WxPython, but I've found plenty of horror stories of packaging it with cx_freeze and getting 30mb+ binaries, and no real advice on how to actually do the packaging and how trust-worthy it is.","AnswerCount":7,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5407,"Q_Id":153956,"Users Score":0,"Answer":"I've used py2Exe myself - it's really easy (at least for small apps).","Q_Score":11,"Tags":"python,user-interface,wxpython,distribution,freeze","A_Id":153999,"CreationDate":"2008-09-30T16:50:00.000","Title":"Python GUI Application redistribution","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to develop an app using turbogears and sqlalchemy.\nThere is already an existing app using kinterbasdb directly under mod_wsgi on the same server.\nWhen both apps are used, neither seems to recognize that kinterbasdb is already initialized\nIs there something non-obvious I am missing about using sqlalchemy and kinterbasdb in separate apps?  In order to make sure only one instance of kinterbasdb gets initialized and both apps use that instance, does anyone have suggestions?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":270,"Q_Id":155029,"Users Score":2,"Answer":"I thought I posted my solution already...\nModifying both apps to run under WSGIApplicationGroup ${GLOBAL} in their httpd conf file\nand patching sqlalchemy.databases.firebird.py to check if self.dbapi.initialized is True\nbefore calling self.dbapi.init(... was the only way I could manage to get this scenario up and running.\nThe SQLAlchemy 0.4.7 patch:\n\ndiff -Naur SQLAlchemy-0.4.7\/lib\/sqlalchemy\/databases\/firebird.py SQLAlchemy-0.4.7.new\/lib\/sqlalchemy\/databases\/firebird.py\n--- SQLAlchemy-0.4.7\/lib\/sqlalchemy\/databases\/firebird.py       2008-07-26 12:43:52.000000000 -0400\n+++ SQLAlchemy-0.4.7.new\/lib\/sqlalchemy\/databases\/firebird.py   2008-10-01 10:51:22.000000000 -0400\n@@ -291,7 +291,8 @@\n         global _initialized_kb\n         if not _initialized_kb and self.dbapi is not None:\n             _initialized_kb = True\n-            self.dbapi.init(type_conv=type_conv, concurrency_level=concurrency_level)\n+            if not self.dbapi.initialized:\n+                self.dbapi.init(type_conv=type_conv, concurrency_level=concurrency_level)\n         return ([], opts)\n\n     def create_execution_context(self, *args, **kwargs):","Q_Score":1,"Tags":"python,sqlalchemy,kinterbasdb","A_Id":175634,"CreationDate":"2008-09-30T20:47:00.000","Title":"SQLAlchemy and kinterbasdb in separate apps under mod_wsgi","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a simulator in Python, and am curious about options and opinions regarding basic 2D animations. By animation, I'm referring to rendering on the fly, not displaying prerendered images.\nI'm currently using matplotlib (Wxagg backend), and it's possible that I'll be able to continue using it, but I suspect it won't be able to sufficiently scale in terms of performance or capabilities.\nRequirements are:\n\nCross-platform (Linux, MacOS X,\nWindows)\nLow complexity overhead\nPlays well with wxpython (at least won't step on each other's toes unduly)\nInteractivity. Detect when objects are clicked on, moused over, etc. \n\nNote that high performance isn't on the list, but the ability to handle ~100 bitmap objects on the screen would be good.\nYour thoughts?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":29957,"Q_Id":169810,"Users Score":3,"Answer":"You can try pygame, its very easy to handle and similar to SDL under c++","Q_Score":12,"Tags":"python,animation,2d","A_Id":1568711,"CreationDate":"2008-10-04T05:36:00.000","Title":"2D animation in Python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Many times I will use the same font scheme for static text in a wxPython application. Currently I am making a SetFont() call for each static text object but that seems like a lot of unnecessary work. However, the wxPython demo and wxPython In Action book don't discuss this.\nIs there a way to easily apply the same SetFont() method to all these text objects without making separate calls each time?","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1595,"Q_Id":171694,"Users Score":5,"Answer":"You can do this by calling SetFont on the parent window (Frame, Dialog, etc) before adding any widgets.  The child widgets will inherit the font.","Q_Score":3,"Tags":"python,fonts,wxpython","A_Id":184571,"CreationDate":"2008-10-05T08:27:00.000","Title":"Applying a common font scheme to multiple objects in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am in the position of having to make a technology choice early in a project which is targetted at mobile phones.  I saw that there is a python derivative for S60 and wondered whether anyone could share experiences, good and bad, and suggest appropriate IDE's and emulators.\nPlease don't tell me that I should be developing on Windows Mobile, I have already decided not to do that so will mark those answers down.","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1684,"Q_Id":173484,"Users Score":0,"Answer":"I have some J2ME experience and now I decided to write a couple of useful apps for my phone so I decided to use PyS60 to study Python by the way:)\nSome things I don't like about the platform are:\n\nYou can't invoke any graphical functions (module appuifw) from non-main thread.\nPython script model is not well-suited for ui applications because the script must contain explicit while loop or semaphore to prevent main thread from exit\nThere function sys.exit() is not available.\n\nAgain, I'm a newbie to PyS60 so if the issues given above do have nice workarounds don't hesitate to write them as comments. I would be very grateful.","Q_Score":10,"Tags":"python,mobile,pys60","A_Id":1195831,"CreationDate":"2008-10-06T07:37:00.000","Title":"Does anyone have experience with PyS60 mobile development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am in the position of having to make a technology choice early in a project which is targetted at mobile phones.  I saw that there is a python derivative for S60 and wondered whether anyone could share experiences, good and bad, and suggest appropriate IDE's and emulators.\nPlease don't tell me that I should be developing on Windows Mobile, I have already decided not to do that so will mark those answers down.","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1684,"Q_Id":173484,"Users Score":0,"Answer":"I've written a calculator, that I'd like to have, and made a simple game. \nI wrote it right on the phone. I was writing in text editor then switched to Python and ran a script. It is not very comfortable, but it's ok. Moreover, I was writing all this when I hadn't PC nearby.\nIt was a great experience!","Q_Score":10,"Tags":"python,mobile,pys60","A_Id":489368,"CreationDate":"2008-10-06T07:37:00.000","Title":"Does anyone have experience with PyS60 mobile development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am working on a desktop application in PyGTK and seem to be bumping up against some limitations of my file organization.  Thus far I've structured my project this way:\n\napplication.py - holds the primary application class (most functional routines)\ngui.py - holds a loosely coupled GTK gui implementation.  Handles signal callbacks, etc.\ncommand.py - holds command line automation functions not dependent on data in the application class\nstate.py - holds the state data persistence class\n\nThis has served fairly well so far, but at this point application.py is starting to get rather long.  I have looked at numerous other PyGTK applications and they seem to have similar structural issues.  At a certain point the primary module starts to get very long and there is not obvious way of breaking the code out into narrower modules without sacrificing clarity and object orientation.\nI have considered making the GUI the primary module and having seperate modules for the toolbar routines, the menus routines, etc, but at that point I believe I will lose most of the benefits of OOP and end up with an everything-references-everything scenario.\nShould I just deal with having a very long central module or is there a better way of structuring the project so that I don't have to rely on the class browser so much?\nEDIT I\nOk, so point taken regarding all the MVC stuff.  I do have a rough approximation of MVC in my code, but admittedly I could probably gain some mileage by further segregating the model and controller.  However, I am reading over python-gtkmvc's documentation (which is a great find by the way, thank you for referencing it) and my impression is that its not going to solve my problem so much as just formalize it.  My application is a single glade file, generally a single window. So no matter how tightly I define the MVC roles of the modules I'm still going to have one controller module doing most everything, which is pretty much what I have now. Admittedly I'm a little fuzzy on proper MVC implementation and I'm going to keep researching, but it doesn't look to me like this architecture is going to get any more stuff out of my main file, its just going to rename that file to controller.py.\nShould I be thinking about separate Controller\/View pairs for seperate sections of the window (the toolbar, the menus, etc)? Perhaps that is what I'm missing here.  It seems that this is what S. Lott is referring to in his second bullet point.\nThanks for the responses so far.","AnswerCount":6,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2015,"Q_Id":216093,"Users Score":0,"Answer":"So having not heard back regarding my edit to the original question, I have done some more research and the conclusion I seem to be coming to is that yes, I should break the interface out into several views, each with its own controller.  Python-gtkmvc provides the ability to this by providing a glade_top_widget_name parameter to the View constructor.  This all seems to make a good deal of sense although it is going to require a large refactoring of my existing codebase which I may or may not be willing to undertake in the near-term (I know, I know, I should.)  Moreover, I'm left to wonder whether should just have a single Model object (my application is fairly simple--no more than twenty-five state vars) or if I should break it out into multiple models and have to deal with controllers observing multiple models and chaining notifications across them.  (Again, I know I really should do the latter.)  If anyone has any further insight, I still don't really feel like I've gotten an answer to the original question, although I have a direction to head in now.\n(Moreover it seems like their ought to be other architectural choices at hand, given that up until now I had not seen a single Python application coded in the MVC style, but then again many Python applications tend to have the exact problem I've described above.)","Q_Score":8,"Tags":"python,gtk,module,pygtk,organization","A_Id":219737,"CreationDate":"2008-10-19T06:07:00.000","Title":"How do I coherently organize modules for a PyGTK desktop application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a desktop application in PyGTK and seem to be bumping up against some limitations of my file organization.  Thus far I've structured my project this way:\n\napplication.py - holds the primary application class (most functional routines)\ngui.py - holds a loosely coupled GTK gui implementation.  Handles signal callbacks, etc.\ncommand.py - holds command line automation functions not dependent on data in the application class\nstate.py - holds the state data persistence class\n\nThis has served fairly well so far, but at this point application.py is starting to get rather long.  I have looked at numerous other PyGTK applications and they seem to have similar structural issues.  At a certain point the primary module starts to get very long and there is not obvious way of breaking the code out into narrower modules without sacrificing clarity and object orientation.\nI have considered making the GUI the primary module and having seperate modules for the toolbar routines, the menus routines, etc, but at that point I believe I will lose most of the benefits of OOP and end up with an everything-references-everything scenario.\nShould I just deal with having a very long central module or is there a better way of structuring the project so that I don't have to rely on the class browser so much?\nEDIT I\nOk, so point taken regarding all the MVC stuff.  I do have a rough approximation of MVC in my code, but admittedly I could probably gain some mileage by further segregating the model and controller.  However, I am reading over python-gtkmvc's documentation (which is a great find by the way, thank you for referencing it) and my impression is that its not going to solve my problem so much as just formalize it.  My application is a single glade file, generally a single window. So no matter how tightly I define the MVC roles of the modules I'm still going to have one controller module doing most everything, which is pretty much what I have now. Admittedly I'm a little fuzzy on proper MVC implementation and I'm going to keep researching, but it doesn't look to me like this architecture is going to get any more stuff out of my main file, its just going to rename that file to controller.py.\nShould I be thinking about separate Controller\/View pairs for seperate sections of the window (the toolbar, the menus, etc)? Perhaps that is what I'm missing here.  It seems that this is what S. Lott is referring to in his second bullet point.\nThanks for the responses so far.","AnswerCount":6,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":2015,"Q_Id":216093,"Users Score":2,"Answer":"\"holds the primary application class (most functional routines)\"\nAs in singular -- one class?\nI'm not surprised that the One Class Does Everything design isn't working.  It might not be what I'd call object-oriented.   It doesn't sound like it follows the typical MVC design pattern if your functionality is piling up in a single class.\nWhat's in this massive class?  I suggest that you can probably refactor this into pieces.  You have two candidate dimensions for refactoring your application class -- if, indeed, I've guessed right that you've put everything into a single class.\n\nBefore doing anything else, refactor into components that parallel the Real World Entities.  It's not clear what's in your \"state.py\" -- wether this is a proper model of real-world entities, or just mappings between persistent storage and some murky data structure in the application.  Most likely you'd move processing out of your application and into your model (possibly state.py, possibly a new module that is a proper model.)\nBreak your model into pieces.  It will help organize the control and view elements.  The most common MVC mistake is to put too much in control and nothing in the model.\n\nLater, once your model is doing most of the work, you can look at refactor into components that parallel the GUI presentation.  Various top-level frames, for example, should probably have separate cotrol objects.  It's not clear what's in \"GUI.py\" -- this might be a proper view.  What appears to be missing is a Control component.","Q_Score":8,"Tags":"python,gtk,module,pygtk,organization","A_Id":216386,"CreationDate":"2008-10-19T06:07:00.000","Title":"How do I coherently organize modules for a PyGTK desktop application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed Python 2.6 for one user on Windows Vista.  Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors.  I've tried tinkering with the Visual Studio runtime, with no good results.  Any ideas on how to resolve this?","AnswerCount":3,"Available Count":3,"Score":-0.0665680765,"is_accepted":false,"ViewCount":1345,"Q_Id":219215,"Users Score":-1,"Answer":"python 2.6.2 + tkinter 8.5, no problems","Q_Score":3,"Tags":"python,windows,windows-vista,tkinter","A_Id":792527,"CreationDate":"2008-10-20T17:19:00.000","Title":"How do I use Tkinter with Python on Windows Vista?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed Python 2.6 for one user on Windows Vista.  Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors.  I've tried tinkering with the Visual Studio runtime, with no good results.  Any ideas on how to resolve this?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1345,"Q_Id":219215,"Users Score":1,"Answer":"It seems this is a one of the many weird Vista problems and some random reinstalling, installing\/upgrading of the visual studio runtime or some such seems sometimes to help, or disabling sxs in the system configuration or writing a manifest file etc.\nThough I think you should downgrade to windows XP.","Q_Score":3,"Tags":"python,windows,windows-vista,tkinter","A_Id":219326,"CreationDate":"2008-10-20T17:19:00.000","Title":"How do I use Tkinter with Python on Windows Vista?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed Python 2.6 for one user on Windows Vista.  Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors.  I've tried tinkering with the Visual Studio runtime, with no good results.  Any ideas on how to resolve this?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1345,"Q_Id":219215,"Users Score":1,"Answer":"Maybe you should downgrade to 2.5 version?","Q_Score":3,"Tags":"python,windows,windows-vista,tkinter","A_Id":219284,"CreationDate":"2008-10-20T17:19:00.000","Title":"How do I use Tkinter with Python on Windows Vista?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a program that fits the wizard concept ideally; the user is walked through the steps to create a character for a game.\nHowever, I'm realizing that the limitations of the wizard are making it difficult to design \"elegant\" logic flow. For example, because all pages of the wizard are initalized at the same time, I can't have the values entered in one page available to the next one. I have to put a button on each page to get the values from a previous page rather than simply having fields auto-populated.\nI've thought about alternatives to using the wizard. I think the best idea is to have some buttons on one panel that change the information on another panel, e.g. a splitter window.\nHowever, I can't find any documentation in wxPython on how to dynamically change the panel. Everything I've found so far is really pretty static, hence the use of the wizard. Even the \"wxPython in Action\" book doesn't mention it.\nAre there any tutorials for making \"dynamic panels\" or better management of a wizard?","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":2843,"Q_Id":224337,"Users Score":1,"Answer":"The wxPython demo has an example of a \"dynamic\" wizard. Pages override GetNext() and GetPrev() to show pages dynamically. This shows the basic technique; you can extend it to add and remove pages, change pages on the fly, and rearrange pages dynamically.\nThe wizard class is just a convenience, though. You can modify it, or create your own implementation. A style that seems popular nowadays is to use an HTML-based presentation; you can emulate this with the wxHtml control, or the IEHtmlWindow control if your app is Windows only.","Q_Score":3,"Tags":"python,wxpython,wizard","A_Id":247409,"CreationDate":"2008-10-22T02:54:00.000","Title":"Alternatives to a wizard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a program that fits the wizard concept ideally; the user is walked through the steps to create a character for a game.\nHowever, I'm realizing that the limitations of the wizard are making it difficult to design \"elegant\" logic flow. For example, because all pages of the wizard are initalized at the same time, I can't have the values entered in one page available to the next one. I have to put a button on each page to get the values from a previous page rather than simply having fields auto-populated.\nI've thought about alternatives to using the wizard. I think the best idea is to have some buttons on one panel that change the information on another panel, e.g. a splitter window.\nHowever, I can't find any documentation in wxPython on how to dynamically change the panel. Everything I've found so far is really pretty static, hence the use of the wizard. Even the \"wxPython in Action\" book doesn't mention it.\nAre there any tutorials for making \"dynamic panels\" or better management of a wizard?","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2843,"Q_Id":224337,"Users Score":0,"Answer":"I'd get rid of wizard in whole. They are the most unpleasant things I've ever used.\nThe problem that requires a wizard-application where you click 'next' is perhaps a problem where you could apply a better user interface in a bit different manner. Instead of bringing up a dialog with annoying 'next' -button. Do this:\nBring up a page. When the user inserts the information to the page, extend or shorten it according to the input. If your application needs to do some processing to continue, and it's impossible to revert after that, write a new page or disable the earlier section of the current page. When you don't need any input from the user anymore or the app is finished, you can show a button or enable an existing such.\nI don't mean you should implement it all in browser. Make simply a scrolling container that can contain buttons and labels in a flat list.\nBenefit: The user can just click a tab, and you are encouraged to put all the processing into the end of filling the page.","Q_Score":3,"Tags":"python,wxpython,wizard","A_Id":247633,"CreationDate":"2008-10-22T02:54:00.000","Title":"Alternatives to a wizard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I want to move to C++ and SDL in the future, is Python and pygame a good way to learn SDL?","AnswerCount":9,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":25055,"Q_Id":238523,"Users Score":6,"Answer":"Yes. If python is much more natural to you than C++, it might be a good idea to learn pygame first. You'll have to go through a translation process when migrating to using SDL and C, but it should be a more-or-less one-to-one mapping.","Q_Score":18,"Tags":"c++,python,sdl,pygame","A_Id":239167,"CreationDate":"2008-10-26T19:54:00.000","Title":"Is Python and pygame a good way to learn SDL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I want to move to C++ and SDL in the future, is Python and pygame a good way to learn SDL?","AnswerCount":9,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":25055,"Q_Id":238523,"Users Score":0,"Answer":"I wouldn't consider Python (or any managed or interpreted language, for that matter) a good way to learn any complex task, because it insulates the programmer from the workings of the system too much. As a friend of mine put it, \"Python loves you and wants you to be happy.\" And that's all well and good if you already know the fundamentals, but if you want to learn, the last thing you want is a language that does all the work for you.\nYou'll learn the what very quickly, but not the why, and then when something goes badly wrong, (and it will eventually, in any non-trivial project,) you'll be left with no idea what's happening or why.","Q_Score":18,"Tags":"c++,python,sdl,pygame","A_Id":255136,"CreationDate":"2008-10-26T19:54:00.000","Title":"Is Python and pygame a good way to learn SDL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I want to move to C++ and SDL in the future, is Python and pygame a good way to learn SDL?","AnswerCount":9,"Available Count":5,"Score":0.022218565,"is_accepted":false,"ViewCount":25055,"Q_Id":238523,"Users Score":1,"Answer":"python won't prevent you off learning design and that's pretty much the more important thing to learn IMO, I'm doing a smash bros clone with pygame and I learnt a lot in design. And yet you will learn not to write too much suboptimal code too, python have clever and beautiful hacks too.","Q_Score":18,"Tags":"c++,python,sdl,pygame","A_Id":275461,"CreationDate":"2008-10-26T19:54:00.000","Title":"Is Python and pygame a good way to learn SDL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I want to move to C++ and SDL in the future, is Python and pygame a good way to learn SDL?","AnswerCount":9,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":25055,"Q_Id":238523,"Users Score":6,"Answer":"pygame abstracts the SDL interface quite a lot, therefore I don't think there's much of an advantage carried over.","Q_Score":18,"Tags":"c++,python,sdl,pygame","A_Id":238659,"CreationDate":"2008-10-26T19:54:00.000","Title":"Is Python and pygame a good way to learn SDL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I want to move to C++ and SDL in the future, is Python and pygame a good way to learn SDL?","AnswerCount":9,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":25055,"Q_Id":238523,"Users Score":6,"Answer":"You can learn some techniques, ways to implement game logic etc. in SDL-based enviroment but after moving to C++\/SDL you will have to use SDL functions directly, helper functions\/objects from pyGame will be completely useles.","Q_Score":18,"Tags":"c++,python,sdl,pygame","A_Id":238671,"CreationDate":"2008-10-26T19:54:00.000","Title":"Is Python and pygame a good way to learn SDL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is.\nJust to avoid the \"just use C\" comments, here is why I want to use Python:\nThere are a couple reasons I am wanting to switch from C to Python, but the main one is because we are about to start writing a raytracer and I would like to use classes to make it easier on me. Since I hate classes in C++ and structs in C seems a little crazy, I thought I would give Python a try at it. I have also been looking for a reason to use Python again as it has been a while.\nThanks for any help.","AnswerCount":6,"Available Count":5,"Score":0.0333209931,"is_accepted":false,"ViewCount":18416,"Q_Id":242059,"Users Score":1,"Answer":"What OpenGL library are you using?  What windowing library?  What version of Python?\nMost likely cause I can think of is that your windowing library (SDL or whatever you're using) isn't initializing OpenGL before you start calling into it.","Q_Score":15,"Tags":"python,opengl,fedora","A_Id":242063,"CreationDate":"2008-10-28T02:29:00.000","Title":"OpenGl with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is.\nJust to avoid the \"just use C\" comments, here is why I want to use Python:\nThere are a couple reasons I am wanting to switch from C to Python, but the main one is because we are about to start writing a raytracer and I would like to use classes to make it easier on me. Since I hate classes in C++ and structs in C seems a little crazy, I thought I would give Python a try at it. I have also been looking for a reason to use Python again as it has been a while.\nThanks for any help.","AnswerCount":6,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":18416,"Q_Id":242059,"Users Score":0,"Answer":"We have neither ideas about random segmentation faults. There is not enough information. What python libraries are you using for opengl? How do you use them? Can you show us your code? It's probably something trivial but my god -skill ends up to telling me just and only that.\nRaytracer in python? I'd prefer just doing that in C with those structs. But then, I'm assuming you aren't going to do a realtime raytracer so that may be ok.","Q_Score":15,"Tags":"python,opengl,fedora","A_Id":242371,"CreationDate":"2008-10-28T02:29:00.000","Title":"OpenGl with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is.\nJust to avoid the \"just use C\" comments, here is why I want to use Python:\nThere are a couple reasons I am wanting to switch from C to Python, but the main one is because we are about to start writing a raytracer and I would like to use classes to make it easier on me. Since I hate classes in C++ and structs in C seems a little crazy, I thought I would give Python a try at it. I have also been looking for a reason to use Python again as it has been a while.\nThanks for any help.","AnswerCount":6,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":18416,"Q_Id":242059,"Users Score":0,"Answer":"Perhaps you are calling an OpenGL function that requires an active OpenGL context, without having one? That shouldn't necessarily crash, but I guess it might. How to set up such a context depends on the platform, and it's been a while since I used GL from Python (and when I did, I also used GTK+ which complicates matters).","Q_Score":15,"Tags":"python,opengl,fedora","A_Id":246922,"CreationDate":"2008-10-28T02:29:00.000","Title":"OpenGl with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is.\nJust to avoid the \"just use C\" comments, here is why I want to use Python:\nThere are a couple reasons I am wanting to switch from C to Python, but the main one is because we are about to start writing a raytracer and I would like to use classes to make it easier on me. Since I hate classes in C++ and structs in C seems a little crazy, I thought I would give Python a try at it. I have also been looking for a reason to use Python again as it has been a while.\nThanks for any help.","AnswerCount":6,"Available Count":5,"Score":0.0665680765,"is_accepted":false,"ViewCount":18416,"Q_Id":242059,"Users Score":2,"Answer":"Well, I don't know if these are the libs the original poster are using but I saw identical issues in a pet project I'm working on (Graphics Engine using C++ and Python) using PyOpenGL.\nPyOpenGL didn't correctly pick up the rendering context if it was created after the python script had been loaded (I was loading the script first, then calling Python methods in it from my C++ code).\nThe problem doesn't appear if you initialize the display and create the OpenGL rendering context before loading the Python script.","Q_Score":15,"Tags":"python,opengl,fedora","A_Id":1778664,"CreationDate":"2008-10-28T02:29:00.000","Title":"OpenGl with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is.\nJust to avoid the \"just use C\" comments, here is why I want to use Python:\nThere are a couple reasons I am wanting to switch from C to Python, but the main one is because we are about to start writing a raytracer and I would like to use classes to make it easier on me. Since I hate classes in C++ and structs in C seems a little crazy, I thought I would give Python a try at it. I have also been looking for a reason to use Python again as it has been a while.\nThanks for any help.","AnswerCount":6,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":18416,"Q_Id":242059,"Users Score":0,"Answer":"Scripts never cause segmentation faults. \nBut first see if your kernel and kmod video driver working property ...\nExtension modules can cause \"segmentation fault\".","Q_Score":15,"Tags":"python,opengl,fedora","A_Id":2284461,"CreationDate":"2008-10-28T02:29:00.000","Title":"OpenGl with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am getting a DC for a window handle of an object in another program using win32gui.GetDC which returns an int\/long.  I need to blit this DC into a memory DC in python.  The only thing I can't figure out how to do is get a wxDC derived object from the int\/long that win32gui returns.  None of the wxDC objects allow me to pass an actual DC handle to them from what I can tell.  This of course keeps me from doing my blit. Is there any way to do this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1086,"Q_Id":244340,"Users Score":0,"Answer":"From what I can tell, DCs in python are abstracted due to platform variation.  So a device context in python doesn't directly map to a device context in Windows even though many of the methods are direct Windows method calls.  To make this happen it appears you would need to make your own DelegateDC class or something similar that is intended just for Windows so that you could set the DC handle directly.\nThere might also be some way to attach a wxWindow to the window handle after which you could get a wxWindowDC from the wxWindow...can't figure this out though.","Q_Score":2,"Tags":"wxpython,device,win32gui,bitblit","A_Id":253897,"CreationDate":"2008-10-28T18:35:00.000","Title":"wxPython wxDC object from win32gui.GetDC","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As it seems there is no scripting language for Windows mobile devices that gives access to phone (sms, mms, make a call, take photo). I wonder how complex it would be to make a Python library that would enable that (write something in C, compile, and import in PythonCE).\nQuestion: Where shall start to understand how to compile a PythonCE module that will give additional functionality to Python on Windows mobile. Also, what is the required toolkit. Is it at all possible on Mac (Leopard)?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":871,"Q_Id":252859,"Users Score":1,"Answer":"MSDN has plenty of samples for C++ development on Windows Mobile, and the SDK comes with several sample application. Unfortunately VS Express editions (the free ones) do not come with compilers for Smart Devices.  The only free option is the older eMbedded Visual C++ (eVC), which is now something like 8 years old and not supported (though it can still create apps for devices at least up through CE 5.0).","Q_Score":1,"Tags":"c,windows-mobile,extending,pythonce","A_Id":253562,"CreationDate":"2008-10-31T08:13:00.000","Title":"Extending PythonCE to Access gsm\/camera\/gps Easily from PythonCE","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a UI library to create a message box or input box in python?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":6196,"Q_Id":257398,"Users Score":11,"Answer":"Your best bet is the tkMessageBox module, which should work on all systems (as Python will typically come with Tkinter).\nIf you can restrict yourself to a specific operating system, better choices might be available.","Q_Score":6,"Tags":"python,user-controls,user-interface","A_Id":257403,"CreationDate":"2008-11-02T21:22:00.000","Title":"Message Box in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a UI library to create a message box or input box in python?","AnswerCount":4,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":6196,"Q_Id":257398,"Users Score":2,"Answer":"I've heard good things about wx python, which is also multi-platform.","Q_Score":6,"Tags":"python,user-controls,user-interface","A_Id":257532,"CreationDate":"2008-11-02T21:22:00.000","Title":"Message Box in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Background\nI have been asked by a client to create a picture of the world which has animated arrows\/rays that come from one part of the world to another.   \nThe rays will be randomized, will represent a transaction, will fade out after they happen and will increase in frequency as time goes on.  The rays will start in one country's boundary and end in another's.  As each animated transaction happens a continuously updating sum of the amounts of all the transactions will be shown at the bottom of the image. The amounts of the individual transactions will be randomized.  There will also be a year showing on the image that will increment every n seconds.\nThe randomization, summation and incrementing are not a problem for me, but I am at a loss as to how to approach the animation of the arrows\/rays.\nMy question is what is the best way to do this?  What frameworks\/libraries are best suited for this job?\nI am most fluent in python so python suggestions are most easy for me, but I am open to any elegant way to do this.\nThe client will present this as a slide in a presentation in a windows machine.","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":902,"Q_Id":267660,"Users Score":2,"Answer":"The client will present this as a slide in a presentation in a windows machine\n\nI think this is the key to your answer. Before going to a 3d implementation and writing all the code in the world to create this feature, you need to look at the presentation software.  Chances are, your options will boil down to two things:\n\nAnimated Gif\nCustom Presentation Scripts\n\nObviously, an animated gif is not ideal due to the fact that it repeats when it is done rendering, and to make it last a long time would make a large gif.\nCustom Presentation Scripts would probably be the other way to allow him to bring it up in a presentation without running any side-programs, or doing anything strange. I'm not sure which presentation application is the target, but this could be valuable information.\nHe sounds like he's more non-technical and requesting something he doesn't realize will be difficult. I think you should come up with some options, explain the difficulty in implementing them, and suggest another solution that falls into the 'bang for your buck' range.","Q_Score":1,"Tags":"python,image,graphics,animation,drawing","A_Id":267698,"CreationDate":"2008-11-06T04:44:00.000","Title":"How to create a picture with animated aspects programmatically","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Background\nI have been asked by a client to create a picture of the world which has animated arrows\/rays that come from one part of the world to another.   \nThe rays will be randomized, will represent a transaction, will fade out after they happen and will increase in frequency as time goes on.  The rays will start in one country's boundary and end in another's.  As each animated transaction happens a continuously updating sum of the amounts of all the transactions will be shown at the bottom of the image. The amounts of the individual transactions will be randomized.  There will also be a year showing on the image that will increment every n seconds.\nThe randomization, summation and incrementing are not a problem for me, but I am at a loss as to how to approach the animation of the arrows\/rays.\nMy question is what is the best way to do this?  What frameworks\/libraries are best suited for this job?\nI am most fluent in python so python suggestions are most easy for me, but I am open to any elegant way to do this.\nThe client will present this as a slide in a presentation in a windows machine.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":902,"Q_Id":267660,"Users Score":1,"Answer":"It depends largely on the effort you want to expend on this, but the basic outline of an easy way. Would be to load an image of an arrow, and use a drawing library to color and rotate it in the direction you want to point(or draw it using shapes\/curves).\nFinally to actually animate it interpolate between the coordinates based on time.\nIf its just for a presentation though, I would use Macromedia Flash, or a similar animation program.(would do the same as above but you don't need to program anything)","Q_Score":1,"Tags":"python,image,graphics,animation,drawing","A_Id":267676,"CreationDate":"2008-11-06T04:44:00.000","Title":"How to create a picture with animated aspects programmatically","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our program.\nThe alternatives I tried were:\n\nBoost.Python\nI liked the cleaner API produced by Boost.Python, but the fact that it would have required that users install an additional dependency made us switch to SWIG.\nSWIG\nSWIG's main advantage for us was that it doesn't require end users to install it to use the final program.\n\nWhat have you used to do this, and what has been your experience with it?","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":12800,"Q_Id":276761,"Users Score":23,"Answer":"I've used both (for the same project): Boost is better integrated with the STL, and especially C++ exceptions.  Also, its memory management mechanism (which tries to bridge C++ memory management and Python GC) is way more flexible than SWIG's.  However, SWIG has much better documentation, no external dependencies, and if you get the library wrapped in SWIG for Python you're more than half-way there to getting a Java\/Perl\/Ruby wrapper as well.\nI don't think there's a clear-cut choice: for smaller projects, I'd go with Boost.Python again, for larger long-lived projects, the extra investment in SWIG is worth it.","Q_Score":41,"Tags":"c++,python,boost,swig","A_Id":277306,"CreationDate":"2008-11-10T00:34:00.000","Title":"Exposing a C++ API to Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our program.\nThe alternatives I tried were:\n\nBoost.Python\nI liked the cleaner API produced by Boost.Python, but the fact that it would have required that users install an additional dependency made us switch to SWIG.\nSWIG\nSWIG's main advantage for us was that it doesn't require end users to install it to use the final program.\n\nWhat have you used to do this, and what has been your experience with it?","AnswerCount":5,"Available Count":2,"Score":0.0798297691,"is_accepted":false,"ViewCount":12800,"Q_Id":276761,"Users Score":2,"Answer":"A big plus for Boost::Python is that it allows for tab completion in the ipython shell: You import a C++ class, exposed by Boost directly, or you subclass it, and from then on, it really behaves like a pure Python class.\nThe downside: It takes so long to install and use Boost that all the  Tab-completion time-saving won't ever amortize ;-(\nSo I prefer Swig: No bells and whistles, but works reliably after a short introductory example.","Q_Score":41,"Tags":"c++,python,boost,swig","A_Id":847688,"CreationDate":"2008-11-10T00:34:00.000","Title":"Exposing a C++ API to Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking to do some tinkering with openGL and Python and haven't been able to find good reasons for using PyOpenGl versus pyglet\nWhich would you recommend and why?","AnswerCount":9,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":18513,"Q_Id":279912,"Users Score":32,"Answer":"Start with pyglet. It contains the best high-level API, which contains all you need to get started, from opening a window to drawing sprites and OpenGL primitives using their friendly and powerful Sprite and Batch classes.\nLater, you might also want to write your own lower-level code, that makes calls directly to OpenGL functions such as glDrawArrays, etc. You can do this using pyglet's OpenGL bindings, or using PyOpenGL's. The good news is that whichever you use, you can insert such calls right into the middle of your existing pyglet application, and they will 'just work'. Transitioning your code from Pyglet to PyOpenGL is fairly easy, so this is not a decision you need to worry about too much upfront. The trades-off between the two are:\nPyOpenGL's bindings make the OpenGL interface more friendly and pythonic. For example, you can pass vertex arrays in many different forms, ctypes arrays, numpy arrays, plain lists, etc, and PyOpenGL will convert them into something OpenGL can use. Things like this make PyOpenGL really easy and convenient.\npyglet's OpenGL bindings are automatically generated, and are not as friendly to use as PyOpenGL. For example, sometimes you will have to manually create ctypes objects, in order to pass 'C pointer' kinds of args to OpenGL. This can be fiddly. The plus side though, is pyglet's bindings tends to be significantly faster.\nThis implies that there is an optimal middle ground: Use pyglet for windowing, mouse events, sound, etc. Then use PyOpenGL's friendly API when you want to make direct OpenGL function calls. Then when optimising, replace just the small percentage of performance-critical PyOpenGL calls that lie within your inner render loop with the pyglet equivalents. For me, this gives me between 2 and 4 times faster framerates, with PyOpenGL's convenience for 90% of my code.","Q_Score":25,"Tags":"python,pyglet,pyopengl","A_Id":4246325,"CreationDate":"2008-11-11T03:17:00.000","Title":"PyOpenGl or pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking to do some tinkering with openGL and Python and haven't been able to find good reasons for using PyOpenGl versus pyglet\nWhich would you recommend and why?","AnswerCount":9,"Available Count":5,"Score":0.0886555158,"is_accepted":false,"ViewCount":18513,"Q_Id":279912,"Users Score":4,"Answer":"pyglet's GL API is nowhere near as nice as PyOpenGL's - pyglet's is at the raw ctypes layer which means you'll need to learn ctypes as well. If you're planning on doing a bunch of OpenGL programming you'll want to use PyOpenGL. \nThe nice thing is you can mix the two just fine. Use pyglet to provide the GL context, sounds, events, image loading and texture management, text rendering, etc, etc. Use PyOpenGL for the actual OpenGL programming you need to do.","Q_Score":25,"Tags":"python,pyglet,pyopengl","A_Id":2396038,"CreationDate":"2008-11-11T03:17:00.000","Title":"PyOpenGl or pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking to do some tinkering with openGL and Python and haven't been able to find good reasons for using PyOpenGl versus pyglet\nWhich would you recommend and why?","AnswerCount":9,"Available Count":5,"Score":0.0886555158,"is_accepted":false,"ViewCount":18513,"Q_Id":279912,"Users Score":4,"Answer":"pyglet has a lot of nice extras included with it (like image loading and sound).  If you're starting out, I'd try pyglet first, and then switch to PyOpenGL if you feel like you want to get closer to the metal.\nThe real important question though is: what are you trying to accomplish?","Q_Score":25,"Tags":"python,pyglet,pyopengl","A_Id":279942,"CreationDate":"2008-11-11T03:17:00.000","Title":"PyOpenGl or pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking to do some tinkering with openGL and Python and haven't been able to find good reasons for using PyOpenGl versus pyglet\nWhich would you recommend and why?","AnswerCount":9,"Available Count":5,"Score":0.0886555158,"is_accepted":false,"ViewCount":18513,"Q_Id":279912,"Users Score":4,"Answer":"I promote pyglet because it has the nicest API I've yet seen on stuff like this.\nPyglet has opengl API as well. But it's often nicer to use the recently added vertex list support.\npyglet.gl","Q_Score":25,"Tags":"python,pyglet,pyopengl","A_Id":281395,"CreationDate":"2008-11-11T03:17:00.000","Title":"PyOpenGl or pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking to do some tinkering with openGL and Python and haven't been able to find good reasons for using PyOpenGl versus pyglet\nWhich would you recommend and why?","AnswerCount":9,"Available Count":5,"Score":0.0665680765,"is_accepted":false,"ViewCount":18513,"Q_Id":279912,"Users Score":3,"Answer":"I would recommend Pyglet because it is very easy to get started and have something basic running, and then you can add more advanced techniques at your own pace.","Q_Score":25,"Tags":"python,pyglet,pyopengl","A_Id":397041,"CreationDate":"2008-11-11T03:17:00.000","Title":"PyOpenGl or pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I get a list of the running applications? I'm referring to the ones in the panel at the bottom of the screen.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":368,"Q_Id":306456,"Users Score":0,"Answer":"The panel you are referring to is the GNOME panel. So this is a GNOME question, not a GTK question.\nThere is not a well-defined concept of \"multi-window application\" in GNOME that I know of. The panel task list is probably build by querying the window manager for the list of windows and grouping the windows by their \"class\" property.\nThere are also various window manager hints that must be taken into account, for example to ignore panels and other utility windows. In your place, I would look at the source code of the taskbar applet. There is maybe some documentation somewhere that covers the status-quo, but I do know where it would be.","Q_Score":2,"Tags":"python,gtk,pygtk","A_Id":306866,"CreationDate":"2008-11-20T19:02:00.000","Title":"How can I get a list of the running applications with GTK?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"How can I get a list of the running applications? I'm referring to the ones in the panel at the bottom of the screen.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":368,"Q_Id":306456,"Users Score":3,"Answer":"I believe what you are looking for is libwnck","Q_Score":2,"Tags":"python,gtk,pygtk","A_Id":307046,"CreationDate":"2008-11-20T19:02:00.000","Title":"How can I get a list of the running applications with GTK?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am using CYGWIN as a platform and would like to use wxPython. Is there a way to get the source compiled and working in cygwin?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3640,"Q_Id":310224,"Users Score":0,"Answer":"Isn't the whole point of using wxPython being to use WxWidgets? Isn't the whole point of using THAT being to have a cross platform GUI library?\nIn other words, forget about X11, and just use the native wxPython on windows.\nIf you want to avoid requiring the user to install wxPython and its dependencies, consider writing an installer. Alternatively, investigate py2exe to \"compile\" python to an .exe file (plus supporting .zip and .dll files), which is much more ammendable to \"installing by merely copying files\".","Q_Score":4,"Tags":"python,installation,wxpython,cygwin,compilation","A_Id":4467468,"CreationDate":"2008-11-21T21:18:00.000","Title":"How do you compile wxPython under cygwin?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using CYGWIN as a platform and would like to use wxPython. Is there a way to get the source compiled and working in cygwin?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3640,"Q_Id":310224,"Users Score":0,"Answer":"I tried another solution for using wxPython in cygwin:\n\nI installed python27 and wxPython in Windows7\nDid \"echo 'export PATH=\/cygdrive\/c\/Python27\/:$PATH'>>~\/.bashrc\"\nRestart cygwin\n\nIt works. Cheer!\nI don't know if any other Path should be added, but my program was executed on Fedora and it works on there.","Q_Score":4,"Tags":"python,installation,wxpython,cygwin,compilation","A_Id":11237925,"CreationDate":"2008-11-21T21:18:00.000","Title":"How do you compile wxPython under cygwin?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using CYGWIN as a platform and would like to use wxPython. Is there a way to get the source compiled and working in cygwin?","AnswerCount":4,"Available Count":3,"Score":0.1488850336,"is_accepted":false,"ViewCount":3640,"Q_Id":310224,"Users Score":3,"Answer":"You would need a full working X environment to get it to work.  It would be much easier to just use Python and wxPython under plain vanilla Windows.  Do you have a special case?","Q_Score":4,"Tags":"python,installation,wxpython,cygwin,compilation","A_Id":310365,"CreationDate":"2008-11-21T21:18:00.000","Title":"How do you compile wxPython under cygwin?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to install the Python Imaging Library 1.1.6 for Python 2.6. After downloading the installation executable (Win XP), I receive the following error message:\n\"Application failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem\"\nAny thoughts on what I have done \/ not done? The application has not been installed, and I can't import the module through the IDLE session. Thoughts?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":784,"Q_Id":321668,"Users Score":1,"Answer":"Install Python \"for all users\", not \"just for me\".","Q_Score":4,"Tags":"python,image-processing","A_Id":323097,"CreationDate":"2008-11-26T18:21:00.000","Title":"Application configuration incorrect with Python Imaging Library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to install the Python Imaging Library 1.1.6 for Python 2.6. After downloading the installation executable (Win XP), I receive the following error message:\n\"Application failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem\"\nAny thoughts on what I have done \/ not done? The application has not been installed, and I can't import the module through the IDLE session. Thoughts?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":784,"Q_Id":321668,"Users Score":0,"Answer":"I got that same message recently to do with the wxPython library. It was because wxPython had been built using a later version of Visual C++ than I had on my PC. As atzz suggests, one solution is to install the appropriate redistributable package. Try a Google search for 'Microsoft Visual C++ 2008 Redistributable Package' and do the download. If that doesn't work, repeat for the 2005 version.","Q_Score":4,"Tags":"python,image-processing","A_Id":368543,"CreationDate":"2008-11-26T18:21:00.000","Title":"Application configuration incorrect with Python Imaging Library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use something like this: \nscreen.addstr(text, color_pair(1) | A_BOLD), but it doesn't seem to work..\nHowever, A_REVERSE and all others attribute does work! \nIn fact, I'm trying to print something in white, but the COLOR_WHITE prints it gray.. and after a while of searching, it seems that printing it gray + BOLD makes it! \nAny helps would be greatly appreciated.","AnswerCount":2,"Available Count":1,"Score":0.4621171573,"is_accepted":false,"ViewCount":6287,"Q_Id":327026,"Users Score":5,"Answer":"I tried this: screen.addstr(text, curses.color_pair(1) | curses.A_BOLD) and it worked!\nSo just add curses. and it should do the trick.\nOf course at the beginning use: import curses","Q_Score":6,"Tags":"python,linux,curses,bold","A_Id":53016371,"CreationDate":"2008-11-29T01:46:00.000","Title":"Attribute BOLD doesn't seem to work in my curses","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm giving my first steps on Python.  I saw that we don't have switch case statement,\nso I would you guys implement a text Menu in python?\nThanks","AnswerCount":6,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5723,"Q_Id":327597,"Users Score":0,"Answer":"To your first question I agree with Ali A.\nTo your second question :\nimport sys\nsys.exit(1)","Q_Score":3,"Tags":"python","A_Id":327735,"CreationDate":"2008-11-29T15:01:00.000","Title":"Suggestion to implement a text Menu without switch case","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a long time C++\/Java developer trying to get into Python and am looking for the stereotypical \"Python for C++ Developers\" article, but coming up blank.  I've seen these sort of things for C#, Java, etc, and they're incredibly useful for getting up to speed on language features and noteworthy differences.  Anyone have any references?\nAs a secondary bonus question, what open source Python program would you suggest looking at for clean design, commenting, and use of the language as a point of reference for study?\nThanks in advance.","AnswerCount":8,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":43679,"Q_Id":328577,"Users Score":4,"Answer":"I learned a lot about Python by reading the source of the standard library that ships with Python.  I seem to remember having a few \"a-ha!\" moments when reading urllib2.py in particular.","Q_Score":56,"Tags":"c++,python","A_Id":328599,"CreationDate":"2008-11-30T07:14:00.000","Title":"Python for C++ Developers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a long time C++\/Java developer trying to get into Python and am looking for the stereotypical \"Python for C++ Developers\" article, but coming up blank.  I've seen these sort of things for C#, Java, etc, and they're incredibly useful for getting up to speed on language features and noteworthy differences.  Anyone have any references?\nAs a secondary bonus question, what open source Python program would you suggest looking at for clean design, commenting, and use of the language as a point of reference for study?\nThanks in advance.","AnswerCount":8,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":43679,"Q_Id":328577,"Users Score":0,"Answer":"For the best examples of code of a language, the language's standard library is often a good place to look. Pick a recent piece, though - old parts are probably written for older versions and also sometimes were written before the library became big enough to warrant big standards - like PHP and Erlang's libraries, which have internal inconsistency.\nFor Python in particular, Python 3000 is cleaning up the library a lot, and so is probably a great source of good Python code (though it is written for a future Python version).","Q_Score":56,"Tags":"c++,python","A_Id":328598,"CreationDate":"2008-11-30T07:14:00.000","Title":"Python for C++ Developers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a long time C++\/Java developer trying to get into Python and am looking for the stereotypical \"Python for C++ Developers\" article, but coming up blank.  I've seen these sort of things for C#, Java, etc, and they're incredibly useful for getting up to speed on language features and noteworthy differences.  Anyone have any references?\nAs a secondary bonus question, what open source Python program would you suggest looking at for clean design, commenting, and use of the language as a point of reference for study?\nThanks in advance.","AnswerCount":8,"Available Count":3,"Score":0.024994793,"is_accepted":false,"ViewCount":43679,"Q_Id":328577,"Users Score":1,"Answer":"C# and Java are seen as cleaner replacements for C++ in many application areas so there is often a \"migration\" from one to the other - which is why there are books available.\nPython and C++ are very different beasts, and although they are both considered general purpose programming languages they are targetted towards different ends of the programming spectrum.\nDon't try to write C++ in Python; in fact, try to forget C++ when writing Python.\nI found it far better to learn the common Python paradigms and techniques and apply them to my C++ programs than the other way around.","Q_Score":56,"Tags":"c++,python","A_Id":328689,"CreationDate":"2008-11-30T07:14:00.000","Title":"Python for C++ Developers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently looking at developing a mobile apps for the S60 platform and is specifically looking at PyS60. It seems to suggest that the it can be compiled into native .sis files without the need for an embedded python interpreter. Reading through the documentations I could not find any statements where this is explicitly mentioned. While I am right now downloading the SDKs, Emulators, and the whole bunch of tool chains needed to test the development out on Linux, I thought I would ask here a bit while I am doing that.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1161,"Q_Id":334765,"Users Score":1,"Answer":"Linux is not officially supported for Series60 development yet. You will save yourself a lot of headache using Windows, weirdly enough.\nAs far as Python is oncerned, I think the developed application is packaged into a .sis file  but still requires the PyS60 interpreter to run once installed.","Q_Score":9,"Tags":"python,symbian,s60,pys60","A_Id":337308,"CreationDate":"2008-12-02T17:30:00.000","Title":"Does PyS60 produce sis files that are native?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We know that Python provides a  lot of productivity over any compiled languages. We have programming in C# & need to write the unit test cases in C# itself. If we see the amount of code we write for unit test is approximately ten times more than the original code. \nIs it ideal choice to write unit test cases in IronPython instead of C#? Any body has done like that? I wrote few test cases, they seems to be good. But hairy pointy managers won't accept.","AnswerCount":8,"Available Count":6,"Score":0.0,"is_accepted":false,"ViewCount":3355,"Q_Id":340128,"Users Score":0,"Answer":"Very interesting. \nWhat would happen if you write all your code with IronPython (not just the unit tests)? Would you end up with approximately 10 times less code? \nMaybe I should learn IronPython too.","Q_Score":13,"Tags":"c#,python,unit-testing,ironpython","A_Id":342457,"CreationDate":"2008-12-04T10:21:00.000","Title":"IronPython For Unit Testing over C#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We know that Python provides a  lot of productivity over any compiled languages. We have programming in C# & need to write the unit test cases in C# itself. If we see the amount of code we write for unit test is approximately ten times more than the original code. \nIs it ideal choice to write unit test cases in IronPython instead of C#? Any body has done like that? I wrote few test cases, they seems to be good. But hairy pointy managers won't accept.","AnswerCount":8,"Available Count":6,"Score":0.0,"is_accepted":false,"ViewCount":3355,"Q_Id":340128,"Users Score":0,"Answer":"I gotta go with Will and Jon..\nI would prefer my tests be in the same language as the code I'm testing; it causes fewer cognitive context switches.  But maybe I'm just not as mentally agile as I once was.\n\nJon","Q_Score":13,"Tags":"c#,python,unit-testing,ironpython","A_Id":443959,"CreationDate":"2008-12-04T10:21:00.000","Title":"IronPython For Unit Testing over C#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We know that Python provides a  lot of productivity over any compiled languages. We have programming in C# & need to write the unit test cases in C# itself. If we see the amount of code we write for unit test is approximately ten times more than the original code. \nIs it ideal choice to write unit test cases in IronPython instead of C#? Any body has done like that? I wrote few test cases, they seems to be good. But hairy pointy managers won't accept.","AnswerCount":8,"Available Count":6,"Score":0.0748596907,"is_accepted":false,"ViewCount":3355,"Q_Id":340128,"Users Score":3,"Answer":"Actually testing is a great opportunity to try integrating a new language. Languages like Python shine especially well in testing, and it's a low risk project to try - the worst case is not too bad at all.\nAs far as experience testing another language in Python, I've tested C and C++ systems like this and it was excellent. I think it's definitely worth a shot.\nWhat Jon says is true, though - the level of tooling for Python in general, and IronPython in particular, is nowhere near that of C#. How much that affects you is something you'll find out in your pilot.","Q_Score":13,"Tags":"c#,python,unit-testing,ironpython","A_Id":342490,"CreationDate":"2008-12-04T10:21:00.000","Title":"IronPython For Unit Testing over C#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We know that Python provides a  lot of productivity over any compiled languages. We have programming in C# & need to write the unit test cases in C# itself. If we see the amount of code we write for unit test is approximately ten times more than the original code. \nIs it ideal choice to write unit test cases in IronPython instead of C#? Any body has done like that? I wrote few test cases, they seems to be good. But hairy pointy managers won't accept.","AnswerCount":8,"Available Count":6,"Score":0.0748596907,"is_accepted":false,"ViewCount":3355,"Q_Id":340128,"Users Score":3,"Answer":"Python being a much less verbose language than C# might actually lower the barrier to writing unit tests since there is still a lot of developers that are resistant to doing automated unit testing in general. Introducing and having them use a language like IronPython that typically tends to take less time to write the equivalent code in C# might actually encourage more unit tests to be written which is always a good thing.\nPlus, by using IronPython for your test code, you might end up with less lines of code (LOC) for your project overall meaning that your unit tests might be more likely to be maintained in the long run versus being ignored and\/or discarded.","Q_Score":13,"Tags":"c#,python,unit-testing,ironpython","A_Id":341683,"CreationDate":"2008-12-04T10:21:00.000","Title":"IronPython For Unit Testing over C#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We know that Python provides a  lot of productivity over any compiled languages. We have programming in C# & need to write the unit test cases in C# itself. If we see the amount of code we write for unit test is approximately ten times more than the original code. \nIs it ideal choice to write unit test cases in IronPython instead of C#? Any body has done like that? I wrote few test cases, they seems to be good. But hairy pointy managers won't accept.","AnswerCount":8,"Available Count":6,"Score":1.0,"is_accepted":false,"ViewCount":3355,"Q_Id":340128,"Users Score":6,"Answer":"Python is excellent for UnitTesting C# code.  Our app is 75% in Python and 25% C#(Python.Net), and our unit tests are 100% python.  \nI find that it's much easier to make use of stubs and mocks in Python which is probably one of the most critical components that enable one to write effective unittests.","Q_Score":13,"Tags":"c#,python,unit-testing,ironpython","A_Id":346907,"CreationDate":"2008-12-04T10:21:00.000","Title":"IronPython For Unit Testing over C#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We know that Python provides a  lot of productivity over any compiled languages. We have programming in C# & need to write the unit test cases in C# itself. If we see the amount of code we write for unit test is approximately ten times more than the original code. \nIs it ideal choice to write unit test cases in IronPython instead of C#? Any body has done like that? I wrote few test cases, they seems to be good. But hairy pointy managers won't accept.","AnswerCount":8,"Available Count":6,"Score":0.049958375,"is_accepted":false,"ViewCount":3355,"Q_Id":340128,"Users Score":2,"Answer":"There's an obvious disadvantage which is that everyone working on the code now needs to be proficient in two languages, not just one.  I'm fairly hairy but not very pointy, but I do see why managers might be sceptical.","Q_Score":13,"Tags":"c#,python,unit-testing,ironpython","A_Id":340152,"CreationDate":"2008-12-04T10:21:00.000","Title":"IronPython For Unit Testing over C#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Okay, what is it, and why does it occur on Win2003 server, but not on WinXP.\nIt doesn't seem to affect my application at all, but I get this error message when I close the application.  And it's annoying (as errors messages should be).\nI am using pyOpenGl and wxPython to do the graphics stuff.  Unfortunately, I'm a C# programmer that has taken over this Python app, and I had to learn Python to do it.\nI can supply code and version numbers etc, but I'm still learning the technical stuff, so any help would be appreciated.\nPython 2.5, wxPython and pyOpenGL","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":91403,"Q_Id":345991,"Users Score":2,"Answer":"After adding the Logging above, I was able to see that the problem was caused by missing TConstants class, which I was excluding in the py2exe setup.py file.  \nAfter removing the \"Tconstants\" from the excluded list, I no longer had problems.","Q_Score":80,"Tags":"python,logging,opengl,wxpython,pyopengl","A_Id":369184,"CreationDate":"2008-12-06T05:59:00.000","Title":"Python - No handlers could be found for logger \"OpenGL.error\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to decide on a GUI\/Widget toolkit to use with Python for a new project. The target platforms will be Linux with KDE and Windows XP (and probably Vista). What Python GUI toolkit looks best and consistent with the native look and feel of the run time platform?\nIf possible, cite strengths and weaknesses of the suggested toolkit.\nThank you,\nLuis","AnswerCount":3,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":1840,"Q_Id":360602,"Users Score":8,"Answer":"Python binding of Wx is very strong since at least one of the core developer is a python guy itself. WxWdgets is robust, time proven stable, mature, but also bit more than just GUI. Even is a lot is left out in WxPython - because Python itself offers that already - you might find that extra convenient for your project. Wx is the fastest especially on Win, because it lets render the OS and yes WxLicense is de facto LGPL. With XRC you have also a way like Glade to click you to a UI that you can reuse by different projects and languages. What is one major reason for me to use Wx is the fast and helping mailing list, never seen a flamewar, you get even often answers from core developers there, like the notorious vadim zeitlin++. The only thing con to Wx is the API that once grew out of MS MFC and has still its darker(unelegant) corners, but with every version you have some improvements on that as well.\nQT done some nice stuff, especially warping the language but under python that don't count. They invented also a lot of extra widgets. In wx you have also combined, more complex widgets like e.g. for config dialog, but that goes not that far as in QT. \nAnd you could of course use GTK. almost no difference under linux to Wx but a bit alien and slower under win. but also free.","Q_Score":4,"Tags":"python,windows,linux,native,gui-toolkit","A_Id":361672,"CreationDate":"2008-12-11T19:38:00.000","Title":"What GUI toolkit looks best for a native LAF for Python in Windows and Linux?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to decide on a GUI\/Widget toolkit to use with Python for a new project. The target platforms will be Linux with KDE and Windows XP (and probably Vista). What Python GUI toolkit looks best and consistent with the native look and feel of the run time platform?\nIf possible, cite strengths and weaknesses of the suggested toolkit.\nThank you,\nLuis","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1840,"Q_Id":360602,"Users Score":0,"Answer":"Like others said, PyQt or wxPython... The technical difference between the two is more or less imaginary - it's a question of your comfort with the toolkit that matters, really.","Q_Score":4,"Tags":"python,windows,linux,native,gui-toolkit","A_Id":361996,"CreationDate":"2008-12-11T19:38:00.000","Title":"What GUI toolkit looks best for a native LAF for Python in Windows and Linux?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is a two part question. A dumb technical query and a broader query about my possibly faulty approach to learning to do some things in a language I'm new to.\nI'm just playing around with a few Python GUI libraries (mostly wxPython and IronPython) for some work I'm thinking of doing on an open source app, just to improve my skills and so forth.\nBy day I am a pretty standard c# bod working with a pretty normal set of MS based tools and I am looking at Python to give me a new perspective. Thus using Ironpython Studio is probably cheating a bit (alright, a lot). This seems not to matter because however much it attempts to look like a Visual Studio project etc. There's one simple behaviour I'm probably being too dumb to implement.\nI.E. How do I keep my forms in nice separate code files, like the c# monkey I have always been ,and yet invoke them from one another? I've tried importing the form to be invoked to the main form but I just can't seem to get the form to be recognized as anything other than an object. The new form appears to be a form object in its own code file, I am importing the clr. I am trying to invoke a form's 'Show' method. Is this not right?\nI've tried a few (to my mind more unlikely) ways around this but the problem seems intractable. Is this something I'm just not seeing or would it in fact be more appropriate for me to change the way I think about my GUI scripting to fit round Python (in which case I may switch back to wxPython which seemed more approachable from a Pythonic point of view) rather than try to look at Python from the security of the Visual Studio shell?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1298,"Q_Id":362428,"Users Score":0,"Answer":"In the end it was even simpler.\nI was trying to invoke the subform thus:\nf = frmSubform()\nf.Show()\nBut I actually needed to do it this way\nf = frmSubform()\nForm.Show(f)\nForm.ShowDialog(f) worked also; in a Dialog format of course.\nA simple enough error but until you know you, well, don't know.\nI'm not 100% sure I understand at this stage why what works, works, but I'm sure I shall learn with experience.","Q_Score":1,"Tags":"ironpython,ironpython-studio","A_Id":363455,"CreationDate":"2008-12-12T10:36:00.000","Title":"Ironpython Studio forms","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've had some experience with Pygame, but there seems to be a lot of buzz around Pyglet these days.\nHow do these two libraries compare? What would be the advantage of using one over the other, both in features and ease of use?\nFinally, would you say that one is more Pythonic than the other?","AnswerCount":5,"Available Count":2,"Score":0.1194272985,"is_accepted":false,"ViewCount":24875,"Q_Id":370680,"Users Score":3,"Answer":"Having looked at both pygame and pyglet I found pyglet easier to pick up and was able to write a simple breakout style game within a few days.","Q_Score":46,"Tags":"python,pygame,pyglet","A_Id":2477829,"CreationDate":"2008-12-16T07:55:00.000","Title":"Differences between Python game libraries Pygame and Pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've had some experience with Pygame, but there seems to be a lot of buzz around Pyglet these days.\nHow do these two libraries compare? What would be the advantage of using one over the other, both in features and ease of use?\nFinally, would you say that one is more Pythonic than the other?","AnswerCount":5,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":24875,"Q_Id":370680,"Users Score":15,"Answer":"Pyglet is good (for 2D games) if you never intend to draw any vector graphics or primitives within the game itself, and just stick to loading images from disk. It's also much cleaner because there's no need to write your own game loop and have to worry about speed and timing and responsiveness.\nHowever, if you ever have to generate graphics on-the-fly, and then save them, either as a variable or as a file, then pyglet becomes considerably more complicated because you start having to muck around with the low-level OpenGL functions. In those scenarios, pygame is much more user-friendly, with its software rendering and Surface class. Or you could use Python Imaging Library and interface it with pyglet.\nObviously, for 3D games, you are going to have to muck around with OpenGL functions anyway, in which case I recommend pyglet over pygame + PyOpenGL.","Q_Score":46,"Tags":"python,pygame,pyglet","A_Id":4520448,"CreationDate":"2008-12-16T07:55:00.000","Title":"Differences between Python game libraries Pygame and Pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking into writing a wxWidget that displays a graphical node network, and therefore does a lot of drawing operations.  I know that using Python to do it is going to be slower, but I'd rather get it working and port it later when its functional.  Ideally, if the performance hit isn't too great, I'd prefer to keep the codebase in Python for easy updates.\nWhat I'm wondering is how much slower should I expect things to go?  I realize this is vague and open ended, but I just need a sense of what to expect.  Will drawing 500 circles bog down?  Will it be noticeable at all? What are your experiences?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1255,"Q_Id":379442,"Users Score":1,"Answer":"For drawing, people have suggested PyGame. I like PyGame, its easy to work with and works well. Other choices would be Pyglet, or using PyOpenGL (you can most likely draw to a wx widget too, though I've never done it).\nPersonally, I'd do it in Python using whatever library I'm most familiar with (in my case, I'd use pygtk and cairo) and worry about performance only when it becomes a problem - then profile and optimize the bottleneck, if its Python code thats slow, I'll know which bits to run in C instead.","Q_Score":6,"Tags":"c++,python,performance,drawing,wxpython","A_Id":380558,"CreationDate":"2008-12-18T21:52:00.000","Title":"How much slower is a wxWidget written in Python versus C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting out with wxPython and have been working my way through every tutorial and example I can get my hands on.  I've run into a slight problem, however, and it has to do with the wx.App versus the wx.Frame and which should contain specific methods.  Just about every example I've seen don't go much beyond layouts\/sizers and event handling, none really tackle project organization of a wxPython project.\nFor example, I have a method that gets a list of folders.  The way most examples would deal with this would be to stick the method right in the frame class.  This method has the potential to be used in several other parts of the application, so it would make more sense to store it at the application class level.\nHow should I organize and call \"universal\" methods like these so that I don't clutter up my frame classes.\nUPDATE:\nTo clarify, the \"list of folders\" was just an example, my actual method does a lot more work.  What I'm saying is I have code that isn't Frame-specific.  If I had this in the application class, what is the best way to call it from and event method in my frame.\nI'm looking for actual project organization techniques, not programming fundamentals.","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":1063,"Q_Id":390867,"Users Score":2,"Answer":"As Mark stated you should make a new class that handles things like this. \nThe ideal layout of code when using something like wxWidgets is the model view controller where the wxFrame class only has the code needed to display items and all the logic and business rules are handled by other class that interact with the wxFrame. This way you can change logic and business rules with out having to change your interface and change (or swap) your interface with out having to change your logic and business rules.","Q_Score":1,"Tags":"python,wxpython,wxwidgets,model-view-controller,project-organization","A_Id":390912,"CreationDate":"2008-12-24T06:07:00.000","Title":"Calling Application Methods from a wx Frame Class","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting out with wxPython and have been working my way through every tutorial and example I can get my hands on.  I've run into a slight problem, however, and it has to do with the wx.App versus the wx.Frame and which should contain specific methods.  Just about every example I've seen don't go much beyond layouts\/sizers and event handling, none really tackle project organization of a wxPython project.\nFor example, I have a method that gets a list of folders.  The way most examples would deal with this would be to stick the method right in the frame class.  This method has the potential to be used in several other parts of the application, so it would make more sense to store it at the application class level.\nHow should I organize and call \"universal\" methods like these so that I don't clutter up my frame classes.\nUPDATE:\nTo clarify, the \"list of folders\" was just an example, my actual method does a lot more work.  What I'm saying is I have code that isn't Frame-specific.  If I had this in the application class, what is the best way to call it from and event method in my frame.\nI'm looking for actual project organization techniques, not programming fundamentals.","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1063,"Q_Id":390867,"Users Score":2,"Answer":"Your classes that inherit from wxWidgets\/wxPython data types should not implement any business logic. wxWidgets is a GUI library, so any subclasses of wxApp or wxFrame should remain focused on GUI, that is on displaying the interface and being responsive to user actions. \nThe code that does something useful should be separated from wx, as you can decide later to use it in some web or console application and you don't want to create wxApp object in such case. You can also decide later on to move some computations to separate 'worker threads', while your GUI will be the 'main thread' - responsive, and repainted properly during long lasting computations. \nLast but not least - the classes that encapsulate your logic might tend to grow during projects lifetime. If they're mixed with your GUI classes they will grow faster, and finally they become so complex that you're almost unable to debug them... \nWhile having them separated leads to clean code when you don't mix bugs in logic with bugs in GUI (refreshing\/layout\/progress bar etc.). Such approach has another nice feature - ability to split work among GUI-people and logic-people, which can do their work without constant conflicts.","Q_Score":1,"Tags":"python,wxpython,wxwidgets,model-view-controller,project-organization","A_Id":394333,"CreationDate":"2008-12-24T06:07:00.000","Title":"Calling Application Methods from a wx Frame Class","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting out with wxPython and have been working my way through every tutorial and example I can get my hands on.  I've run into a slight problem, however, and it has to do with the wx.App versus the wx.Frame and which should contain specific methods.  Just about every example I've seen don't go much beyond layouts\/sizers and event handling, none really tackle project organization of a wxPython project.\nFor example, I have a method that gets a list of folders.  The way most examples would deal with this would be to stick the method right in the frame class.  This method has the potential to be used in several other parts of the application, so it would make more sense to store it at the application class level.\nHow should I organize and call \"universal\" methods like these so that I don't clutter up my frame classes.\nUPDATE:\nTo clarify, the \"list of folders\" was just an example, my actual method does a lot more work.  What I'm saying is I have code that isn't Frame-specific.  If I had this in the application class, what is the best way to call it from and event method in my frame.\nI'm looking for actual project organization techniques, not programming fundamentals.","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1063,"Q_Id":390867,"Users Score":0,"Answer":"In a proper OOP design, this would be independent or part of a filesystem class - it wouldn't be part of the app or the frame.","Q_Score":1,"Tags":"python,wxpython,wxwidgets,model-view-controller,project-organization","A_Id":390887,"CreationDate":"2008-12-24T06:07:00.000","Title":"Calling Application Methods from a wx Frame Class","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I develop tools in Autodesk Maya.  Many of the tools I build have simple windowed GUIs for the animators and modellers to use.  These GUIs often contain what you'd normally expect to see in any basic window; labels, lists, menus, buttons, textfields, etc.  However, there are limitations to the complexity of the UIs you can build with the available tools, specifically in the types of available widgets.\nI'm interested in using some of the more advanced wxPython widgets such as the ListView (grid), Tree, etc.  This would involve using a complete wxFrame (window) to display the whole UI, which would essentially mean that window would no longer be tied to Maya.  Not a deal breaker, but it means when Maya is minimized, the window won't follow suit.\nI've tried something like this before with tkinter as a test, but found that it needed a MainLoop to run in its own thread.  This is logical, but in my case, it conflicts with Maya's own thread, essentially making Maya hang until the window is closed.  This is due to the fact that Maya runs all scripts, be they MEL or Python, in a single thread that the main Maya GUI shares.  This is to prevent one script from, say, deleting an object while another script is trying to do work on the same object.\nwxPython has this same \"mainloop\" methodolgy. I'm wondering if there's any way around it so that it can work within Maya?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3503,"Q_Id":397337,"Users Score":0,"Answer":"The best way to go is creating a QWidget with what you need, and using it from within a MPxCommand thru the C++ API.  That way you also have the chance to inject complete custom editors into Maya via scriptedPanels.\nBut if you're bound to Python, pyQt is the way to go.","Q_Score":8,"Tags":"python,scripting,wxpython,wxwidgets,maya","A_Id":30247511,"CreationDate":"2008-12-29T08:41:00.000","Title":"Using external GUI libraries to make user interfaces in Autodesk Maya","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I develop tools in Autodesk Maya.  Many of the tools I build have simple windowed GUIs for the animators and modellers to use.  These GUIs often contain what you'd normally expect to see in any basic window; labels, lists, menus, buttons, textfields, etc.  However, there are limitations to the complexity of the UIs you can build with the available tools, specifically in the types of available widgets.\nI'm interested in using some of the more advanced wxPython widgets such as the ListView (grid), Tree, etc.  This would involve using a complete wxFrame (window) to display the whole UI, which would essentially mean that window would no longer be tied to Maya.  Not a deal breaker, but it means when Maya is minimized, the window won't follow suit.\nI've tried something like this before with tkinter as a test, but found that it needed a MainLoop to run in its own thread.  This is logical, but in my case, it conflicts with Maya's own thread, essentially making Maya hang until the window is closed.  This is due to the fact that Maya runs all scripts, be they MEL or Python, in a single thread that the main Maya GUI shares.  This is to prevent one script from, say, deleting an object while another script is trying to do work on the same object.\nwxPython has this same \"mainloop\" methodolgy. I'm wondering if there's any way around it so that it can work within Maya?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3503,"Q_Id":397337,"Users Score":0,"Answer":"I don't know if there is a way around a mainloop for the gui, since it is needed to handle all event chains and redraw queues. \nBut there are several means of inter-process communication, like pipes or semaphores. Maybe it is an option to split your Maya extension into the actual plugin, being tight into maya, and a separate application for the gui. These two could use such means to communicate and exchange model information between plugin and gui.\nI'm not sure, however, if I can really recommend this approach because it very much complicates the application.\nYou could have a look at IPython, an interactive Python shell, whose dev team has put some effort into integrating it with wxPython. They have some way of interrupting the event loop and hooking into it to do their own stuff.","Q_Score":8,"Tags":"python,scripting,wxpython,wxwidgets,maya","A_Id":398469,"CreationDate":"2008-12-29T08:41:00.000","Title":"Using external GUI libraries to make user interfaces in Autodesk Maya","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"More particularly - I have a window handle of another running application. This application contains a TListControl.UnicodeClass control somewhere (I know this from Winspector). How can I, using the Windows API and that window handle, go through all the items in that list control and get the text from all of the items?\nYou can assume the language is C\/C++, though I'll actually be using win32all for python. References to the appropriate API calls would be great.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1808,"Q_Id":408334,"Users Score":2,"Answer":"Above answers are completely wrong and don't even know what is a PAS.\nThis has been answered hundreds of times for 20 years on Usenet.\nYou must use IPC of course (RPM)\nask on news:\/\/comp.os.ms-windows.programmer.win32 for code.","Q_Score":1,"Tags":"python,windows,winapi,controls","A_Id":409110,"CreationDate":"2009-01-02T23:49:00.000","Title":"In Windows, how can I enumerate and get text from another window's controls?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to force my python app to the front if a condition occurs. I'm using Kubuntu & QT3.1\nI've tried setActiveWindow(), but it only flashes the task bar in KDE.\nI think Windows has a function bringwindowtofront() for VB.\nIs there something similar for KDE?","AnswerCount":3,"Available Count":1,"Score":0.2605204458,"is_accepted":false,"ViewCount":2418,"Q_Id":412214,"Users Score":4,"Answer":"Check if KWin is configured to prevent focus stealing.\nThere might be nothing wrong with your code -- but we linux people don't like applications bugging us when we work, so stealing focus is kinda frowned upon, and difficult under some window managers.","Q_Score":1,"Tags":"python,qt","A_Id":413073,"CreationDate":"2009-01-05T03:36:00.000","Title":"How to bring program to front using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Does anyone know of an example where it is shown how to drag a button from one panel to another in wxPython?\nI have created a bitmap button in a panel, and I would like to be able to drag it to a different panel and drop I there. \nI haven't found any examples using buttons, just text and files.\nI am using the latest version of Python and wxPython.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1052,"Q_Id":425722,"Users Score":4,"Answer":"If you want to graphically represent the drag, one good way to do this is to create a borderless Frame that follows the mouse during a drag.  You remove the button from your source Frame, temporarily put it in this \"drag Frame\", and then, when the user drops, add it to your destination Frame.","Q_Score":1,"Tags":"python,drag-and-drop,wxpython","A_Id":425740,"CreationDate":"2009-01-08T20:17:00.000","Title":"Drag button between panels in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My site is full of rounded corners on every box and picture, except for the thumbnails of user uploaded photos.\nHow can I use the Python Imaging Library to 'draw' white or transparent rounded corners onto each thumbnail?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3944,"Q_Id":430379,"Users Score":0,"Answer":"Might it not be a better idea (assuming HTML is the output) to use HTML and CSS  to put some rounded borders on those pictures?  That way, if you want to change the look of your site, you don't have to do any image reprocessing, and you don't have to do any image processing in the first place.","Q_Score":0,"Tags":"python,python-imaging-library,rounded-corners","A_Id":430410,"CreationDate":"2009-01-10T02:00:00.000","Title":"Draw rounded corners on photo with PIL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if there is something similar to Java's JFileChooser for Python?\nJFileChooser is a graphical front end to choose a file.\nPreferably something that is already with Python. Maybe with Tkinter.","AnswerCount":6,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":2182,"Q_Id":433945,"Users Score":4,"Answer":"wxPython (www.wxpython.org) provides the wx.FileDialog class which will give you a native file selection dialog on any of the supported platforms (Mac, Linux or Windows).","Q_Score":4,"Tags":"java,python,jfilechooser","A_Id":433967,"CreationDate":"2009-01-11T23:03:00.000","Title":"JFileChooser for Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if there is something similar to Java's JFileChooser for Python?\nJFileChooser is a graphical front end to choose a file.\nPreferably something that is already with Python. Maybe with Tkinter.","AnswerCount":6,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2182,"Q_Id":433945,"Users Score":0,"Answer":"Maybe you would like to take a look at Jython.","Q_Score":4,"Tags":"java,python,jfilechooser","A_Id":433977,"CreationDate":"2009-01-11T23:03:00.000","Title":"JFileChooser for Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a wx.Toolbar and I'd like to make the buttons larger.  I've searched and can't seem to find any concrete documentation on how to do this.\nI'm also wondering how well this will translate across platforms; what will happen to the buttons and icons on OSX?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":3854,"Q_Id":445037,"Users Score":2,"Answer":"Doesn't the size of the toolbar adapts itself automatically to the size of the bitmap icons? I think if you want a bigger toolbar, you need bigger bitmaps.","Q_Score":2,"Tags":"python,user-interface,wxpython,wxwidgets,toolbar","A_Id":446014,"CreationDate":"2009-01-14T22:57:00.000","Title":"How to make a wx Toolbar buttons larger?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found the bottleneck in my python code, played around with psycho etc. Then decided to write a c\/c++ extension for performance.\nWith the help of swig you almost don't need to care about arguments etc. Everything works fine.\nNow my question: swig creates a quite large py-file which does a lot of 'checkings' and 'PySwigObject' before calling the actual .pyd or .so code.\nDoes anyone of you have any experience whether there is some more performance to gain if you hand-write this file or let swig do it.","AnswerCount":10,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":32045,"Q_Id":456884,"Users Score":8,"Answer":"An observation: Based on the benchmarking conducted by the pybindgen developers, there is no significant difference between boost.python and swig. I haven't done my own benchmarking to verify how much of this depends on the proper use of the boost.python functionality. \nNote also that there may be a reason that pybindgen seems to be in general quite a bit faster than swig and boost.python: it may not produce as versatile a binding as the other two. For instance, exception propagation, call argument type checking, etc. I haven't had a chance to use pybindgen yet but I intend to. \nBoost is in general quite big package to install, and last I saw you can't just install boost python you pretty much need the whole Boost library. As others have mentioned compilation will be slow due to heavy use of template programming, which also means typically rather cryptic error messages at compile time. \nSummary: given how easy SWIG is to install and use, that it generates decent binding that is robust and versatile, and that one interface file allows your C++ DLL to be available from several other languages like LUA, C#, and Java, I would favor it over boost.python. But unless you really need multi-language support I would take a close look at PyBindGen because of its purported speed, and pay close attention to robustness and versatility of binding it generates.","Q_Score":70,"Tags":"python,c++,c,swig,cython","A_Id":3167276,"CreationDate":"2009-01-19T08:32:00.000","Title":"Extending python - to swig, not to swig or Cython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found the bottleneck in my python code, played around with psycho etc. Then decided to write a c\/c++ extension for performance.\nWith the help of swig you almost don't need to care about arguments etc. Everything works fine.\nNow my question: swig creates a quite large py-file which does a lot of 'checkings' and 'PySwigObject' before calling the actual .pyd or .so code.\nDoes anyone of you have any experience whether there is some more performance to gain if you hand-write this file or let swig do it.","AnswerCount":10,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":32045,"Q_Id":456884,"Users Score":6,"Answer":"There be dragons here. Don't swig, don't boost. For any complicated project the code you have to fill in yourself to make them work becomes unmanageable quickly. If it's a plain C API to your library (no classes), you can just use ctypes. It will be easy and painless, and you won't have to spend hours trawling through the documentation for these labyrinthine wrapper projects trying to find the one tiny note about the feature you need.","Q_Score":70,"Tags":"python,c++,c,swig,cython","A_Id":461364,"CreationDate":"2009-01-19T08:32:00.000","Title":"Extending python - to swig, not to swig or Cython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found the bottleneck in my python code, played around with psycho etc. Then decided to write a c\/c++ extension for performance.\nWith the help of swig you almost don't need to care about arguments etc. Everything works fine.\nNow my question: swig creates a quite large py-file which does a lot of 'checkings' and 'PySwigObject' before calling the actual .pyd or .so code.\nDoes anyone of you have any experience whether there is some more performance to gain if you hand-write this file or let swig do it.","AnswerCount":10,"Available Count":3,"Score":0.0599281035,"is_accepted":false,"ViewCount":32045,"Q_Id":456884,"Users Score":3,"Answer":"If its not a big extension, boost::python might also be an option, it executes faster than swig, because you control what's happening, but it'll take longer to dev.\nAnyways swig's overhead is acceptable if the amount of work within a single call is large enough. For example if you issue is that you have some medium sized logic block you want to move to C\/C++, but that block is called within a tight-loop, frequently, you might have to avoid swig, but I can't really think of any real-world examples except for scripted graphics shaders.","Q_Score":70,"Tags":"python,c++,c,swig,cython","A_Id":456894,"CreationDate":"2009-01-19T08:32:00.000","Title":"Extending python - to swig, not to swig or Cython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for a way to implement this design in wxPython on Linux...\nI have a toolbar with a button, when the button is pressed a popup should appear, mimicking an extension of the toolbar (like a menu), and this popup should show two columns of radio buttons (say 2x5) and a text box...\nMy main problem is that the toolbar is small in height, so the popup has to overflow the bounds of the window\/client area..\nI thought of two possible implementations:  \n\nby using a wxMenu, since a menu can be drawn outside the client area. I fear that the layout possibilities aren't flexible enough for my goal\nby using a shaped frame. Pressing the button would re-shape the frame and draw the needed widgets as requested.\n\nMy question is: am I missing something \/ wrong on something? :) Is this doable at all?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":551,"Q_Id":462320,"Users Score":1,"Answer":"Using a menu is a no-go, because wxWidgets can't put widgets on a menu. Using the shaped frame would be possible in principle, but the problem is then to get the position of the button you clicked, to display the window at the right position. I tried to do that back then, but didn't have luck (in C++ wxWidgets). Maybe this situation changed in between though, good luck. \nYou can also try a wxComboCtrl, which allows you to have a custom popup window. That one could then display the radio boxes and the input control.","Q_Score":1,"Tags":"wxpython,wxwidgets,shaped-window","A_Id":462387,"CreationDate":"2009-01-20T17:44:00.000","Title":"Window-overflowing widget in wxWidgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am adding some wx.StaticText objects on top of my main wx.Frame, which already has a background image applied. However, the StaticText always seems to draw with a solid (opaque) background color, hiding the image. I have tried creating a wx.Color object and changing the alpha value there, but that yields no results. Is there any way I can put text on the frame and have the background shine through? And furthermore, is it possible to make the text itself translucent? Thanks.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":472,"Q_Id":462933,"Users Score":1,"Answer":"You probably need some graphics rendering widget. As far as I know, in wxPython you can use either built-in wxGraphicsContext or pyCairo directly. Cairo is more powerful. However, I don't know the details.","Q_Score":1,"Tags":"python,wxpython,transparency,opacity","A_Id":464706,"CreationDate":"2009-01-20T20:20:00.000","Title":"Is it possible to make text translucent in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am adding some wx.StaticText objects on top of my main wx.Frame, which already has a background image applied. However, the StaticText always seems to draw with a solid (opaque) background color, hiding the image. I have tried creating a wx.Color object and changing the alpha value there, but that yields no results. Is there any way I can put text on the frame and have the background shine through? And furthermore, is it possible to make the text itself translucent? Thanks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":472,"Q_Id":462933,"Users Score":0,"Answer":"I would try aggdraw into a small canvas.\nAny Static Text uses the platform's native label machinery, so you don't get that sort of control over it.","Q_Score":1,"Tags":"python,wxpython,transparency,opacity","A_Id":598202,"CreationDate":"2009-01-20T20:20:00.000","Title":"Is it possible to make text translucent in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is going to be a generic question.\nI am struggling in designing a GUI application, esp. with dealing with interactions between different parts.\nI don't know how I should deal with shared state. On one hand, shared state is bad, and things should be as explicit as possible. On the other hand, not having shared state introduces unwanted coupling between components.\nAn example:\nI want my application to be extendable in an Emacs\/Vim sort of way, via scripts. Clearly, some sort of shared state needs to be modified, so that the GUI will use it. My initial plan was having a global \"session\" that is accessible from everywhere, but I'm not so sure about it.\nOne tricky use case is key bindings. I want the user to be able to specify custom keybindings from a script. Each keybinding maps to an arbitrary command, that receives the session as the only argument.\nNow, the editor component captures keypresses. It has to have access to the keymappings, which are per-session, so it needs access to the session. Is coupling the editor to the session a good idea? Other components will also need to access the keybindings, so the session now becomes shared and can be a singleton...\nIs there any good reading about designing GUI applications that goes beyond MVC?\nThis is Python and wxPython, FWIW.\n[EDIT]: Added concrete usecase.","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":805,"Q_Id":471279,"Users Score":2,"Answer":"If you've looked at MVC you're probably moving in the right direction.  MVC, MVP, Passive View, Supervising Controller.  Those are all different ways, each with their own pros and cons, of accomplishing what you're after.  I find that Passive View is the \"ideal\", but it causes you to introduce far too many widgets into your GUI interfaces (i.e. IInterface).  In general I find that Supervising Controller is a good compromise.","Q_Score":9,"Tags":"python,model-view-controller,user-interface,architecture,wxpython","A_Id":471297,"CreationDate":"2009-01-22T23:25:00.000","Title":"Organising a GUI application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is going to be a generic question.\nI am struggling in designing a GUI application, esp. with dealing with interactions between different parts.\nI don't know how I should deal with shared state. On one hand, shared state is bad, and things should be as explicit as possible. On the other hand, not having shared state introduces unwanted coupling between components.\nAn example:\nI want my application to be extendable in an Emacs\/Vim sort of way, via scripts. Clearly, some sort of shared state needs to be modified, so that the GUI will use it. My initial plan was having a global \"session\" that is accessible from everywhere, but I'm not so sure about it.\nOne tricky use case is key bindings. I want the user to be able to specify custom keybindings from a script. Each keybinding maps to an arbitrary command, that receives the session as the only argument.\nNow, the editor component captures keypresses. It has to have access to the keymappings, which are per-session, so it needs access to the session. Is coupling the editor to the session a good idea? Other components will also need to access the keybindings, so the session now becomes shared and can be a singleton...\nIs there any good reading about designing GUI applications that goes beyond MVC?\nThis is Python and wxPython, FWIW.\n[EDIT]: Added concrete usecase.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":805,"Q_Id":471279,"Users Score":1,"Answer":"In MVC, the Model stuff is the shared state of the information.\nThe Control stuff is the shared state of the GUI control settings and responses to mouse-clicks and what-not.\nYour scripting angle can \n1) Update the Model objects.  This is good.  The Control can be \"Observers\" of the model objects and the View be updated to reflect the observed changes.\n2) Update the Control objects.  This is not so good, but...  The Control objects can then make appropriate changes to the Model and\/or View.\nI'm not sure what the problem is with MVC.  Could you provide a more detailed design example with specific issues or concerns?","Q_Score":9,"Tags":"python,model-view-controller,user-interface,architecture,wxpython","A_Id":471307,"CreationDate":"2009-01-22T23:25:00.000","Title":"Organising a GUI application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We are ready in our company to move everything to Python instead of C#, we are a consulting company and we usually write small projects in C# we don't do huge projects and our work is more based on complex mathematical models not complex software structures. So we believe IronPython is a good platform for us because it provides standard GUI functionality on windows and access to all of .Net libraries. \nI know Ironpython studio is not complete, and in fact I had a hard time adding my references but I was wondering if someone could list some of the pros and cons of this migration for us, considering Python code is easier to read by our clients and we usually deliver a proof-of-concept prototype instead of a full-functional code, our clients usually go ahead and implement the application themselves","AnswerCount":3,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":5128,"Q_Id":471712,"Users Score":7,"Answer":"The way you describe things, it sounds like you're company is switching to Python simple for the sake of Python.  Is there some specific reason you want to use Python?  Is a more dynamic language necessary?  Is the functional programming going to help you at all?  If you've got a perfectly good working set of tools in C#, why bother switching?\nIf you're set on switching, you may want to consider starting with standard Python unless you're specifically tied to the .NET libraries.  You can write cross platform GUIs using a number of different frameworks like wxPython, pyQt, etc.  That said, Visual Studio has a far superior GUI designer to just about any of the tools out there for creating Python windowed layouts.","Q_Score":16,"Tags":"python,ironpython,ironpython-studio","A_Id":471725,"CreationDate":"2009-01-23T02:49:00.000","Title":"Pros and cons of IronPython and IronPython Studio","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We are ready in our company to move everything to Python instead of C#, we are a consulting company and we usually write small projects in C# we don't do huge projects and our work is more based on complex mathematical models not complex software structures. So we believe IronPython is a good platform for us because it provides standard GUI functionality on windows and access to all of .Net libraries. \nI know Ironpython studio is not complete, and in fact I had a hard time adding my references but I was wondering if someone could list some of the pros and cons of this migration for us, considering Python code is easier to read by our clients and we usually deliver a proof-of-concept prototype instead of a full-functional code, our clients usually go ahead and implement the application themselves","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":5128,"Q_Id":471712,"Users Score":18,"Answer":"My company, Resolver Systems, develops what is probably the biggest application written in IronPython yet. (It's called Resolver One, and it's a Pythonic spreadsheet). We are also hosting the Ironclad project (to run CPython extensions under IronPython) and that is going well (we plan to release a beta of Resolver One & numpy soon).\nThe reason we chose IronPython was the .NET integration - our clients want 100% integration on Windows and the easiest way to do that right now is .NET. \nWe design our GUI (without behaviour) in Visual Studio, compile it into a DLL and subclass it from IronPython to add behaviour.\nWe have found that IronPython is faster at some cases and slower at some others. However, the IronPython team is very responsive, whenever we report a regression they fix it and usually backport it to the bugfix release. If you worry about performance, you can always implement a critical part in C# (we haven't had to do that yet).\nIf you have experience with C#, then IronPython will be natural for you, and easier than C#, especially for prototypes.\nRegarding IronPython studio, we don't use it. Each of us has his editor of choice (TextPad, Emacs, Vim & Wing), and everything works fine.","Q_Score":16,"Tags":"python,ironpython,ironpython-studio","A_Id":472355,"CreationDate":"2009-01-23T02:49:00.000","Title":"Pros and cons of IronPython and IronPython Studio","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with PyGTK, trying to come up with a combination of widgets that will do the following:\n\nLet me add an endless number of widgets in a column\nProvide a vertical scrollbar to get to the ones that run off the bottom\nMake the widgets' width adjust to fill available horizontal space when the window is resized\n\nThanks - I'm new to GTK.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4354,"Q_Id":474034,"Users Score":8,"Answer":"An endless number of widgets in a column:  Sounds like a GtkVBox.\nVertical scrollbar:  Put your VBox in a GtkScrolledWindow.\nHorizontal stretching:  This requires setting the appropriate properties for the VBox, ScrolledWindow, and your other widgets.  At least in Glade the defaults seem to mostly handle this (You will probably want to change the scrollbar policy of the ScrolledWindow).\n\nNow for the trick.  If you just do what I've listed above, the contents of the VBox will try to resize vertically as well as horizontally, and you won't get your scrollbar.  The solution is to place your VBox in a GtkViewport.\nSo the final hierarchy is ScrolledWindow( Viewport( VBox( widgets ) ) ).","Q_Score":4,"Tags":"python,gtk,pygtk,widget","A_Id":474134,"CreationDate":"2009-01-23T18:53:00.000","Title":"Which GTK widget combination to use for scrollable column of widgets?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":0.0,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":0,"Answer":"Between komodo and wingide i would go for wing. The license is not that expensive and the fact that it is commercial gives you a bigger probability of more updates and bug fixes. If you, like me, prefer a free solution, then stick with pydev. At least until aptana closes the free door :)","Q_Score":18,"Tags":"python,ide","A_Id":495362,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":0.0363476168,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":2,"Answer":"Check to see if the 'P' icon is appearing for your items and in the top of your editor after opening it. If it's not appearing, it may be that there's a problem with the file association, so, go to window > preferences > general > editors > file associations and make sure that the .py files are associated with the Python Editor (note that because of an eclipse bug, if it seems correct, you may have to remove the association and add it again)","Q_Score":18,"Tags":"python,ide","A_Id":1399741,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":0.0181798149,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":1,"Answer":"It sounds like you have to specify the location of the Python interpreter.  Do this under Preferences > Pydev > Interpreter - Python.  Create a new interpreter and point it to the Python interpreter executable.","Q_Score":18,"Tags":"python,ide","A_Id":4665424,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":0.0906594778,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":5,"Answer":"Make sure you use 'Open With' as 'Python Editor' by right clicking on the file - It worked for me","Q_Score":18,"Tags":"python,ide","A_Id":17847161,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":0.0,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":0,"Answer":"Check your Theme configuration. Python highlighting uses Theme Colors","Q_Score":18,"Tags":"python,ide","A_Id":18933901,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":0.0,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":0,"Answer":"In case anyone else makes the embarrassing mistake that I did:  be sure your source code file actually ends with \".py\". Even if its in a Python project, PyDev won't guess without the extension.","Q_Score":18,"Tags":"python,ide","A_Id":19301447,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":0.0,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":0,"Answer":"When syntax highlighting was not working for me using PyDev, I discovered that there were somehow two 'Python Editor' associations defined for .py files in my installation of Eclipse\/PyDev.  From the Eclipse Main Menu, go to Window  > Preferences > General > Editors > FileAssociations to see the file extension <-> editor mapping. I set a different one as default for .py files at the bottom of the dialog, and got syntax highlighting working again.","Q_Score":18,"Tags":"python,ide","A_Id":35208736,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":0.0,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":0,"Answer":"Well, I tried the Wing Professional and I think its really the best Py IDE out there.","Q_Score":18,"Tags":"python,ide","A_Id":495297,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":1.0,"is_accepted":false,"ViewCount":31316,"Q_Id":491053,"Users Score":13,"Answer":"The typical reason that code completion doesn't work under PyDev is that the libraries aren't in the PYTHONPATH.  If you go into the Project Properties, and setup PyDev PYTHONPATH preferences to include the places where the code you are trying to complete lives, it will work just fine...\nProject > Properties > PyDev-PYTHONPAH >  click 'Add source folder'","Q_Score":18,"Tags":"python,ide","A_Id":1836524,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?\nKomodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. \nI prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.\nIf I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion","AnswerCount":11,"Available Count":10,"Score":1.2,"is_accepted":true,"ViewCount":31316,"Q_Id":491053,"Users Score":23,"Answer":"To enable code completion, go to Window > Preferences > Pydev > Editor > Code Completion, and check the 'Use Code Completion?' box, as well as the other boxes for what you want to complete on.  It seems to take a second to load, the first time it has to complete something.\nSyntax coloring should just work by default.  Right-click on the file in the package explorer, go to 'Open With', and make sure you're opening it with the Python Editor, and not the regular Text Editor.\nI don't know exactly what you mean by importing external modules.  I have my source in a separate directory structure on disk; my PyDev projects contain folders linked to those.  Code completion works for that, as well as other modules like 'os'.  If you're having troubles, are the modules added to the PyDev's Python search path (not necessarily the same as the regular one)?\nI took a brief look at Komodo and Wingware a while back, so I can't answer the second part of your question.  But ended up going with PyDev.  I'm not a big fan of Eclipse, but PyDev works reasonably well for me.","Q_Score":18,"Tags":"python,ide","A_Id":492073,"CreationDate":"2009-01-29T09:50:00.000","Title":"No code completion and syntax highlighting in Pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a frame with a textctrl. When the mouse enters the textctrl (EVT_ENTER_WINDOW) I show a PopupWindow on top of the textctrl, and when the mouse leaves the popup (EVT_LEAVE_WINDOW) I hide it again.\nEverything works fine, except when inside the PopupWindow there's a ScrolledWindow with shown scrollbars. The EVT_LEAVE_WINDOW gets fired when I move the mouse on top of a scrollbar, so it looks like wxPython thinks the scrollbars are not part of the scrolledwindow.. :\/\nI tried binding the event to the popup or the scrollwindow itself, but nothing changes.. Is there a way I could get around this?\nMany thanks!\n(wxPython 2.8.8.0 on Xubuntu 8.10)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":628,"Q_Id":492365,"Users Score":0,"Answer":"Since tooltips normally disappear when the user moves the mouse you could also bind to EVT_MOTION instead of EVT_LEAVE_WINDOW and hide the tooltip when the user moves the mouse.","Q_Score":1,"Tags":"wxpython,wxwidgets","A_Id":826451,"CreationDate":"2009-01-29T16:30:00.000","Title":"ScrolledWindow and wx.EVT_LEAVE_WINDOW","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a frame with a textctrl. When the mouse enters the textctrl (EVT_ENTER_WINDOW) I show a PopupWindow on top of the textctrl, and when the mouse leaves the popup (EVT_LEAVE_WINDOW) I hide it again.\nEverything works fine, except when inside the PopupWindow there's a ScrolledWindow with shown scrollbars. The EVT_LEAVE_WINDOW gets fired when I move the mouse on top of a scrollbar, so it looks like wxPython thinks the scrollbars are not part of the scrolledwindow.. :\/\nI tried binding the event to the popup or the scrollwindow itself, but nothing changes.. Is there a way I could get around this?\nMany thanks!\n(wxPython 2.8.8.0 on Xubuntu 8.10)","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":628,"Q_Id":492365,"Users Score":0,"Answer":"Robin Dunn told me: \"the same thing would happen with any other widgets that are on the scrolled window, just as the frame will get a EVT_LEAVE_WINDOW when the mouse moves into the scrolled window (assuming some portion of the frame was visible so it could have received an enter window event too)\"","Q_Score":1,"Tags":"wxpython,wxwidgets","A_Id":11717036,"CreationDate":"2009-01-29T16:30:00.000","Title":"ScrolledWindow and wx.EVT_LEAVE_WINDOW","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"in my python program to upload a file to the internet, im using a GTK progress bar to show the upload progress.  But the problems that im facing is that the progress bar does not show any activity until the upload is complete, and then  it abruptly indicates upload complete. im using pycurl to make the http requests...my question is -\ndo i need to have a multi-threaded application to upload the file and simultaneously update the gui? or is there some other mistake that im making? \nThanks in advance!","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":6986,"Q_Id":496814,"Users Score":1,"Answer":"More than likely the issue is that in your progress callback, which is where I presume you're updating the progress bar, you're not making a call to manually update the display i.e. run through the GUI's event loop. This is just speculation though, if you can provide more code, it might be easier to narrow it down further.\nThe reason you need to manually update the display is because your main thread is also performing the upload, which is where it's blocking.","Q_Score":9,"Tags":"python,user-interface,gtk,progress-bar,pygtk","A_Id":496995,"CreationDate":"2009-01-30T19:17:00.000","Title":"Progress bar not updating during operation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C extension module for Python and I want to make it available to Rubyists.\nThe source has a number of C modules, with only one being Python-dependent. The rest depend only on each other and the standard library. I can build it with python setup.py build in the usual way.\nI've been experimenting with adding Ruby support using newgem and I can build a version of the extension with rake gem. However, the combined source has an ugly directory layout (mixing Gem-style and Setuptools-style structures) and the build process is a kludge.\nI can't just keep all the sources in the same directory because mkmf automatically picks up the Python-dependent module and tries to build that, and users shouldn't have to install Python to compile a module that won't be used. My current hack is for extconf.rb to copy the Python-independent source-files into the same directory as the Ruby-dependent extension module.\nIs there a saner way to make the code available to both languages? Should I just duplicate the Python-independent code in a separate Gem? Should I release the independent code as a separate lib built with autotools? Is there a version of mkmf that can skip the unwanted module?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":734,"Q_Id":511412,"Users Score":5,"Answer":"One way to solve it is to create three different projects:\n\nThe library itself, independent on python & ruby\nPython bindings\nRuby bindings\n\nThat's probably the cleanest solution, albeit it requires a bit more work when doing releases, but it has the advantage that you can release a new version of the Ruby bindings without having to ship a new library\/python bindings version.","Q_Score":8,"Tags":"python,ruby,setuptools,newgem","A_Id":511871,"CreationDate":"2009-02-04T13:42:00.000","Title":"Combined Python & Ruby extension module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been writing tools in Maya for years using MEL and Python.  I'd consider myself an expert in custom window\/gui design in Maya except for one area; modifying existing panels and editors.\nTypically, I'm building tools that need totally custom UIs, so its customary for me to build them from scratch.  However, recently I've found myself wanting to add some additional functionality to the layer editor in Maya.  I've seen tutorials that explain how to do this, but now that I want to do it, I can't find any.\nLinks to tutorials or a brief code snippet to get me started would be great.  I just need to know how to find the layer editor\/panel and, say, add a button or text field to it.","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5048,"Q_Id":527314,"Users Score":1,"Answer":"Have you tried searching ui item names in MEL files under maya installation directory? It should be one of the MEL scripts included, and from there you can just modify it.","Q_Score":1,"Tags":"python,user-interface,maya,panels,mel","A_Id":551109,"CreationDate":"2009-02-09T07:05:00.000","Title":"How to modify existing panels in Maya using MEL or Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got an wx App that has the UI defined in XRC files. Each form is in its own xrc file. There is one panel that is common to many of the forms. Is there a way to have objects defined in one file that are included and referenced in another?\nI know there is a object_ref mechanism, but I can't see how that can reference external xrc files.\nI'd like something that worked similar to the way you can define xsd elements in one file and include and reference them in another xsd file.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":260,"Q_Id":537774,"Users Score":1,"Answer":"XRC doesn't have an include mechanism that I know of, but you can have custom widgets.\nSo implement your common panel as its own XRC, and set that up as something that you can reference by class name in other xrc files.\nYou would create an XmlResourceHandler that handles the custom Panel in the XRC, and instantiates your Panel class.  The place to look is demo\/wxXmlResourceHandler.py\nYou can even extend XRCed to recognize your own resource, and insert it into future dialogs with ease.","Q_Score":0,"Tags":"wxpython,wxwidgets,xrc","A_Id":598169,"CreationDate":"2009-02-11T16:58:00.000","Title":"Is there to include elements from one xrc file in another xrc file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to remove tkinter icon from title bar in it's window","AnswerCount":7,"Available Count":1,"Score":0.057080742,"is_accepted":false,"ViewCount":45549,"Q_Id":550050,"Users Score":2,"Answer":"Alternative to @ubomb's solution for adding custom images by utilizing Tkinter.PhotoImage's built-in support for processing .gif images.\nFrom file:\nicon = Tkinter.PhotoImage(file=\"logo.gif\")\nfrom base64:\ngif_base64_string = \"\"\" R0lGODdhEAAQAIcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4O Dg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEh ... 4B8AAP9Ci\/4HoLTpfwD+qV4NoHVAADs= \"\"\"\nicon = Tkinter.PhotoImage(data=gif_base64_string)\nVisit the undermentioned link for more details:\n\/\/effbot.org\/tkinterbook\/photoimage.htm","Q_Score":26,"Tags":"python,python-3.x,tkinter,tk","A_Id":52803981,"CreationDate":"2009-02-15T00:27:00.000","Title":"Removing the TK icon on a Tkinter window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For C++, Java, or Python, what are some good game + free game engines that are easy to pick up?\nAny type of game engine is okay. I just want to get started somewhere by looking into different game engines and their capabilities.","AnswerCount":14,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":10754,"Q_Id":564469,"Users Score":0,"Answer":"There is a RPG engine called VERGE if you're interested. Never tried it but I heard good things from it. \nI think it's in C++.","Q_Score":9,"Tags":"java,c++,python","A_Id":1949983,"CreationDate":"2009-02-19T09:05:00.000","Title":"What is a good & free game engine?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In a \"multitouch\" environement, any application showed on a surface can be rotated\/scaled to the direction of an user. Actual solution is to drawing the application on a FBO, and draw a rotated\/scaled rectangle with the texture on it. I don't think it's good for performance, and all graphics cards don't provide FBO.\nThe idea is to clip the rendering viewport in the direction of user.\nSince glViewport cannot be used for that, is another way exist to achieve that ?\n(glViewport use (x, y, width, height), and i would like (x, y, width, height, rotation from center?))\nPS: rotating the modelview or projection matrix will not help, i would like to \"rotate the clipping plan\" generated by glViewport. (only part of the all scene).","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":3051,"Q_Id":577639,"Users Score":2,"Answer":"If you already have the code set up to render your scene, try adding a glRotate() call to the viewmodel matrix setup, to \"rotate the camera\" before rendering the scene.","Q_Score":2,"Tags":"python,math,opengl","A_Id":577672,"CreationDate":"2009-02-23T13:33:00.000","Title":"Rotating a glViewport?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In a \"multitouch\" environement, any application showed on a surface can be rotated\/scaled to the direction of an user. Actual solution is to drawing the application on a FBO, and draw a rotated\/scaled rectangle with the texture on it. I don't think it's good for performance, and all graphics cards don't provide FBO.\nThe idea is to clip the rendering viewport in the direction of user.\nSince glViewport cannot be used for that, is another way exist to achieve that ?\n(glViewport use (x, y, width, height), and i would like (x, y, width, height, rotation from center?))\nPS: rotating the modelview or projection matrix will not help, i would like to \"rotate the clipping plan\" generated by glViewport. (only part of the all scene).","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3051,"Q_Id":577639,"Users Score":2,"Answer":"There's no way to have a rotated viewport in OpenGL, you have to handle it manually. I see the following possible solutions :\n\nKeep on using textures, perhaps using glCopyTexSubImage instead of FBOs, as this is basic OpenGL feature. If your target platforms are hardware accelerated, performance should be ok, depending on the number of viewports you need on your desk, as this is a very common use case nowadays.\nWithout textures, you could setup your glViewport to the screen-aligned bounding rectangle (rA) of your rotated viewport  (rB) (setting also proper scissor testing area). Then draw a masking area, possibly only in depth or stencil buffer, filling the (rA - rB) area, that will prevent further drawing on those pixels. Then draw normally your application, using a glRotate to adjust you projection matrix, so that the rendering is properly oriented according to rB.","Q_Score":2,"Tags":"python,math,opengl","A_Id":593825,"CreationDate":"2009-02-23T13:33:00.000","Title":"Rotating a glViewport?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Symbian has a stack limit of 8kB. Does this also apply to the function calling in PyS60 apps?","AnswerCount":4,"Available Count":4,"Score":0.1488850336,"is_accepted":false,"ViewCount":417,"Q_Id":595296,"Users Score":3,"Answer":"Yes, PyS60 is based on CPython, thus uses the C stack.","Q_Score":3,"Tags":"python,symbian,nokia,pys60","A_Id":595330,"CreationDate":"2009-02-27T15:48:00.000","Title":"Does the stack limit of Symbian also apply to PyS60?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Symbian has a stack limit of 8kB. Does this also apply to the function calling in PyS60 apps?","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":417,"Q_Id":595296,"Users Score":1,"Answer":"Increasing the Symbian stack size is done through a parameter in the mmp file.\nThis is valid when you create a native application that the toolchain will turn into an exe file.\nIf you were to upgrade the Python runtime on your phone, with a version you built yourself, you could increase the stack size of the runtime process itself.","Q_Score":3,"Tags":"python,symbian,nokia,pys60","A_Id":606180,"CreationDate":"2009-02-27T15:48:00.000","Title":"Does the stack limit of Symbian also apply to PyS60?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Symbian has a stack limit of 8kB. Does this also apply to the function calling in PyS60 apps?","AnswerCount":4,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":417,"Q_Id":595296,"Users Score":0,"Answer":"I would assume that PyS60 should be doing the memory management for you, as your program will probably be constrained by the resources of PyS60.","Q_Score":3,"Tags":"python,symbian,nokia,pys60","A_Id":685145,"CreationDate":"2009-02-27T15:48:00.000","Title":"Does the stack limit of Symbian also apply to PyS60?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Symbian has a stack limit of 8kB. Does this also apply to the function calling in PyS60 apps?","AnswerCount":4,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":417,"Q_Id":595296,"Users Score":1,"Answer":"There is a difference between python runtime and python apps. Also from PyS60 app developer point of view, it's the heapsize that's more interesting...\nVersion 1.9.5 comes by default with heapsize 100k min and 4M max. Of course you can define those by yourself when creating the SIS package to release and distribute your application.\nSorry if I answered right question with wrong answer (stack vs heap).\nStack is usually \"enough\", but with deep enough recursion you can run out of it. Have done it - and fixed some endless loops :) Never had any real stack problems. Usually it's the heap that runs out, esp with graphics manipulation.","Q_Score":3,"Tags":"python,symbian,nokia,pys60","A_Id":915134,"CreationDate":"2009-02-27T15:48:00.000","Title":"Does the stack limit of Symbian also apply to PyS60?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm hosting IronPython in a c#-based WebService to be able to provide custom extension scripts. However, I'm finding that memory usage sharply increases when I do simple load testing by executing the webservice repeatedly in a loop.\nIronPython-1.1 implemented IDisposable on its objects so that you can dispose of them when they are done. The new IronPython-2 engine based on the DLR has no such concept.\nFrom what I understood, everytime you execute a script in the ScriptEngine a new assembly is injected in the appdomain and can't be unloaded.\nIs there any way around this?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1344,"Q_Id":610128,"Users Score":0,"Answer":"Turns out, after aspnet_wp goes to about 500mb, the garbage collector kicks in and cleans out the mess. The memory usage then drops to about 20mb and steadily starts increasing again during load testing.\nSo there's no memory 'leak' as such.","Q_Score":2,"Tags":"performance,ironpython","A_Id":613533,"CreationDate":"2009-03-04T11:11:00.000","Title":"IronPython memory usage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm hosting IronPython in a c#-based WebService to be able to provide custom extension scripts. However, I'm finding that memory usage sharply increases when I do simple load testing by executing the webservice repeatedly in a loop.\nIronPython-1.1 implemented IDisposable on its objects so that you can dispose of them when they are done. The new IronPython-2 engine based on the DLR has no such concept.\nFrom what I understood, everytime you execute a script in the ScriptEngine a new assembly is injected in the appdomain and can't be unloaded.\nIs there any way around this?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1344,"Q_Id":610128,"Users Score":1,"Answer":"You could try creating a new AppDomain every time you run one of your IronPython scripts. Although assebmlies cannot be unloaded from memory you can unload an AppDomain and this will allow you to get the injected assembly out of memory.","Q_Score":2,"Tags":"performance,ironpython","A_Id":611623,"CreationDate":"2009-03-04T11:11:00.000","Title":"IronPython memory usage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"From what I have seen and read on blogs, PyPy is a very ambitious project. What are some advantages it will bring to the table over its siblings (CPython, Jython, and IronPython)? Is it speed, cross-platform compatibility (including mobile platforms), the ability to use c-extensions without the GIL, or is this more of a technical exercise on what can be done?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3214,"Q_Id":619437,"Users Score":0,"Answer":"cross-platform compatibility\n\nYes","Q_Score":28,"Tags":"python,interpreter,pypy","A_Id":619480,"CreationDate":"2009-03-06T16:25:00.000","Title":"What does PyPy have to offer over CPython, Jython, and IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"From what I have seen and read on blogs, PyPy is a very ambitious project. What are some advantages it will bring to the table over its siblings (CPython, Jython, and IronPython)? Is it speed, cross-platform compatibility (including mobile platforms), the ability to use c-extensions without the GIL, or is this more of a technical exercise on what can be done?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3214,"Q_Id":619437,"Users Score":38,"Answer":"PyPy is really two projects:\n\nAn interpreter compiler toolchain allowing you to write interpreters in RPython (a static subset of Python) and have cross-platform interpreters compiled standalone, for the JVM, for .NET (etc)\nAn implementation of Python in RPython\n\nThese two projects allow for many things.\n\nMaintaining Python in Python is much easier than maintaining it in C\nFrom a single codebase you can generate Python interpreters that run on the JVM, .NET and standalone - rather than having multiple slightly incompatible implementations\nPart of the compiler toolchain includes an experimental JIT generator (now in its fifth incarnation and starting to work really well) - the goal is for a JITed PyPy to run much faster than CPython\nIt is much easier to experiment with fundamental language features - like removing the GIL, better garbage collection, integrating stackless and so on\n\nSo there are really a lot of reasons for PyPy to be exciting, and it is finally starting to live up to all its promises.","Q_Score":28,"Tags":"python,interpreter,pypy","A_Id":619544,"CreationDate":"2009-03-06T16:25:00.000","Title":"What does PyPy have to offer over CPython, Jython, and IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"wx (and wxPython) has two events I miss in PyQt: \n\nEVT_IDLE that's being sent to a frame. It can be used to update the various widgets according to the application's state\nEVT_UPDATE_UI that's being sent to a widget when it has to be repainted and updated, so I can compute its state in the handler\n\nNow, PyQt doesn't seem to have these, and the PyQt book suggests writing an updateUi method and calling it manually. I even ended up calling it from a timer once per 0.1 seconds, in order to avoid many manual calls from methods that may update the GUI. Am I missing something? Is there a better way to achieve this?\n\nAn example: I have a simple app with a Start button that initiates some processing. The start button should be enabled only when a file has been opened using the menu. In addition, there's a permanent widget on the status bar that displays information.\nMy application has states:\n\nBefore the file is opened (in this state the status bar show something special and the start button is disabled)\nFile was opened and processing wasn't started: the start button is enabled, status bar shows something else\nThe processing is running: the start button now says \"Stop\", and the status bar reports progress\n\nIn Wx, I'd have the update UI event of the button handle its state: the text on it, and whether it's enabled, depending on the application state. The same for the status bar (or I'd use EVT_IDLE for that).\nIn Qt, I have to update the button in several methods that may affect the state, or just create a update_ui method and call it periodically in a timer. What is the more \"QT\"-ish way?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":2691,"Q_Id":624050,"Users Score":1,"Answer":"As far as I understand EVT_IDLE is sent when application message queue is empty. There is no such event in Qt, but if you need to execute something in Qt when there are no pending events, you should use QTimer with 0 timeout.","Q_Score":2,"Tags":"python,qt,wxpython,pyqt","A_Id":624282,"CreationDate":"2009-03-08T18:26:00.000","Title":"wx's idle and UI update events in PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"wx (and wxPython) has two events I miss in PyQt: \n\nEVT_IDLE that's being sent to a frame. It can be used to update the various widgets according to the application's state\nEVT_UPDATE_UI that's being sent to a widget when it has to be repainted and updated, so I can compute its state in the handler\n\nNow, PyQt doesn't seem to have these, and the PyQt book suggests writing an updateUi method and calling it manually. I even ended up calling it from a timer once per 0.1 seconds, in order to avoid many manual calls from methods that may update the GUI. Am I missing something? Is there a better way to achieve this?\n\nAn example: I have a simple app with a Start button that initiates some processing. The start button should be enabled only when a file has been opened using the menu. In addition, there's a permanent widget on the status bar that displays information.\nMy application has states:\n\nBefore the file is opened (in this state the status bar show something special and the start button is disabled)\nFile was opened and processing wasn't started: the start button is enabled, status bar shows something else\nThe processing is running: the start button now says \"Stop\", and the status bar reports progress\n\nIn Wx, I'd have the update UI event of the button handle its state: the text on it, and whether it's enabled, depending on the application state. The same for the status bar (or I'd use EVT_IDLE for that).\nIn Qt, I have to update the button in several methods that may affect the state, or just create a update_ui method and call it periodically in a timer. What is the more \"QT\"-ish way?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2691,"Q_Id":624050,"Users Score":5,"Answer":"The use of EVT_UPDATE_UI in wxWidgets seems to highlight one of the fundamental differences in the way wxWidgets and Qt expect developers to handle events in their code.\nWith Qt, you connect signals and slots between widgets in the user interface, either handling \"business logic\" in each slot or delegating it to a dedicated method. You typically don't worry about making separate changes to each widget in your GUI because any repaint requests will be placed in the event queue and delivered when control returns to the event loop. Some paint events may even be merged together for the sake of efficiency.\nSo, in a normal Qt application where signals and slots are used to handle state changes, there's basically no need to have an idle mechanism that monitors the state of the application and update widgets because those updates should occur automatically.\nYou would have to say a bit more about what you are doing to explain why you need an equivalent to this event in Qt.","Q_Score":2,"Tags":"python,qt,wxpython,pyqt","A_Id":624734,"CreationDate":"2009-03-08T18:26:00.000","Title":"wx's idle and UI update events in PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing an IM client for Mac (in Python, but an Objective C \/ Cocoa solution here is fine). I want to detect whether or not the user is currently watching a movie or playing a game in the foreground, or doing anything else that takes up the entire screen. If so, I won't play a sound when a new IM comes in, but if not, I will play the sound.\nHow can I detect this? Is there some way to get the foreground window with Applescript and look at its dimensions? Or is there some other API call?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1606,"Q_Id":633086,"Users Score":0,"Answer":"The two solutions posted so far apply to \u201creal\u201d full-screen, but it\u2019s worth noting that many full-screen apps just put a window over the whole screen (or, as vasi points out, a whole screen). To be accurate, you\u2019ll have to check both.","Q_Score":2,"Tags":"python,objective-c,cocoa,macos,fullscreen","A_Id":633718,"CreationDate":"2009-03-11T02:11:00.000","Title":"Detecting fullscreen on Mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?","AnswerCount":6,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":5022,"Q_Id":636990,"Users Score":6,"Answer":"If all you want is a GUI, wxPython should do the trick.\nIf you're looking to add sound, controller input, and take it beyond a simple card game, then you may want to use pygame.","Q_Score":6,"Tags":"python,wxpython,pygame,playing-cards","A_Id":637017,"CreationDate":"2009-03-12T00:53:00.000","Title":"wxPython or pygame for a simple card game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?","AnswerCount":6,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":5022,"Q_Id":636990,"Users Score":3,"Answer":"Generally, PyGame is the better option for coding games. But that's for the more common type of games - where things move on the screen and you must have a good \"frame-rate\" performance. \nFor something like a card game, however, I'd go with wxPython (or rather, PyQt). This is because a card game hasn't much in terms of graphics (drawing 2D card shapes on the screen is no harder in wx \/ PyQt than in PyGame). And on the other hand, you get lots of benefits from wx - like a ready-made GUI for interaction. \nIn Pygame you have to create a GUI yourself or wade through several half-baked libraries that do it for you. This actually makes sense for Pygame because when you create a game you usually want a GUI of your own, that fits the game's style. But for card games, most chances are that wx's standard GUI widgets will do the trick and will save you hours of coding.","Q_Score":6,"Tags":"python,wxpython,pygame,playing-cards","A_Id":640064,"CreationDate":"2009-03-12T00:53:00.000","Title":"wxPython or pygame for a simple card game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?","AnswerCount":6,"Available Count":3,"Score":0.0333209931,"is_accepted":false,"ViewCount":5022,"Q_Id":636990,"Users Score":1,"Answer":"I'd say pygame -- I've heard it's lots of fun, easy and happy.  Also, all of my experiences with wxPython have been sad an painful.\nBut I'm not bias or anything.","Q_Score":6,"Tags":"python,wxpython,pygame,playing-cards","A_Id":637004,"CreationDate":"2009-03-12T00:53:00.000","Title":"wxPython or pygame for a simple card game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am planning to write an simple 3d(isometric view) game in Java using jMonkeyEngine - nothing to fancy, I just want to learn something about OpenGL and writing efficient algorithms (random map generating ones). \nWhen I was planning what to do, I started wondering about switching to Python. I know that Python didn't come into existence to be a tool to write 3d games, but is it possible to write good looking games with this language? \nI have in mind 3d graphics, nice effects and free CPU time to power to rest of game engine? I had seen good looking java games - and too be honest, I was rather shocked when I saw level of detail achieved in Runescape HD. \nOn the other hand, pygame.org has only 2d games, with some starting 3d projects. Are there any efficient 3d game engines for python? Is pyopengl the only alternative? Good looking games in python aren't popular or possible to achieve? \nI would be grateful for any information \/ feedback.","AnswerCount":8,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":17104,"Q_Id":641770,"Users Score":18,"Answer":"If you are worried about 3D performance: Most of the performance-critical parts will be handled by OpenGL (in a C library or even in hardware), so the language you use to drive it should not matter too much.\nTo really find out if performance is a problem, you'd have to try it. But there is no reason why it cannot work in principle.\nAt any rate, you could still optimize the critical parts, either in Python or by dropping to C. You still gain Python's benefit for most of the game engine which is less performance-critical.","Q_Score":16,"Tags":"python,opengl","A_Id":641832,"CreationDate":"2009-03-13T07:48:00.000","Title":"Can 3D OpenGL game written in Python look good and run fast?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am planning to write an simple 3d(isometric view) game in Java using jMonkeyEngine - nothing to fancy, I just want to learn something about OpenGL and writing efficient algorithms (random map generating ones). \nWhen I was planning what to do, I started wondering about switching to Python. I know that Python didn't come into existence to be a tool to write 3d games, but is it possible to write good looking games with this language? \nI have in mind 3d graphics, nice effects and free CPU time to power to rest of game engine? I had seen good looking java games - and too be honest, I was rather shocked when I saw level of detail achieved in Runescape HD. \nOn the other hand, pygame.org has only 2d games, with some starting 3d projects. Are there any efficient 3d game engines for python? Is pyopengl the only alternative? Good looking games in python aren't popular or possible to achieve? \nI would be grateful for any information \/ feedback.","AnswerCount":8,"Available Count":2,"Score":0.024994793,"is_accepted":false,"ViewCount":17104,"Q_Id":641770,"Users Score":1,"Answer":"There was a Vampires game out a few years ago where most if not all of the code was in Python. Not sure if the 3D routines were in them, but it worked fine.","Q_Score":16,"Tags":"python,opengl","A_Id":645987,"CreationDate":"2009-03-13T07:48:00.000","Title":"Can 3D OpenGL game written in Python look good and run fast?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I noticed that my programs written with wxPython have Win98 button style.\nBut Boa Constructor (that is written using wxPython too) got pretty buttons.\nHow to make buttons look like current Windows buttons style?","AnswerCount":4,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":1511,"Q_Id":642853,"Users Score":-2,"Answer":"Have you tried running your scripts with pythonw.exe instead of python.exe?","Q_Score":3,"Tags":"python,coding-style,wxpython","A_Id":642948,"CreationDate":"2009-03-13T14:01:00.000","Title":"WinXP button-style with wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I noticed that my programs written with wxPython have Win98 button style.\nBut Boa Constructor (that is written using wxPython too) got pretty buttons.\nHow to make buttons look like current Windows buttons style?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1511,"Q_Id":642853,"Users Score":0,"Answer":"The answers so far handle distributing the package as an executable (eg. py2exe), where the answer has already been given.\nBut since (i think) python 2.6 you have the same problem when just starting the .py file from the commandline (Vista and Windows7). Robin Dunn suggested using update_manifest.py which he distributes with wxPython and puts it in the same directory as python.exe.\nAfter applying update_manifest.py using a copied version of python.exe wxPython apps have the correct themed look and yes it also works using windows7 RC1.","Q_Score":3,"Tags":"python,coding-style,wxpython","A_Id":841710,"CreationDate":"2009-03-13T14:01:00.000","Title":"WinXP button-style with wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C++ application that has embedded Python. I'm building with Visual Studio 2005. When I try to link to python26.lib, I get a number of unresolved symbols, all of which begin with \"__imp\":\nerror LNK2019: unresolved external symbol __imp__Py_Initialize referenced in function _main\npython26.lib is an import library (installed by the Python 2.6 installer). What do I have to do to resolve these symbols? They do exist in the import library (dumpbin \/all shows them). Thanks.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":6181,"Q_Id":658879,"Users Score":2,"Answer":"Try to include C:\\WINDOWS\\system32\\python26.dll in your references. python26.lib contains the symbol names for the main DLL.","Q_Score":8,"Tags":"python,visual-studio,import,linker","A_Id":659107,"CreationDate":"2009-03-18T15:52:00.000","Title":"Linking to Python import library in Visual Studio 2005","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C++ application that has embedded Python. I'm building with Visual Studio 2005. When I try to link to python26.lib, I get a number of unresolved symbols, all of which begin with \"__imp\":\nerror LNK2019: unresolved external symbol __imp__Py_Initialize referenced in function _main\npython26.lib is an import library (installed by the Python 2.6 installer). What do I have to do to resolve these symbols? They do exist in the import library (dumpbin \/all shows them). Thanks.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":6181,"Q_Id":658879,"Users Score":13,"Answer":"Looks like I was trying to link a 64-bit Python library to a 32-bit application. I wish the linker would tell me something other than \"unresolved symbol.\" Linking to the 32-bit library fixes the problem.","Q_Score":8,"Tags":"python,visual-studio,import,linker","A_Id":660181,"CreationDate":"2009-03-18T15:52:00.000","Title":"Linking to Python import library in Visual Studio 2005","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing editing front ends in Python since several years now, and I am fed up with micromanaging every UI detail of a window or dialog every single time.\nIs there a technology that allows me to, say, specify the relations between a GTK+ Glade-designed interface and the tables and records of an SQLite database to do all the middle man work? It should spare me the work of manually writing event handlers, input evaluators and view updates.\nThe technologies in question are just examples, but I want to stick with Python as far as possible.","AnswerCount":8,"Available Count":3,"Score":0.024994793,"is_accepted":false,"ViewCount":1574,"Q_Id":671741,"Users Score":1,"Answer":"There is a good book on wxPython, \"wxPython in Action\", which can't be said for some of the other solutions.  No knock on the others.  I've had success developing with wxPython in the past and it comes with a great set of demo applications with source code from which you can borrow liberally.\nThe best UI designer I found for wxPython applications is a commercial one, Anthemion DialogBlocks.  It's by one of the wxPython programmers and is worth the money.  Other solutions for UI design include wxGlade (I found it usable but not featureful) and Boa Constructor (haven't used it).  Wing IDE might also have one.  Stani's Python Editor bundles wxGlade, I believe.  There are a lot of other projects that don't really work or are fairly old.\nAs far as SQL automation goes, as another answerer says, I'd look at SQL alchemy, but the learning curve for a small application might be too much and you'd be better off just going straight to odbc.  The best odbc api is the one used by Django, pyodbc.\nIt's been a while since I developed with these tools, so there may be something newer for each, but at the time these were definitely the best of breed in my opinion.","Q_Score":7,"Tags":"python,user-interface,sqlite,gtk,glade","A_Id":691567,"CreationDate":"2009-03-22T22:49:00.000","Title":"Is there a Python library that allows to build user interfaces without writing much code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing editing front ends in Python since several years now, and I am fed up with micromanaging every UI detail of a window or dialog every single time.\nIs there a technology that allows me to, say, specify the relations between a GTK+ Glade-designed interface and the tables and records of an SQLite database to do all the middle man work? It should spare me the work of manually writing event handlers, input evaluators and view updates.\nThe technologies in question are just examples, but I want to stick with Python as far as possible.","AnswerCount":8,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1574,"Q_Id":671741,"Users Score":0,"Answer":"I had lots of success with wxPython, but that was some years ago now and there may be better new solutions...","Q_Score":7,"Tags":"python,user-interface,sqlite,gtk,glade","A_Id":678000,"CreationDate":"2009-03-22T22:49:00.000","Title":"Is there a Python library that allows to build user interfaces without writing much code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing editing front ends in Python since several years now, and I am fed up with micromanaging every UI detail of a window or dialog every single time.\nIs there a technology that allows me to, say, specify the relations between a GTK+ Glade-designed interface and the tables and records of an SQLite database to do all the middle man work? It should spare me the work of manually writing event handlers, input evaluators and view updates.\nThe technologies in question are just examples, but I want to stick with Python as far as possible.","AnswerCount":8,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":1574,"Q_Id":671741,"Users Score":4,"Answer":"PyQt and its models can automate some of these tasks for you (to some amount off course, e.g. filling widgets with data from a database and handling most of the widgets behaviour, buffering etc.).\nIf you want a more object-oriented approach to handling SQL you could look into an ORM-oriented solution (for example SQLAlchemy).","Q_Score":7,"Tags":"python,user-interface,sqlite,gtk,glade","A_Id":671752,"CreationDate":"2009-03-22T22:49:00.000","Title":"Is there a Python library that allows to build user interfaces without writing much code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My next work is going to be heavily focused on working with data that is best understood when organized on a two-dimensional zoomable plane or canvas, instead of using lists and property forms.\nThe library can be based on OpenGL, GTK+ or Cairo. It should allow me to:\n\nbuild widgets out of vector shapes and text (perhaps even SVG based?)\narrange these widgets on a 2D plane\ncatch widget-related events\nzoom deeply into a widget to reveal additional data\narrange widgets in a tree\nanimate widgets fluidly\n\nIt wouldn't hurt if it would also allow for some databinding or model\/view concept.","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":802,"Q_Id":673434,"Users Score":3,"Answer":"Qt has this covered... check PyQt","Q_Score":3,"Tags":"python,user-interface,opengl,gtk,cairo","A_Id":673447,"CreationDate":"2009-03-23T13:51:00.000","Title":"Is there a Python library for easily writing zoomable UI's?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is a continuation of my question Python2.5.2\nThe code i developed is working fine with clr.Addreference().\nNow thee problem is I have to load ny script which uses dll developed in .NET to another application.They had used QT for its implementation.There is a Script console in that application.When ii entered 'import clr' ,it was saying 'No module named clr' or 'Cannot import clr'.What shall i do?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":614,"Q_Id":680336,"Users Score":3,"Answer":"You won't be able to run your script in that application. The script console in that QT application doubtlessly uses plain ol' CPython instead of IronPython. There's no real good way to change that without significant surgery to the application that's hosting the python console.","Q_Score":0,"Tags":"python,ironpython","A_Id":680367,"CreationDate":"2009-03-25T05:34:00.000","Title":"Python 2.5.2 continued","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I hit this issue about two years ago when I first implemented our SWIG bindings.  As soon as we exposed a large amount of code we got to the point where SWIG would output C++ files so large the compiler could not handle them.  The only way I could get around the issue was to split up the interfaces into multiple modules and to compile them separately.\nThis has several downsides:\n\u2022 Each module must know about dependencies in other modules.  I have a script to generate the interface files which handles this side of things, but it adds extra complexity.\n\u2022 Each additional module increases the time that the dynamic linker requires to load in the code.  I have added an init.py file that imports all the submodules, so that the fact that the code is split up is transparent to the user, but what is always visible is the long load times.\nI'm currently reviewing our build scripts \/ build process and I wanted to see if I could find a solution to this issue that was better than what I have now.  Ideally, I'd have one shared library containing all the wrapper code.  \nDoes anyone know how I can acheive this with SWIG?  I've seen some custom code written in Ruby for a specific project, where the output is post-processed to make this possible, but when I looked at the feasibility for Python wrappers it does not look so easy.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2117,"Q_Id":697749,"Users Score":0,"Answer":"If split properly, the modules don't necessarily need to have the same dependencies as the others - just what's necessary to do compilation.  If you break things up appropriately, you can have libraries without cyclic dependencies.  The issue with using multiple libraries is that by default, SWIG declares its runtime code statically, and as a result, as problems passing objects from one module to another.  You need to enable a shared version of the SWIG runtime code.\nFrom the documentation (SWIG web page documentation link is broken):\n\nThe runtime functions are private to\n  each SWIG-generated module. That is,\n  the runtime functions are declared\n  with \"static\" linkage and are visible\n  only to the wrapper functions defined\n  in that module. The only problem with\n  this approach is that when more than\n  one SWIG module is used in the same\n  application, those modules often need\n  to share type information. This is\n  especially true for C++ programs where\n  SWIG must collect and share\n  information about inheritance\n  relationships that cross module\n  boundaries.\n\nCheck out that section in your downloaded documentation (section 16.2 The SWIG runtime code), and it'll give you details on how to enable this so that objects can be properly handled when passed from one module to the other.\nFWIW, I've not worked with Python SWIG, but have done Tcl SWIG.","Q_Score":9,"Tags":"c++,python,swig","A_Id":698089,"CreationDate":"2009-03-30T15:40:00.000","Title":"Is it possible to split a SWIG module for compilation, but rejoin it when linking?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wx.Frame, in which I have a vertical BoxSizer with two items, a TextCtrl and a custom widget. I want the custom widget to have a fixed pixel height, while the TextCtrl will expand normally to fill the window. What should I do?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2175,"Q_Id":730394,"Users Score":6,"Answer":"Got it.\nWhen creating the widget, use a size of (-1,100), where \"100\" is the height you want. Apparently the \"-1\" is a sort of \"None\" in this context.\nWhen adding the widget to the sizer, use a proportion of 0, like this:\nself.sizer.Add(self.timeline,0,wx.EXPAND)","Q_Score":2,"Tags":"python,layout,wxpython,widget","A_Id":730452,"CreationDate":"2009-04-08T14:53:00.000","Title":"wxPython: Making a fixed-height panel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm kind of lost on how to approach this problem, I'd like to write a GUI ideally using Tkinter with python, but I initially started with Qt and found that the problem extends either with all GUI frameworks or my limited understanding.\nThe data in this case is coming from a named pipe, and I'd like to display whatever comes through the pipe into a textbox. I've tried having one thread listen on the pipe and another create the GUI, but in both cases one thread always seems to hang or the GUI never gets created. \nAny suggestions?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":641,"Q_Id":731759,"Users Score":0,"Answer":"When I did something like this I used a separate thread listening on the pipe. The thread had a pointer\/handle back to the GUI so it could send the data to be displayed.\nI suppose you could do it in the GUI's update\/event loop, but you'd have to make sure it's doing non-blocking reads on the pipe. I did it in a separate thread because I had to do lots of processing on the data that came through.\nOh and when you're doing the displaying, make sure you do it in non-trivial \"chunks\" at a time. It's very easy to max out the message queue (on Windows at least) that's sending the update commands to the textbox.","Q_Score":0,"Tags":"python,user-interface,named-pipes","A_Id":731919,"CreationDate":"2009-04-08T20:46:00.000","Title":"Showing data in a GUI where the data comes from an outside source","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm kind of lost on how to approach this problem, I'd like to write a GUI ideally using Tkinter with python, but I initially started with Qt and found that the problem extends either with all GUI frameworks or my limited understanding.\nThe data in this case is coming from a named pipe, and I'd like to display whatever comes through the pipe into a textbox. I've tried having one thread listen on the pipe and another create the GUI, but in both cases one thread always seems to hang or the GUI never gets created. \nAny suggestions?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":641,"Q_Id":731759,"Users Score":0,"Answer":"In the past when I've had GUI's reading data off of external things (eg: ethernet sockets), I've had a separate thread that handles servicing the external thing, and a timed callback (generally set to something like half a second) to update the GUI widget that displays the external data.","Q_Score":0,"Tags":"python,user-interface,named-pipes","A_Id":731927,"CreationDate":"2009-04-08T20:46:00.000","Title":"Showing data in a GUI where the data comes from an outside source","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just want the equivalent of closing and reopening my main program. I want to invoke it when a \"new\"-like option from a drop-down menu is clicked on. Something like calling root.destroy() and then re-initiating the mainloop.\nHow can I get this done?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":6011,"Q_Id":731887,"Users Score":1,"Answer":"You could take all your GUI building logic and initial state code out of the mainloop and put it into functions. Call these functions from the mainloop (something like: buildgui() & initstate()) and then, when the user clicks your menu icon, just call initstate() to set it back like it was when the application first started.","Q_Score":3,"Tags":"python,tkinter","A_Id":732131,"CreationDate":"2009-04-08T21:14:00.000","Title":"Resetting the main GUI window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just want the equivalent of closing and reopening my main program. I want to invoke it when a \"new\"-like option from a drop-down menu is clicked on. Something like calling root.destroy() and then re-initiating the mainloop.\nHow can I get this done?","AnswerCount":3,"Available Count":3,"Score":0.2605204458,"is_accepted":false,"ViewCount":6011,"Q_Id":731887,"Users Score":4,"Answer":"There are at least three ways you can solve this. \nMethod one: the head fake. When you create your app, don't put all the widgets in the root window. Instead, hide the root window and create a new toplevel that represents your application. When you restart it's just a matter of destroying that new toplevel and re-running all your start-up logic.\nMethod two: nuke and pave. Similar in concept but slightly different in execution. In this model, when you want to restart you simply delete all the widgets in the main window, reset the geometry to null (so the window will once again resize itself based on its contents) and then run the logic that draws all the other widgets.\nMethod three: if it worked the first time... As suggested by Martin v. L\u00f6wis, simply have your program exec a new instance of the program, then exit. \nThe first two methods are potentially faster and have the (dis?)advantage of preserving the current environment. For example you could save the copy of the clipboard, column widths, etc. The third method absolutely guarantees a blank slate.","Q_Score":3,"Tags":"python,tkinter","A_Id":732529,"CreationDate":"2009-04-08T21:14:00.000","Title":"Resetting the main GUI window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just want the equivalent of closing and reopening my main program. I want to invoke it when a \"new\"-like option from a drop-down menu is clicked on. Something like calling root.destroy() and then re-initiating the mainloop.\nHow can I get this done?","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":6011,"Q_Id":731887,"Users Score":2,"Answer":"If you are on Unix, restart the entire application with os.execv. Make sure you pass all command line arguments etc.","Q_Score":3,"Tags":"python,tkinter","A_Id":732085,"CreationDate":"2009-04-08T21:14:00.000","Title":"Resetting the main GUI window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know I can call Tkinter.Tk().winfo_rgb(color) to get a tuple of values that represent the named color.\nfor instance Tkinter.Tk().winfo_rgb(\"red\") returns (65535, 0, 0)\nThe problem is it also opens a window.  I was hoping to abstract some color calculations into a generic color class, and handle whether or not the class was instantiated with \"red\" or \"#ff0000\" or maybe even some other formats.\nWith the class abstracted, I don't have a tk parent to pull this info from without instantiating a new window, or passing in a parent.\nIs there any way to get this kind of color name \u2192 hex value conversion without having an instantiated Tk window?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1348,"Q_Id":732192,"Users Score":0,"Answer":"Instantiate Tk(), run the code once, and then stick the information into your source as a dict literal?","Q_Score":2,"Tags":"python,colors,tkinter","A_Id":732452,"CreationDate":"2009-04-08T22:47:00.000","Title":"Get Tk winfo_rgb() without having a window instantiated","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a web-app using Python and Pylons.  I need a textbox that is rich (ie, provides the ability to bold\/underline\/add bullets..etc...).  Does anyone know a library or widget I can use?\nIt doesn't have to be Python\/Pylons specific, as it can be a Javascript implementation as well.\nThanks!","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":8362,"Q_Id":732429,"Users Score":1,"Answer":"webkit-gtk is getting very stable, and i believe has python bindings now so technically you could use that (then your text editor merely needs to be <body contenteditable><\/body> and you'd be done.  Unfortunately i'm not sure how complete its bindings are at present","Q_Score":4,"Tags":"javascript,python,http,pylons,widget","A_Id":732453,"CreationDate":"2009-04-09T00:52:00.000","Title":"HTML Rich Textbox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I understood that in certain Windows XP programs, like Photoshop, there is something called \"scratch disks\". What I understood that this means, and please correct me if I'm wrong, is that Photoshop manages its own virtual memory on the hard-drive, instead of letting Windows manage it. I understood that the reason for this is some limitation by Windows XP on how much total memory a process can take, regardless of HD space. I think it's around 3 GB. Did I get it right so far?\nI am making an application in Python for running simulations. It will take a lot of memory, and will run on Windows XP. Is it possible for it to use scratch disks? How?","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":561,"Q_Id":737947,"Users Score":0,"Answer":"You are probably looking for something like ZODB.  However, though ZODB tries hard to be transparent, no solution is going to be 100% free of artifacts.  You have to write your code with an awareness that your objects primarily live in a database, but that there are multiple representations of your objects, there are caching\/syncing issues, etc.  Nothing is going to make this very difficult problem completely trivial for you.","Q_Score":2,"Tags":"python,windows,memory-management","A_Id":4207006,"CreationDate":"2009-04-10T15:11:00.000","Title":"Scratch disks in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I understood that in certain Windows XP programs, like Photoshop, there is something called \"scratch disks\". What I understood that this means, and please correct me if I'm wrong, is that Photoshop manages its own virtual memory on the hard-drive, instead of letting Windows manage it. I understood that the reason for this is some limitation by Windows XP on how much total memory a process can take, regardless of HD space. I think it's around 3 GB. Did I get it right so far?\nI am making an application in Python for running simulations. It will take a lot of memory, and will run on Windows XP. Is it possible for it to use scratch disks? How?","AnswerCount":7,"Available Count":2,"Score":0.0285636566,"is_accepted":false,"ViewCount":561,"Q_Id":737947,"Users Score":1,"Answer":"Scratch disks will benefit your application in the case that it works with very big files, \nIs that the case? \nIf not, then i don't think you may find something that will benefit your application in scratch disks.","Q_Score":2,"Tags":"python,windows,memory-management","A_Id":737963,"CreationDate":"2009-04-10T15:11:00.000","Title":"Scratch disks in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've written a python CGI script that converts files into .jpgs and displays them in a simple HTML page.  I don't want to clutter up the folders with these .jpg files, so I used tempfile.NamedTemporaryFile to create a file to store the converted .jpg output.  Everything works great, but i want to remove this file after the page is displayed.  Currently I have delete=False set, but i can't seem to remove the file without causing a broken img link.","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":510,"Q_Id":759271,"Users Score":3,"Answer":"You can't remove the file from your cgi script. Because the html page is send to the user only after your script finishes to run. And then the users browser parse the html and fetch the jpg file.\nThe simplest option is to write the temporary files to a sub directory and periodically clean that directory (living in it the last few minutes only). There are ways to improve this process but they are probably pointless.\nA more advanced option (which is also probably pointless, depending on your scenario) is to configure the web server to run a script on the \"get jpg\" request. And then you can stream the jpg through  your script. That way you will know when the jpg was fetched. And in this script you can call a subscript asynchronically to delete the jpg file.","Q_Score":2,"Tags":"python,image,cgi","A_Id":759547,"CreationDate":"2009-04-17T06:37:00.000","Title":"How can I remove a temporary file (image) that is being displayed by CGI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing an editor which has lot of parameters that could be easily interacted with through text. I find it inconvenient to implement a separate text-editor or lots of UI code for every little parameter. Usual buttons, boxes and gadgets would be burdensome and clumsy. I'd much rather let user interact with those parameters through vim.\nThe preferable way for me would be to get editor open vim with my text buffer. Then, when one would save the text buffer in vim, my editor would get notified from that and update it's view.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":300,"Q_Id":763372,"Users Score":6,"Answer":"Write your intermediate results (what you want the user to edit) to a temp file.  Then use the $EDITOR environment variable in a system call to make the user edit the temp file, and read the results when the process finishes.\nThis lets users configure which editor they want to use in a pseudo-standard fashion.","Q_Score":1,"Tags":"python,linux,vim","A_Id":763426,"CreationDate":"2009-04-18T12:34:00.000","Title":"How to interact through vim?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are various ways to take screenshots of a running application in Windows. However, I hear that an application can be tailored such that it can notice when a screenshot is being taken of it, through some windows event handlers perhaps? Is there any way of taking a screenshot such that it is impossible for the application to notice? (Maybe even running the application inside a VM, and taking a screenshot from the host?) I'd prefer solutions in Python, but anything will do.","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":3194,"Q_Id":767212,"Users Score":6,"Answer":"There will certainly be no protection against a screenshot taken with a digital camera.","Q_Score":0,"Tags":"python,windows,events,operating-system,screenshot","A_Id":767992,"CreationDate":"2009-04-20T07:11:00.000","Title":"Programmatically taking screenshots in windows without the application noticing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"There are various ways to take screenshots of a running application in Windows. However, I hear that an application can be tailored such that it can notice when a screenshot is being taken of it, through some windows event handlers perhaps? Is there any way of taking a screenshot such that it is impossible for the application to notice? (Maybe even running the application inside a VM, and taking a screenshot from the host?) I'd prefer solutions in Python, but anything will do.","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3194,"Q_Id":767212,"Users Score":3,"Answer":"> I hear that an application can be tailored such that it can notice when a screenshot is being taken of it\nComplete nonsense.\nDon't repeat what kids say...\nRead MSDN about screenshots.","Q_Score":0,"Tags":"python,windows,events,operating-system,screenshot","A_Id":767985,"CreationDate":"2009-04-20T07:11:00.000","Title":"Programmatically taking screenshots in windows without the application noticing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Is there a way to force a gtk.Window object to ignore the Window Manager's show\/hide commands, such as \"iconify\" and \"show desktop?\"\nI'm trying to create a persistent window, stuck to the desktop, that will not disappear with all other windows when the desktop is exposed.\nEDIT: I guess what I'm wondering specifically is whether or not it's possible to reproduce the behavior found in applications such as docks, desktop widgets, system trays, etc. using PyGTK?","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1034,"Q_Id":769175,"Users Score":0,"Answer":"Not having received a \"this is how to do this\" answer and having done a bit more research I can say that -- as far as I know -- there is no easy way to achieve this sort of functionality with PyGTK. The best options are to set window manager hints and leave it up to the WM to do what you want (hopefully).","Q_Score":1,"Tags":"python,gtk,pygtk,x11","A_Id":1030408,"CreationDate":"2009-04-20T16:57:00.000","Title":"Persistent Windows in PyGTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to force a gtk.Window object to ignore the Window Manager's show\/hide commands, such as \"iconify\" and \"show desktop?\"\nI'm trying to create a persistent window, stuck to the desktop, that will not disappear with all other windows when the desktop is exposed.\nEDIT: I guess what I'm wondering specifically is whether or not it's possible to reproduce the behavior found in applications such as docks, desktop widgets, system trays, etc. using PyGTK?","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1034,"Q_Id":769175,"Users Score":0,"Answer":"I think gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_SPLASHSCREEN) is what you want. It is also GDK_WINDOW_TYPE_HINT_DOCK, but then the window stay on top of all, and you can't send it back.","Q_Score":1,"Tags":"python,gtk,pygtk,x11","A_Id":5474070,"CreationDate":"2009-04-20T16:57:00.000","Title":"Persistent Windows in PyGTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to force a gtk.Window object to ignore the Window Manager's show\/hide commands, such as \"iconify\" and \"show desktop?\"\nI'm trying to create a persistent window, stuck to the desktop, that will not disappear with all other windows when the desktop is exposed.\nEDIT: I guess what I'm wondering specifically is whether or not it's possible to reproduce the behavior found in applications such as docks, desktop widgets, system trays, etc. using PyGTK?","AnswerCount":5,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1034,"Q_Id":769175,"Users Score":2,"Answer":"You've got it backwards; it's not the window manager telling the window to minimize, by sending it a command. The window manager owns the window, if it wants to stop mapping a window, it will just do it, without asking the window for permission.\nSo I would think that the answer is \"no\".","Q_Score":1,"Tags":"python,gtk,pygtk,x11","A_Id":771431,"CreationDate":"2009-04-20T16:57:00.000","Title":"Persistent Windows in PyGTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I defined an handler for EVT_IDLE that does a certain background task for me. (That task is to take completed work from a few processes and integrate it into some object, making a visible change in the GUI.)\nThe problem is that when the user is not moving the mouse or doing anything, EVT_IDLE doesn't get called more than once. I would like this handler to be working all the time. So I tried calling event.RequestMore() at the end of the handler. Works, but now it takes a whole lot of CPU. (I'm guessing it's just looping excessively on that task.)\nI'm willing to limit the number of times the task will be carried out per second; How do I do that?\nOr do you have another solution in mind?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1623,"Q_Id":783023,"Users Score":0,"Answer":"This sounds like a use case for wxTimerEvent instead of wxIdleEvent.  When there is processing to do call wxTimerEvent.Start().  When there isn't any to do, call wxTimerEvent.Stop() and call your methods to do processing from EVT_TIMER.\n(note: i use from wxWidghets for C++ and am not familiar with wxPython but I assume they have a similar API)","Q_Score":3,"Tags":"python,wxpython","A_Id":783439,"CreationDate":"2009-04-23T18:45:00.000","Title":"wxPython: Using EVT_IDLE","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Has anyone done this?  I've tried generating a c# proxy class and connecting through it, but I cannot figure out how to get IronPython to use the generated app.config file that defines the endpoint.  It tries to connect, but I just get an error about no default endpoint.  I would ideally like to make the connection using only IronPython code and not use the proxy class, if possible.  The binding for the service I am trying to connect to is a NetTcpBinding if that makes any difference.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2231,"Q_Id":783120,"Users Score":0,"Answer":"Is your WCF service interface available in a shared assembly?  If so, you could look at using the ChannelFactory to create your client proxy dynamically (instead of using the generated C# proxy).  With that method you can supply all the details of the endpoint when you create the ChannelFactory and you won't require any configuration in your .config file.","Q_Score":2,"Tags":"wcf,ironpython","A_Id":783626,"CreationDate":"2009-04-23T19:08:00.000","Title":"How to connect to a WCF Service with IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Python 3.0?\nAny suggestions are welcomed.\nThanks!","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":1811,"Q_Id":800769,"Users Score":0,"Answer":"Just use whichever editor you are most comfortable with.\nThe \"leading space as logic\" and duck typing mean that there is a limited amount of syntax checking and re-factoring an editor can reasonably do (or is required!) with python source.\nIf you dont have a favorite editor then just use the \"idle\" editor which comes with most python distributions.\nIf you were talking about a GUI design tool then you need to choose among the several supported GUIs (Tk, WxWindows etc. etc.) before you choose your design tool.","Q_Score":3,"Tags":"python,user-interface,python-3.x","A_Id":800794,"CreationDate":"2009-04-29T03:37:00.000","Title":"About GUI editor that would be compatible with Python 3.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Python 3.0?\nAny suggestions are welcomed.\nThanks!","AnswerCount":6,"Available Count":4,"Score":0.0333209931,"is_accepted":false,"ViewCount":1811,"Q_Id":800769,"Users Score":1,"Answer":"There are many useful libraries (not to mention educational material, cookbook snippets, etc.) that have yet to be ported to Python 3.0, so I recommend using Python 2.x for now (where, currently, 5 <= x <= 6). Doubly so if you're a beginner to Python. Triply so if you're actually planning on releasing some software--many systems do not ship with Python 3.0.\nPython 3.0 is not radically different from the Python 2.x series; what you learn in Python 2 will very much still apply to Python 3. Searching Python 3.0 here on SO reveals many threads in which the majority declare that they're not moving to Python 3.0 anytime soon.","Q_Score":3,"Tags":"python,user-interface,python-3.x","A_Id":800824,"CreationDate":"2009-04-29T03:37:00.000","Title":"About GUI editor that would be compatible with Python 3.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Python 3.0?\nAny suggestions are welcomed.\nThanks!","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":1811,"Q_Id":800769,"Users Score":0,"Answer":"WING 3.2 beta work in python 3.\nricnar","Q_Score":3,"Tags":"python,user-interface,python-3.x","A_Id":800941,"CreationDate":"2009-04-29T03:37:00.000","Title":"About GUI editor that would be compatible with Python 3.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Python 3.0?\nAny suggestions are welcomed.\nThanks!","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":1811,"Q_Id":800769,"Users Score":0,"Answer":"The only GUI toolkit currently available in Python3.0 is Tkinter, and I don't think there are any Python3.0 GUI-builders available yet.","Q_Score":3,"Tags":"python,user-interface,python-3.x","A_Id":800918,"CreationDate":"2009-04-29T03:37:00.000","Title":"About GUI editor that would be compatible with Python 3.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a little experience developing small command-line applications with Python. I want to move on to developing GUIs with Python. From the available GUI toolkits for Python, the ones I feel the most inclined to are wxPython and Tkinter; but I don't want to code all of the GUI by myself all of the time.\nAre there any good GUI IDEs for any of these toolkits? It doesn't need to be free or open source.","AnswerCount":8,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":70190,"Q_Id":800849,"Users Score":2,"Answer":"I use Eclipse with PyDev as my Python IDE (Which is probably not the best solution out there, but it is quite decent)\nFor GUI developement, I have used wxGlade for a mid-sized project and found it to be quite easy to use one you've grasped the concepts of WxPython. The XML generation is very useful for separating actual GUI design from program logic.\nAll of the these are free.","Q_Score":43,"Tags":"python,user-interface,ide,wxpython,tkinter","A_Id":17740395,"CreationDate":"2009-04-29T04:17:00.000","Title":"Nice IDE with GUI designer for wxPython or Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a little experience developing small command-line applications with Python. I want to move on to developing GUIs with Python. From the available GUI toolkits for Python, the ones I feel the most inclined to are wxPython and Tkinter; but I don't want to code all of the GUI by myself all of the time.\nAre there any good GUI IDEs for any of these toolkits? It doesn't need to be free or open source.","AnswerCount":8,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":70190,"Q_Id":800849,"Users Score":0,"Answer":"I've used wxGlade for a few mission-critical apps. If you're a little weak in wx, it can be rough, but once you get used to it, its a great tool.","Q_Score":43,"Tags":"python,user-interface,ide,wxpython,tkinter","A_Id":801176,"CreationDate":"2009-04-29T04:17:00.000","Title":"Nice IDE with GUI designer for wxPython or Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":1.2,"is_accepted":true,"ViewCount":3120,"Q_Id":816212,"Users Score":14,"Answer":"In general it's all of these things. Memory, speed, and probably most importantly programmer familiarity. Apple has a huge investment in Objective C, Java is known by basically everyone, and C# is very popular as well. If you're trying for mass programmer appeal it makes sense to start with something popular, even if it's sort of boring.\nThere aren't really any technical requirements stopping it. We could write a whole Ruby stack and let the programmer re-implement the slow bits in C and it wouldn't be that big of a deal. It would be an investment for whatever company is making the mobile OS, and at the end of the day I'm not sure they gain as much from this.\nFinally, it's the very beginning of mobile devices. In 5 years I wouldn't be at all surprised to see a much wider mobile stack.","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":816248,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":3120,"Q_Id":816212,"Users Score":0,"Answer":"webOS -- the new OS from Palm, which will debut on the Pre -- has you write apps against a webkit runtime in JavaScript. Time will tell how successful it is, but I suspect it will not be the first to go down this path. As mobile devices become more powerful, you'll see dynamic languages become more prevalent.","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":817560,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":3120,"Q_Id":816212,"Users Score":0,"Answer":"Memory is also a significant factor. It's easy to eat memory in Python, unfortunately.","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":816228,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":3120,"Q_Id":816212,"Users Score":0,"Answer":"There is a linux distribution for OpenMoko Freerunner called SHR. Most of its settings and framework code is written in python and... well, it isn't very fast. It is bearable, but it was planned from the beginning to rewrite it in Vala.\nOn the other side, my few smallish apps work fast enough (with the only drawback having big startup time) to consider python to develop user applications.\nFor the record: Freerunner has ARM-something 400MHz and 128MB of RAM. I guess that once mobile devices cross 1GHz, languages like Python will be fast enough for middle-level stuff too (the low-level being the kernel).","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":1077315,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":0.0153834017,"is_accepted":false,"ViewCount":3120,"Q_Id":816212,"Users Score":1,"Answer":"I think that performance concerns may be part of, but not all of, the reason. Mobile devices do not have very powerful hardware to work with.\nI am partly unsure about this, though.","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":816225,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":0.0153834017,"is_accepted":false,"ViewCount":3120,"Q_Id":816212,"Users Score":1,"Answer":"One of the most pressing matters is garbage collection. Garbage collection often times introduce unpredictable pauses in embedded machines which sometimes need real time performance.\nThis is why there is a Java Micro Edition which has a different garbage collector which reduces pauses in exchange for a slower program.\nRefcounting garbage collectors (like the one in CPython) are also less prone to pauses but can explode when data with many nested pointers (like a linked list) get deleted.","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":816233,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":3120,"Q_Id":816212,"Users Score":0,"Answer":"There are many reasons. Among them:\n\nbusiness reasons, such as software lock-in strategies,\nefficiency: dynamic languages are usually perceived to be slower (and in some cases really are slower, or at least provide a limit to the amount of optimsation you can do. On a mobile device, optimising code is necessary much more often than on a PC), and tend to use more memory, which is a significant issue on portable devices with limited memory and little cache,,\nkeeping development simple: a platform that supports say Python and Ruby and Java out of the box:\n\n\nmeans thrice the work to write documentation and provide support,\ndivides development effort into three; it takes longer for helpful material to appear on the web and there are less developers who use the same language as you on your platform,\nrequires more storage on the device to support all these languages,\n\nmanagement need to be convinced. I've always felt that the merits of Java are easily explained to a non-technical audience. .Net and Obj-C also seem a very natural choice for a Microsoft and Apple platform, respectively.","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":816266,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":0.0153834017,"is_accepted":false,"ViewCount":3120,"Q_Id":816212,"Users Score":1,"Answer":"Jailbroken iPhones can have python installed, and I actually use python very frequently on mine.","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":816219,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was wondering why smartphone\/mobile device OSs are not written to allow dynamic languages as the language of choice?  iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.\nWhat would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language?  I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it.  I mean, there is Jython or CPython.\nI was just wondering why we do not see more dynamic language support in today's mobile OS's.","AnswerCount":13,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":3120,"Q_Id":816212,"Users Score":0,"Answer":"I suspect the basic reason is a combination of security and reliability.  You don't want someone to be easily able to hack the phone, and you want to have some control over what's being installed.","Q_Score":10,"Tags":"python,ruby,mobile,operating-system,dynamic-languages","A_Id":816217,"CreationDate":"2009-05-03T03:09:00.000","Title":"Python\/Ruby as mobile OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm beginner for the GUI programing using Tkinter, so who can tell me some useful sample codes which contains some useful codes.","AnswerCount":10,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1839,"Q_Id":818458,"Users Score":0,"Answer":"You have the source for idle.  That shows useful tkinter code.","Q_Score":2,"Tags":"python,tkinter","A_Id":818490,"CreationDate":"2009-05-04T01:03:00.000","Title":"How can I begin with Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm beginner for the GUI programing using Tkinter, so who can tell me some useful sample codes which contains some useful codes.","AnswerCount":10,"Available Count":3,"Score":0.0599281035,"is_accepted":false,"ViewCount":1839,"Q_Id":818458,"Users Score":3,"Answer":"I used Manning's book on Tkinter, as someone else mentioned. The tutorials are very thorough, and you quickly get into the habit of thinking like a GUI coder. The New Mexico Tech worksheet is useful as a reference, but a bit too clumsy for a first resource.","Q_Score":2,"Tags":"python,tkinter","A_Id":7546018,"CreationDate":"2009-05-04T01:03:00.000","Title":"How can I begin with Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm beginner for the GUI programing using Tkinter, so who can tell me some useful sample codes which contains some useful codes.","AnswerCount":10,"Available Count":3,"Score":0.0399786803,"is_accepted":false,"ViewCount":1839,"Q_Id":818458,"Users Score":2,"Answer":"Mark Lutz's tome Programming Python deals at length with Tkinter. The Introduction to Tkinter ( effbot.org) and Tkinter reference: a GUI for Python (John Shipman, New Mexico Tech) are good summaries of the major features. I have read that the Tk\/Tcl manual is a good reference but that might be for later.","Q_Score":2,"Tags":"python,tkinter","A_Id":1035813,"CreationDate":"2009-05-04T01:03:00.000","Title":"How can I begin with Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm learning wxPython so most of the libraries and classes are new to me.\nI'm creating a Preferences dialog class but don't know the best way to make sure the OK\/Cancel (or Save\/Close) buttons are in the correct order for the platform. This program is intended to run both on GNOME and Windows, so I want to make sure that the buttons are in the correct order for each platform.\nDoes wxPython provide functionality that prevents me from doing a if platform.system() == 'Linux' kind of hack?","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1095,"Q_Id":818942,"Users Score":4,"Answer":"The appearance of a dialog can change only if you use stock dialogs (like wx.FileDialog), if you make your own the layout will stay the same on every platform.\nwx.Dialog has a CreateStdDialogButtonSizer method that creates a wx.StdDialogButtonSizer with standard buttons where you might see differences in layout on different platforms but you don't have to use that.","Q_Score":2,"Tags":"python,user-interface,cross-platform,wxpython","A_Id":819026,"CreationDate":"2009-05-04T06:04:00.000","Title":"WxPython: Cross-Platform Way to Conform Ok\/Cancel Button Order","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm learning wxPython so most of the libraries and classes are new to me.\nI'm creating a Preferences dialog class but don't know the best way to make sure the OK\/Cancel (or Save\/Close) buttons are in the correct order for the platform. This program is intended to run both on GNOME and Windows, so I want to make sure that the buttons are in the correct order for each platform.\nDoes wxPython provide functionality that prevents me from doing a if platform.system() == 'Linux' kind of hack?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1095,"Q_Id":818942,"Users Score":0,"Answer":"There's the GenericMessageDialog widget that should do the right thing depending on the platform (but I've never used it so I'm not sure it does). See the wxPython demo. \nYou can also use the SizedControls addon library (it's part of wxPython). The SizedDialog class helps to create dialogs that conform to the Human Interface Guidelines of each platform. See the wxPython demo.","Q_Score":2,"Tags":"python,user-interface,cross-platform,wxpython","A_Id":819330,"CreationDate":"2009-05-04T06:04:00.000","Title":"WxPython: Cross-Platform Way to Conform Ok\/Cancel Button Order","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm learning wxPython so most of the libraries and classes are new to me.\nI'm creating a Preferences dialog class but don't know the best way to make sure the OK\/Cancel (or Save\/Close) buttons are in the correct order for the platform. This program is intended to run both on GNOME and Windows, so I want to make sure that the buttons are in the correct order for each platform.\nDoes wxPython provide functionality that prevents me from doing a if platform.system() == 'Linux' kind of hack?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1095,"Q_Id":818942,"Users Score":0,"Answer":"If you're going to use wx (or any other x-platform toolkit) you'd better trust that it does the right thing, mon!-)","Q_Score":2,"Tags":"python,user-interface,cross-platform,wxpython","A_Id":819110,"CreationDate":"2009-05-04T06:04:00.000","Title":"WxPython: Cross-Platform Way to Conform Ok\/Cancel Button Order","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using wx.FileDialog in a wxPython 2.8.8.0 application, under Xubuntu 8.10.. My problem is that this dialog isn't network-aware, so I can't browse Samba shares.\nI see that this problem plagues other applications too (Firefox, Audacious...) so I'd like to ask where I could find informations on how to make it work.\nIs that dialog supposed to be already network-aware? Am I missing something? Some library maybe? Or should I write my own implementation?\nMany thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":276,"Q_Id":825724,"Users Score":0,"Answer":"Robin Dunn himself told me that\n\nIt's using the \"native\" GTK file\n  dialog, just like the other apps, so \n  there isn't anything that wx can do\n  about it.\n\nSo as a workaround I ended up installing gvfs-fuse and browsing\nthe network through $HOME\/.gvfs.. A bit klunky but it works.","Q_Score":1,"Tags":"linux,ubuntu,wxpython","A_Id":876524,"CreationDate":"2009-05-05T16:22:00.000","Title":"Network-aware wx.FileDialog","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I got the impression that Panel is better. Is that true?\nWhat advantage does one have over the other? What reason is there to use one over the other?","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":3627,"Q_Id":842208,"Users Score":20,"Answer":"wx.Window is the base class for all widgets (not necessarily all windows - the name is misleading).\nwx.Panel is a subclass of wx.Window, which is more tailored towards containing widgets inside it. For example, it by default allows moving between widgets using \"tab\", and handles a focus event in a way that is more useful with child widgets.","Q_Score":4,"Tags":"wxpython,wxwidgets","A_Id":843023,"CreationDate":"2009-05-08T23:10:00.000","Title":"wxPython: What is the difference between a wx.Panel and a wx.Window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a vb.net application that has got 2 textboxes, 7 radio buttons and 2 buttons(one named compile and the other 'run'). How can I load the content of a C\/C++(or any programming language) file into the 1st textbox and on clicking the compile button, i should be able to show the errors or the C\/C++ program in the 2nd textbox. On clicking Run, I should be able to show the output in the 2nd textbox. In short, I want to use the 2nd textbox as a terminal\/console. The radio buttons are 4 selecting the language C or C++ or python or C# or java or perl or vb.\nAre the compilers of all these languages present in .net? If so how can I call them?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1053,"Q_Id":847860,"Users Score":1,"Answer":"Compiling can be done by calling cl.exe which comes with Visual Studio. Of course you could also use GCC instead.","Q_Score":1,"Tags":"c#,c++,python,c,vb.net","A_Id":847883,"CreationDate":"2009-05-11T12:24:00.000","Title":"How to write a vb.net code to compile C\/C++ programs?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've wanted to get into Python development for awhile and most of my programming experience has been in .NET and no mobile development.  I recently thought of a useful app to make for my windows mobile phone and thought this could be a great first Python project.  \nI did a little research online and found PyCe which I think is what I would need to get started on the app?  Can anyone with some experience in this area point me in the right direction?  What to download to get started, what lightweight database I could use, etc?\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1216,"Q_Id":864887,"Users Score":1,"Answer":"Can't help you much with Python\\CE but if you want a great db for mobile devices SQLLite will do the job for you. If you do a quick google you'll find there are libraries for connecting to SQLLite with Python too.","Q_Score":0,"Tags":"python,windows-mobile,mobile-phones","A_Id":864988,"CreationDate":"2009-05-14T18:17:00.000","Title":"Beginning Windows Mobile 6.1 Development With Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"using Ruby or Python, does someone know how to draw on the screen, covering up any other window?  Kind of like, press a key, and the program will show current weather or stock quote on the screen (using the whole screen as the canvas), and then press the key again, and everything restores to the same as before?  (like Mac OS X's dash board).","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":179,"Q_Id":872737,"Users Score":1,"Answer":"I would recommend PyGame.","Q_Score":1,"Tags":"python,ruby,user-interface","A_Id":873925,"CreationDate":"2009-05-16T16:19:00.000","Title":"does someone know how to show content on screen (covering up any window) using Ruby or Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"using Ruby or Python, does someone know how to draw on the screen, covering up any other window?  Kind of like, press a key, and the program will show current weather or stock quote on the screen (using the whole screen as the canvas), and then press the key again, and everything restores to the same as before?  (like Mac OS X's dash board).","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":179,"Q_Id":872737,"Users Score":4,"Answer":"You could use the systems dashboard (desktop widgets, or whatever it's called) API. In order to do that you need bindings to it for Python or Ruby.\nAlternatively you could use some generic gui toolkit or application framework and just create a frameless window with transparent background. Then you need to be sure that the chosen toolkit supports 'always-on-top' options on your desired platform(s).","Q_Score":1,"Tags":"python,ruby,user-interface","A_Id":872757,"CreationDate":"2009-05-16T16:19:00.000","Title":"does someone know how to show content on screen (covering up any window) using Ruby or Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm sorry for the verbal description.\nI have a wxPython app in a file called applicationwindow.py that resides in a package called garlicsimwx. When I launch the app by launching the aforementioned file, it all works well. However, I have created a file rundemo.py in a folder which contains the garlicsimwx package, which runs the app as well. When I use rundemo.py, the app launches, however, when the main wx.Frame imports a sub-package of garlicsimwx, namely simulations.life, for some reason a new instance of my application is created (i.e., a new identical window pops out.)\nI have tried stepping through the commands one-by-one, and although the bug happens only after importing the sub-package, the import statement doesn't directly cause it. Only when control returns to PyApp.MainLoop the second window opens.\nHow do I stop this?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":223,"Q_Id":874856,"Users Score":0,"Answer":"You could create a global boolean variable like g_window_was_drawn and check it in the function that does the work of creating a window. The value would be false at the start of the program and would change to True when first creating a window. The function that creates the window would check if the g_window_was_drawn is already true, and if it is, it would throw an exception. Then You will have a nice stacktrace telling You who is responsible of executing this function.\nI hope that helps You find it. I'm sorry for the verbal solution ;)","Q_Score":0,"Tags":"python,import,wxpython","A_Id":875039,"CreationDate":"2009-05-17T15:45:00.000","Title":"wxPython launches my app twice when importing a sub-package","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My PyQt application that uses matplotlib takes several seconds to load for the first time, even on a fast machine (the second load time is much shorter as the DLLs are kept in memory by Windows).\nI'm wondering whether it's feasible to show a splash screen while the matplotlib library is being loaded. Where does the actual loading take place - is it when the from line is executed? If so, how can I make this line execute during the splash screen and still be able to use the module throughout the code?\nA related dilemma is how to test this - can I ask Windows to load the DLLs for every execution and not cache them?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3080,"Q_Id":876107,"Users Score":3,"Answer":"Yes, loading the module takes place at the line where the import statement is. If you create your QApplication and show your splash screen before that, you should be able to do what you want -- also you need  to call QApplication.processEvents() whenever you need the splash screen to update with a new message.","Q_Score":4,"Tags":"python,performance,matplotlib,pyqt","A_Id":876151,"CreationDate":"2009-05-18T03:15:00.000","Title":"PyQt: splash screen while loading \"heavy\" libraries","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPython program with two processes: A primary and a secondary one (I'm using the multiprocessing module.) The primary one runs the wxPython GUI, the secondary one does not. However, there is something I would like to do from the secondary process: Given a string that describes a color, to check whether this would be legitimate color for wxPython. That means, whether I can create a wx.Pen(color_string) or not.\nHow do I do this?\n(I tried making a wx.Pen and comparing its color to the null color, but that required to create a wx.App in the second process, and when I did create one the program raised an error in some special wxPython window.)","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":670,"Q_Id":883348,"Users Score":1,"Answer":"You could make two Queues between the two processes and have the second one delegate wx-related functionality to the first one (by pushing on the first queue the parameters of the task to perform, and waiting for the result on the second one).","Q_Score":0,"Tags":"python,wxpython,multiprocessing","A_Id":883451,"CreationDate":"2009-05-19T15:09:00.000","Title":"wxPython + multiprocessing: Checking if a color string is legitimate","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a custom wxPython dialog by subclassing wx.Dialog. When I press Enter while using it, (and while being focused on one of the form elements,) it just takes the focus to the next form element, while I want it to press the ok button.\nHow do I solve this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1846,"Q_Id":885294,"Users Score":5,"Answer":"That should happen automatically if the button has the wx.ID_OK id. If that's impossible then the wx.StdDialogButtonSizer.SetAffirmativeButton() method could be a solution (using the StdDialogButtonSizer class will help with correct button placement and positioning on the different platforms), and there is also wx.Button.SetDefault().","Q_Score":3,"Tags":"python,keyboard,wxpython","A_Id":885307,"CreationDate":"2009-05-19T22:13:00.000","Title":"wxPython dialogs: \"Enter\" keyboard button would not \"ok\" the dialog","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I posted this in the mailing list, but the reply I got wasn't too clear, so maybe I'll have better luck here.\nI currently have a grid with data in it.\nI would like to know if there is a way to give each generated row an\nID, or at least, associate each row with an object.\nIt may make it more clear if I clarify what i'm doing. It is described\nbelow.\nI pull data from an SQL table and display them in the grid.\nI am allowing for the user to add\/delete rows and edit cells.\nSay the user is viewing a grid that has 3 rows(which is, in turn, a\nmysql table with 3 rows).\nIf he is on the last row and presses the down arrow key, a new row is\ncreated and he can enter data into it and it will be inserted in the\ndatabase when he presses enter.\nHowever, I need a way to find out which rows will use \"insert\" query\nand which will use \"update\" query.\nSo ideally, when the user creates a new row by pressing the down\narrow, I would give that row an ID and store it in a list(or, if rows\nalready have IDs, just store it in a list) and when the user finishes\nentering data in the cells and presses enter, I would check if that\nrow's ID is in the in the list. If it is, i would insert all of that\nrow's cells values into the table, if not, i would update mysql with\nthe values.\nHope I made this clear.","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":1026,"Q_Id":901704,"Users Score":3,"Answer":"What I did when I encountered such a case was to create a column for IDs and set its width to 0.","Q_Score":2,"Tags":"python,wxpython,wxwidgets","A_Id":901806,"CreationDate":"2009-05-23T15:13:00.000","Title":"Give Wxwidget Grid rows an ID","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.\nEDIT:: im on a windows vista 64-bit","AnswerCount":7,"Available Count":6,"Score":0.0285636566,"is_accepted":false,"ViewCount":1819,"Q_Id":913204,"Users Score":1,"Answer":"I would assume it'd be the same as running two versions of 2.x; as long as they're each in their own directory you should be OK.","Q_Score":3,"Tags":"python,python-3.x","A_Id":913212,"CreationDate":"2009-05-26T23:02:00.000","Title":"Is it possible to install python 3 and 2.6 on same PC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.\nEDIT:: im on a windows vista 64-bit","AnswerCount":7,"Available Count":6,"Score":0.0285636566,"is_accepted":false,"ViewCount":1819,"Q_Id":913204,"Users Score":1,"Answer":"You certainly can.  On Mac Ports, there's a tool called python_select that lets you switch among python versions; if nothing like it exists on Windows (momentary googling didn't reveal one), it could certainly be written.","Q_Score":3,"Tags":"python,python-3.x","A_Id":913222,"CreationDate":"2009-05-26T23:02:00.000","Title":"Is it possible to install python 3 and 2.6 on same PC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.\nEDIT:: im on a windows vista 64-bit","AnswerCount":7,"Available Count":6,"Score":0.0855049882,"is_accepted":false,"ViewCount":1819,"Q_Id":913204,"Users Score":3,"Answer":"Typically python is installed with a name like python2.6, so you can have more than one. There may be a symlink from python to one of the numbered files. Quite workable.","Q_Score":3,"Tags":"python,python-3.x","A_Id":913225,"CreationDate":"2009-05-26T23:02:00.000","Title":"Is it possible to install python 3 and 2.6 on same PC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.\nEDIT:: im on a windows vista 64-bit","AnswerCount":7,"Available Count":6,"Score":0.057080742,"is_accepted":false,"ViewCount":1819,"Q_Id":913204,"Users Score":2,"Answer":"Yes, it is possible. \nI maintain 3 python installations (2.5, 2.6, 3.0). The only issue that could be confusing is figuring out which Python version takes precedence in PATH variable (if any) . To execute a script for a specific version, you would go into the python directory for that version\nC:\\Python25\\ , C:\\Python26\\, C:\\Python30\\, etc. \nDrop the file in there, and run \"python.exe file.py\" from command-line.\nYou could even rename each python.exe to python25.exe python26.exe python30.exe and have each directory in PATH so it would be easy to execute any script on any version.","Q_Score":3,"Tags":"python,python-3.x","A_Id":913269,"CreationDate":"2009-05-26T23:02:00.000","Title":"Is it possible to install python 3 and 2.6 on same PC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.\nEDIT:: im on a windows vista 64-bit","AnswerCount":7,"Available Count":6,"Score":0.0855049882,"is_accepted":false,"ViewCount":1819,"Q_Id":913204,"Users Score":3,"Answer":"Erm... yes. I just installed Python 3.0 on this computer to test it. You haven't specified your operating system, but I'm running Ubuntu 9.04 and I can explicitly specify the version of Python I want to run by typing python2.5 myscript.py or python3.0 myscript.py, depending on my needs.","Q_Score":3,"Tags":"python,python-3.x","A_Id":913223,"CreationDate":"2009-05-26T23:02:00.000","Title":"Is it possible to install python 3 and 2.6 on same PC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.\nEDIT:: im on a windows vista 64-bit","AnswerCount":7,"Available Count":6,"Score":1.2,"is_accepted":true,"ViewCount":1819,"Q_Id":913204,"Users Score":9,"Answer":"If you are on Windows, then just install another version of Python using the installer. It would be installed into another directory.\nThen if you install other packages using the installer, it would ask you for which python installation to apply. If you use installation from source or easy_install, then just make sure that when you install, you are using the one of the proper version.\nIf you have many packages installed in your current python-3, then just make a zip backup of your current installation just in case.","Q_Score":3,"Tags":"python,python-3.x","A_Id":913216,"CreationDate":"2009-05-26T23:02:00.000","Title":"Is it possible to install python 3 and 2.6 on same PC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":0.0767717131,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":5,"Answer":"The answer to what I think your specific question is, \"... in pure Python ...\" the answer is NO.\nPython is not fast enough to call OpenGL or DirectX efficently enough to re-create World Of Warcraft at an exceptable frame rate.\nLike many others have answered, given some high level frame work, it would be possible to use Python has the scripting language but at a minimum you'd need some kind of graphics system written in another language like C++ to handle the graphics.  For networking, given that WoW is not an action game, you might be able to get away with pure python but most likely that part as well would need to be some non-python library.","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":1360670,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":0.0307595242,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":2,"Answer":"As a technologist I know:\nIf it can be written in C\\C++ it can be written in assembly (though it will take longer).\nIf it can be written in C\\C++ and is not a low-level code - it can be written in any managed environment.\nWoW is a high-level program that is written in C\\C++\npython is a managed environment\nThere for:\nWoW can be written in python and so any other MMORPG in 3D...\n\nThe hardest part will be the 3d engine for it is the \"heaviest\" part of code - you will need to use an outside engine (written in C\\C++\\Assebly) or to write one and optimize it (not recommended)","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":1656715,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":0.0614608973,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":4,"Answer":"I have been trying my hand at writing 3D games in Python, and given a good rendering framework (my favourite is OGRE) and decent bindings, it is amazing what you can get away with. However, especially with games, you are always trying to squeeze as much as you can out of the hardware. The performance disadvantage of python eventually will make itself felt.\nThe main problem I ran into using python is its massive call overhead. Calling python functions, even from other python functions is very expensive. In a way, it's the price you pay for the dynamic nature of python. When you use the function call operator \"()\" on a symbol, it has to work out whether it's a function or a class, look over the method resolution order, handle the keyword arguments, etc etc. All these things are done ahead of time in less dynamic (compiled) languages.\nI have seen people trying to overcome this problem by manually inlining function calls. I do not have to tell you that this medicine is worse than the ailment.","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":1656654,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":0.0307595242,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":2,"Answer":"Just because it might give an interesting read, Civilization is partly written using Python.\nA google on it returns interesting reading material.","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":930968,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":0,"Answer":"Because Python is interpreted there would be a performance hit, as opposed to C\/C++, but, you would want to use something like PyOpenGL instead of DirectX though, to run on more operating systems.\nBut, I don't see why you couldn't write such a game in Python.","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":916693,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":1.0,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":6,"Answer":"Yes, you could write it in assembly, or Java, or Python, or brainfuck. It's just how much time you are willing to put into it. Language performance's aren't a major issue anymore, it's more about which algorithms you use, not what language you use.","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":916704,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":1.0,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":9,"Answer":"Technically, anything is possible in any Turing Complete programming language.\nPractically though, you will run into trouble making the networking stack out of a high level language, because the server will have to be VERY fast to handle so many players.  \nThe gaming side of things on the client, there should be no problem, because there is nothing too complicated about GUIs or quests or keyboard input and what have you.  \nThe problems will be in whatever is computationally intensive up on the server.  Anything that happens in human-time like logging on will probably be just fine, but if somemthing needs to be instantaneous over ten thousand users, you might want to go for an external library done up in C. \nNow some Python guru is going to come out of the woodwork and rip my head off because, as I said at the top, technically, anything can be done with enough effort.","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":916701,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":1.0,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":17,"Answer":"Yes. How it will perform is another question.\nA good development pattern would be to develop it in pure python, and then profile it, and rewrite performance-critical bottlenecks, either in C\/C++\/Cython or even python itself but with more efficient code.","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":916686,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?\nAssuming the use of DirectX \/ D3D bindings or OpenGL bindings.\nIf not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of habit!\nAny information would help satisfy my curiosity.\nEdit:\nWould the GIL post a major issue on 3d client performance? And what is the general performance penalty for using say, OpenGL or DirectX bindings vs natively using the libraries?","AnswerCount":13,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":10718,"Q_Id":916663,"Users Score":0,"Answer":"Python is not interpreted - it is tokenized\/'just in time' bytecode 'interpreted' and it doesn't have a VM like Java does.  This means, in english, it can be daaaaaamnfast.  Not all the time though, it depends on the problem and the libraries, but python is not slow, this is a common misconception even among knowledgable people (and that includes deep java engine folks who have just not gone and tried python).","Q_Score":12,"Tags":"python,3d,direct3d","A_Id":1316198,"CreationDate":"2009-05-27T16:16:00.000","Title":"Would it be possible to write a 3D game as large as World of Warcraft in pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The tutorials I've found on WxPython all use examples from Linux, but there seem to be differences in some details.\nFor example, in Windows a Panel behind the widgets is mandatory to show the background properly. Additionally, some examples that look fine in the tutorials don't work in my computer.\nSo, do you know what important differences are there, or maybe a good tutorial that is focused on Windows?\nEDIT:  I just remembered this: Does anybody know why when subclassing wx.App an OnInit() method is required, rather than the more logical __init__()?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2618,"Q_Id":916987,"Users Score":0,"Answer":"EDIT:  I just remembered this: Does anybody know why when subclassing wx.App an OnInit() method is required, rather than the more logical __init__()?\n\nI use OnInit() for symmetry: there's also an OnExit() method.\nEdit: I may be wrong, but I don't think using OnInit() is required.","Q_Score":1,"Tags":"python,windows,linux,user-interface,wxpython","A_Id":917040,"CreationDate":"2009-05-27T17:16:00.000","Title":"WxPython differences between Windows and Linux","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The tutorials I've found on WxPython all use examples from Linux, but there seem to be differences in some details.\nFor example, in Windows a Panel behind the widgets is mandatory to show the background properly. Additionally, some examples that look fine in the tutorials don't work in my computer.\nSo, do you know what important differences are there, or maybe a good tutorial that is focused on Windows?\nEDIT:  I just remembered this: Does anybody know why when subclassing wx.App an OnInit() method is required, rather than the more logical __init__()?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2618,"Q_Id":916987,"Users Score":0,"Answer":"I find a number of small differences, but don't remember all of them.  Here are two:\n1) The layout can be slightly different, for example, causing things to not completely fit in the window in one OS when the do in the other.  I haven't investigated the reasons for this, but it happens most often when I use positions rather than sizers to arrange things.\n2) I have to explicitly call Refresh more in Windows.  For example, if you place one panel over another, you won't see it the top panel in Windows until you call Refresh.\nI general, I write apps in Linux and run them in Windows, and things work similarly enough so this is a reasonable approach, but it's rare for me when something runs perfectly straight out of the gate after an OS switch.","Q_Score":1,"Tags":"python,windows,linux,user-interface,wxpython","A_Id":935519,"CreationDate":"2009-05-27T17:16:00.000","Title":"WxPython differences between Windows and Linux","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm am trying to roll out a test application to test the feasibility of righting a Click Once Smart Client app that also uses a rules engine customizable by embedding IronPython.\nSo far all users but me get this error (below) when invoking the script engine.\nDo I need to do something special to force deployment of the IronPython and Scripting assemblies? I thought that would be automatic because they were referenced in my project.\nIs this just not feasible in .NET 2.0? \nThoughts?\n\n************** Exception Text **************\nSystem.MissingMethodException: Method not found: 'Void System.Reflection.Emit.DynamicMethod..ctor(System.String, System.Type, System.Type[], Boolean)'.\n   at Microsoft.Scripting.Utils.Helpers.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes)\n   at Microsoft.Linq.Expressions.Compiler.Snippets.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes)\n   at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CreateDynamicLambdaCompiler(CompilerScope scope, String methodName, Type returnType, IList`1 paramTypes, IList`1 paramNames, Boolean closure, Boolean emitDebugSymbols, Boolean forceDynamic)\n   at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CompileLambda(LambdaExpression lambda, Type delegateType, Boolean emitDebugSymbols, Boolean forceDynamic, MethodInfo& method)\n   at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CompileLambda[T](LambdaExpression lambda, Boolean emitDebugSymbols)\n   at Microsoft.Linq.Expressions.LambdaExpression.Compile[T](Boolean emitDebugSymbols)\n   at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope)\n   at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)\n   at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)\n   at UAP.UI.Form1.button1_Click(Object sender, EventArgs e)\n   at System.Windows.Forms.Control.OnClick(EventArgs e)\n   at System.Windows.Forms.Button.OnClick(EventArgs e)\n   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\n   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\n   at System.Windows.Forms.Control.WndProc(Message& m)\n   at System.Windows.Forms.ButtonBase.WndProc(Message& m)\n   at System.Windows.Forms.Button.WndProc(Message& m)\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\n   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1241,"Q_Id":922681,"Users Score":0,"Answer":"If you right click your project and go to Properties theres a Publish tab, that allows you to specify prerequisite installs for your application.\nPresumably you can supply a path to the IronPython install executable here.","Q_Score":2,"Tags":"c#,.net,scripting,ironpython","A_Id":922701,"CreationDate":"2009-05-28T19:14:00.000","Title":"IronPython, Click Once, .NET 2.0 Error - thoughts?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm am trying to roll out a test application to test the feasibility of righting a Click Once Smart Client app that also uses a rules engine customizable by embedding IronPython.\nSo far all users but me get this error (below) when invoking the script engine.\nDo I need to do something special to force deployment of the IronPython and Scripting assemblies? I thought that would be automatic because they were referenced in my project.\nIs this just not feasible in .NET 2.0? \nThoughts?\n\n************** Exception Text **************\nSystem.MissingMethodException: Method not found: 'Void System.Reflection.Emit.DynamicMethod..ctor(System.String, System.Type, System.Type[], Boolean)'.\n   at Microsoft.Scripting.Utils.Helpers.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes)\n   at Microsoft.Linq.Expressions.Compiler.Snippets.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes)\n   at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CreateDynamicLambdaCompiler(CompilerScope scope, String methodName, Type returnType, IList`1 paramTypes, IList`1 paramNames, Boolean closure, Boolean emitDebugSymbols, Boolean forceDynamic)\n   at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CompileLambda(LambdaExpression lambda, Type delegateType, Boolean emitDebugSymbols, Boolean forceDynamic, MethodInfo& method)\n   at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CompileLambda[T](LambdaExpression lambda, Boolean emitDebugSymbols)\n   at Microsoft.Linq.Expressions.LambdaExpression.Compile[T](Boolean emitDebugSymbols)\n   at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope)\n   at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)\n   at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)\n   at UAP.UI.Form1.button1_Click(Object sender, EventArgs e)\n   at System.Windows.Forms.Control.OnClick(EventArgs e)\n   at System.Windows.Forms.Button.OnClick(EventArgs e)\n   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\n   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\n   at System.Windows.Forms.Control.WndProc(Message& m)\n   at System.Windows.Forms.ButtonBase.WndProc(Message& m)\n   at System.Windows.Forms.Button.WndProc(Message& m)\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\n   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)","AnswerCount":2,"Available Count":2,"Score":0.3799489623,"is_accepted":false,"ViewCount":1241,"Q_Id":922681,"Users Score":4,"Answer":"IronPython requiers .NET 2.0SP1 or later to run.  This exception is happening due to an overload that was added in SP1.","Q_Score":2,"Tags":"c#,.net,scripting,ironpython","A_Id":923395,"CreationDate":"2009-05-28T19:14:00.000","Title":"IronPython, Click Once, .NET 2.0 Error - thoughts?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to code up a panel that will be used both in Linux and Windows. Ideally it will be written in Python using PyQT.\nWhat I've found so far is the QSystemTrayIcon widget, and while that is quite useful, that's not quite what I'm looking for. That widget lets you attach a menu to the left and right clicks of an icon on the system tray and then you can have a dialog open in certain situations.\nI'm looking for something that will let me write up something like the tools that Gnome lets you add to the taskbar (they call them panels). Such as a weather feed, or processor usage, right on the taskbar. And also not in the system tray area.\nI'm writing more of a tool than something reflects a status.\nI know that I could write this natively in both OSes using GTK and its ilk, but anyway to write in PyQT or WxWidget so I don't have to deal with dependancy issues?","AnswerCount":2,"Available Count":1,"Score":0.4621171573,"is_accepted":false,"ViewCount":1572,"Q_Id":923701,"Users Score":5,"Answer":"Widgets inside the GNOME panel are called applets, and to my knowledge it's not possible to write them with anything but Gtk, since you have to use the respective GNOME library libpanel-applet (in either C, C++ or Python). \nSystem tray icons are different, because they only allow icons to be displayed inside the notification area, since Windows only supports icons there. \nThe panel mechanism on Windows (Vista, XP does only have the notification area) is quite different, I would assume. Unless somebody already wrote a library that abstracts the differences of the GNOME panel and the Vista side bar, you would have to do that yourself.","Q_Score":4,"Tags":"python,qt4,pyqt","A_Id":923757,"CreationDate":"2009-05-28T23:28:00.000","Title":"Python taskbar applet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to change the look of my Ironpython windows forms, Is it possible to change the style of the form and for example make it more like a Mac?\nthank you","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":706,"Q_Id":931580,"Users Score":0,"Answer":"As an interface designer, it's important to use an many standard windows controls as possible. The more your app looks like the microsoft ones users are used to, they will become more comfortable with it quicker. \nA good example is how out of place iTunes and Safari look in windows. My tip is to just keep it with the windows look.","Q_Score":0,"Tags":"winforms,ironpython","A_Id":931629,"CreationDate":"2009-05-31T07:44:00.000","Title":"Different styles for Windows forms in Ironpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Is there any way besides Shoes to develop and distribute cross-platform GUI desktop applications written in Ruby?\nI come to believe that general bugginess of _why's applications is exceptionally crippling in case of Shoes, and anything more complex than a two-button form is a pain to maintain.\nRubyGTK, wxRuby, etc seem to be promising, but they do not solve the issue of distributing an app in a way that doesn't require Ruby pre-installed on users' computers \u2014 and libraries like ruby2exe seem to be horribly out-of-date and incomplete.\nGenerally \u2014 what is the current fad?\nBTW: if there is a really easy solution to this in Python, I may consider redoing the stuff I'm up to in Python.","AnswerCount":7,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3071,"Q_Id":940149,"Users Score":0,"Answer":"I don't think anyone really answered his question.\nAs for me, I use VB to do Shell() calls to Ocra compiled Ruby scripts.\nIt works pretty well and allows me to create apps that run in all modern OS.\nLinux testing is done by using Wine to run and ensuring that I use a pre .NET version of VB for the .exe compilation.","Q_Score":10,"Tags":"python,ruby,user-interface,desktop,software-distribution","A_Id":976069,"CreationDate":"2009-06-02T15:15:00.000","Title":"Distributing Ruby\/Python desktop apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way besides Shoes to develop and distribute cross-platform GUI desktop applications written in Ruby?\nI come to believe that general bugginess of _why's applications is exceptionally crippling in case of Shoes, and anything more complex than a two-button form is a pain to maintain.\nRubyGTK, wxRuby, etc seem to be promising, but they do not solve the issue of distributing an app in a way that doesn't require Ruby pre-installed on users' computers \u2014 and libraries like ruby2exe seem to be horribly out-of-date and incomplete.\nGenerally \u2014 what is the current fad?\nBTW: if there is a really easy solution to this in Python, I may consider redoing the stuff I'm up to in Python.","AnswerCount":7,"Available Count":3,"Score":0.057080742,"is_accepted":false,"ViewCount":3071,"Q_Id":940149,"Users Score":2,"Answer":"The state of affairs is pretty bad.  The most reliable method at present is probably to use JRuby.  I know that's probably not the answer you want to hear, but, as you say, ruby2exe is unreliable, and Shoes is a long way off (and isn't even intended to be a full-scale application).  Personally, I dislike forcing users to install GTK or Qt or wxWidgets, but the JVM is fairly ubiquitous.","Q_Score":10,"Tags":"python,ruby,user-interface,desktop,software-distribution","A_Id":940214,"CreationDate":"2009-06-02T15:15:00.000","Title":"Distributing Ruby\/Python desktop apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way besides Shoes to develop and distribute cross-platform GUI desktop applications written in Ruby?\nI come to believe that general bugginess of _why's applications is exceptionally crippling in case of Shoes, and anything more complex than a two-button form is a pain to maintain.\nRubyGTK, wxRuby, etc seem to be promising, but they do not solve the issue of distributing an app in a way that doesn't require Ruby pre-installed on users' computers \u2014 and libraries like ruby2exe seem to be horribly out-of-date and incomplete.\nGenerally \u2014 what is the current fad?\nBTW: if there is a really easy solution to this in Python, I may consider redoing the stuff I'm up to in Python.","AnswerCount":7,"Available Count":3,"Score":-0.057080742,"is_accepted":false,"ViewCount":3071,"Q_Id":940149,"Users Score":-2,"Answer":"I've read about (but not used) Seattlerb's Wilson, which describes itself as a pure x86 assembler, but it doesn't sound like it'd be cross-platform or GUI.","Q_Score":10,"Tags":"python,ruby,user-interface,desktop,software-distribution","A_Id":942712,"CreationDate":"2009-06-02T15:15:00.000","Title":"Distributing Ruby\/Python desktop apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to embed a 3-D editor inside my wxPython application? (I'm thinking Blender, but other suggestions are welcome.)\nMy application opens a wxPython window, and I want to have a 3-D editor inside of it. Of course, I want my program and the 3-D editor to interact with each other.\nPossible? How?","AnswerCount":5,"Available Count":1,"Score":0.0798297691,"is_accepted":false,"ViewCount":1823,"Q_Id":950145,"Users Score":2,"Answer":"Blender has python plugins, you can write a plugin to interract with your program.","Q_Score":1,"Tags":"python,3d,wxpython,embedding,blender","A_Id":950196,"CreationDate":"2009-06-04T12:13:00.000","Title":"Embedding a 3-D editor (such as Blender) in a wxPython application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Continuing on with my Python learning, I just installed Komodo edit, are there any recommended add ins\/extensions that I should include?  Any recommendations on using it or another GUI designer (TkInter base)?","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1483,"Q_Id":951974,"Users Score":0,"Answer":"try using eclipse instead with PyDev.","Q_Score":3,"Tags":"python,ide,komodo","A_Id":952842,"CreationDate":"2009-06-04T17:29:00.000","Title":"Komodo Extension","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Continuing on with my Python learning, I just installed Komodo edit, are there any recommended add ins\/extensions that I should include?  Any recommendations on using it or another GUI designer (TkInter base)?","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1483,"Q_Id":951974,"Users Score":0,"Answer":"I use to install MoreKomodo and TweakUI after putting Komodo on some machine for me.","Q_Score":3,"Tags":"python,ide,komodo","A_Id":7241975,"CreationDate":"2009-06-04T17:29:00.000","Title":"Komodo Extension","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a macro generator\/ keyboard remapper in python, for xubuntu.\nI've figured out how to intercept and record keystrokes, and send keystrokes I want to record, but I haven't figured out how to block keystrokes. I need to disable keyboard input to remap a key. For example, if I wanted to send 'a' when I press the 's' key, I can currently record the 'a' keystroke, and set it to playback when I press the 's' key. I cannot, however keep the 's' keystroke from being sent alongside it.\nI used the pyxhook module from an open source keyboard-logger for the hooks, and a again, the xtest fake input method from the python x library.\nI remember reading somewhere about somebody blocking all keyboard input by redirecting all keystrokes to an invisible window by using tkinter. If somebody could post that method that'd be great. \nI need something that will block all keystrokes, but not turn off my keyboard hooks.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":5147,"Q_Id":958491,"Users Score":1,"Answer":"I think it's going to depend heavily on the environment: curses & the activestate recipe are good for command line, but if you want it to run in a DE, you'll need some hooks to that DE. You might look at Qt or GTK bindings for python, or there's a python-xlib library that might let you tie right into the X system.\nSo I guess the answer is \"it depends.\" Are you looking for console noecho functionality, or a text replacement program for a DE, or an xmodmap-style layout changer?","Q_Score":5,"Tags":"python,keyboard","A_Id":981709,"CreationDate":"2009-06-05T22:51:00.000","Title":"Python disable\/redirect keyboard input","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a macro generator\/ keyboard remapper in python, for xubuntu.\nI've figured out how to intercept and record keystrokes, and send keystrokes I want to record, but I haven't figured out how to block keystrokes. I need to disable keyboard input to remap a key. For example, if I wanted to send 'a' when I press the 's' key, I can currently record the 'a' keystroke, and set it to playback when I press the 's' key. I cannot, however keep the 's' keystroke from being sent alongside it.\nI used the pyxhook module from an open source keyboard-logger for the hooks, and a again, the xtest fake input method from the python x library.\nI remember reading somewhere about somebody blocking all keyboard input by redirecting all keystrokes to an invisible window by using tkinter. If somebody could post that method that'd be great. \nI need something that will block all keystrokes, but not turn off my keyboard hooks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":5147,"Q_Id":958491,"Users Score":0,"Answer":"I've got a keyboard hook that detects X events. I'm looking for a way to globally prevent a single keyboard event from being sent to a window. Something that works by accessing the event queue and removing the keyboard event from it would be ideal. It looks like it should be possible using Python Xlib, but I can't figure it out.","Q_Score":5,"Tags":"python,keyboard","A_Id":993251,"CreationDate":"2009-06-05T22:51:00.000","Title":"Python disable\/redirect keyboard input","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this.","AnswerCount":3,"Available Count":3,"Score":0.1973753202,"is_accepted":false,"ViewCount":3989,"Q_Id":960467,"Users Score":3,"Answer":"I have a single main window with a QGraphicsView and lots of QGraphicsItem objects.  Each type of the Items have a different context menu.\nI find that not being able to create the contextMenu's, or at least the actions that are in them a serious limitation of QtDesigner.  It means that I can create about 10% or so of the actions using the designer, and I have to create 90% programaticaly.  Compare that with the Microsoft resource editor which allows all of these things to be created, and maintained effortlessly.  \nI hope this will be addressed at some point.","Q_Score":1,"Tags":"python,qt,widget,designer","A_Id":1235766,"CreationDate":"2009-06-06T20:33:00.000","Title":"how can I add a QMenu and QMenuItems to a window from Qt Designer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this.","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":3989,"Q_Id":960467,"Users Score":3,"Answer":"When you edit a QMainWindow you can right click the window and then choose \"create menu bar\".\nOr are you talking about a \"context menu\" aka \"right click menu\"?","Q_Score":1,"Tags":"python,qt,widget,designer","A_Id":960506,"CreationDate":"2009-06-06T20:33:00.000","Title":"how can I add a QMenu and QMenuItems to a window from Qt Designer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3989,"Q_Id":960467,"Users Score":0,"Answer":"Adding menu editing for every widget in the designer would probably make a very awkward and inconvenient UI. There's really no place you can visualize it on.\nIf you're editing a QMainWindow you can edit the menu bar and its popups because there's a proper place for them to be displayed in.","Q_Score":1,"Tags":"python,qt,widget,designer","A_Id":960479,"CreationDate":"2009-06-06T20:33:00.000","Title":"how can I add a QMenu and QMenuItems to a window from Qt Designer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use gtk.EntryCompletion to implement the autocomletion function.\nBut the list is so long that the pop-up window touches the bottom of screen.\nAnd I cant find the method of set the height of pop-up window in doc of pygtk.\nHow to set the height of pop-up window in gtk.EntryCompletion?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":509,"Q_Id":961735,"Users Score":0,"Answer":"I don't know if this applies to gtk.EntryCompletion widgets, but for cell like widgets you can control their height with the cell.set_fixed_height_from_font(True) method. \nLook at the gtk.CellRendererText API for details.","Q_Score":2,"Tags":"python,gtk,pygtk","A_Id":962054,"CreationDate":"2009-06-07T11:19:00.000","Title":"pygtk: How to set the height of pop-up window in gtk.EntryCompletion","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use gtk.EntryCompletion to implement the autocomletion function.\nBut the list is so long that the pop-up window touches the bottom of screen.\nAnd I cant find the method of set the height of pop-up window in doc of pygtk.\nHow to set the height of pop-up window in gtk.EntryCompletion?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":509,"Q_Id":961735,"Users Score":0,"Answer":"Maybe you can solve the problem using gtk.EntryCompletion.set_minimum_key_length to prevent long list of suggestions.","Q_Score":2,"Tags":"python,gtk,pygtk","A_Id":7963132,"CreationDate":"2009-06-07T11:19:00.000","Title":"pygtk: How to set the height of pop-up window in gtk.EntryCompletion","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":1.0,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":13,"Answer":"I've heard these complaints before about C++, but the fact is, programming in any language with which you are unfamiliar is time consuming.  \nA good C++ programmer can probably crank out the app much faster than an okay Python programmer and visa versa.  \nI think C++ often gets a bad reputation because it allows you get much lower level - pointers, memory management, etc, and if you aren't used to thinking about such things, it can take a bit of time.  If you are used to working in that environment, it can become second nature.\nUnless choice of language is something imposed upon you by your company, team, client, etc. I usually recommend that folks go with the language they are most comfortable with OR most interested in learning more about.  If speed is the issue you are concerned with, look at the learning curve for each language and your past experience.  C++ tends to have a higher learning curve, but that too depends on the person.\nKindof a non-answer I know.","Q_Score":19,"Tags":"c++,python","A_Id":977443,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":1.0,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":24,"Answer":"There are two things that are relevant between C++ and Python that will affect your time-to-develop any project including a game.  There are the languages themselves and the libraries.  I've played with the SDL to some extent and peeked at PyGame and for your specific instance I don't think the libraries are going to be much of a factor.  So I'll focus on the languages themselves.\nPython is a dynamically-typed, garbage-collected language.  C++ is a statically-typed, non-garbage-collected language.  What this means is that in C++ a lot of your development time will be spent managing memory and dealing with your type structure.  This affords you a lot of power, but the question is do you really need it?\nIf you're looking to write a simple game with some basic graphics and some good gameplay, then I don't think you truly need all the power that C++ will give you.  If you're looking to write something that will push the envelope, be the next A-list game, be the next MMO, fit on a console or a handheld device, then you will likely need the power that C++ affords.","Q_Score":19,"Tags":"c++,python","A_Id":977451,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0307595242,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":2,"Answer":"It's time consuming because in C++ you have to deal with more low-level tasks.\nIn Python you are free to focus on the development of the actual game instead of dealing with memory management etc.","Q_Score":19,"Tags":"c++,python","A_Id":977412,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":0,"Answer":"Some people would argue that development time is slower in C++ when compared to Python. \nWouldn't it be the case that the time you saved in developing an application (or game) in python is the time you gonna use in improving performance after its developed? and in the later part when you have least options left?\nIt largely depends upon the purpose for which you are going to develop the application. \nIf you are thinking for an enterprise application in which case it is going to be hit by millions (web-app) or an application with focus on low-footprint, faster loading into memory, faster execution, then your choice is C++. \nIf you are projecting your application for not being use at this level, surely Python is the choice to go for. \nMaintainability is considerable, but disciplined code can overcome this.\nLargely depends upon long term projections. On how serious and critical the application is going to be.","Q_Score":19,"Tags":"c++,python","A_Id":4546946,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":0,"Answer":"Why limit yourself to those two options? With C# or Java you get access to a huge collection of useful libraries plus garbage collection and (in the case of C#) JIT compiling.\nFurthermore, you're saying that you're looking to do game development, but from your task description it sounds like you're also looking at coding your own engine. Is that part of the exercise? Otherwise you should definitely take a look at the available Indie engines out there - lots are cheap of not free and open source.\nNeedless to say, working from an existing engine is definitely faster than going from scratch :)","Q_Score":19,"Tags":"c++,python","A_Id":1079100,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0307595242,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":2,"Answer":"It takes about the same amount of time to write the same code in pretty much all of the high level languages. The win is that in certain languages it is easier to use other peoples code. In a lot of Python\/Ruby\/Perl apps, you write 10% of the code and import libraries to do the other 90%. That is harder in C\/C++ since the libraries have different interfaces and other incompatibilities.\nC++ vs Python is a pretty personal choice. Personally I feel I lose more time with not having the C\/Java class system (more run time errors\/debugging time, don't have anywhere near as good auto completion, need to do more documentation and optimization) than I gain (not having to write interfaces\/stub function and being able to worry less about memory managment). Other people feel the exact opposite.\nIn the end it probably depends on the type of game. If your processor intensive go to C++ (maybe with a scripting language if it makes sense). Otherwise use whatever language you prefer","Q_Score":19,"Tags":"c++,python","A_Id":1009820,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0461211021,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":3,"Answer":"Python has some big advantages over programming languages like C++. I myself have programmed a lot with C++, C and other programming languages. Lately I am also programming in Python and I got to like it very much!\nYou can have a quick start with Python. Since it is rather simple to learn (at least with some programming experience and enough abstract thinking), you can have fast successes. Also the script-like behaviour makes starting easy and it is also possible, to quickly test some things in the integrated shell. This can also be good for debugging.\nThe whole language is packed with powerful features and it has a good and rather complete set of libraries.\nThere was the argument that with the \"right library\" you can develop as quickly with C++ as with Python. This might (partly) be, but I myself have never experienced it, because such libraries are rare. I had also a big library at hand, but still lacked many valuable features in C++. The so called \"standard template library\" STL makes things even worse in my opinion. It is a really powerful library. But it is also that complex, that it adds the complexity of an additional programming language to C++. I really disliked it and in a company I worked in, much worktime was lost, because the compiler was not able to give useful error-output in case of errors in the STL.\nPython is different. Instead of putting the \"speed of the programm\" on the throne -- sacrificing all else (as C++ and especially the STL does) -- it puts \"speed of development\" first. The language gives you a powerful toolkit and it is accompanied by a huge library. When you need speed, you can also implement time critical things in C or C++ and call it from Python.\nThere is also at least one big online Game implemented in Python.","Q_Score":19,"Tags":"c++,python","A_Id":986810,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":0,"Answer":"Do you have any programming experience at all? If not, I would start with Python which is easier to learn, even if it is not a better tool for game development. If you decide you want to program games for living, you'll probably need to switch to C++ at some point.","Q_Score":19,"Tags":"c++,python","A_Id":977759,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":0,"Answer":"Short Answer\nYes python is faster in terms of development time. There are many case studies in real life that show this. However, you don't want to do a 3d graphics engine in Python.","Q_Score":19,"Tags":"c++,python","A_Id":977460,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":0,"Answer":"I'd focus more on choosing a framework to build your game on than trying to pick a language.  Unless the goal is to learn how games work inside and out, you're going to want to use a framework.  Try out a couple, and pick the one that meets your requirements and feels nice to you.\nOnce you've picked the framework, the language choice becomes easy - use the language for which the framework is written.\nThere are many options for game frameworks in C++ - pygame works for python.  There are many that work with other languages\/tools as well (including .NET, Lua, etc.)","Q_Score":19,"Tags":"c++,python","A_Id":977452,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.\nAnyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.","AnswerCount":13,"Available Count":11,"Score":0.0307595242,"is_accepted":false,"ViewCount":5902,"Q_Id":977404,"Users Score":2,"Answer":"there are many things that make c++ longer to develop in.  Its lower level, has pointers, different libraries for different systems, the type system, and there are others I am sure I am missing.","Q_Score":19,"Tags":"c++,python","A_Id":977414,"CreationDate":"2009-06-10T18:33:00.000","Title":"C++ slow, python fast? (in terms of development time)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have to write a desktop application to edit data stored in a XML file. The format is defined by a XML schema file (.xsd). The format is quite complex. \nAre there tools which can generate a basic GUI automatically? It's not yet decided which language to use. I have experience in Python and C++ using wxWidgets and C# (.NET 1) using Windows Forms.","AnswerCount":7,"Available Count":2,"Score":0.0285636566,"is_accepted":false,"ViewCount":19538,"Q_Id":983399,"Users Score":1,"Answer":"One solution could be to write an XSL transformation that converts the XML file into a XAML file.","Q_Score":15,"Tags":"c#,c++,python,xml,schema","A_Id":985246,"CreationDate":"2009-06-11T20:14:00.000","Title":"Create a GUI from a XML schema automatically","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have to write a desktop application to edit data stored in a XML file. The format is defined by a XML schema file (.xsd). The format is quite complex. \nAre there tools which can generate a basic GUI automatically? It's not yet decided which language to use. I have experience in Python and C++ using wxWidgets and C# (.NET 1) using Windows Forms.","AnswerCount":7,"Available Count":2,"Score":0.0285636566,"is_accepted":false,"ViewCount":19538,"Q_Id":983399,"Users Score":1,"Answer":"If the GUI will be simple and you don't bother about the geometry of the components(widgets) in the dialogs, Qt will be a good option. Actually I'm working on a similar task for my project, and my goal was to validate the form data by using an XML file.\nUsing Qt, it is possible to access any widget on the dialog at run-time by using its object name. So that validation can be applied to the dialog contents.\nCreating any dialogs will be even easier, since you will have the widget type and certain information and using layouts, fascinating results can be obtained.","Q_Score":15,"Tags":"c#,c++,python,xml,schema","A_Id":1015238,"CreationDate":"2009-06-11T20:14:00.000","Title":"Create a GUI from a XML schema automatically","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm designing a simple text editor using WxPython, and I want to put the platform's native icons in the toolbar.  It seems that the only way to make toolbars is with custom images, which are not good for portability. Is there some kind of (e.g.) GetSaveIcon()?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1725,"Q_Id":984816,"Users Score":4,"Answer":"I don't think wxPython provides native images on each platform\nbut just for consistency sake you can use wx.ArtProvider\ne.g.\nwx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN)","Q_Score":2,"Tags":"python,wxpython,icons","A_Id":984833,"CreationDate":"2009-06-12T03:16:00.000","Title":"How to use standard toolbar icons with WxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to explicitly disable the compilation of the _tkinter module when compiling Python 2.4.3. It's easy enough to do by modifying the makefile but I'd rather just append a configuration option to avoid supplying a patch.\nI do not understand the complex interplay between Modules\/Setup*, setup.py and their contribution to the generation of makefile.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":672,"Q_Id":994278,"Users Score":5,"Answer":"Unfortunately I suspect you can't do it without editing some file or other -- it's not a configure option we wrote in as far as I recall (I hope I'm wrong and somebody else snuck it in while I wasn't looking but a quick look at the configure file seems to confirm they didnt'). Sorry -- we never thought that somebody (with all the tk libraries installed, otherwise tkinter gets skipped) would need to deliberately avoid building _tkinter:-(. In retrospect, we clearly were wrong, so I apologize.","Q_Score":3,"Tags":"python,compilation,tkinter","A_Id":994311,"CreationDate":"2009-06-15T02:05:00.000","Title":"How can I explicitly disable compilation of _tkinter.c when compiling Python 2.4.3 on CentOS 5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a basic program in python using the PyQt4 module. I'd like to be able to use my system theme's icons for things like the preference dialog's icon, but i have no idea how to do this. So my question is, how do you get the location of an icon, but make sure it changes with the system's icon theme? If it matters, i'm developing this under ubuntu 9.04, so i am using the gnome desktop.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3720,"Q_Id":997904,"Users Score":0,"Answer":"I spent a decent amount of researching this myself not long ago, and my conclusion was that, unfortunately, Qt doesn't provide this functionality in a cross-platform fashion.  Ideally the QIcon class would have defaults for file open, save, '+', '-', preferences, etc, but considering it doesn't you'll have to grab the appropriate icon for your desktop environment.","Q_Score":8,"Tags":"python,icons,pyqt4","A_Id":999115,"CreationDate":"2009-06-15T19:25:00.000","Title":"System theme icons and PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for a Python framework that will enable me to play video as well as draw on that video (for labeling purposes).  \nI've tried Pyglet, but this doesn't seem to work particularly well - when drawing on an existing video, there is flicker (even with double buffering and all of that good stuff), and there doesn't seem to be a way to get the frame index in the video during the per-frame callback (only elapsed time since the last frame).","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":2361,"Q_Id":1003376,"Users Score":2,"Answer":"Qt (PyQt) has Phonon, which might help out. PyQt is available as GPL or payware. (Qt has LGPL too, but the PyQt wrappers don't)","Q_Score":4,"Tags":"python,video,pyglet","A_Id":1003439,"CreationDate":"2009-06-16T19:03:00.000","Title":"Python Video Framework","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can anyone tell me if its possible to redeclare a C# class in IronPython? If I have a C# class, would I be able to monkey-patch it from IronPython?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":324,"Q_Id":1008686,"Users Score":0,"Answer":"You can monkey-patch from IronPython, but IPy is the only environment that will respect your changes; i.e. if you tried to mock out File.Create from IronPython, this would work fine for any IPy code, but if you called a C# method which called File.Create, it would get the real one, not the mock.","Q_Score":1,"Tags":"c#,ironpython,monkeypatching","A_Id":1040151,"CreationDate":"2009-06-17T18:08:00.000","Title":"Redeclare .net classes in IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Can anyone tell me if its possible to redeclare a C# class in IronPython? If I have a C# class, would I be able to monkey-patch it from IronPython?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":324,"Q_Id":1008686,"Users Score":0,"Answer":"You cannot monkey patch from IronPython.  IronPython treats all .NET classes just like CPython treats built-in types: they cannot be monkey patched.  IronRuby on the other hand does support this.","Q_Score":1,"Tags":"c#,ironpython,monkeypatching","A_Id":3155159,"CreationDate":"2009-06-17T18:08:00.000","Title":"Redeclare .net classes in IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have an interface that has two toolbars, one attached to the frame and one embedded in a notebook tab. The one in the frame dutifully shows longHelp strings in the statusbar, the one in the notebook tab\ndoes not. How do I tell the one on the notebook tab where to display its help, or do I have to manage enter and leave bindings myself?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":948,"Q_Id":1014239,"Users Score":0,"Answer":"from wxPython docs\n\"\"\"\nlongHelpString\nThis string is shown in the statusbar (if any) of the parent frame when the mouse pointer is inside the tool\n\"\"\"\nso toolbar in notebook doesn't get any statusbar to display long help, so either thru src we should invertigate how it inquires abt status bar and supply a ref to main frame status bar\nelse i think better way is to just override wxToolBar::OnMouseEnter and display help directly on status bar","Q_Score":2,"Tags":"wxpython,wxwidgets","A_Id":1021396,"CreationDate":"2009-06-18T17:57:00.000","Title":"wxPython: how to make two toolbars use one statusbar for tooltips?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program that sends and receives images to each other using sockets.\nThe server sends the image data using 'image.tostring()' and the client side receives it and turns it back into an image using 'Image.fromstring', then into a QImage using 'ImageQt.ImageQt(image)', turns it into a QPixmap using 'QPixmap.fromimage(qimage)'then updates my QWidget's QLable's image using 'lable.setPixmap(qpixmap)'\nEverything works fine with small images, but with images larger than 200x200, python.exe crashes and the console only shows \"Process terminated with an exit code of -1073741819\"  and doesn't tell me what the problem is.\nI've isolated the problem down to 'setPixmap()' (everything else works as long as I comment out that), but I can't see what the problem is.\nThis only happens on the client side. The server side uses the same steps going from Image to QImage to QPixmap then setPixmap, but that doesn't have any problems.\nAlso tried making it a QBitmap and using setPixmap on the bitmap, which worked (but it's black and white so can't use it). Weird!\nAny help would be appreciated!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1131,"Q_Id":1029033,"Users Score":0,"Answer":"It may be worth dumping the image data to a file and checking that you have all the data by loading it into an image viewer. If you get incomplete data, you may still be able to obtain a QImage and create a QPixmap, but it may be invalid.","Q_Score":4,"Tags":"python,pyqt,qpixmap","A_Id":1116190,"CreationDate":"2009-06-22T19:38:00.000","Title":"\"Python.exe\" crashes when PyQt's setPixmap() is called with a Pixmap","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I make any wxPython widget (like wx.Panel or wx.Button) automatically expand to fill its parent window?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3216,"Q_Id":1034399,"Users Score":0,"Answer":"In the case of a Button, to make a button fill its parent window when the parent window (a frame in my case) changes size, put button.SetSize(parent_window.GetSize()) in the parent window's OnSize event handling routine.","Q_Score":4,"Tags":"python,user-interface,wxpython","A_Id":5628847,"CreationDate":"2009-06-23T18:46:00.000","Title":"wxPython: Making something expand","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.\nRecently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK \/ pyQt on gnome \/ kde. Does such a library exist? If not, what do you think is wrong with this idea?","AnswerCount":9,"Available Count":6,"Score":1.0,"is_accepted":false,"ViewCount":5803,"Q_Id":1037673,"Users Score":8,"Answer":"Tkinter is part of the python standard distribution and is installed by default.  Expect to find this on all python installs where there is a graphical display in the first place.","Q_Score":9,"Tags":"python,tkinter,pyqt,pygtk,pyobjc","A_Id":1037851,"CreationDate":"2009-06-24T10:58:00.000","Title":"Pure python gui library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.\nRecently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK \/ pyQt on gnome \/ kde. Does such a library exist? If not, what do you think is wrong with this idea?","AnswerCount":9,"Available Count":6,"Score":1.0,"is_accepted":false,"ViewCount":5803,"Q_Id":1037673,"Users Score":6,"Answer":"Notion of \"pure python gui library\" is wrong because ultimately you will be using system level calls and widgets, may be thru ctypes but that doesn't change the fact that if you start implementing your idea you will eventually become wxPython","Q_Score":9,"Tags":"python,tkinter,pyqt,pygtk,pyobjc","A_Id":1038265,"CreationDate":"2009-06-24T10:58:00.000","Title":"Pure python gui library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.\nRecently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK \/ pyQt on gnome \/ kde. Does such a library exist? If not, what do you think is wrong with this idea?","AnswerCount":9,"Available Count":6,"Score":0.0886555158,"is_accepted":false,"ViewCount":5803,"Q_Id":1037673,"Users Score":4,"Answer":"For one thing, all those libraries use different abstractions, so anything that worked with all of them is likely to wind up supporting a least-common-denominator set of functionality, or doing a LOT of work to use each to its fullest.","Q_Score":9,"Tags":"python,tkinter,pyqt,pygtk,pyobjc","A_Id":1037740,"CreationDate":"2009-06-24T10:58:00.000","Title":"Pure python gui library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.\nRecently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK \/ pyQt on gnome \/ kde. Does such a library exist? If not, what do you think is wrong with this idea?","AnswerCount":9,"Available Count":6,"Score":0.0886555158,"is_accepted":false,"ViewCount":5803,"Q_Id":1037673,"Users Score":4,"Answer":"Not really sure what you mean by \"heavyweight.\"\nwx uses native controls on each platform, and is about as easy to use in Python as I can imagine; after all, GUI APIs are complex because GUIs can get complex.\nI think wx, for the effort required to build a window and the quality of what shows up on screen, is great.  I don't think you're likely to roll something better on your own.","Q_Score":9,"Tags":"python,tkinter,pyqt,pygtk,pyobjc","A_Id":1037810,"CreationDate":"2009-06-24T10:58:00.000","Title":"Pure python gui library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.\nRecently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK \/ pyQt on gnome \/ kde. Does such a library exist? If not, what do you think is wrong with this idea?","AnswerCount":9,"Available Count":6,"Score":0.0444152037,"is_accepted":false,"ViewCount":5803,"Q_Id":1037673,"Users Score":2,"Answer":"I think it's about not inventig the wheel. It would work, but why should you do that? All the GUI libraries you mentioned are stable and more or less bullet proofen.\nI could imagine that there are some experiments implementing a pure python library. But I never saw one. Everything about GUIs is hard work and a pure python library wouldn't have such a big audience.","Q_Score":9,"Tags":"python,tkinter,pyqt,pygtk,pyobjc","A_Id":1037705,"CreationDate":"2009-06-24T10:58:00.000","Title":"Pure python gui library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python has a lot of GUI libraries: tkinter, wxWidgets, pyGTK etc. But all these GUIs need to be installed and quite heavyweight, so it's a bit complex to deploy end-user GUI python apps that relay on mentioned GUI libraries.\nRecently, I have thought about python's built-in ctypes module. Theoretically, it's possible to create a pure python GUI library that will use ctypes on windows ( windll.user32.CreateWindowEx, etc ), native pyObjC on MacOS and pyGTK \/ pyQt on gnome \/ kde. Does such a library exist? If not, what do you think is wrong with this idea?","AnswerCount":9,"Available Count":6,"Score":1.2,"is_accepted":true,"ViewCount":5803,"Q_Id":1037673,"Users Score":10,"Answer":"The path of least effort and best results would be to learn what it takes to deploy an app using those existing GUI libraries.","Q_Score":9,"Tags":"python,tkinter,pyqt,pygtk,pyobjc","A_Id":1037722,"CreationDate":"2009-06-24T10:58:00.000","Title":"Pure python gui library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to convert HTML CSS file to wxPython files? That is, how to create slidsheet in wxPython like HTML CSS files?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":677,"Q_Id":1038182,"Users Score":0,"Answer":"stylesheet, not slidesheet.\nf = open('NAMEOFSTYLESHEET.css','w')\nf.write('#ID{}\\n.class{}')","Q_Score":0,"Tags":"wxpython","A_Id":14180592,"CreationDate":"2009-06-24T12:54:00.000","Title":"HTML conversion","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"In my wx.Frame based wxpython application, I draw some lines on a panel when some events occur by creating wx.ClientDC instances when needed. The only problem is, if the window is minimized and then restored, the lines disappear! Is there some kind of method that I should override or event to bind to that will allow me to call the drawing method I created when the window is restored?\nThanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":541,"Q_Id":1046157,"Users Score":0,"Answer":"When the window is restored it is (on some platforms) repainted using EVT_PAINT handler.\nThe solution is e.g. to draw the same lines in OnPaint(). Or buffer what you draw. See  the wxBufferedDC class.","Q_Score":1,"Tags":"python,wxpython","A_Id":1046259,"CreationDate":"2009-06-25T20:42:00.000","Title":"wxpython: How can I redraw something when a window is retored?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing an student attendance application in wxpython and I need to know how to ensure that password field doesn't echo characters to the screen.\nForexample :if I give the name as moni means then it should be displayed as in format of   ****","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":427,"Q_Id":1048446,"Users Score":1,"Answer":"You need to give your text control the TE_PASSWORD style.\n(As J\u00f8rn's comment points out, this isn't \"encryption\" - I'm assuming you're only talking about the visual presentation of the password.)","Q_Score":0,"Tags":"wxpython","A_Id":1048463,"CreationDate":"2009-06-26T10:44:00.000","Title":"Hiding characters typed into password field","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to extend a large C project with some new functionality, but I really want to write it in Python.  Basically, I want to call Python code from C code.  However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.\nI'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing\/reading from a socket (or unix pipe).  my python component can read\/write to socket to communicate.  Is that a reasonable approach?  Is there something better?  Like some special RPC mechanism?\nThanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program.  I don't want to embed a Python interpreter.  Thanks!","AnswerCount":9,"Available Count":3,"Score":0.022218565,"is_accepted":false,"ViewCount":79185,"Q_Id":1056051,"Users Score":1,"Answer":"I haven't used an IPC approach for Python<->C communication but it should work pretty well. I would have the C program do a standard fork-exec and use redirected stdin and stdout in the child process for the communication. A nice text-based communication will make it very easy to develop and test the Python program.","Q_Score":52,"Tags":"python,c,interop,cross-domain","A_Id":1056105,"CreationDate":"2009-06-28T23:37:00.000","Title":"How do you call Python code from C code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to extend a large C project with some new functionality, but I really want to write it in Python.  Basically, I want to call Python code from C code.  However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.\nI'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing\/reading from a socket (or unix pipe).  my python component can read\/write to socket to communicate.  Is that a reasonable approach?  Is there something better?  Like some special RPC mechanism?\nThanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program.  I don't want to embed a Python interpreter.  Thanks!","AnswerCount":9,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":79185,"Q_Id":1056051,"Users Score":0,"Answer":"apparently Python need to be able to compile to win32 dll, it will solve the problem\nIn such a way that converting c# code to win32 dlls will make it usable by any development tool","Q_Score":52,"Tags":"python,c,interop,cross-domain","A_Id":1621442,"CreationDate":"2009-06-28T23:37:00.000","Title":"How do you call Python code from C code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to extend a large C project with some new functionality, but I really want to write it in Python.  Basically, I want to call Python code from C code.  However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.\nI'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing\/reading from a socket (or unix pipe).  my python component can read\/write to socket to communicate.  Is that a reasonable approach?  Is there something better?  Like some special RPC mechanism?\nThanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program.  I don't want to embed a Python interpreter.  Thanks!","AnswerCount":9,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":79185,"Q_Id":1056051,"Users Score":7,"Answer":"Have you considered just wrapping your python application in a shell script and invoking it from within your C application?\nNot the most elegant solution, but it is very simple.","Q_Score":52,"Tags":"python,c,interop,cross-domain","A_Id":1056087,"CreationDate":"2009-06-28T23:37:00.000","Title":"How do you call Python code from C code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've made a small tool that parses a chunk of text, does some simple processing (retrieves values from a dictionary, a few regex, etc.) and then spits the results.\nIn order to make easier to read the results, I made two graphic ports, one with tkInter and other with wxPython, so the output is nicely displayed in a Text Area with some words having different colours.\nThe tkInter implementation uses Tkinter.Text object and to apply the colours to the words uses tags (configured with the method Tkinter.Text.tag_config and passing them to Tkinter.Text.insert), and the measured while outputting about 400 different coloured words is < 0.02s.\nThe wxPython implementation uses wx.richtext.RichTextCtrl and to apply the colours to the words uses wx.richtext.RichTextCtrl.BeginTextColour and then wx.richtext.RichTextCtrl.AppendText; the performance is ridiculous, it takes abut 1.4s to do the same job that only took 0.02s to the tkInter port.\nIs this an intrinsic problem of the RichTextCtrl widget, the wxPython bindings, or there is some way to speed it up?\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1031,"Q_Id":1059214,"Users Score":0,"Answer":"It kind of avoids the question slightly, but could you use wxStyledTextCtrl instead?","Q_Score":0,"Tags":"python,performance,wxpython,tkinter,richtextediting","A_Id":1070836,"CreationDate":"2009-06-29T16:26:00.000","Title":"wxPython RichTextCtrl much slower than tkInter Text?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've made a small tool that parses a chunk of text, does some simple processing (retrieves values from a dictionary, a few regex, etc.) and then spits the results.\nIn order to make easier to read the results, I made two graphic ports, one with tkInter and other with wxPython, so the output is nicely displayed in a Text Area with some words having different colours.\nThe tkInter implementation uses Tkinter.Text object and to apply the colours to the words uses tags (configured with the method Tkinter.Text.tag_config and passing them to Tkinter.Text.insert), and the measured while outputting about 400 different coloured words is < 0.02s.\nThe wxPython implementation uses wx.richtext.RichTextCtrl and to apply the colours to the words uses wx.richtext.RichTextCtrl.BeginTextColour and then wx.richtext.RichTextCtrl.AppendText; the performance is ridiculous, it takes abut 1.4s to do the same job that only took 0.02s to the tkInter port.\nIs this an intrinsic problem of the RichTextCtrl widget, the wxPython bindings, or there is some way to speed it up?\nThanks!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1031,"Q_Id":1059214,"Users Score":1,"Answer":"I'm copying here the comment that solved the problem:\n\nHave you tried using Freeze() and\n  Thaw() to only update the display\n  after you are done appending the\n  coloured text? \u2013 mghie Jun 30 at 7:20","Q_Score":0,"Tags":"python,performance,wxpython,tkinter,richtextediting","A_Id":1189222,"CreationDate":"2009-06-29T16:26:00.000","Title":"wxPython RichTextCtrl much slower than tkInter Text?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been reading through this wonderful website regarding the recommended Python IDEs and have narrowed it down to either\n\nWingIDE\nKomodoIDE\n\nwhich you guys will recommend for the purpose of developing Pylons apps? I know that most questions have been asked pertaining to Python IDEs but how about Python web framework IDEs which is a mishmash of various templating languages and Python itself.\nOne con i have to raise about WingIDE on Windows is that it has an AWFUL interface (probably cos of the GTK+ toolkit?)\nI have been using e-text editor all the while and increasingly been dissatisfied with it especially when its unable to do correct syntax highlighting at times. Furthermore I am hoping syntax coloration can be done for Mako templates.\nThank you very much all and have a great day!","AnswerCount":9,"Available Count":4,"Score":0.022218565,"is_accepted":false,"ViewCount":4484,"Q_Id":1065964,"Users Score":1,"Answer":"Try Aptana Studio... It's eclipse+pydev+web stuff, it doesnt have any specific pylons stuff or mako support. But eclipse+pydev alone is great + all the nice jscript+html+css stuff aptana adds.","Q_Score":8,"Tags":"python,ide,pylons","A_Id":3596813,"CreationDate":"2009-06-30T20:46:00.000","Title":"Recommended IDE for developing Pylons apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been reading through this wonderful website regarding the recommended Python IDEs and have narrowed it down to either\n\nWingIDE\nKomodoIDE\n\nwhich you guys will recommend for the purpose of developing Pylons apps? I know that most questions have been asked pertaining to Python IDEs but how about Python web framework IDEs which is a mishmash of various templating languages and Python itself.\nOne con i have to raise about WingIDE on Windows is that it has an AWFUL interface (probably cos of the GTK+ toolkit?)\nI have been using e-text editor all the while and increasingly been dissatisfied with it especially when its unable to do correct syntax highlighting at times. Furthermore I am hoping syntax coloration can be done for Mako templates.\nThank you very much all and have a great day!","AnswerCount":9,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":4484,"Q_Id":1065964,"Users Score":0,"Answer":"Wow, I've also been looking for a good Pylons web app IDE.  Seems like KomodoIDE 5.1 kicks some serious ass.  I love the support for Mako and that it supports pretty much all of the SCMs.  \nI've been using Textmate, but KomodoIDE will take over from now onwards","Q_Score":8,"Tags":"python,ide,pylons","A_Id":2364669,"CreationDate":"2009-06-30T20:46:00.000","Title":"Recommended IDE for developing Pylons apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been reading through this wonderful website regarding the recommended Python IDEs and have narrowed it down to either\n\nWingIDE\nKomodoIDE\n\nwhich you guys will recommend for the purpose of developing Pylons apps? I know that most questions have been asked pertaining to Python IDEs but how about Python web framework IDEs which is a mishmash of various templating languages and Python itself.\nOne con i have to raise about WingIDE on Windows is that it has an AWFUL interface (probably cos of the GTK+ toolkit?)\nI have been using e-text editor all the while and increasingly been dissatisfied with it especially when its unable to do correct syntax highlighting at times. Furthermore I am hoping syntax coloration can be done for Mako templates.\nThank you very much all and have a great day!","AnswerCount":9,"Available Count":4,"Score":0.022218565,"is_accepted":false,"ViewCount":4484,"Q_Id":1065964,"Users Score":1,"Answer":"+1 for Spyder. Never heard of it before reading this page. Working great so far.","Q_Score":8,"Tags":"python,ide,pylons","A_Id":4134659,"CreationDate":"2009-06-30T20:46:00.000","Title":"Recommended IDE for developing Pylons apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been reading through this wonderful website regarding the recommended Python IDEs and have narrowed it down to either\n\nWingIDE\nKomodoIDE\n\nwhich you guys will recommend for the purpose of developing Pylons apps? I know that most questions have been asked pertaining to Python IDEs but how about Python web framework IDEs which is a mishmash of various templating languages and Python itself.\nOne con i have to raise about WingIDE on Windows is that it has an AWFUL interface (probably cos of the GTK+ toolkit?)\nI have been using e-text editor all the while and increasingly been dissatisfied with it especially when its unable to do correct syntax highlighting at times. Furthermore I am hoping syntax coloration can be done for Mako templates.\nThank you very much all and have a great day!","AnswerCount":9,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":4484,"Q_Id":1065964,"Users Score":0,"Answer":"after very very careful comparison, KomodoIDE 5.1 is most suitable for my purposes.\nReasons:\n\nExtensibility\nSupport for Mako and YUI (required by me)\nNative interface support (no GTK unfamiliarity)\nSupport for Mercurial SCM (required by me)\n\nthats all I guess. I am extremely satisfied with KomodoIDE and have just shelled out some money to buy it.\nI figured when making a choice of tools, spend a day or two (yes, it takes time) trying them out and choosing what best suits your day-to-day purposes. If its just your first time coding, using a standard free tool or open source tool is far more useful than expending the time to find out the best tool.\nOnly after some degree of expertise is acquired, you have a very narrow spectrum of requirements\/preferences which will make choosing a tool far easier.","Q_Score":8,"Tags":"python,ide,pylons","A_Id":1085987,"CreationDate":"2009-06-30T20:46:00.000","Title":"Recommended IDE for developing Pylons apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use Python to access MFC document files generically? Can CArchive be used to query a file and view the structure, or does Python, in opening the document, need to know more about the document structure in order to view the contents?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":216,"Q_Id":1070932,"Users Score":0,"Answer":"I think that the Python code needs to know the document structure. \nMaybe you should make a python wrapper of your c++ code. \nIn this case, I would recommend to use http:\/\/sourceforge.net\/projects\/pycpp\/>pycpp which is my opinion a great library for making python extensions in c++.","Q_Score":1,"Tags":"python,windows,mfc,file","A_Id":1071011,"CreationDate":"2009-07-01T19:37:00.000","Title":"How To: View MFC Doc File in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Developing a project of mine I realize I have a need for some level of persistence across sessions, for example when a user executes the application, changes some preferences and then closes the app.  The next time the user executes the app, be it after a reboot or 15 minutes, I would like to be able to retain the preferences that had been changed.  \nMy question relates to this persistence.  Whether programming an application using the win32 API or the MFC Framework .. or using the newer tools for higher level languages such as wxPython or wxRuby, how does one maintain the type of persistence I refer to?  Is it done as a temporary file written to the disk?  Is it saved into some registry setting?  Is there some other layer it is stored in that I am unaware of?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":729,"Q_Id":1077649,"Users Score":3,"Answer":"I would advice to do it in two steps.\n\nFirst step is to save your prefs. as\nstring, for that you can\na)\nUse any xml lib or output xml by\nhand    to output string and read\nsimilarly    from string\nb) Just use pickle module to dump your prefs object as a string\nc) Somehow generate a string from prefs which you can read back as prefs e.g. use yaml, config , JSON etc actually JSON is a good option when simplejson makes it so easy.\nOnce you have your methods to convert to and from string are ready, you just need to store it somewhere where it is persisted and you can read back next time, for that you can\na) Use wx.Config which save to registry in windows and to other places depending on platform so you don't have to worry where it saves, you can just read back values in platform independent way. But if you wish you can just use wx.Config for directly saving reading prefs.\nb) Directly save prefs. string to a file in a folder assigned by OS to your app e.g. app data folder in windows.\n\nBenefit of saving to a string and than using wx.Config to save it, is that you can easily change where data is saved in future e.g. in future if there is a need to upload prefs. you can just upload prefs. string.","Q_Score":1,"Tags":"python,windows,wxpython","A_Id":1077697,"CreationDate":"2009-07-03T03:24:00.000","Title":"Windows Application Programming & wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What's the correct way to prevent invoking (creating an instance of) a C type from Python?\nI've considered providing a tp_init that raises an exception, but as I understand it that would still allow __new__ to be called directly on the type.\nA C function returns instances of this type -- that's the only way instances of this type are intended to be created.\nEdit: My intention is that users of my type will get an exception if they accidentally use it wrongly. The C code is such that calling a function on an object incorrectly created from Python would crash. I realise this is unusual: all of my C extension types so far have worked nicely when instantiated from Python. My question is whether there is a usual way to provide this restriction.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":339,"Q_Id":1079690,"Users Score":0,"Answer":"There is a fantastically bulletproof way. Let people create the object, and have Python crash. That should stop them doing it pretty efficiently.  ;)\nAlso you can underscore the class name, to indicate that it should be internal. (At least, I assume you can create underscored classnames from C too, I haven't actually ever done it.)","Q_Score":2,"Tags":"python,cpython","A_Id":1080330,"CreationDate":"2009-07-03T14:49:00.000","Title":"Preventing invoking C types from Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I can use PIL to grab a screenshot of the desktop, and then use pywin32 to get its rectangle and crop out the part I want. However, if there's something in front of the window I want, it'll occlude the application I wanted a screenshot of. Is there any way to get what windows would say an application is currently displaying? It has that data somewhere, even when other windows are in front of it.","AnswerCount":7,"Available Count":4,"Score":0.057080742,"is_accepted":false,"ViewCount":12921,"Q_Id":1080719,"Users Score":2,"Answer":"There is a way to do this, using the PrintWindow function. It causes the window to redraw itself on another surface.","Q_Score":6,"Tags":"python,windows,screenshot","A_Id":3586035,"CreationDate":"2009-07-03T20:22:00.000","Title":"Screenshot an application, regardless of what's in front of it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I can use PIL to grab a screenshot of the desktop, and then use pywin32 to get its rectangle and crop out the part I want. However, if there's something in front of the window I want, it'll occlude the application I wanted a screenshot of. Is there any way to get what windows would say an application is currently displaying? It has that data somewhere, even when other windows are in front of it.","AnswerCount":7,"Available Count":4,"Score":0.0285636566,"is_accepted":false,"ViewCount":12921,"Q_Id":1080719,"Users Score":1,"Answer":"Maybe you can position the app offscreen, then take the screenshot, then put it back?","Q_Score":6,"Tags":"python,windows,screenshot","A_Id":1270114,"CreationDate":"2009-07-03T20:22:00.000","Title":"Screenshot an application, regardless of what's in front of it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I can use PIL to grab a screenshot of the desktop, and then use pywin32 to get its rectangle and crop out the part I want. However, if there's something in front of the window I want, it'll occlude the application I wanted a screenshot of. Is there any way to get what windows would say an application is currently displaying? It has that data somewhere, even when other windows are in front of it.","AnswerCount":7,"Available Count":4,"Score":0.0285636566,"is_accepted":false,"ViewCount":12921,"Q_Id":1080719,"Users Score":1,"Answer":"If you can, try saving the order of the windows, then move your app to the front, screenshot, and move it back really quickly. Might produce a bit of annoying flicker, but it might be better than nothing.","Q_Score":6,"Tags":"python,windows,screenshot","A_Id":1080741,"CreationDate":"2009-07-03T20:22:00.000","Title":"Screenshot an application, regardless of what's in front of it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I can use PIL to grab a screenshot of the desktop, and then use pywin32 to get its rectangle and crop out the part I want. However, if there's something in front of the window I want, it'll occlude the application I wanted a screenshot of. Is there any way to get what windows would say an application is currently displaying? It has that data somewhere, even when other windows are in front of it.","AnswerCount":7,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":12921,"Q_Id":1080719,"Users Score":0,"Answer":"IIRC, not in Windows pre-vista - with Aero each window has it's own buffer, but before that, you would just use your method, of getting the rectangle. I'm not sure if pywin32 has Aero support or not.","Q_Score":6,"Tags":"python,windows,screenshot","A_Id":1080733,"CreationDate":"2009-07-03T20:22:00.000","Title":"Screenshot an application, regardless of what's in front of it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have neglected my programming skills since i left school and now i want to start a few things that are running around in my head. Qt would be the toolkit for me to use but i am undecided if i should use Python (looks to me like the easier to learn with a few general ideas about programming) or C++ (the thing to use with Qt).\nIn my school we learned the basics with Turbo Pascal, VB and a voluntary C course, though right now i only know a hint of all the things i learned back then.\nCan you recommend me a way and a site or book (or two) that would bring me on that path (a perfect one would be one that teaches the language with help of the toolkit)?\nThank you in advance.","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4290,"Q_Id":1084935,"Users Score":25,"Answer":"Being an expert in both C++ and Python, my mantra has long been \"Python where I can, C++ where I must\": Python is faster (in term of programmer productivity and development cycle) and easier, C++ can give that extra bit of power when I have to get close to the hardware or be extremely careful about every byte or machine cycle I spend. In your situation, I would recommend Python (and the many excellent books and URLs already recommended in other answers).","Q_Score":8,"Tags":"c++,python,qt","A_Id":1084958,"CreationDate":"2009-07-05T22:13:00.000","Title":"C++ or Python as a starting point into GUI programming?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a game in python with pygame and need to render text onto the screen.\nI want to render this text in one colour with an outline, so that I don't have to worry about what sort of background the the text is being displayed over.\npygame.font doesn't seem to offer support for doing this sort of thing directly, and I'm wondering if anyone has any good solutions for achieving this?","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":2637,"Q_Id":1109498,"Users Score":4,"Answer":"A quick and dirty way would be to render your text multiple times with the outline color, shifted by small amounts on a circle around the text position:\n\n          1\n       8  |  2\n        \\ | \/\n         \\|\/\n     7----*----3\n         \/|\\\n        \/ | \\ \n       6  |  4\n          5\n\nEdit: Doh you've been faster ! I wont delete my answer though, this ASCII art is just too good and deserves to live !\nEdit 2: As OregonGhost mentioned, you may need more or fewer steps for the outline rendering, depending on your outline width.","Q_Score":7,"Tags":"python,fonts,pygame","A_Id":1109553,"CreationDate":"2009-07-10T13:24:00.000","Title":"What's a good way to render outlined fonts?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What would you use for a brand new cross platform GUI app, CPython or IronPython ?\nWhat about\n - license \/ freedom\n - development\n    - - doc\n    - - editors\n    - - tools\n - libraries\n - performances\n - portability  \nWhat can you do best with one or the other ?\n - networking\n - database\n - GUI\n - system\n - multi threading \/ processing","AnswerCount":4,"Available Count":4,"Score":0.1973753202,"is_accepted":false,"ViewCount":5086,"Q_Id":1149692,"Users Score":4,"Answer":"if you like\/need to use .net framework, use ironpython, else CPython it's your choice\n(or you can try PyPy :))","Q_Score":7,"Tags":"python,ironpython,cpython","A_Id":1149740,"CreationDate":"2009-07-19T11:21:00.000","Title":"CPython or IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What would you use for a brand new cross platform GUI app, CPython or IronPython ?\nWhat about\n - license \/ freedom\n - development\n    - - doc\n    - - editors\n    - - tools\n - libraries\n - performances\n - portability  \nWhat can you do best with one or the other ?\n - networking\n - database\n - GUI\n - system\n - multi threading \/ processing","AnswerCount":4,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":5086,"Q_Id":1149692,"Users Score":4,"Answer":"Use CPython, with IronPython you are bound to .Net platform which do not have much cross platform support, mono is there on linux but still for a cross platform app, I wouldn't recommend .Net.\nSo my suggestion is use CPython, for GUI use a framework like wxPython\/PyQT and you would be happy.","Q_Score":7,"Tags":"python,ironpython,cpython","A_Id":1149762,"CreationDate":"2009-07-19T11:21:00.000","Title":"CPython or IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What would you use for a brand new cross platform GUI app, CPython or IronPython ?\nWhat about\n - license \/ freedom\n - development\n    - - doc\n    - - editors\n    - - tools\n - libraries\n - performances\n - portability  \nWhat can you do best with one or the other ?\n - networking\n - database\n - GUI\n - system\n - multi threading \/ processing","AnswerCount":4,"Available Count":4,"Score":0.0996679946,"is_accepted":false,"ViewCount":5086,"Q_Id":1149692,"Users Score":2,"Answer":"cpython is native runtime based python,,,it has a thin runtime level to the hosting os,\nironpy is soft vm based python,,,it has a heavy soft interpter embeded in the dotnet vm,,which is called clr\noverall,,,cpython is made to be a scripting language natively,,it focus on the language,while ironpy is made to accomplished with clr,,,where clr is the main essisal,,then the ironpy language itself,,,it focus on the clr platform...\ncheck hellogameprogramming.net for more details","Q_Score":7,"Tags":"python,ironpython,cpython","A_Id":11117032,"CreationDate":"2009-07-19T11:21:00.000","Title":"CPython or IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What would you use for a brand new cross platform GUI app, CPython or IronPython ?\nWhat about\n - license \/ freedom\n - development\n    - - doc\n    - - editors\n    - - tools\n - libraries\n - performances\n - portability  \nWhat can you do best with one or the other ?\n - networking\n - database\n - GUI\n - system\n - multi threading \/ processing","AnswerCount":4,"Available Count":4,"Score":0.0996679946,"is_accepted":false,"ViewCount":5086,"Q_Id":1149692,"Users Score":2,"Answer":"I can only think of about one \"cross platform\" GUI app that's remotely tolerable (firefox), and people are complaining wildly about it everywhere I look.\nIf you want to do cross platform, build a nice, solid model that can do the work you need done and build platform-specific GUIs that use it.\nI don't know how tolerable wxpython or pyqt are on Windows and Linux, but the further you get from plain cocoa on OS X, the harder it gets to build and the less pleasant it gets to use.","Q_Score":7,"Tags":"python,ironpython,cpython","A_Id":1150371,"CreationDate":"2009-07-19T11:21:00.000","Title":"CPython or IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can anybody help me out in how to activate 'close' button of askquestion() of tkMessageBox??","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1575,"Q_Id":1151770,"Users Score":0,"Answer":"By 'activate', do you mean make it so the user can close the message box by clicking the close ('X') button?\nI do not think it is possible using tkMessageBox. I guess your best bet is to implement a dialog box with this functionality yourself.\nBTW: What should askquestion() return when the user closes the dialog box?","Q_Score":1,"Tags":"python,tkmessagebox","A_Id":1151900,"CreationDate":"2009-07-20T05:00:00.000","Title":"tkMessageBox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having some issues with the size of qt4 widgets when their content changes.\nI will illustrate my problems with two simple scenarios:\nScenario 1:\nI have a QLineEdit widget. Sometimes, when I'm changing its content using QLineEdit.setText(), the one-line string doesn't fit into the widget at its current size anymore. I must select the widget and use the arrow keys to scroll the string in both directions in order to see it all.\nScenario 2:\nI have a QTextEdit widget. Sometimes, when I'm changing its content using QTextEdit.setHtml(), the rendered HTML content doesn't fit into the widget at its current size anymore. The widget starts displaying horizontal and\/or vertical scroll bars and I can use them to scroll the HTML content.\nWhat I would want in such scenarios is to have some logic that decides if after a content change, the new content won't fit anymore into the widget and automatically increase the widget size so everything would fit.\nHow are these scenarios handled?\nI'm using PyQt4.\nEdit: after reading both the comment and the first answer (which mentions typing content into the widget), I went over the question one more time. I was unpleasantly surprised to find out a horrible typo. I meant QTextBrowser when I wrote QTextEdit, my apologies for misleading you. That is: I have a widget which renders HTML code that I'm changing and I would want the widget to grow enough to display everything without having scrollbars.\nAs for QLineEdit instead of QLabel - I went for QLineEdit since I've noticed I can't select text from a QLabel with the mouse for copying it. With QLineEdit it is possible.","AnswerCount":5,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":12735,"Q_Id":1153714,"Users Score":8,"Answer":"I'm answering in C++ here, since that's what I'm most familiar with, and your problem isn't specific to PyQt.\nNormally, you just need to call QWidget::updateGeometry() when the sizeHint() may have changed, just like you need to call QWidget::update() when the contents may have changed.\nYour problem, however, is that the sizeHint() doesn't change when text is added to QLineEdit and QTextEdit. For a reason: People don't expect their dialogs to grow-as-they-type :)\nThat said, if you really want grow-as-you-type behaviour in those widgets you need to inherit from them and reimplement sizeHint() and minimumSizeHint() to return the larger size, and potentially setText(), append() etc. to call updateGeometry() so the sizehint change is noticed.\nThe sizehint calculation won't be entirely trivial, and will be way easier for QLineEdit than for QTextEdit (which is secretly a QAbstractScrollArea), but you can look at the sizeHint() and minimumSizeHint() implementations for inspiration (also the one for QComboBox, which has a mode to do exactly what you want: QComboBox::AdjustToContents.\nEDIT: Your two usecases (QTextBrowser w\/o scrollbars and QLineEdit instead of QLabel just for selecting the text in there) can be solved by using a QLabel and a recent enough Qt. QLabel has gained both link-clicking notification and so-called \"text-interaction flags\" (one of which is TextSelectableByMouse) in Qt 4.2. The only difference that I was able to make out is that loading new content isn't automatic, there's no history, and there's no micro focus hinting (ie. tabbing from link to link) in QLabel.","Q_Score":12,"Tags":"c++,python,qt,qt4,pyqt4","A_Id":1166388,"CreationDate":"2009-07-20T13:53:00.000","Title":"PyQt: how to handle auto-resize of widgets when their content changes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having some issues with the size of qt4 widgets when their content changes.\nI will illustrate my problems with two simple scenarios:\nScenario 1:\nI have a QLineEdit widget. Sometimes, when I'm changing its content using QLineEdit.setText(), the one-line string doesn't fit into the widget at its current size anymore. I must select the widget and use the arrow keys to scroll the string in both directions in order to see it all.\nScenario 2:\nI have a QTextEdit widget. Sometimes, when I'm changing its content using QTextEdit.setHtml(), the rendered HTML content doesn't fit into the widget at its current size anymore. The widget starts displaying horizontal and\/or vertical scroll bars and I can use them to scroll the HTML content.\nWhat I would want in such scenarios is to have some logic that decides if after a content change, the new content won't fit anymore into the widget and automatically increase the widget size so everything would fit.\nHow are these scenarios handled?\nI'm using PyQt4.\nEdit: after reading both the comment and the first answer (which mentions typing content into the widget), I went over the question one more time. I was unpleasantly surprised to find out a horrible typo. I meant QTextBrowser when I wrote QTextEdit, my apologies for misleading you. That is: I have a widget which renders HTML code that I'm changing and I would want the widget to grow enough to display everything without having scrollbars.\nAs for QLineEdit instead of QLabel - I went for QLineEdit since I've noticed I can't select text from a QLabel with the mouse for copying it. With QLineEdit it is possible.","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":12735,"Q_Id":1153714,"Users Score":0,"Answer":"Ok implement sizeHint() method. And every time your content change size call updateGeometry()\nWhen content change without changing size use update(). (updateGeometry() automatically call update()).","Q_Score":12,"Tags":"c++,python,qt,qt4,pyqt4","A_Id":1813475,"CreationDate":"2009-07-20T13:53:00.000","Title":"PyQt: how to handle auto-resize of widgets when their content changes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a tkinter GUI that downloads data from multiple websites at once. I run a seperate thread for each download (about 28). Is that too much threads for one GUI process? because it's really slow, each individual page should take about 1 to 2 seconds but when all are run at once it takes over 40 seconds. Is there any way I can shorten the time it takes to download all the pages? Any help is appreciated, thanks.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":373,"Q_Id":1155404,"Users Score":0,"Answer":"You can try using processes instead of threads. Python has GIL which might cause some delays in your situation.","Q_Score":0,"Tags":"python,user-interface,multithreading,download,tkinter","A_Id":1155479,"CreationDate":"2009-07-20T19:20:00.000","Title":"Python accessing multiple webpages at once","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a tkinter GUI that downloads data from multiple websites at once. I run a seperate thread for each download (about 28). Is that too much threads for one GUI process? because it's really slow, each individual page should take about 1 to 2 seconds but when all are run at once it takes over 40 seconds. Is there any way I can shorten the time it takes to download all the pages? Any help is appreciated, thanks.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":373,"Q_Id":1155404,"Users Score":1,"Answer":"A process can have hundreds of threads on any modern OS without any problem.\nIf you're bandwidth-limited, 1 to 2 seconds times 28 means 40 seconds is about right.  If you're latency limited, it should be faster, but with no information, all I can suggest is:\n\nadd logging to your code to make sure it's actually running in parallel, and that you're not accidentally serializing your threads somehow;\nuse a network monitor to make sure that network requests are actually going out in parallel.\n\nIt's hard to give anything better without more information.","Q_Score":0,"Tags":"python,user-interface,multithreading,download,tkinter","A_Id":1155498,"CreationDate":"2009-07-20T19:20:00.000","Title":"Python accessing multiple webpages at once","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to detect which keys are currently pressed using Tkinter? I don't want to have to use extra libraries if possible. I can already detect when keys are pressed, but I want to be able to check at any time what keys are pressed down at the moment.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2295,"Q_Id":1181027,"Users Score":4,"Answer":"I think you need to keep track of events about keys getting pressed and released (maintaining your own set of \"currently pressed\" keys) -- I believe Tk doesn't keep track of that for you (and Tkinter really adds little on top of Tk, it's mostly a direct interface to it).","Q_Score":2,"Tags":"python,tkinter,keylistener","A_Id":1181037,"CreationDate":"2009-07-25T02:38:00.000","Title":"How can you check if a key is currently pressed using Tkinter in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?\nI'd appreciate a simple example - Boost::Python will do","AnswerCount":7,"Available Count":6,"Score":0.0855049882,"is_accepted":false,"ViewCount":522,"Q_Id":1181462,"Users Score":3,"Answer":"Here's two possibilities:\n\nPerhaps the C++ code is already written & available for use. \nIt's likely the C++ code is faster\/smaller than equivalent Python","Q_Score":4,"Tags":"c++,python","A_Id":1181468,"CreationDate":"2009-07-25T07:14:00.000","Title":"Practical point of view: Why would I want to use Python with C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?\nI'd appreciate a simple example - Boost::Python will do","AnswerCount":7,"Available Count":6,"Score":0.057080742,"is_accepted":false,"ViewCount":522,"Q_Id":1181462,"Users Score":2,"Answer":"Here's a real-life example:  I've written a DLL in C to interface with some custom hardware for work.  Then for the very first stage of testing, I was writing short programs in C to verify that the different commands were working properly.  The process of write, compile, run took probably 3-5 times as long as when I finally wrote a Python interface to the DLL using ctypes.\nNow, I can write testing scripts much more rapidly with much less regards to proper variable initialization and memory management that I would have to worry about in C.  In fact, I've even been able to use unit testing libraries in Python to create much more robust tests than before.  Would that have been possible in C?  Absolutely, but it would have taken me much longer, and it would have been many more lines of code.  \nFewer lines of code in Python means (in general) that there are fewer things with my main logic that can go wrong.\nMoreover, since the hardware communication is almost completely IO bound, there's no need to write any supporting code in C.  I may as well program in whatever is fastest to develop.\nSo there you go, real-life example.","Q_Score":4,"Tags":"c++,python","A_Id":1182301,"CreationDate":"2009-07-25T07:14:00.000","Title":"Practical point of view: Why would I want to use Python with C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?\nI'd appreciate a simple example - Boost::Python will do","AnswerCount":7,"Available Count":6,"Score":0.0,"is_accepted":false,"ViewCount":522,"Q_Id":1181462,"Users Score":0,"Answer":"One nice thing about using a scripting language is that you can reload new code into the application without quitting the app, then making changes, recompile, and then relaunching the app.  When people talk about quicker development times, some of that refers to this capability.\nA downside of using a scripting languages is that their debuggers are usually not as fully featured as what you would have in C++.  I haven't done any Python programming so I don't know what the features are of its debugger, if it has one at all.\nThis answer doesn't exactly answer what you asked but I thought it was relevant.  The answer is more the pro\/cons of using a scripting language.  Please don't flame me. :)","Q_Score":4,"Tags":"c++,python","A_Id":1182051,"CreationDate":"2009-07-25T07:14:00.000","Title":"Practical point of view: Why would I want to use Python with C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?\nI'd appreciate a simple example - Boost::Python will do","AnswerCount":7,"Available Count":6,"Score":0.0855049882,"is_accepted":false,"ViewCount":522,"Q_Id":1181462,"Users Score":3,"Answer":"Because C++ provides a direct way of calling OS services, and (if used in a careful way) can produce code that is more efficient in memory and time, whereas Python is a high-level language, and is less painful to use in those situations where utter efficiency isn't a concern and where you already have libraries giving you access to the services you need.\nIf you're a C++ user, you may wonder why this is necessary, but the expressiveness and safety of a high-level language has such a massive relative effect on your productivity, it has to be experienced to be understood or believed.\nI can't speak for Python specifically, but I've heard people talk in terms of \"tripling\" their productivity by doing most of their development in it and using C++ only where shown to be necessary by profiling, or to create extra libraries.\nIf you're a Python user, you may not have encountered a situation where you need anything beyond the libraries already available, and you may not have a problem with the performance you get from pure Python (this is quite likely). In which case - lucky you! You can forget about all this.","Q_Score":4,"Tags":"c++,python","A_Id":1181481,"CreationDate":"2009-07-25T07:14:00.000","Title":"Practical point of view: Why would I want to use Python with C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?\nI'd appreciate a simple example - Boost::Python will do","AnswerCount":7,"Available Count":6,"Score":0.1418931938,"is_accepted":false,"ViewCount":522,"Q_Id":1181462,"Users Score":5,"Answer":"Generally, you'd call C++ from python in order to use an existing library or other functionality. Often someone else has written a set of functions that make your life easier, and calling compiled C code is easier than re-writing the library in python.\nThe other reason is for performance purposes. Often, specific functions of an otherwise completely scripted program are written in a pre-compiled language like C because they take a long time to run and can be more efficiently done in a lower-level language.\nA third reason is for interfacing with devices. Python doesn't natively include a lot of code for dealing with sound cards, serial ports, and so on. If your device needs a device driver, python will talk to it via pre-compiled code you include in your app.","Q_Score":4,"Tags":"c++,python","A_Id":1181476,"CreationDate":"2009-07-25T07:14:00.000","Title":"Practical point of view: Why would I want to use Python with C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?\nI'd appreciate a simple example - Boost::Python will do","AnswerCount":7,"Available Count":6,"Score":0.0,"is_accepted":false,"ViewCount":522,"Q_Id":1181462,"Users Score":0,"Answer":"Performance :\n\nFrom my limited experience, Python is about 10 times slower than using C.\nUsing Psyco will dramatically improve it, but still about 5 times slower than C.\nBUT, calling c module from python is only a little faster than Psyco.\n\nWhen you have some libraries in C.\nFor example, I am working heavily on SIP.  It's a very complicated protocol stacks and there is no complete Python implementation.  So my only choice is calling SIP libraries written in C.\n\nThere are also this kind of cases, like video\/audio decoding.","Q_Score":4,"Tags":"c++,python","A_Id":1181567,"CreationDate":"2009-07-25T07:14:00.000","Title":"Practical point of view: Why would I want to use Python with C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The Python manual says that you can create modules for Python in both C and C++. Can you take advantage of things like classes and templates when using C++? Wouldn't it create incompatibilities with the rest of the libraries and with the interpreter?","AnswerCount":4,"Available Count":2,"Score":0.1488850336,"is_accepted":false,"ViewCount":567,"Q_Id":1185878,"Users Score":3,"Answer":"The boost folks have a nice automated way to do the wrapping of C++ code for use by python.\nIt is called: Boost.Python\nIt deals with some of the constructs of C++ better than SWIG, particularly template metaprogramming.","Q_Score":6,"Tags":"c++,python,c,python-c-api,python-c-extension","A_Id":1185954,"CreationDate":"2009-07-26T23:30:00.000","Title":"Can I use C++ features while extending Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"The Python manual says that you can create modules for Python in both C and C++. Can you take advantage of things like classes and templates when using C++? Wouldn't it create incompatibilities with the rest of the libraries and with the interpreter?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":567,"Q_Id":1185878,"Users Score":9,"Answer":"It doesn't matter whether your implementation of the hook functions is implemented in C or in C++. In fact, I've already seen some Python extensions which make active use of C++ templates and even the Boost library. No problem. :-)","Q_Score":6,"Tags":"c++,python,c,python-c-api,python-c-extension","A_Id":1185907,"CreationDate":"2009-07-26T23:30:00.000","Title":"Can I use C++ features while extending Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a PyShell, which is supposed to be derived from wx.stc.StyledTextCtrl. How do I change the color scheme that it currently uses?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":828,"Q_Id":1211380,"Users Score":0,"Answer":"You can use \nstyledTextCtrl.StyleSetSpec(wx.stc.STC_STYLE_INDENTGUIDE, \"fore:#CDCDCD\")\n(Bunch of .StyleSetSpec properties)\n...\n...\n...\nstyCtrl.SetCaretForeground(\"BLUE\")\nstyCtrl.SetSelBackground(True, wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT))\nstyCtrl.SetSelForeground(True, wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT))\n...\n(Bunch of Set*() commands)\nDon't know if there is a way to load a pre-defined color scheme.\nYou could define it in YAML and load it up via the commands above and more.","Q_Score":1,"Tags":"python,user-interface,wxpython,color-scheme","A_Id":1272807,"CreationDate":"2009-07-31T08:51:00.000","Title":"wxPython: Changing the color scheme of a wx.stc.StyledTextCtrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using pygtk with PIL. I've already figured out a way to convert PIL Images to gtk.gdk.Pixbufs. What I do to display the pixbuf is I create a gtk.gdk.Image, and then use img.set_from_pixbuf. I now want to draw a few lines onto this image. Apparently I need a Drawable to do that. I've started looking through the docs but already I have 8-10 windows open and it is not being straightforward at all. \nSo - what magic do I need to type to get a Drawable representing my picture, draw some things on to it, and then turn it into a gdk.Image so I can display it on my app?","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":5113,"Q_Id":1213090,"Users Score":1,"Answer":"You should connect to the expose-event (GTK 2) or draw (GTK 3) signal. In that handler, simply use image.window to get the widget's gtk.gdk.Window; this is a subclass of gtk.gdk.Drawable, so you can draw on it.","Q_Score":3,"Tags":"python,gtk,drawing,pygtk","A_Id":6578903,"CreationDate":"2009-07-31T15:10:00.000","Title":"pygtk: Draw lines onto a gtk.gdk.Pixbuf","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to be warned when user selects the whole row in a wxGrid but I do not see an event that handles this.What is the best way to do it?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":3008,"Q_Id":1215846,"Users Score":1,"Answer":"Actually, I figured it out. There are events like EVT_GRID_LABEL_LEFT_CLICK and then I test event.GetCol() == -1, to make sure the click is on a whole row, not a whole column.","Q_Score":3,"Tags":"events,wxpython","A_Id":1263720,"CreationDate":"2009-08-01T04:40:00.000","Title":"Detect row selection in wxGrid","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently working on a game engine written in pygame and I wanted to add OpenGL support.\nI wrote a test to see how to make pygame and OpenGL work together, and when it's running in windowed mode, it runs between 150 and 200 fps. When I run it full screen (all I did was add the FULLSCREEN flag when I set up the window), it drops down to 60 fps. I added a lot more drawing functions to see if it was just a huge performance drop, but it always ran at 60 fps.\nIs there something extra I need to do to tell OpenGL that it's running fullscreen or is this a limitation of OpenGL?\n(I am running in Windows XP)","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3949,"Q_Id":1217939,"Users Score":0,"Answer":"If you are not changing your clock.tick() when you change between full screen and windowed mode this is almost certainly a vsync issue. If you are on an LCD then it's 100% certain.\nUnfortunately v-sync can be handled in many places including SDL, Pyopengl, your display server and your video drivers. If you are using windows you can adjust the vsync toggle in the nvidia control panel to test, and there's more than likely something in nvidia-settings for linux as well. I'd guess other manufacturers drivers have similar settings but that's a guess.","Q_Score":2,"Tags":"python,fullscreen,pygame,pyopengl","A_Id":1218011,"CreationDate":"2009-08-02T01:22:00.000","Title":"PyOpenGL + Pygame capped to 60 FPS in Fullscreen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using pyGTK. I want to layout a large element with 2 smaller ones on each side. For aesthetic reasons, I want the 2 smaller ones to be the same size. As it is, they differ by a few pixels, and the middle element is not centered as a result.\nI tried using gtk.Table with 3 cells, but having homogeneous=True doesn't have the desired effect. I tried messing with it by making 8 cells, and then having the center one take up more cells, but it doesn't work well. Is there any way to do this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":238,"Q_Id":1229933,"Users Score":6,"Answer":"You should use GtkSizeGroup for this. Create a GtkSizeGroup, add both widgets to it. This will ensure that both widgets have the same size. If you want that widget have the same size in only one direction (width or height), set the \"mode\" property of SizeGroup.","Q_Score":1,"Tags":"python,layout,gtk,pygtk","A_Id":1229981,"CreationDate":"2009-08-04T21:04:00.000","Title":"How to make two elements in gtk have the same size?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For example, graying out the \"X\" on windows systems.","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":721,"Q_Id":1235417,"Users Score":4,"Answer":"Just call the set_deletable with False on the window in question. It will work as long as GTK can convince the window manager to make the window unclosable.","Q_Score":4,"Tags":"python,windows,gtk,pygtk","A_Id":1235424,"CreationDate":"2009-08-05T19:59:00.000","Title":"In GTK, how do I make a window unable to be closed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Various examples always use alloc_color() and stuff like gtk.color.parse('red'), etc. I just do gtk.gdk.Color(65535,0,0), and that seems to work. What's the need for alloc_color?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":236,"Q_Id":1242541,"Users Score":2,"Answer":"If you're running on a system that uses a palette display (as opposed to a true-colour display), then you must allocate new colours in the palette before you can use them. This is because palette-based displays can only display a limited number of colours at once (usually 256 or sometimes 65536).\nMost displays these days are capable of true colour display, which can display all available colours simultaneously, so this won't appear to be a problem and you can get away with directly asking for specific colours.","Q_Score":1,"Tags":"python,gtk,colors,pygtk","A_Id":1242550,"CreationDate":"2009-08-07T02:03:00.000","Title":"What's the point of alloc_color() in gtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff...\nWe have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using the results of gtk.StatusIcon.get_geometry() to calculate the size and position. \nOf course, the docs for gtk.StatusIcon.get_geometry() point out that \"some platforms do not provide this information\"--and this includes MS Windows, as I get NoneType as the result.\nI can make a guess and position the window in the bottom-right corner of the screen, 30 pixels up from the bottom--as this will catch the majority of Windows users who haven't moved the taskbar. But for those that have, it looks all wrong.\nSo is there a Windows-friendly way to get the position of the systray icon so I can place my window there?\n\nPlease note: I am already using gtk_menu_popup() with gtk_status_icon_position_menu for a pop-up menu which works correctly.\nBut what I am trying to position is a separate gtk.Window, which will not accept gtk_status_icon_position_menu (because it's not a menu).\nAny other ideas would be appreciated...","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1237,"Q_Id":1246552,"Users Score":1,"Answer":"Gtk provides function gtk_status_icon_position_menu that can be passed into gtk_menu_popup as a GtkPositionFunc.\nThis seems to provide the requested functionality.","Q_Score":4,"Tags":"python,windows,gtk,pygtk","A_Id":1247303,"CreationDate":"2009-08-07T19:27:00.000","Title":"Getting the position of the gtk.StatusIcon on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff...\nWe have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using the results of gtk.StatusIcon.get_geometry() to calculate the size and position. \nOf course, the docs for gtk.StatusIcon.get_geometry() point out that \"some platforms do not provide this information\"--and this includes MS Windows, as I get NoneType as the result.\nI can make a guess and position the window in the bottom-right corner of the screen, 30 pixels up from the bottom--as this will catch the majority of Windows users who haven't moved the taskbar. But for those that have, it looks all wrong.\nSo is there a Windows-friendly way to get the position of the systray icon so I can place my window there?\n\nPlease note: I am already using gtk_menu_popup() with gtk_status_icon_position_menu for a pop-up menu which works correctly.\nBut what I am trying to position is a separate gtk.Window, which will not accept gtk_status_icon_position_menu (because it's not a menu).\nAny other ideas would be appreciated...","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1237,"Q_Id":1246552,"Users Score":0,"Answer":"The behavior i experienced in windows with gtk_status_icon_position_menu was that it spawns the window at the location the user clicked in the statusicon","Q_Score":4,"Tags":"python,windows,gtk,pygtk","A_Id":1874016,"CreationDate":"2009-08-07T19:27:00.000","Title":"Getting the position of the gtk.StatusIcon on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've just started working with pygame and I'm trying to make a semi-transparent sprite, and the sprite's source file is a non-transparent bitmap file loaded from the disk. I don't want to edit the source image if I can help it. I'm sure there's a way to do this with pygame code, but Google is of no help to me.","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":7546,"Q_Id":1247921,"Users Score":1,"Answer":"you might consider switching to using png images where you can do any kind of transparency you want directly in the image.","Q_Score":4,"Tags":"python,graphics,sprite,pygame","A_Id":1247984,"CreationDate":"2009-08-08T03:51:00.000","Title":"How to make translucent sprites in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to create a non-editable text box with no cursor in wxPython to dump text in?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4502,"Q_Id":1254819,"Users Score":7,"Answer":"wx.StaticText\nYou could also use a regular TextCtrl with the style TE_READONLY but that shows a cursor and the text looks editable, but it isn't.","Q_Score":5,"Tags":"python,textbox,wxpython,wxwidgets","A_Id":1254881,"CreationDate":"2009-08-10T13:16:00.000","Title":"Non-editable text box in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to change only hight of an object in wxPython, leaving its width automatic? In my case it's a TextCtrl.\nHow to make the height of the window available for change and lock the width?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":258,"Q_Id":1265821,"Users Score":6,"Answer":"For the width or height to be automatically determined based on context you use for it the value of -1, for example (-1, 100) for a height of 100 and automatic width.\nThe default size for controls is usually (-1, -1).\nIf a width or height is specified and the sizer item for the control doesn't have wx.EXPAND flag set (note that even if this flag is set some sizers won't expand in both directions by default) you might call it \"locked\" as it won't chage that dimension.\nMake sure to study the workings of sizers in depth as it is one of the most important things in GUI design.","Q_Score":2,"Tags":"python,wxpython,size","A_Id":1265988,"CreationDate":"2009-08-12T12:22:00.000","Title":"Changing height of an object in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In GTK, how can I scale an image? Right now I load images with PIL and scale them beforehand, but is there a way to do it with GTK?","AnswerCount":6,"Available Count":1,"Score":-0.0333209931,"is_accepted":false,"ViewCount":18745,"Q_Id":1269320,"Users Score":-1,"Answer":"actually when we use\ngdk_pixbuf_scale_simple(pb,700,700,GDK_INTERP_BILINEAR); this function causes memory leakage (If we monitor task manager the memory requirement goes on increasing till it kills the process) when used with a timer event. How to solve that","Q_Score":22,"Tags":"python,user-interface,image,gtk,pygtk","A_Id":64004356,"CreationDate":"2009-08-12T23:44:00.000","Title":"Scale an image in GTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a top-down view 2d game at the moment and I am learning a ton about sprites and sprite handling. My question is how to handle a set of sprites that can be rotated in as many as 32 directions.\nAt the moment a given object has its sprite sheet with all of the animations oriented with the object pointing at 0 degrees at all times. Now, since the object can rotate in as many as 32 directions, what is the best way to work with that original sprite sheet. My current best guess is to have the program basically dynamically create 32 more sprite sheets when the object is first loaded into the game, and then all subsequent instances of that type of object will share those sprite sheets.\nAnyways, any advice in this regard would be helpful. Let me know if I need to rephrase the question, I know its kindof an odd one. Thanks\nEdit: I guess for more clarification. If I have, for instance an object that has 2 animations of 5 frames a peice, that is a pretty easy sprite sheet to create and organize, its a simple 2x5 grid (or 5x2 depending on how you lay it out). But the problem is that now those 2 animations have to be rotated in 32 directions. This means that in the end there will be 320 individual sprites. I am going to say that (and correct me if im wrong) since I'm concerned about performance and frame-rate, rotating the sprites on the fly every single frame is not an option. So, how should these 320 sprites that make up these 2 animations be organized? Would it be better to\n\nThink of it as 32 2x5 sprite sheets\nsplit the sprite sheet up into individual frames, and then have an array the 32 different directions per frame (so 10 arrays of 32 directional sprites)\nOther....?\nDoesn't matter?\n\nThanks","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1381,"Q_Id":1275482,"Users Score":1,"Answer":"Typically you will sacrifice either processor time or memory, and you need to balance between the two. Unless you've got some great limit to your processor or you're computing a lot of expensive stuff, there's no real reason to put all that into the memory. Rotating a few sprites with a transform is cheap enough that it is definitely not worth it to store 32x as much information in memory - especially because that information is a bunch of images, and images use up a lot of memory, relatively speaking.","Q_Score":2,"Tags":"python,pygame,sprite","A_Id":1296881,"CreationDate":"2009-08-14T00:47:00.000","Title":"What is the best way to handle rotating sprites for a top-down view game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a top-down view 2d game at the moment and I am learning a ton about sprites and sprite handling. My question is how to handle a set of sprites that can be rotated in as many as 32 directions.\nAt the moment a given object has its sprite sheet with all of the animations oriented with the object pointing at 0 degrees at all times. Now, since the object can rotate in as many as 32 directions, what is the best way to work with that original sprite sheet. My current best guess is to have the program basically dynamically create 32 more sprite sheets when the object is first loaded into the game, and then all subsequent instances of that type of object will share those sprite sheets.\nAnyways, any advice in this regard would be helpful. Let me know if I need to rephrase the question, I know its kindof an odd one. Thanks\nEdit: I guess for more clarification. If I have, for instance an object that has 2 animations of 5 frames a peice, that is a pretty easy sprite sheet to create and organize, its a simple 2x5 grid (or 5x2 depending on how you lay it out). But the problem is that now those 2 animations have to be rotated in 32 directions. This means that in the end there will be 320 individual sprites. I am going to say that (and correct me if im wrong) since I'm concerned about performance and frame-rate, rotating the sprites on the fly every single frame is not an option. So, how should these 320 sprites that make up these 2 animations be organized? Would it be better to\n\nThink of it as 32 2x5 sprite sheets\nsplit the sprite sheet up into individual frames, and then have an array the 32 different directions per frame (so 10 arrays of 32 directional sprites)\nOther....?\nDoesn't matter?\n\nThanks","AnswerCount":3,"Available Count":2,"Score":0.2605204458,"is_accepted":false,"ViewCount":1381,"Q_Id":1275482,"Users Score":4,"Answer":"The 32 directions for the sprite translate into 32 rotations by 11.25 degrees. \nYou can reduce the number of precalculated images to 8 you only calculate the first 90 degrees (11.25, 22.5, 33.75, 45.0, 56.25, 67.5, 78.75, 90.0) and use the flip operations dynamically. Flips are much faster because they essentially only change the order an image is copied from the buffer. \nFor example, when you display an image that is rotated by 101.25 degrees, load the precalculated image of 67.5 degrees and flip it vertically.\nI just realized that this only works if your graphic is symmetrical ;-)\nWhen talking about a modern computer, you might not need to optimize anything. The memory used by precalculating the sprites is certainly negligible, and the cpu usage when rotating the image probably too. When you are programming for a embedded device however, it does matter.","Q_Score":2,"Tags":"python,pygame,sprite","A_Id":1277181,"CreationDate":"2009-08-14T00:47:00.000","Title":"What is the best way to handle rotating sprites for a top-down view game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am familiar with both Python and C++ as a programmer. I was thinking of writing my own simple web application and I wanted to know which language would be more appropriate for server-side web development.\nSome things I'm looking for:\n\nIt has to be intuitive. I recognize that Wt exists and it follows the model of Qt. The one thing I hate about Qt is that they encourage strange syntax through obfuscated means (e.g. the \"public slots:\" idiom). If I'm going to write C++, I need it to be standard, recognizable, clean code. No fancy shmancy silliness that Qt provides.\nThe less non-C++ or Python code I have to write, the better. The thing about Django (Python web framework) is that it requires you pretty much write the HTML by hand. I think it would be great if HTML forms took more of a wxWidgets approach. Wt is close to this but follows the Qt model instead of wxWidgets.\n\nI'm typically writing video games with C++ and I have no experience in web development. I want to write a nice web site for many reasons. I want it to be a learning experience, I want it to be fun, and I want to easily be able to concentrate on \"fun stuff\" (e.g. less boilerplate, more meat of the app).\nAny tips for a newbie web developer? I'm guessing web app frameworks are the way to go, but it's just a matter of picking one.","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":10487,"Q_Id":1289941,"Users Score":0,"Answer":"Having looked several ones, like django, pylos, web2py, wt. My recommendation is web2py. It's a python version of \"ruby on rails\" and easy to learn.","Q_Score":12,"Tags":"c++,python,wt","A_Id":1475164,"CreationDate":"2009-08-17T19:33:00.000","Title":"Web Application Frameworks: C++ vs Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am familiar with both Python and C++ as a programmer. I was thinking of writing my own simple web application and I wanted to know which language would be more appropriate for server-side web development.\nSome things I'm looking for:\n\nIt has to be intuitive. I recognize that Wt exists and it follows the model of Qt. The one thing I hate about Qt is that they encourage strange syntax through obfuscated means (e.g. the \"public slots:\" idiom). If I'm going to write C++, I need it to be standard, recognizable, clean code. No fancy shmancy silliness that Qt provides.\nThe less non-C++ or Python code I have to write, the better. The thing about Django (Python web framework) is that it requires you pretty much write the HTML by hand. I think it would be great if HTML forms took more of a wxWidgets approach. Wt is close to this but follows the Qt model instead of wxWidgets.\n\nI'm typically writing video games with C++ and I have no experience in web development. I want to write a nice web site for many reasons. I want it to be a learning experience, I want it to be fun, and I want to easily be able to concentrate on \"fun stuff\" (e.g. less boilerplate, more meat of the app).\nAny tips for a newbie web developer? I'm guessing web app frameworks are the way to go, but it's just a matter of picking one.","AnswerCount":7,"Available Count":2,"Score":0.0285636566,"is_accepted":false,"ViewCount":10487,"Q_Id":1289941,"Users Score":1,"Answer":"I think you better go firt python in your case, meanwhile you can extend cppCMS functionalities and write your own framework arround it.\nwt was a good idea design, but somehow not that suitable.","Q_Score":12,"Tags":"c++,python,wt","A_Id":1290620,"CreationDate":"2009-08-17T19:33:00.000","Title":"Web Application Frameworks: C++ vs Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a wx.Frame that has only a single child. While setting up the child's wx.Sizer, I can use the wx.SHAPED flag, which keeps the aspect ratio of the child locked. However, the Frame still has complete freedom in it's aspect ratio, and will leave a blank space in the area that is left unused by the child.\nHow can I lock the aspect ratio of the wx.Frame during resizing?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5993,"Q_Id":1291991,"Users Score":5,"Answer":"Sizers cannot be applied to top-level windows (in order to define properties of the windows themselves as opposed to their contents), so unfortunately there is no \"true\" way to lock in the aspect ratio. Your best bet would be to catch your window's OnSize event, get the size that the user wants the window to be (which is stored in the wxSizeEvent), calculate the new width and height according to the aspect ratio and then immediately call SetSize with the new size. \nThis technique has the drawback of visual artifacts during resizing (the operating system will initially paint the window according to how the user has dragged it but then immediately redraw it after you call SetSize, leading to a flickering effect) so it isn't a great solution, however since you cannot lock top-level windows into aspect ratios (and prevent the need to resize with SetSize at all) you'll have to decide whether the flickering is worth it.","Q_Score":2,"Tags":"wxpython,resize,wxwidgets,frame,aspect-ratio","A_Id":1292083,"CreationDate":"2009-08-18T05:37:00.000","Title":"wxwidgets\/wxPython: Resizing a wxFrame while keeping aspect ratio","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two PNGs that I am trying to combine into a PDF using ReportLab 2.3 on Python 2.5.  When I use canvas.drawImage(ImageReader) to write either PNG onto the canvas and save, the transparency comes out black.  If I use PIL (1.1.6) to generate a new Image, then paste() either PNG onto the PIL Image, it composits just fine.  I've double checked in Gimp and both images have working alpha channels and are being saved correctly.  I'm not receiving an error and there doesn't seem to be anything my google-fu can turn up.  \nHas anybody out there composited a transparent PNG onto a ReportLab canvas, with the transparency working properly?  Thanks!","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":11462,"Q_Id":1308710,"Users Score":2,"Answer":"I've found that mask='auto' has stopped working for me with reportlab 3.1.8. In the docs it says to pass the values that you want masked out. So what works for me now is mask=[0, 2, 0, 2, 0, 2, ]. Basically it looks like this `mask=[red_start, red_end, green_start, green_end, blue_start, blue_end, ]\n\nThe mask parameter lets you create transparent images. It takes 6\n  numbers and defines the range of RGB values which will be masked out\n  or treated as transparent. For example with [0,2,40,42,136,139], it\n  will mask out any pixels with a Red value from 0 or 1, Green from 40\n  or 41 and Blue of 136, 137 or 138 (on a scale of 0-255). It's\n  currently your job to know which color is the 'transparent' or\n  background one.\n\nUPDATE: That masks out anything that is rgb(0, 0, 0) or rgb(1, 1, 1) which obviously might not be the right solution. My problem was people uploading png images with a gray color space. So I need to still figure out a way to detect the color space of the image. and only apply that mask on gray space images.","Q_Score":29,"Tags":"python,python-imaging-library,reportlab","A_Id":28385327,"CreationDate":"2009-08-20T20:45:00.000","Title":"Transparency in PNGs with reportlab 2.3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two PNGs that I am trying to combine into a PDF using ReportLab 2.3 on Python 2.5.  When I use canvas.drawImage(ImageReader) to write either PNG onto the canvas and save, the transparency comes out black.  If I use PIL (1.1.6) to generate a new Image, then paste() either PNG onto the PIL Image, it composits just fine.  I've double checked in Gimp and both images have working alpha channels and are being saved correctly.  I'm not receiving an error and there doesn't seem to be anything my google-fu can turn up.  \nHas anybody out there composited a transparent PNG onto a ReportLab canvas, with the transparency working properly?  Thanks!","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":11462,"Q_Id":1308710,"Users Score":1,"Answer":"ReportLab uses PIL for managing images. Currently, PIL trunk has patch applied to support transparent PNGs, but you will have to wait for a 1.1.6 release if you need stable package.","Q_Score":29,"Tags":"python,python-imaging-library,reportlab","A_Id":1311056,"CreationDate":"2009-08-20T20:45:00.000","Title":"Transparency in PNGs with reportlab 2.3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started using Wing IDE and it's great. I'm building a wxPython app, and I noticed that Wing IDE catches exceptions that are usually caught by wxPython and not really raised. This is usually useful, but I would like to disable this behavior occasionally. How do I do that?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":175,"Q_Id":1323361,"Users Score":0,"Answer":"There is a Ignore this exception location check box in the window where the exception is reported in wing, or you could explicitly silence that specific exception in you code with a try except block.","Q_Score":0,"Tags":"python,wxpython,wing-ide","A_Id":1323458,"CreationDate":"2009-08-24T16:21:00.000","Title":"Getting Wing IDE to stop catching the exceptions that wxPython catches","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using IronPython studio to create IronPython scripts and convert them into executables. When converted to executables, it creates a Main exe and two dlls (IronMath.dll and IronPython.dll). Is it possible to create the executables without IronPython studio. I tried PYC downloaded from codeplex.com. It creates an exe and a dll with the same name as that of the exe (say main.exe and main.dll). But I need an exe and two dlls (similar to what is created by the IronPython studio). So that I can use other IronPython exes without any separate dlls (these 2 dlls would be enough for any FePy exe).","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":3879,"Q_Id":1327105,"Users Score":1,"Answer":"I maybe don't understand the question well but copying IronMath.dll and IronPython.dll to the folder with main.exe and main.dll should work for Ironpython 1.x. These .dlls are different for IronPython 2.x.\nEdit: Well, I tried PYC with IP 1.1 and it does not work. That means you have to use it with at least IP 2.0.2 (it is located in Samples\\pyc folder). For simple script 'print 'hello' you need to ship (along with hello.dll and hello.exe).\n\nIronPython.dll\nMicrosoft.Scripting.Core.dll\nMicrosoft.Scripting.dll\nMicrosoft.Scripting.ExtensionAttribute.dll\n\nFor more complicated script you will probably need IronPython.Modules.dll as well.","Q_Score":0,"Tags":"ironpython,ironpython-studio","A_Id":1330323,"CreationDate":"2009-08-25T09:25:00.000","Title":"Generating EXE out of IronPython script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using IronPython studio to create IronPython scripts and convert them into executables. When converted to executables, it creates a Main exe and two dlls (IronMath.dll and IronPython.dll). Is it possible to create the executables without IronPython studio. I tried PYC downloaded from codeplex.com. It creates an exe and a dll with the same name as that of the exe (say main.exe and main.dll). But I need an exe and two dlls (similar to what is created by the IronPython studio). So that I can use other IronPython exes without any separate dlls (these 2 dlls would be enough for any FePy exe).","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3879,"Q_Id":1327105,"Users Score":0,"Answer":"A DLL is a dynamically linked library. It's required for your application to run properly. All applications written in .NET use them. You just don't know it, because support is built into the .NET framework, which most everyone has installed on their systems. Yay, way to go Microsoft. The DLR (Dynamic Language Runtime) isn't built into any .NET destributable at this time, however (this will change in .NET 4.0). That's why you get the dll file. \nAre you writing software that utilizes any .NET libraries? If not, just write it in good 'ol cpython (the way you're supposed to). Then, uou should look into a program called py2exe. Have you ever used uTorrent? I'm assuming you have. It's build using strait up cpython + py2exe.\nEnjoy. :)","Q_Score":0,"Tags":"ironpython,ironpython-studio","A_Id":1344862,"CreationDate":"2009-08-25T09:25:00.000","Title":"Generating EXE out of IronPython script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using IronPython studio to create IronPython scripts and convert them into executables. When converted to executables, it creates a Main exe and two dlls (IronMath.dll and IronPython.dll). Is it possible to create the executables without IronPython studio. I tried PYC downloaded from codeplex.com. It creates an exe and a dll with the same name as that of the exe (say main.exe and main.dll). But I need an exe and two dlls (similar to what is created by the IronPython studio). So that I can use other IronPython exes without any separate dlls (these 2 dlls would be enough for any FePy exe).","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":3879,"Q_Id":1327105,"Users Score":2,"Answer":"I have created a C# application that uses the IronPython.dll and IronMath.dll to convert the IronPython scripts to executables. This doesn't require IronPython studio to be present. Only the DLLs are enough. The behavior of exe is same as that created by IronPython studio(Integrated with VS2008)","Q_Score":0,"Tags":"ironpython,ironpython-studio","A_Id":1389659,"CreationDate":"2009-08-25T09:25:00.000","Title":"Generating EXE out of IronPython script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want main window to \"gray, freeze, stop working\", when some other window is opened. Is there some default way to do it? Pretty much the same as gtk.Dialog is working.\nEDIT: Currently I'm just replacing all contents by a text line, but I guess there should be better way.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":310,"Q_Id":1329076,"Users Score":3,"Answer":"You really shouldn't try to make a program become unresponsive.\nIf what you want to do is stop the user from using the window, make the dialog modal: gtk.Dialog.set_modal(True)","Q_Score":0,"Tags":"python,window,pygtk,freeze","A_Id":1329140,"CreationDate":"2009-08-25T15:33:00.000","Title":"How to freeze\/grayish window in pygtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Quick question.\nI'm using Linux and I want to try making a GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.\nIs there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is there any IDE that allows you to create GUI like Microsoft Visual Studio does (for C#, C, Visual Basic etc.)?\nOr should I maybe use another language other than Python to make GUI applications?","AnswerCount":5,"Available Count":1,"Score":0.0798297691,"is_accepted":false,"ViewCount":48034,"Q_Id":1355918,"Users Score":2,"Answer":"Each desktop environment uses a specific toolkit to build it's components. For example, KDE uses Qt and GNOME uses Gtk. \nYour use of a toolkit will be dependent upon what type of desktop environment you're targeting at, and if you want to target a wide range of desktops then use a toolkit which will work on many desktop environments, like Wx widgets which will work on Linux, Mac OS and Windows. For building simple GUI applications, Tkinter will do.","Q_Score":14,"Tags":"python,linux,user-interface,gtk,pygtk","A_Id":1355948,"CreationDate":"2009-08-31T05:25:00.000","Title":"Creating GUI with Python in Linux","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a simple tool to add album cover images to mp3 files in python. So far I am just working on sending a request to amazon with artist and album title, and get the resulting list, as well as finding the actual images for each result. What I want to do is to display a simple frame with a button\/link for each image, and a skip\/cancel button.\nI have done some googling, but I can't find examples that I can use as a base.\n\nI want to display the images directly from the web. Ie. using urllib to open and read the bytes into memory, rather than go via a file on disk\nI want to display the images as buttons preferably\n\nAll examples seems to focus on working on files on disk, rather with just a buffer. The TK documentation in the python standard library doesn't seem to cover the basic Button widget. This seems like an easy task, I have just not had any luck in finding the proper documentation yet.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":7084,"Q_Id":1356255,"Users Score":-1,"Answer":"For displaying jpgs in Python check out PIL","Q_Score":5,"Tags":"python,tkinter","A_Id":1356882,"CreationDate":"2009-08-31T07:32:00.000","Title":"Display jpg images in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am about to start my A-Level Computing project (High School Level) which will hopefully be a  point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course and not get into University. So this is quite important to me.\nI want to use Python to develop a Cocoa app. I know that I need PyObjc, however all details on the net seem to assume it is pre-installed. Apparently this is the case with Leopard and Snow Leopard but I don't seem to have it on Snow Leopard and never noticed it on Leopard. Also, I have tried installing the latest beta of PyObjc by following the instructions on the Sourceforge page, but with no luck.\nI would really appreciate it if anyone could shed some light on what needs to be installed, how, and links to any resources or tutorials that could help me.\nThanks in advance for the help!\nUpdate: I see that this is a popular question, I just got the 'Notable Question' badge for it so I thought I would update anyone coming to this page on what I did after getting the answers.\nUnfortunately, I wasn't able to use Python to create a Mac application. This was rather disappointing at the time, but probably a good thing. I made a Windows app in C# for my project, it was a tool for creating and running Assembly apps in a simulated environment. My course teacher has now started to use my tool to teach the course instead of his own! I got a very high score on the computing project (over 90%) and this contributed to me getting an A* in my computing A-Level (the highest grade available) and I consequently got in to Southampton University to study Computer Science. \nThis summer, I decided to make an iPad app (soon to be released) and I am glad to say that I know think I could make a Mac OS application in Objective-C as I feel I have learnt enough. I am glad that I took the time to learn it, it is a great language and really useful with iOS becoming so popular.\nSorry for all the boasting, but I am really happy about it. What I really want to say is, if you are coming to this page hoping to use PyObjc to create Mac apps easily, don't bother. It takes some time and some effort, but once you have learnt Objective-C, it is really satisfying to create apps with it. Good Luck!","AnswerCount":6,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":4914,"Q_Id":1359227,"Users Score":18,"Answer":"Allow me to echo what has already been said. I too am a student who just started a Cocoa development project, and at the beginning I thought \"Well, I already know Python, I'll just use PyObjC and save myself from having to learn Objective-C, which looks beyond my grasp.\" I learned quickly that it can't be done. You can develop for OS X without learning Objective-C, but not without learning the Cocoa libraries, which constitute 99% of what you need to learn to write a Cocoa app in Objective-C. Objective-C itself isn't that hard; it's the Cocoa libraries that you need to invest in learning.\nPyObjC basically uses Cocoa libraries and Python syntax. I gave up with it quickly and decided that if I was going to have to learn Cocoa, I may as well use Objective-C.\nIf you're looking to learn, Aaron Hillegass's book is a good place to start. Good luck!","Q_Score":12,"Tags":"python,cocoa,xcode,osx-snow-leopard,pyobjc","A_Id":1359605,"CreationDate":"2009-08-31T20:19:00.000","Title":"PyObjc and Cocoa on Snow Leopard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am about to start my A-Level Computing project (High School Level) which will hopefully be a  point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course and not get into University. So this is quite important to me.\nI want to use Python to develop a Cocoa app. I know that I need PyObjc, however all details on the net seem to assume it is pre-installed. Apparently this is the case with Leopard and Snow Leopard but I don't seem to have it on Snow Leopard and never noticed it on Leopard. Also, I have tried installing the latest beta of PyObjc by following the instructions on the Sourceforge page, but with no luck.\nI would really appreciate it if anyone could shed some light on what needs to be installed, how, and links to any resources or tutorials that could help me.\nThanks in advance for the help!\nUpdate: I see that this is a popular question, I just got the 'Notable Question' badge for it so I thought I would update anyone coming to this page on what I did after getting the answers.\nUnfortunately, I wasn't able to use Python to create a Mac application. This was rather disappointing at the time, but probably a good thing. I made a Windows app in C# for my project, it was a tool for creating and running Assembly apps in a simulated environment. My course teacher has now started to use my tool to teach the course instead of his own! I got a very high score on the computing project (over 90%) and this contributed to me getting an A* in my computing A-Level (the highest grade available) and I consequently got in to Southampton University to study Computer Science. \nThis summer, I decided to make an iPad app (soon to be released) and I am glad to say that I know think I could make a Mac OS application in Objective-C as I feel I have learnt enough. I am glad that I took the time to learn it, it is a great language and really useful with iOS becoming so popular.\nSorry for all the boasting, but I am really happy about it. What I really want to say is, if you are coming to this page hoping to use PyObjc to create Mac apps easily, don't bother. It takes some time and some effort, but once you have learnt Objective-C, it is really satisfying to create apps with it. Good Luck!","AnswerCount":6,"Available Count":4,"Score":0.1325487884,"is_accepted":false,"ViewCount":4914,"Q_Id":1359227,"Users Score":4,"Answer":"And as one of the Checkout developers I'll weigh in too (hi Quinn!). From what we've seen PyObjC runs fairly well on Snow Leopard. We've built one of the latest SVN revisions 2.2b with some customizations on Leopard and just moved over the site-packages folder.\nTheoretically you should be able to use the built in Python\/PyObjC (just do import objc, Foundation, AppKit) but as we ship\/work with custom versions of both Python and PyObjC I'm not sure what the status exactly is. The mailing list doesn't mention a lot of people having issues (just a few) so that could be a good sign.\nGood luck with the project, and if you have specific POS questions shoot me an email ;-)","Q_Score":12,"Tags":"python,cocoa,xcode,osx-snow-leopard,pyobjc","A_Id":1359575,"CreationDate":"2009-08-31T20:19:00.000","Title":"PyObjc and Cocoa on Snow Leopard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am about to start my A-Level Computing project (High School Level) which will hopefully be a  point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course and not get into University. So this is quite important to me.\nI want to use Python to develop a Cocoa app. I know that I need PyObjc, however all details on the net seem to assume it is pre-installed. Apparently this is the case with Leopard and Snow Leopard but I don't seem to have it on Snow Leopard and never noticed it on Leopard. Also, I have tried installing the latest beta of PyObjc by following the instructions on the Sourceforge page, but with no luck.\nI would really appreciate it if anyone could shed some light on what needs to be installed, how, and links to any resources or tutorials that could help me.\nThanks in advance for the help!\nUpdate: I see that this is a popular question, I just got the 'Notable Question' badge for it so I thought I would update anyone coming to this page on what I did after getting the answers.\nUnfortunately, I wasn't able to use Python to create a Mac application. This was rather disappointing at the time, but probably a good thing. I made a Windows app in C# for my project, it was a tool for creating and running Assembly apps in a simulated environment. My course teacher has now started to use my tool to teach the course instead of his own! I got a very high score on the computing project (over 90%) and this contributed to me getting an A* in my computing A-Level (the highest grade available) and I consequently got in to Southampton University to study Computer Science. \nThis summer, I decided to make an iPad app (soon to be released) and I am glad to say that I know think I could make a Mac OS application in Objective-C as I feel I have learnt enough. I am glad that I took the time to learn it, it is a great language and really useful with iOS becoming so popular.\nSorry for all the boasting, but I am really happy about it. What I really want to say is, if you are coming to this page hoping to use PyObjc to create Mac apps easily, don't bother. It takes some time and some effort, but once you have learnt Objective-C, it is really satisfying to create apps with it. Good Luck!","AnswerCount":6,"Available Count":4,"Score":0.0996679946,"is_accepted":false,"ViewCount":4914,"Q_Id":1359227,"Users Score":3,"Answer":"I'm a long time python developer who's been doing iPhone apps for awhile now (and only using my python knowledge to package up build files for the apps in run scripts), then who started making some PyObjC apps.\nI'd have to say, PyObjC is pretty much STILL having to learn objective C (which I already know via iPhone dev), however you get several pretty cool benefits if you use it instead\n\nEasy use of python libraries you know (faster for you)\nOption to drop it and go to wxPython if styimied by Cocoa\nSomewhat faster development time (you're writing less code, and the translation between the two languages is pretty darn easy to get used to).\n\nAdditionally, interface builder is a little tricky to get used to comparatively speaking, but if you're a python dev, it's not like you're exactly used to a functional gui builder anyhow :oP","Q_Score":12,"Tags":"python,cocoa,xcode,osx-snow-leopard,pyobjc","A_Id":1905283,"CreationDate":"2009-08-31T20:19:00.000","Title":"PyObjc and Cocoa on Snow Leopard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am about to start my A-Level Computing project (High School Level) which will hopefully be a  point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course and not get into University. So this is quite important to me.\nI want to use Python to develop a Cocoa app. I know that I need PyObjc, however all details on the net seem to assume it is pre-installed. Apparently this is the case with Leopard and Snow Leopard but I don't seem to have it on Snow Leopard and never noticed it on Leopard. Also, I have tried installing the latest beta of PyObjc by following the instructions on the Sourceforge page, but with no luck.\nI would really appreciate it if anyone could shed some light on what needs to be installed, how, and links to any resources or tutorials that could help me.\nThanks in advance for the help!\nUpdate: I see that this is a popular question, I just got the 'Notable Question' badge for it so I thought I would update anyone coming to this page on what I did after getting the answers.\nUnfortunately, I wasn't able to use Python to create a Mac application. This was rather disappointing at the time, but probably a good thing. I made a Windows app in C# for my project, it was a tool for creating and running Assembly apps in a simulated environment. My course teacher has now started to use my tool to teach the course instead of his own! I got a very high score on the computing project (over 90%) and this contributed to me getting an A* in my computing A-Level (the highest grade available) and I consequently got in to Southampton University to study Computer Science. \nThis summer, I decided to make an iPad app (soon to be released) and I am glad to say that I know think I could make a Mac OS application in Objective-C as I feel I have learnt enough. I am glad that I took the time to learn it, it is a great language and really useful with iOS becoming so popular.\nSorry for all the boasting, but I am really happy about it. What I really want to say is, if you are coming to this page hoping to use PyObjc to create Mac apps easily, don't bother. It takes some time and some effort, but once you have learnt Objective-C, it is really satisfying to create apps with it. Good Luck!","AnswerCount":6,"Available Count":4,"Score":0.0996679946,"is_accepted":false,"ViewCount":4914,"Q_Id":1359227,"Users Score":3,"Answer":"I hardly use PyObjC myself, but I believe you need to run the Xcode installer on the Snow Leopard DVD in order to use PyObjC.\nAlso, as Quinn said, you will need to understand at least some Objective-C in order to use a Cocoa bridge like PyObjC without tearing your hair out. It just doesn't insulate you that completely.","Q_Score":12,"Tags":"python,cocoa,xcode,osx-snow-leopard,pyobjc","A_Id":1359428,"CreationDate":"2009-08-31T20:19:00.000","Title":"PyObjc and Cocoa on Snow Leopard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to have a text control that only accepts numbers. (Just integer values like 45 or 366)\nWhat is the best way to do this?","AnswerCount":7,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":11475,"Q_Id":1369086,"Users Score":5,"Answer":"IntCtrl, Masked Edit Control, and NumCtrl are all designed to do just this, with different levels of control.  Checkout the wx demo under \"More Windows\/Controls\" to see how they work.\n(Or, if you're instead really looking forward to doing this directly with a raw TextCtrl, I think you'd want to catch EVT_CHAR events, test the characters, and call evt.Skip() if it was an allowed character.)","Q_Score":10,"Tags":"wxpython,textctrl","A_Id":1370281,"CreationDate":"2009-09-02T17:27:00.000","Title":"Is it possible to limit TextCtrl to accept numbers only in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to have a text control that only accepts numbers. (Just integer values like 45 or 366)\nWhat is the best way to do this?","AnswerCount":7,"Available Count":2,"Score":-0.0285636566,"is_accepted":false,"ViewCount":11475,"Q_Id":1369086,"Users Score":-1,"Answer":"Please check \"Validator.py\" script in wxpython demo. it is exactly what you need","Q_Score":10,"Tags":"wxpython,textctrl","A_Id":23052986,"CreationDate":"2009-09-02T17:27:00.000","Title":"Is it possible to limit TextCtrl to accept numbers only in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently working on an application written in C#, which I'm embedding IronPython in. I generally have no problems about it, but there's one thing that I don't know how to deal with. \nI want to import an external module into the script. How can I do that? Simple import ext_lib doesn't work. Should I add a path to the lib to sys.path? \nMaybe it is possible to copy the lib's .py file into app directory and import from there?\nEDIT:\nI finally chosen another solution - compiled my script with py2exe and I'm just running it from main C# app with Process (without using IronPython).\nAnyway, thanks for help ;)","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":34961,"Q_Id":1371994,"Users Score":3,"Answer":"If you have installed IronPython from NuGet packages and you want modules from the CPython Standard Library then the best way to do it is by installing the IronPython.StdLib NuGet package which is from the same authors of IronPython.","Q_Score":20,"Tags":"python,import,ironpython","A_Id":67905932,"CreationDate":"2009-09-03T07:50:00.000","Title":"Importing external module in IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to remove border on a gtk.Button and also set its size fixed. How can I accomplish that?\nMy button looks like that:\n\n b = gtk.Button()\n b.set_relief(gtk.RELIEF_NONE)\n\nThanks!\np.d: I'm using pygtk","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":2081,"Q_Id":1383663,"Users Score":-1,"Answer":"I don't think the EventBox can send button events like \"activated\" and \"clicked\".","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":1507847,"CreationDate":"2009-09-05T16:01:00.000","Title":"remove inner border on gtk.Button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing on Windows, and I've searched everywhere without finding anyone talking about this kind of thing.\nI made a C++ app on my desktop that embedded Python 3.1 using MSVC. I linked python31.lib and included python31.dll in the app's run folder alongside the executable. It works great. My extension and embedding code definitely works and there are no crashes.\nI sent the run folder to my friend who doesn't have Python installed, and the app crashes for him during the scripting setup phase.\nA few hours ago, I tried the app on my laptop that has Python 2.6 installed. I got the same crash behavior as my friend, and through debugging found that it was the Py_Initialize() call that fails.\nI installed Python 3.1 on my laptop without changing the app code. I ran it and it runs perfectly. I uninstalled Python 3.1 and the app crashes again. I put in code in my app to dynamically link from the local python31.dll, to ensure that it was using it, but I still get the crash.\nI don't know if the interpreter needs more than the DLL to start up or what. I haven't been able to find any resources on this. The Python documentation and other guides do not seem to ever address how to distribute your C\/C++ applications that use Python embedding without having the users install Python locally. I know it's more of an issue on Windows than on Unix, but I've seen a number of Windows C\/C++ applications that embed Python locally and I'm not sure how they do it.\nWhat else do I need other than the DLL? Why does it work when I install Python and then stop working when I uninstall it? It sounds like it should be so trivial; maybe that's why nobody really talks about it. Nevertheless, I can't really explain how to deal with this crash issue.\nThank you very much in advance.","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":11259,"Q_Id":1387906,"Users Score":24,"Answer":"In addition to pythonxy.dll, you also need the entire Python library, i.e. the contents of the lib folder, plus the extension modules, i.e. the contents of the DLLs folder. Without the standard library, Python won't even start, since it tries to find os.py (in 3.x; string.py in 2.x). On startup, it imports a number of modules, in particular site.py.\nThere are various locations where it searches for the standard library; in your cases, it eventually finds it in the registry. Before, uses the executable name (as set through Py_SetProgramName) trying to find the landmark; it also checks for a file python31.zip which should be a zipped copy of the standard library. It also checks for a environment variable PYTHONHOME.\nYou are free to strip the library from stuff that you don't need; there are various tools that compute dependencies statically (modulefinder in particular).\nIf you want to minimize the number of files, you can\n\nlink all extension modules statically into your pythonxy.dll, or even link pythonxy.dll statically into your application\nuse the freeze tool; this will allow linking the byte code of the standard library into your pythonxy.dll.\n(alternatively to 2.) use pythonxy.zip for the standard library.","Q_Score":23,"Tags":"python,c++,dll,embed","A_Id":1387977,"CreationDate":"2009-09-07T06:56:00.000","Title":"C++ with Python embedding: crash if Python not installed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing on Windows, and I've searched everywhere without finding anyone talking about this kind of thing.\nI made a C++ app on my desktop that embedded Python 3.1 using MSVC. I linked python31.lib and included python31.dll in the app's run folder alongside the executable. It works great. My extension and embedding code definitely works and there are no crashes.\nI sent the run folder to my friend who doesn't have Python installed, and the app crashes for him during the scripting setup phase.\nA few hours ago, I tried the app on my laptop that has Python 2.6 installed. I got the same crash behavior as my friend, and through debugging found that it was the Py_Initialize() call that fails.\nI installed Python 3.1 on my laptop without changing the app code. I ran it and it runs perfectly. I uninstalled Python 3.1 and the app crashes again. I put in code in my app to dynamically link from the local python31.dll, to ensure that it was using it, but I still get the crash.\nI don't know if the interpreter needs more than the DLL to start up or what. I haven't been able to find any resources on this. The Python documentation and other guides do not seem to ever address how to distribute your C\/C++ applications that use Python embedding without having the users install Python locally. I know it's more of an issue on Windows than on Unix, but I've seen a number of Windows C\/C++ applications that embed Python locally and I'm not sure how they do it.\nWhat else do I need other than the DLL? Why does it work when I install Python and then stop working when I uninstall it? It sounds like it should be so trivial; maybe that's why nobody really talks about it. Nevertheless, I can't really explain how to deal with this crash issue.\nThank you very much in advance.","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":11259,"Q_Id":1387906,"Users Score":6,"Answer":"A zip of the Python standard library worked for me with Python27.\nI zipped the contents of Lib and dll, and made sure there was no additional python27-subfolder or Lib or dll subfolder. i.e. just a zip named python27.zip containing all the files.\nI copied that zip and the python27.dll alongside the executable.","Q_Score":23,"Tags":"python,c++,dll,embed","A_Id":9115925,"CreationDate":"2009-09-07T06:56:00.000","Title":"C++ with Python embedding: crash if Python not installed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do you embed a vpython plot (animated) within your Qt GUI? so that it has its own display area and would not need to created a new window anymore.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1265,"Q_Id":1397553,"Users Score":1,"Answer":"I contacted maintainer of VPython and he confirmed, that he is not aware of any working solution where Visual is embedded into QT window.\nThat turned me to try VTK and so far I'm pretty happy, no problem with using VTK within PyQT framework.","Q_Score":2,"Tags":"python,user-interface,qt","A_Id":1414819,"CreationDate":"2009-09-09T04:40:00.000","Title":"embedding plot within Qt gui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using a wxPython wx.html.HtmlWindow to display part of my interface. The user can scroll down a list of links in a window smaller than the list. When they click on a link, I need to repaint the web page, but I want to return the page position back to where they clicked it. \nI've tried MouseEvent.GetLogicalPosition() on the event, but it wants a DC and the best I've been able to do is get the same information as GetPosition(), so I must not be feeding it the right one.\nI also tried HtmlWindow.CalcScrolledPosition(), but apparently that isn't available in HtmlWindow because I get a NotImplementedError...\nWhat I would like is a scroll position that can be derived from the MouseEvent, or the OnLinkClicked information.\nI know about HtmlWindow.ScrollToAnchor(), but it's flaky and unaesthetic -- I would prefer to bypass it if possible so that I can scroll back exactly to where the user clicked.\nThanks!","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1216,"Q_Id":1400179,"Users Score":0,"Answer":"Usually, click events are trigged by MouseUp events. If you track the mouse position by capturing any MouseDown events, you will know where the last click (MouseUp) happened, and that should allow you to reconstruct things.\nFor this particular problem, you might have to do a bit more work in MouseDown like checking if they are within the wxHtmlWindow control and if so, then saving something like a line number.","Q_Score":2,"Tags":"python,wxpython","A_Id":1579014,"CreationDate":"2009-09-09T14:45:00.000","Title":"How do I scroll a wxPython wx.html.HtmlWindow back down to where it was when the user clicked a link?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm starting to study Python, and for now I like it very much. But, if you could just answer a few questions for me, which have been troubling me, and I can't find any definite answers to them:\n\nWhat is the relationship between Python's C implementation (main version from python.org) and IronPython, in terms of language compatibility ? Is it the same language, and do I by learning one, will be able to smoothly cross to another, or is it Java to JavaScript ?\nWhat is the current status to IronPython's libraries ? How much does it lags behind CPython libraries ? I'm mostly interested in numpy\/scipy and f2py. Are they available to IronPython ?\nWhat would be the best way to access VB from Python and the other way back (connecting some python libraries to Excel's VBA, to be exact) ?","AnswerCount":5,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":3658,"Q_Id":1403103,"Users Score":18,"Answer":"1) IronPython and CPython share nearly identical language syntax.  There is very little difference between them.  Transitioning should be trivial.\n2) The libraries in IronPython are very different than CPython.  The Python libraries are a fair bit behind - quite a few of the CPython-accessible libraries will not work (currently) under IronPython.  However, IronPython has clean, direct access to the entire .NET Framework, which means that it has one of the most extensive libraries natively accessible to it, so in many ways, it's far ahead of CPython.  Some of the numpy\/scipy libraries do not work in IronPython, but due to the .NET implementation, some of the functionality is not necessary, since the perf. characteristics are different.\n3) Accessing Excel VBA is going to be easier using IronPython, if you're doing it from VBA.  If you're trying to automate excel, IronPython is still easier, since you have access to the Execl Primary Interop Assemblies, and can directly automate it using the same libraries as C# and VB.NET.","Q_Score":15,"Tags":"python,excel,vba,ironpython,python.net","A_Id":1403134,"CreationDate":"2009-09-10T02:30:00.000","Title":"Python - IronPython dilemma","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting to study Python, and for now I like it very much. But, if you could just answer a few questions for me, which have been troubling me, and I can't find any definite answers to them:\n\nWhat is the relationship between Python's C implementation (main version from python.org) and IronPython, in terms of language compatibility ? Is it the same language, and do I by learning one, will be able to smoothly cross to another, or is it Java to JavaScript ?\nWhat is the current status to IronPython's libraries ? How much does it lags behind CPython libraries ? I'm mostly interested in numpy\/scipy and f2py. Are they available to IronPython ?\nWhat would be the best way to access VB from Python and the other way back (connecting some python libraries to Excel's VBA, to be exact) ?","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":3658,"Q_Id":1403103,"Users Score":1,"Answer":"1) The language implemented by CPython and IronPython are the same, or at most a version or two apart.  This is nothing like the situation with Java and Javascript, which are two completely different languages given similar names by some bone-headed marketing decision.\n2) 3rd-party libraries implemented in C (such as numpy) will have to be evaluated carefully.  IronPython has a facility to execute C extensions (I forget the name), but there are many pitfalls, so you need to check with each library's maintainer\n3) I have no idea.","Q_Score":15,"Tags":"python,excel,vba,ironpython,python.net","A_Id":1403118,"CreationDate":"2009-09-10T02:30:00.000","Title":"Python - IronPython dilemma","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using pygame with python 2.6 right now, But I want to use python 3.1.1 instead. The normal pygame only works with 2.x, but the subversion ones work with 3.x I think. But what about pgreloaded? Is that useable yet? The normal pygame actually works with 3.1 too, but not for os x (at least there isn't a download). Does anyone actually use pgreloaded or subversion pygames? So anyway, should I use pygame subversion, pgreloaded, or stick with the current pygame? I don't really care about being compatible with other things or distribution.\nThanks!\nEDIT: Ok, I got rid of python 2.6, installed 3.1, used svn command to get pygame, tried running python3 setup.py, didn't work, changed raw_input in setup.py to input(), worked, now my pygames (that were so simple that they work the same under 2.6 and 3.1) run with python 3.1. :) I didn't get pgreloaded because there's no documentation for it.","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1917,"Q_Id":1414258,"Users Score":1,"Answer":"Just stick with Python 2.6.","Q_Score":3,"Tags":"python,python-3.x,pygame","A_Id":1416509,"CreationDate":"2009-09-12T04:16:00.000","Title":"Should I use pgreloaded? Or subversion of pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a computer game I'm working on, and I'm wanting to give the user an option to turn off alpha compositing for speed purposes. Rather than doing checks everywhere, does Pygame have a global option to say \"Don't use alpha\" such that it would just ignore all my calls to set_alpha and the likes?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":570,"Q_Id":1424734,"Users Score":1,"Answer":"Considering the pygame docs I would say \"no, there is no global way to disable alpha\".\nHowever there are at least two 'local' ways to do it:   \n\nFirst would be to subclass pygame.Surface and provide your own implementation of set_alpha\nwhich in turn could honor your global alpha settings.   \nSecond one is a bit more tricky as it depends on the pixel-format in use.\nTo quote the pygame docs:  \n\n\nSurface.set_alpha\nset the alpha value for the whole surface\n[...]\n  This value is different than the per pixel Surface alpha. If the Surface format contains\n  per pixel alphas, then this alpha value will be ignored. If the Surface contains per pixel\n  alphas, setting the alpha value to None will disable the per pixel transparency.\n[...]\n\nWith this you could provide two sets of textures:   \n\none with an opaque (per-pixel) alpha channel which will overwrite all your calls to set_alpha()\none which has no per-pixel alpha and thus will honor your set_alpha()\n\nHope this will help!","Q_Score":1,"Tags":"python,pygame,alphablending","A_Id":1429443,"CreationDate":"2009-09-15T01:49:00.000","Title":"Turn off Pygame alpha","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am embedding a c++ library (binding done with SIP) in my python application. Under certain circonstances (error cases), this library uses exit(), which causes my entire application to exit. \nIs there a way to catch this event, or do I need to modify the library to handle error cases differently ? \nThank you very much,","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1407,"Q_Id":1439533,"Users Score":0,"Answer":"You can override the library linking with LD_LIBRARY_PATH and make your own exit function.  Works fine.","Q_Score":7,"Tags":"python,exception,binding,exit","A_Id":8099938,"CreationDate":"2009-09-17T15:19:00.000","Title":"How to catch exit() in embedded C++ module from python code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am embedding a c++ library (binding done with SIP) in my python application. Under certain circonstances (error cases), this library uses exit(), which causes my entire application to exit. \nIs there a way to catch this event, or do I need to modify the library to handle error cases differently ? \nThank you very much,","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1407,"Q_Id":1439533,"Users Score":7,"Answer":"You must modify the source of the library. There is no \"exception handling\" in C and exit() does not return to the calling code under any circumstances.","Q_Score":7,"Tags":"python,exception,binding,exit","A_Id":1439585,"CreationDate":"2009-09-17T15:19:00.000","Title":"How to catch exit() in embedded C++ module from python code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wx.TextCtrl that I am using to represent a display with a fixed number of character rows and columns. I would like to hide the vertical scrollbar that is displayed to the right of the text pane since it is entirely unnecessary in my application. Is there a way to achieve this?\nAlso...I would like to hide the blinking cursor that is displayed in the pane. Unfortunately, wx.TextCtrl.GetCaret() is returning None so I cannot call wx.Caret.Hide().\nEnvironment info:\n\nWindows XP\nPython 2.5\nwxPython 2.8","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2839,"Q_Id":1441502,"Users Score":4,"Answer":"How about setting the style wx.TE_NO_VSCROLL for the wx.TxtCtrl?","Q_Score":4,"Tags":"python,wxpython,wxtextctrl","A_Id":1442312,"CreationDate":"2009-09-17T21:47:00.000","Title":"Hiding Vertical Scrollbar in wx.TextCtrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Accelerators on wxPython do not seem to work with nested panels. In other words:\n    -----------------------------------------------\n    | Main panel                                  |\n    | -----------------    -----------------      |\n    | | Subpanel 1    |    | Subpanel 2    |      |\n    | | accelerator   |    | accelerator   |      |\n    | | key for 'a'   |    | key for 'b'   |      |\n    | -----------------    -----------------      |\n    -----------------------------------------------\nWhen a control in subpanel 1 has focus, I want Alt+b to still trigger the control in subpanel 2 that uses b as its accelerator key. How do I do this?\nIf it matters, I'm loading the panel with xrc into a plain old wx.Frame.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":336,"Q_Id":1446672,"Users Score":0,"Answer":"If the main panel has the accelerator table with Alt+b, this should work.  Maybe the sub-panels have their own accelerator tables that are conflicting?  You might try inactivating these with subpanel.SetAcceleratorTable(wx.NullAcceleratorTable) for each subpanel.","Q_Score":2,"Tags":"wxpython","A_Id":1483678,"CreationDate":"2009-09-18T20:28:00.000","Title":"wxPython, nested panels and accelerators","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to Python and I'm trying to create a simple GUI using Tkinter. \nSo often in many user interfaces, hitting the tab button will change the focus from one Text widget to another. Whenever I'm in a Text widget, tab only indents the text cursor.\nDoes anyone know if this is configurable?","AnswerCount":3,"Available Count":1,"Score":-1.0,"is_accepted":false,"ViewCount":13443,"Q_Id":1450180,"Users Score":-5,"Answer":"It is really simple in PyQt4 simply use this one single line below and you will be able to change focus by pressing tab button:\nself.textEdit.setTabChangesFocus(True)","Q_Score":15,"Tags":"python,tkinter","A_Id":41727157,"CreationDate":"2009-09-20T03:06:00.000","Title":"Change the focus from one Text widget to another","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm far from a python expert but I hear this one all the time, about its C\/C++ bindings.  How does this concept work, and how does Python (and Java) bind to C-based APIs like OpenGL?  This stuff has always been a mystery to me.","AnswerCount":6,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":3183,"Q_Id":1475637,"Users Score":12,"Answer":"Interpreters Written in C89 with Reflection, Who Knew?\n\nI have a feeling you are looking for an explanation of the mechanism and not a link to the API or instructions on how to code it. So, as I understand it . . .\nThe main interpreter is typically written in C and is dynamically linked. In a dynamically linked environment, even C89 has a certain amount of reflective behavior. In particular, the dlopen(3) and dlsym(3) calls will load a dynamic (typically ELF) library and look up the address of a symbol named by a string. Give that address, the interpreter can call a function. Even if statically linked, the interpreter can know the address of C functions whose names are compiled into it.\nSo then, it's just a simple matter of having the interpreted code tell the interpreter to call a particular native function in a particular native library.\nThe mechanism can be modular. An extension library for the interpreter, written in the script, can itself invoke the bare hooks for dlopen(3) and dlsym(3) and hook up to a new library that the interpreter never knew about.\nFor passing simple objects by value, a few prototype functions will typically allow various calls. But for structured data objects (imagine stat(2)) the wrapper module needs to know the layout of the data. At some point, either when packaging the extension module or when installing it, a C interface module includes the appropriate header files and in conjunction with handwritten code constructs an interface object. This is why you may need to install something like libsqlite3-dev even if you already had sqlite3 on your system; only the -dev package has the .h files needed to recompile the linkage code.\nI suppose we could sum this up by saying: \"it's done with brute force and ignorance\". :-)","Q_Score":16,"Tags":"java,python,binding","A_Id":1475717,"CreationDate":"2009-09-25T05:55:00.000","Title":"How do you bind a language (python, for example) to another (say, C++)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to display search result data quickly. I have all absolute file paths for files on my network drive(s) in a single, ~50MB text file.  The python script makes a single pass over every line in this file [kept on the local drive] in a second or less, and that is acceptable. That is the time it takes to gather results.\nHowever, the results are given in a wx.TextCtrl widget.  Appending them line by line to a wx TextCtrl would be ridiculous.  The best method I have come up with is to write the results to a text file, and call wx.TextCtrl's LoadFile native, which, depending on the number of results, loads the lines of text into the pane in between 0.1 to 5 seconds or so.  However there must be a faster way for 10+MB of text inbound.  The results are immediately calculated and available in the same process as the GUI... so please, tell me is there any way I can pipe\/proxy\/hack that data directly into the TextCtrl?  Would mmap help this transfer?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1831,"Q_Id":1507075,"Users Score":0,"Answer":"Are people really going to read (or need) all 10MB in a text control? Probably not.\nSuggest that, you load on demand by paging in portions of the data.\nOr better still, provide some user search functionality that narrows down the results to the information of interest.","Q_Score":0,"Tags":"python,file-io,wxpython,wxwidgets,mmap","A_Id":1507087,"CreationDate":"2009-10-01T23:44:00.000","Title":"wx.TextCtrl.LoadFile()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":1673,"Q_Id":1534450,"Users Score":0,"Answer":"As someone familiar with C# and .NET you should consider IronPython. Python for .NET. This would be a good way to leverage what you know and learn a new dynamic language at the same time.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534470,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":1.0,"is_accepted":false,"ViewCount":1673,"Q_Id":1534450,"Users Score":7,"Answer":"I Am a little scared of C++ because developing anything in it takes ages.\n\nI'm not sure how you can say that when you say yourself that you have no experience in the language.  C++ is a good tool for some things, Python is good for other things.  What you want to do should be driving this decision, not the technology in and of itself.\nC# programmer or not, I would assume that you can pick up any language, but a language is just a tool, so your question is difficult to answer.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534460,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":0.0996679946,"is_accepted":false,"ViewCount":1673,"Q_Id":1534450,"Users Score":5,"Answer":"Python may be easier to get started with, but a dynamically typed scripting language is a very different language from C# or C++.  You will learn more about programming learning it than you will by hopping to a close cousin of a language you already know.  Really, solid familiarity with at least one scripting language (Python, Perl and Ruby are the favorites) should be a requirement for all programmers.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534467,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":1.2,"is_accepted":true,"ViewCount":1673,"Q_Id":1534450,"Users Score":2,"Answer":"C# is a little closer to Java and C++ than it is to Python, so learn Python first out of the two.\nHowever, my advice would be:\n\nStick with your current language and learn more techniques, such as a wider range of algorithms, functional programming, design by contract, unit testing, OOAD, etc.\nlearn C (focus on figuring out pointers, multi-dimensional arrays, data structures like linked lists, and resource management like memory allocation\/deallocation, file handles, etc)\nlearn Assembly (on a modern platform with a flat memory architecture, but doing low-level stuff like talking to hardware or drawing on a canvas)\nlearn Python or Ruby.  Chances are, you'll stick with one of these for a while, knowing all of the above, unless some hot new language has come along by then.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534729,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":0.0599281035,"is_accepted":false,"ViewCount":1673,"Q_Id":1534450,"Users Score":3,"Answer":"If you want to apply to Google then Python might be the one to go for, surely MS would like the C# already.  If nothing else the competition would not be as fierce as there are much more folk out there with multi years of C++ experience.  Also Python gives you a broader language skill and would be a good path to more languages and scripting.\nBut as said and will be said again, choose your tool wisely and see whether it's a nail or a screw you're trying to secure.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534483,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":1673,"Q_Id":1534450,"Users Score":0,"Answer":"You might be interested in looking at Windows Powershell. It's the latest scripting technology from Microsoft, built on .NET, and can be extended via C#.\nGranted, it's not as portable as C++ or Python, but it would leverage your C#\/.NET experience more readily. Otherwise, I would suggest C++ (and possibly C). Microsoft builds a lot more of its products with C\/C++ than with Python.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534589,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":0.0199973338,"is_accepted":false,"ViewCount":1673,"Q_Id":1534450,"Users Score":1,"Answer":"C++ is usually used when speed, and low-level OS access is involved.\nIt's a good skill to have if you want to expand.\nPython allows you to do thing quickly, and it's quite easy to learn, and provides more power than you'd expect from a scripting language, and probably one of the fastest ones out there.\nC++ isn't exactly slow to develop, if you've got an IDE, it's not hard to write per-se, but the syntax is going to get you.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534645,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":0.0199973338,"is_accepted":false,"ViewCount":1673,"Q_Id":1534450,"Users Score":1,"Answer":"If you want to apply to Google and\/ or Microsoft then I'd say that of the two you need both!\nGiven more choice, probably C++ and one other language - either dynamic, functional, or both (Scala might be a good choice too).\nIt's not necessarily about whether you'd use the languages themselves but more about the different approaches they require and encourage.\nIf you continue to be \"scared\" by C++ you're probably going to struggle applying as a dev at either of those organisations - unless you are highly specialised elsewhere.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534651,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#\/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.\nSo: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool\/language.\nAny C# developers having same dilemma?","AnswerCount":10,"Available Count":9,"Score":0.0199973338,"is_accepted":false,"ViewCount":1673,"Q_Id":1534450,"Users Score":1,"Answer":"Why not learn some of each. Studying a language for a week or so won't make you an expert, but it will answer a lot of questions in your head and plant a seed for the future.\nIt's important to not just read through exercises. Find some simple problems that can be programmed in a page or two at most and solve them with each language. That will help you to learn the strengths and weaknesses in the context of the way you think and how you solve problems.","Q_Score":2,"Tags":"c#,c++,python","A_Id":1534556,"CreationDate":"2009-10-07T21:52:00.000","Title":"C++ or Python for C# programmer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a background in C++ and Java and Objective C programming, but i am finding it hard to learn python, basically where its \"Main Function\" or from where the program start executing. So is there any tutorial\/book which can teach python to people who have background in C++ or Java. Basically something which can show if how you were doing this in C++ and how this is done in Python.\nOK i think i did not put the question heading or question right, basically i was confused about the \"Main\" Function, otherwise other things are quite obvious from python official documentation except this concept.\nThanks to all","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":463,"Q_Id":1548620,"Users Score":0,"Answer":"I started Python over a year ago too, also C++ background.  \nI've learned that everything is simpler in Python, you don't need to worry so much if you're doing it right, you probably are. Most of the things came natural.\nI can't say I've read a book or anything, I usually pested the guys in #python on freenode a lot and looked at lots of other great code out there.\nGood luck :)","Q_Score":4,"Tags":"python","A_Id":1548641,"CreationDate":"2009-10-10T17:56:00.000","Title":"Python for C++ or Java Programmer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a background in C++ and Java and Objective C programming, but i am finding it hard to learn python, basically where its \"Main Function\" or from where the program start executing. So is there any tutorial\/book which can teach python to people who have background in C++ or Java. Basically something which can show if how you were doing this in C++ and how this is done in Python.\nOK i think i did not put the question heading or question right, basically i was confused about the \"Main\" Function, otherwise other things are quite obvious from python official documentation except this concept.\nThanks to all","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":463,"Q_Id":1548620,"Users Score":0,"Answer":"The pithiest comment I guess is that the entry point is the 1st line of your script that is not a function or a class. You don't necessarily need to use the if hack unless you want to and your script is meant to be imported.","Q_Score":4,"Tags":"python","A_Id":1548801,"CreationDate":"2009-10-10T17:56:00.000","Title":"Python for C++ or Java Programmer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to do this? Also, I need this to work with pygame, since I want audio in my game. I'm asking this because I didn't see any tone change function in pygame.. Anyone knows?\nUpdate:\nI need to do something like the noise of a car accelerating. I don't really know if it is timbre or tone.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1240,"Q_Id":1561104,"Users Score":1,"Answer":"Well, it depends on how you're doing your sounds: I'm not sure if this is possible with pygame, but SDL (which pygame is based off of) lets you have a callback to retrieve data for the sound buffer, and it's possible to change the frequency of the sine wave (or whatever) to get different tones in the callback, given that you generate the sound there.\nIf you're using a pre-rendered tone, or sound file, then you'll probably have to resample it to get it to play at different frequencies, although it'd be difficult to keep the same length. If you're talking about changing the timbre of the sound, then that's a whole different ballpark...\nAlso, it depends on how fast the sound needs to change: if you can accept a little lag in response, you could probably generate a few short sounds, and play\/loop them as necessary. I'm not sure how constant replaying of sounds would impact performance\/the overall audio quality, though: you'd have to make sure the ends of all the waveform ends smoothly transition to the beginning of the next one (maybe).","Q_Score":1,"Tags":"python,pygame,pitch","A_Id":1561314,"CreationDate":"2009-10-13T15:44:00.000","Title":"Playing sounds with python and changing their tone during playback?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"After upgrading to Snow Leopard, I'm having trouble building my application.  It looks like py2app is building and copying over wxPython, but when I run from the buld app, it can't find wx.","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":997,"Q_Id":1562483,"Users Score":7,"Answer":"I solved this by doing a clean Snow Leopard install, and installing python from Python.org, then the corresponding wxPython.  py2app I built from source.","Q_Score":4,"Tags":"macos,wxpython,osx-snow-leopard,py2app","A_Id":1583793,"CreationDate":"2009-10-13T19:39:00.000","Title":"py2app dropping wxpython (Snow Leopard)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am probably looking for the wrong thing in the handbook, but I am looking to take an image object and expand it without resizing (stretching\/squishing) the original image.  \nToy example: imagine a blue rectangle, 200 x 100, then I perform some operation and I have a new image object, 400 x 300, consisting of a white background upon which a 200 x 100 blue rectangle rests.  Bonus if I can control in which direction this expands, or the new background color, etc.\nEssentially, I have an image to which I will be adding iteratively, and I do not know what size it will be at the outset.  \nI suppose it would be possible for me to grab the original object, make a new, slightly larger object, paste the original on there, draw a little more, then repeat.  It seems like it might be computationally expensive.  However, I thought there would be a function for this, as I assume it is a common operation.  Perhaps I assumed wrong.","AnswerCount":4,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":13934,"Q_Id":1572691,"Users Score":6,"Answer":"You might consider a rather different approach to your image... build it out of tiles of a fixed size.  That way, as you need to expand, you just add new image tiles.  When you have completed all of your computation, you can determine the final size of the image, create a blank image of that size, and paste the tiles into it.  That should reduce the amount of copying you're looking at for completing the task.\n(You'd likely want to encapsulate such a tiled image into an object that hid the tiling aspects from the other layers of code, of course.)","Q_Score":26,"Tags":"python,python-imaging-library","A_Id":1573679,"CreationDate":"2009-10-15T14:23:00.000","Title":"In Python, Python Image Library 1.1.6, how can I expand the canvas without resizing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a library written in C++ which I wrap using SWIG and use in python. Generally there is one class with few methods. The problem is that calling these methods may be time consuming - they may hang my application (GIL is not released when calling these methods). So my question is: \nWhat is the simplest way to release GIL for these method calls? \n(I understand that if I used a C library I could wrap this with some additional C code, but here I use C++ and classes)","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3393,"Q_Id":1576737,"Users Score":0,"Answer":"You can use the same API call as for C. No difference. Include \"python.h\" and call the appoproate function.\nAlso, see if SWIG doesn't have a typemap or something to indicate that the GIL shuold not be held for a specific function.","Q_Score":7,"Tags":"c++,python,swig,gil","A_Id":1576959,"CreationDate":"2009-10-16T08:07:00.000","Title":"Releasing Python GIL while in C++ code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to create a desktop app that will work with Windows and Gnome(Ubuntu).  I would like to use Python to do this.  The GUI part of the app will be a single form with a message area and a couple of buttons.\nThe list of GUI's for Python seems overwhelming.  I am looking for something simple if possible, the main requirements is it must work with Gnome(2.26 and up) and Windows XP\/Vista\/7.","AnswerCount":4,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":895,"Q_Id":1577175,"Users Score":4,"Answer":"You might want to check out wxPython. It's a mature project and should work on Windows\nand Linux (Gnome).","Q_Score":4,"Tags":"python,user-interface,cross-platform","A_Id":1577197,"CreationDate":"2009-10-16T09:53:00.000","Title":"Python GUI Library for Windows\/Gnome","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm sure others have run into this problem too...\nI often watch videos in a small VLC window while working on other tasks, but no matter where the window is placed, I eventually need to access something in the GUI behind it, and have to manually reposition the video window first.\nThis could be solved by having the VLC window snap to another corner whenever the mouse pointer is moved over it. I haven't found an app that does this, so would like to write one. What technologies could I use to do this? Cross platform might be harder... so what if just on Windows?\nI'd prefer something in C# (or Python), but am willing to learn something new if need be.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":565,"Q_Id":1581782,"Users Score":0,"Answer":"This is a bit OOT, but in Windows 7, shaking the active window will hide others to reveal the desktop (and so will clicking\/hovering the rightmost taskbar button). Instead of hiding\/moving vlc, you could just temporarily reveal the whole desktop. Shaking the active window again brings everything back.","Q_Score":2,"Tags":"c#,python,windows,cross-platform,vlc","A_Id":1582934,"CreationDate":"2009-10-17T09:04:00.000","Title":"Reposition a VLC window programmatically","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know a bunch of scripting languages, (python, ruby, lua, php) but I don't know any compiled languages like C\/C++ , I wanted to try and speed up some python code using cython, which is essentially a python -> C compiler, aimed at creating C extensions for python. Basically you code in a stricter version of python which compiles into C -> native code. \nhere's the problem, I don't know C, yet the cython documentation is aimed at people who obviously already know C (nothing is explained, only presented), and is of no help  to me, I need to know if there are any good cython tutorials aimed at python programmers, or if I'm gonna have to learn C before I learn Cython.\nbear in mind I'm a competent python programmer, i would much rather learn cython from the perspective of the language I'm already good at, rather than learn a whole new language in order to learn cython.\n1) PLEASE don't recommend psyco \nedit: ANY information that will help understand the oficial cython docs is useful information","AnswerCount":7,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":8650,"Q_Id":1582105,"Users Score":0,"Answer":"Cython does not support threads well at all. It holds the GIL (Global Intrepreter Lock) the entire time! This makes your code thread-safe by (virtually) disabling concurrent execution. So I wouldn't use it for general purpose development.","Q_Score":20,"Tags":"python,c,cython","A_Id":4445452,"CreationDate":"2009-10-17T12:33:00.000","Title":"Noob-Ready Cython Tutorials","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know a bunch of scripting languages, (python, ruby, lua, php) but I don't know any compiled languages like C\/C++ , I wanted to try and speed up some python code using cython, which is essentially a python -> C compiler, aimed at creating C extensions for python. Basically you code in a stricter version of python which compiles into C -> native code. \nhere's the problem, I don't know C, yet the cython documentation is aimed at people who obviously already know C (nothing is explained, only presented), and is of no help  to me, I need to know if there are any good cython tutorials aimed at python programmers, or if I'm gonna have to learn C before I learn Cython.\nbear in mind I'm a competent python programmer, i would much rather learn cython from the perspective of the language I'm already good at, rather than learn a whole new language in order to learn cython.\n1) PLEASE don't recommend psyco \nedit: ANY information that will help understand the oficial cython docs is useful information","AnswerCount":7,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":8650,"Q_Id":1582105,"Users Score":0,"Answer":"About all the C that you really need to know is:\n\nC types are much faster than Python types (adding to C ints or doubles can be done in a single clock cycle) but less safe (they are not arbitrarily sized and may silently overflow).\nC function (cdef) calls are much faster than Python (def) function calls (but are less flexible). \n\nThis will get you most of the way there. If you want to eke out that last 10-20% speedup for most applications, there's no getting around knowing C, and how modern processes work (pointers, cache, ...).","Q_Score":20,"Tags":"python,c,cython","A_Id":2582450,"CreationDate":"2009-10-17T12:33:00.000","Title":"Noob-Ready Cython Tutorials","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know a bunch of scripting languages, (python, ruby, lua, php) but I don't know any compiled languages like C\/C++ , I wanted to try and speed up some python code using cython, which is essentially a python -> C compiler, aimed at creating C extensions for python. Basically you code in a stricter version of python which compiles into C -> native code. \nhere's the problem, I don't know C, yet the cython documentation is aimed at people who obviously already know C (nothing is explained, only presented), and is of no help  to me, I need to know if there are any good cython tutorials aimed at python programmers, or if I'm gonna have to learn C before I learn Cython.\nbear in mind I'm a competent python programmer, i would much rather learn cython from the perspective of the language I'm already good at, rather than learn a whole new language in order to learn cython.\n1) PLEASE don't recommend psyco \nedit: ANY information that will help understand the oficial cython docs is useful information","AnswerCount":7,"Available Count":4,"Score":0.0285636566,"is_accepted":false,"ViewCount":8650,"Q_Id":1582105,"Users Score":1,"Answer":"You can do a lot of very useful things with Cython if you can answer the following C quiz...\n(1) What is a double? What is an int?\n(2) What does the word \"compile\" mean?\n(3) What is a header (.h) file?\nTo answer these questions you don't need to read a whole C book! ...maybe chapter 1.\nOnce you can pass that quiz, try again with the tutorial.\nWhat I usually do is start with pure python code, and add Cython elements bit by bit. In that situation, you can learn the Cython features bit by bit. For example I don't understand C strings, because so far I have not tried to cythonize code that involves strings. When I do, I will first look up how strings work in C, and then second look up how strings work in Cython.\nAgain, once you've gotten started with Cython, you will now and then run into some complication that requires learning slightly more C. And of course the more C you know, the more dextrous you will be with taking full advantage of Cython, not to mention troubleshooting if something goes wrong. But that shouldn't make you reluctant to start!","Q_Score":20,"Tags":"python,c,cython","A_Id":11103468,"CreationDate":"2009-10-17T12:33:00.000","Title":"Noob-Ready Cython Tutorials","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know a bunch of scripting languages, (python, ruby, lua, php) but I don't know any compiled languages like C\/C++ , I wanted to try and speed up some python code using cython, which is essentially a python -> C compiler, aimed at creating C extensions for python. Basically you code in a stricter version of python which compiles into C -> native code. \nhere's the problem, I don't know C, yet the cython documentation is aimed at people who obviously already know C (nothing is explained, only presented), and is of no help  to me, I need to know if there are any good cython tutorials aimed at python programmers, or if I'm gonna have to learn C before I learn Cython.\nbear in mind I'm a competent python programmer, i would much rather learn cython from the perspective of the language I'm already good at, rather than learn a whole new language in order to learn cython.\n1) PLEASE don't recommend psyco \nedit: ANY information that will help understand the oficial cython docs is useful information","AnswerCount":7,"Available Count":4,"Score":0.0285636566,"is_accepted":false,"ViewCount":8650,"Q_Id":1582105,"Users Score":1,"Answer":"Cython does support concurrency (you can use native POSIX threads with c, that can be compiled in extent ion module)  , you just need to be careful enough to not to modify any python objects when GIL is released and keep in mind the interpreter itself is not thread safe. You can also use multiprocessing with python to use more cores for parallelism which can in turn use your compiled cython extensions to speed up even more. But all in all you definitely have to know  c programming model , static types etc","Q_Score":20,"Tags":"python,c,cython","A_Id":10643399,"CreationDate":"2009-10-17T12:33:00.000","Title":"Noob-Ready Cython Tutorials","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to do panning or 3d sound in Pygame? The only way I've found to control sound playback is to set the volume for both the left and right channels.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2176,"Q_Id":1583284,"Users Score":0,"Answer":"I think setting the separate channel volume is the only way. Pygame doesn't seem to have any notion of world space or positioning for sounds.","Q_Score":2,"Tags":"python,audio,pygame","A_Id":1583298,"CreationDate":"2009-10-17T21:32:00.000","Title":"positioning sound with pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"What would be the best library for multithreaded harvesting\/downloading with multiple proxy support? I've looked at Tkinter, it looks good but there are so many, does anyone have a specific recommendation? Many thanks!","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":940,"Q_Id":1597093,"Users Score":0,"Answer":"Is this something you can't just do by passing a URL to newly spawned threads and calling urllib2.urlopen in each one, or is there a more specific requirement?","Q_Score":0,"Tags":"python,proxy,download,multithreading,harvest","A_Id":1597142,"CreationDate":"2009-10-20T20:27:00.000","Title":"Multithreaded Downloading Through Proxies In Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"what I want to do is a image recognition for a simple app:\n\ngiven image (500 x 500) pxs ( 1 color background )\nthe image will have only 1 geometric figure (triangle or square or smaleyface :) ) of (50x50) pxs.\npython will do the recognition of the figure and display what geometric figure is.\n\nany links? any hints? any API? thxs :)","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":38079,"Q_Id":1603688,"Users Score":2,"Answer":"If you know the statespace of your data, you can use Principal Component Analysis. With PCA all of the objects must be posed (in the center of the screen). PCA will not do detection, but it will seperate objects into unique layers in which you can identify as being a triangle, etc. Also note: this is not scale or rotation invariant. \n[I can't remember what this technique is called, but its similar to how the postoffice does handwritting rec]\nIf you can handle only non-curved curvfaces, you could do edge detection, and then do sampling at intersections to get an approximation of similarity.","Q_Score":36,"Tags":"python,algorithm,image,image-processing,python-imaging-library","A_Id":1603723,"CreationDate":"2009-10-21T21:13:00.000","Title":"python image recognition","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using the Python\/C API with my app and am wondering how you can get console output with a gui app. When there is a script error, it is displayed via printf but this obviously has no effect with a gui app. I want to be able to obtain the output without creating a console. Can this be done?\nEdit - Im using Windows, btw.\nEdit - The Python\/C library internally calls printf and does so before any script can be loaded and run. If there is an error I want to be able to get it.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":173,"Q_Id":1604811,"Users Score":1,"Answer":"If by printf you mean exactly thqt call from C code, you need to redirect (and un-buffer) your standard output (file descriptor 0) to somewhere you can pick up the data from -- far from trivial, esp. in Windows, although maybe doable.  But why not just change that call in your C code to something more sensible?  (Worst case, a geprintf function of your own devising that mimics printf to build a string then directs that string appropriately).\nIf you actually mean print statements in Python code, it's much easier -- just set sys.stdout to an object with a write method accepting a string, and you can have that method do whatever you want, including logging, writing on a GUI windows, whatever you wish. Ah were it that simple at the C level!-)","Q_Score":0,"Tags":"python,user-interface","A_Id":1604842,"CreationDate":"2009-10-22T03:06:00.000","Title":"How to get output?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to compile my python script into a single .exe using gui2exe (which uses py2exe to create a .exe). My program is using wxWidgets and everytime I try to compile it I get the following error message:\n\nerror MSVCP90.dll: No such file or directory. \n\nI have already downloaded and installed the VC++ redistributable package, so I should have this .dll shouldn't I?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":3149,"Q_Id":1605006,"Users Score":1,"Answer":"what you need is to go to microsoft's download site and get visual C++ 2008 redistributed package.  Tell it to do a repair and search for the driver.  Copy the driver to the DLL folder in the python directory","Q_Score":9,"Tags":"python,dll,wxwidgets,py2exe,gui2exe","A_Id":5768777,"CreationDate":"2009-10-22T04:20:00.000","Title":"Making a Windows .exe with gui2exe does not work because of missing MSVCP90.dll","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an app that uses the python\/c api and I was wondering what files I need to distribute with it? The app runs on Windows and links with libpython31.a Are there any other files? I tried the app on a seperate Win2k system and it said that python31.dll was needed so theres at least one.\nEdit - My app is written in C++ and uses the Python\/C api as noted below.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":260,"Q_Id":1605022,"Users Score":2,"Answer":"The best way to tell is to try it on 'clean' installations of windows and see what it complains about. Virtual machines are a good way to do that.","Q_Score":2,"Tags":"python,file,runtime","A_Id":1605039,"CreationDate":"2009-10-22T04:29:00.000","Title":"What files do I need to include with my Python app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a python app using Tkinter for buttons and graphics and having trouble getting a timer working, what I need is a sample app that has three buttons and a label.\n[start timer]  [stop timer] [quit]\nWhen I press the start button a function allows the label to count up from zero every 5 seconds, the stop button stops the timer and the quit button quits the app.\nI need to be able to press stop timer and quit at any time, and the time.sleep(5) function locks everything up so I can't use that.\ncurrently i'm using threading.timer(5,do_count_function) and getting nowhere !\nI'm a vb.net programmer, so python is a bit new to me, but hey, i'm trying.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1711,"Q_Id":1606700,"Users Score":2,"Answer":"Check the .after method of your Tk() object. This allows you to use Tk's timer to fire events within the gui's own loop by giving it a length of time and a callback method.","Q_Score":1,"Tags":"python,tkinter","A_Id":1606815,"CreationDate":"2009-10-22T11:53:00.000","Title":"Timer in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anyone know of a automated GUI testing package for that works with PyQT besides Squish?  Nothing against Squish I am just looking for other packages.  It would be cool if there were an open source package.  I am doing my testing under Linux.","AnswerCount":4,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":3768,"Q_Id":1616228,"Users Score":4,"Answer":"It looks like PyQT4 includes a QtTest object that can be used for unit testing.","Q_Score":18,"Tags":"python,testing,pyqt","A_Id":1829332,"CreationDate":"2009-10-23T22:19:00.000","Title":"PyQT GUI Testing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C++ app that uses Python to load some scripts. It calls some functions in the scripts, and everything works fine until the app exits and calls Py_Finalize. Then it displays the following: (GetName is a function in one of the scripts)\nException AttributeError: \"'module' object has no attribute 'GetName'\" in 'garbage collection' ignored\nFatal Python error: unexpected exception during garbage collection\nThen the app crashes.\nI'm using Python 3.1 on Windows. Any advice would be appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1194,"Q_Id":1619908,"Users Score":4,"Answer":"From the docs to Py_Finalize():\n\nBugs and caveats: The destruction of\n  modules and objects in modules is done\n  in random order; this may cause\n  destructors (__del__() methods) to\n  fail when they depend on other objects\n  (even functions) or modules.\n  Dynamically loaded extension modules\n  loaded by Python are not unloaded.\n  Small amounts of memory allocated by\n  the Python interpreter may not be\n  freed (if you find a leak, please\n  report it). Memory tied up in circular\n  references between objects is not\n  freed. Some memory allocated by\n  extension modules may not be freed.\n  Some extensions may not work properly\n  if their initialization routine is\n  called more than once; this can happen\n  if an application calls\n  Py_Initialize() and Py_Finalize() more\n  than once.\n\nMost likely a __del__ contains a call to <somemodule>.GetName(), but that module has already been destroyed by the time __del__ is called.","Q_Score":2,"Tags":"python,exception,attributes","A_Id":1619944,"CreationDate":"2009-10-25T03:24:00.000","Title":"What is causing this Python exception?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know python and I'm a newibe with wx python but I would like to make a card game. \nHowever I have no idea how to make a image follow the mouse and put it in the middle of the screen when the program running. It will be nice if you guys can help me out.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":877,"Q_Id":1622884,"Users Score":2,"Answer":"Going through the wxPython demo and looking at all the examples would be a good start.  You'll likely find page Using Images | DragImage to be useful, since you'll probably want cards that you can drag.\nGenerally, the demo can help you do most things in wxPython, and also show you what wxPython can do, and it's worth the time to see every demo.  This approach works for everything except the very first step of getting an app running and putting a frame in it (since the demo itself is an app, but not a simple one).  Any of the basic tutorials can help you get started with an app and frame in just a very lines of code.","Q_Score":0,"Tags":"wxpython,drag,playing-cards","A_Id":1623027,"CreationDate":"2009-10-26T02:52:00.000","Title":"wx python card game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on an adventure game in Python using Pygame. My main problem is how I am going to define the boundaries of the room and make the main character walk aroud without hitting a boundary every time. Sadly, I have never studied algorithms so I have no clue on how to calculate a path. I know this question is quite general and hard to answer but a point in the right direction would be very appreciated. Thanks!","AnswerCount":4,"Available Count":1,"Score":0.1488850336,"is_accepted":false,"ViewCount":1431,"Q_Id":1623331,"Users Score":3,"Answer":"Sadly, I have never studied algorithms so I have no clue on how to calculate a path.\n\nBefore you start writing games, you should educate yourself on those. This takes a little more effort at the beginning, but will save you much time later.","Q_Score":0,"Tags":"python,pygame","A_Id":1623346,"CreationDate":"2009-10-26T06:16:00.000","Title":"Adventure game - walking around inside a room","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm now thinking, is it possible to integrate Python, Perl and C\/C++ and also doing a GUI application with this very nice mix of languages?","AnswerCount":5,"Available Count":3,"Score":0.1973753202,"is_accepted":false,"ViewCount":735,"Q_Id":1628001,"Users Score":5,"Answer":"Anything is \"possible\", but whether it is necessary or beneficial is debatable and highly depends on your requirements. Don't mix if you don't need to. Use the language that best fits the domain or target requirements. \nI can't think of a scenario where one needs to mix Python and Perl as their domain is largely the same.\nUsing C\/C++ can be beneficial in cases where you need hardcore system integration or specialized machine dependent services. Or when you need to extend Python or Perl itself (both are written in C\/C++).\nEDIT: if you want to do a GUI application, it is probably easier to choose a language that fits the OS you want your GUI to run in. I.e. something like (but not limited to) C# for Windows, Objective-C for iPhone or Mac, Qt + C++ for Linux etc.","Q_Score":1,"Tags":"c++,python,c,perl,integration","A_Id":1628011,"CreationDate":"2009-10-27T00:04:00.000","Title":"Python, Perl And C\/C++ With GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm now thinking, is it possible to integrate Python, Perl and C\/C++ and also doing a GUI application with this very nice mix of languages?","AnswerCount":5,"Available Count":3,"Score":0.0399786803,"is_accepted":false,"ViewCount":735,"Q_Id":1628001,"Users Score":1,"Answer":"Everything is possible - but why add two and a half more levels of complexity?","Q_Score":1,"Tags":"c++,python,c,perl,integration","A_Id":1628012,"CreationDate":"2009-10-27T00:04:00.000","Title":"Python, Perl And C\/C++ With GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm now thinking, is it possible to integrate Python, Perl and C\/C++ and also doing a GUI application with this very nice mix of languages?","AnswerCount":5,"Available Count":3,"Score":0.0399786803,"is_accepted":false,"ViewCount":735,"Q_Id":1628001,"Users Score":1,"Answer":"Python & Perl? together?\nI can only think of an editor.","Q_Score":1,"Tags":"c++,python,c,perl,integration","A_Id":1628013,"CreationDate":"2009-10-27T00:04:00.000","Title":"Python, Perl And C\/C++ With GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If you have a QImage wrapped inside a QLabel, is it possible to scale it up or down when you resize the window and maintain the aspect ratio (so the image doesn't become distorted)? I figured out that it can scale using setScaledContents(), and you can set a minimum and maximum size, but the image still loses its aspect. \nIt would be great if this could be explained using Python (since I don't know c++), but I'll take what I can get. :-)\nThanks in advance!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2384,"Q_Id":1631574,"Users Score":2,"Answer":"I'm showing this as C++, which is what the documentation I'm looking at is in.  It shouldn't be too difficult to convert to python.\nYou need to create a custom derivative of QLayoutItem, which overrides bool hasHeightForWidth() and int heightForWidth( int width) to preserve the aspect ratio somehow.  You could either pass the image in and query it, or you could just set the ratio directly.  You'll also need to make sure the widget() function returns a pointer to the proper label.\nOnce that is done, you can add a layout item to a layout in the same manner you would a widget.  So when your label gets added, change it to use your custom layout item class.\nI haven't actually tested any of this, so it is a theoretical solution at this point.  I don't know of any way to do this solution through designer, if that was desired.","Q_Score":1,"Tags":"python,user-interface,qt,pyqt","A_Id":1632726,"CreationDate":"2009-10-27T15:23:00.000","Title":"How to allow scaling with uniform aspect ratio in (Py)Qt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For the program idea I have, it requires that the software be written in one binary that is executeable by all major desktop platforms, meaning it needs an interpreted language or a language within a JVM. Either is fine with me, but the programming language has to balance power & simplicity (e.g. Python)\nI know of wxPython but I have read that it's support on Mac OS X is fairly limited\nJava sounds good & it looks good but it seems almost too difficult to program in\nAny help?","AnswerCount":11,"Available Count":6,"Score":0.0,"is_accepted":false,"ViewCount":3320,"Q_Id":1653419,"Users Score":0,"Answer":"Java seems better for what you want.\nWell what about the web application in Javascript?","Q_Score":3,"Tags":"java,python,cross-platform,wxpython,multiplatform","A_Id":1653442,"CreationDate":"2009-10-31T04:34:00.000","Title":"Cross-Platform Programming Language with a decent gui toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"For the program idea I have, it requires that the software be written in one binary that is executeable by all major desktop platforms, meaning it needs an interpreted language or a language within a JVM. Either is fine with me, but the programming language has to balance power & simplicity (e.g. Python)\nI know of wxPython but I have read that it's support on Mac OS X is fairly limited\nJava sounds good & it looks good but it seems almost too difficult to program in\nAny help?","AnswerCount":11,"Available Count":6,"Score":0.0,"is_accepted":false,"ViewCount":3320,"Q_Id":1653419,"Users Score":0,"Answer":"I would suggest going the wxPython route, I know that wxWidgets (which is what wxPython is using) can be made to have great looking Mac apps (look at PgAdmin3 from postgresql).  While PgAdmin3 is not done in python, it was done with wxWidgets and looks fine on a mac.","Q_Score":3,"Tags":"java,python,cross-platform,wxpython,multiplatform","A_Id":1681376,"CreationDate":"2009-10-31T04:34:00.000","Title":"Cross-Platform Programming Language with a decent gui toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"For the program idea I have, it requires that the software be written in one binary that is executeable by all major desktop platforms, meaning it needs an interpreted language or a language within a JVM. Either is fine with me, but the programming language has to balance power & simplicity (e.g. Python)\nI know of wxPython but I have read that it's support on Mac OS X is fairly limited\nJava sounds good & it looks good but it seems almost too difficult to program in\nAny help?","AnswerCount":11,"Available Count":6,"Score":0.0181798149,"is_accepted":false,"ViewCount":3320,"Q_Id":1653419,"Users Score":1,"Answer":"I think wxPython is pretty good, though I am not sure what you mean by \"support on Mac OS X is fairly limited\" but I have been porting a wxPython app (www.mockupscreens.com) to Mac and it wasn't that difficult with few tweaks e.g. some UI elements may not come up as you expected, as wxPython uses native UI elements, which can be an advanatage or disadvantage based on your requirements.\nOther good option is PyQT which will give you consistent look on all platforms.","Q_Score":3,"Tags":"java,python,cross-platform,wxpython,multiplatform","A_Id":1656477,"CreationDate":"2009-10-31T04:34:00.000","Title":"Cross-Platform Programming Language with a decent gui toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"For the program idea I have, it requires that the software be written in one binary that is executeable by all major desktop platforms, meaning it needs an interpreted language or a language within a JVM. Either is fine with me, but the programming language has to balance power & simplicity (e.g. Python)\nI know of wxPython but I have read that it's support on Mac OS X is fairly limited\nJava sounds good & it looks good but it seems almost too difficult to program in\nAny help?","AnswerCount":11,"Available Count":6,"Score":0.0181798149,"is_accepted":false,"ViewCount":3320,"Q_Id":1653419,"Users Score":1,"Answer":"I work on a program that has to run on Windows, Linux and OS X (and OS X is my development platform), and wxPython is what we use.\nIf I had a chance to start again, I'd probably go with PyQT (based on advice from friends), but wxPython will get the job done.","Q_Score":3,"Tags":"java,python,cross-platform,wxpython,multiplatform","A_Id":1653436,"CreationDate":"2009-10-31T04:34:00.000","Title":"Cross-Platform Programming Language with a decent gui toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"For the program idea I have, it requires that the software be written in one binary that is executeable by all major desktop platforms, meaning it needs an interpreted language or a language within a JVM. Either is fine with me, but the programming language has to balance power & simplicity (e.g. Python)\nI know of wxPython but I have read that it's support on Mac OS X is fairly limited\nJava sounds good & it looks good but it seems almost too difficult to program in\nAny help?","AnswerCount":11,"Available Count":6,"Score":0.0,"is_accepted":false,"ViewCount":3320,"Q_Id":1653419,"Users Score":0,"Answer":"I use three cross-platform tools regularly: Realbasic from Realsoftware which is what Visual Basic v6 would have been if allowed to grow; Revolution from Runrev which is what Hypercard would have been if allowed to survive (and its neat using a scripting language whose syntax is basically English); and finally, Delphi Prism with Mono.\nAll are quite mature and yet expanding at a great rate. For instance, Revolution is just introducing a web-application feature to its language that is really easy to use.","Q_Score":3,"Tags":"java,python,cross-platform,wxpython,multiplatform","A_Id":1681426,"CreationDate":"2009-10-31T04:34:00.000","Title":"Cross-Platform Programming Language with a decent gui toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"For the program idea I have, it requires that the software be written in one binary that is executeable by all major desktop platforms, meaning it needs an interpreted language or a language within a JVM. Either is fine with me, but the programming language has to balance power & simplicity (e.g. Python)\nI know of wxPython but I have read that it's support on Mac OS X is fairly limited\nJava sounds good & it looks good but it seems almost too difficult to program in\nAny help?","AnswerCount":11,"Available Count":6,"Score":1.2,"is_accepted":true,"ViewCount":3320,"Q_Id":1653419,"Users Score":6,"Answer":"I used Python with wxPython for quite a while and found it very easy to use. I now use Java with both Swing and SWT.\nI prefer Java but that's just a personal preference so you shouldn't let that sway you.\nI didn't find the transition from Python to Java that difficult. In terms of GUI, they both have the layout manager paradigm - the managers are different but not so different you'll have trouble switching.\nJava has an absolute huge class library to the point where you probably don't need to write your own version of anything, just string together the components. I never really got that deep into Python but it may well be similar. One thing I did notice is that all the really good stuff I used in Python (e.g., s[-4:-1]) could still be done quite easily in Java. Both languages were a step up from C where I had to manage strings with my own libraries.\nIf you think wxPython is limited on MacOS, you should try Java. I run my Java code on Windows, Linux and other UNIXes without compatibility problems. Sadly, not Mac, so I can't really advise you there.\nMy advice, pick a smallish project - do it in both Python and Java - see how it runs on all the platforms you're interested in.","Q_Score":3,"Tags":"java,python,cross-platform,wxpython,multiplatform","A_Id":1653433,"CreationDate":"2009-10-31T04:34:00.000","Title":"Cross-Platform Programming Language with a decent gui toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to design an MVC-pattern with PyQt.\nI want to split all programs into 3 parts:\n\nclasses abstracted from all Qt classes (model)\nclasses providing data from the model to a Qt app (controller)\nthe Qt app itself with defined method SignalsToSlots that connects signals with controller.\n\nIs this optimally? What scheme is recommended for use in PyQt development?","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":29014,"Q_Id":1660474,"Users Score":9,"Answer":"Yes, PyQt uses Model\/View concept (officially without the \"Controller\" part), but may be you have a somewhat distorted picture what does it mean in PyQt.\nThere are two parts:\n\nModels, subclassed from appropriate PyQt base abstract model classes (QAbstractItemModel, QAbstractTableModel, QAbstractListModel, etc.). These models can talk to your data sources directly (files, databases), or proxy your own PyQt-agnostic models which were written before.\nViews, which are implemented in Qt library, and often do not require any modifications (examples: QTreeView, QTableView and others). Even some simpler controls, like QComboBox can act as a view for a PyQt model.\n\nAll other parts of you application, which react to signals, etc. may be considered as \"Controller\".\nPyQt also provides a set of predefined \"universal\" models which can be subclassed or used directly if you need only simple functionality from the model, like QStringListModel, QStandardItemModel, etc. And there are also models which can talk to databases directly, like QSqlTableModel.","Q_Score":35,"Tags":"python,qt,pyqt","A_Id":1692893,"CreationDate":"2009-11-02T10:27:00.000","Title":"PyQt and MVC-pattern","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am looking for an example application written in Python and PyGTK.\nThere should be an editor out there somewhere that already does this.\nSome app with a text editor row of buttons:\n- Font\n- Bold\/italic\/underline\n- etc\nI am hoping to avoid reinventing the wheel on this one! \nthanks","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1341,"Q_Id":1665288,"Users Score":2,"Answer":"I found some related examples: KeepNote, which has a custom rich edit, and Rednotebook which implements KeepNote's richedit.","Q_Score":1,"Tags":"python,pygtk,pango","A_Id":1772990,"CreationDate":"2009-11-03T04:40:00.000","Title":"Are there any examples of a Python PyGTK Pango editor toolbar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In Gnome, whenever an application is started, the mouse cursor changes from normal to an activity indicator (a spinning wheel type thing on Ubuntu). Is there any way to inform Gnome (through some system call) when the application has finished launching so that the mouse cursor returns to normal without waiting for the usual timeout of 30 seconds to occur.\nI have a program in Pythong using GTK+ that is showing the icon even after launching, so what system call do I make?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":840,"Q_Id":1680311,"Users Score":0,"Answer":"This normally happens automatically when calling the gtk.main() function","Q_Score":7,"Tags":"python,linux,ubuntu,gnome","A_Id":1680360,"CreationDate":"2009-11-05T12:39:00.000","Title":"GTK+ Startup Notification Icon","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have a lot of APIs\/Classes that I have developed in Ruby and Python that I would like to use in my .NET apps. Is it possible to instantiate a Ruby or Python Object in C# and call its methods?\nIt seems that libraries like IronPython do the opposite of this. Meaning, they allow Python to utilize .NET objects, but not the reciprocal of this which is what I am looking for... Am I missing something here?\nAny ideas?","AnswerCount":4,"Available Count":1,"Score":-0.049958375,"is_accepted":false,"ViewCount":5027,"Q_Id":1684145,"Users Score":-1,"Answer":"I have seen ways to call into Ruby \/ Python from c#. But it's easier the other way around.","Q_Score":8,"Tags":"c#,.net,python,ruby","A_Id":1684168,"CreationDate":"2009-11-05T22:37:00.000","Title":"Call Ruby or Python API in C# .NET","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a widget that displays a filesystem hierarchy for convenient browsing (basically a tree control and some associated toolbar buttons, such as \"refresh\"). Each of these widgets has a set of base directories for it to display (recursively). Assume that the user may instantiate as many of these widgets as they find convenient. Note that these widgets don't correspond to any business data -- they're independent of the model.\nWhere should the (per-widget) set of base directories live in good MVC design?\nWhen the refresh button is pushed, an event is trapped by the controller, and the event contains the corresponding filesystem-browser widget. The controller determines the base directories for that particular widget (somehow), walks that directory path, and passes the widget some data to render.\nTwo places I can think to store the base directories:\n\nThe easy solution: make the base directories an instance variable on the widget and have the controller manipulate it to retain state for that widget. There's a conceptual issue with this, though: since the widget never looks at that instance variable, you're just projecting one of the responsibilities of the controller onto the widget.\nThe more (technically, maybe conceptually) complex solution: Keep a {widget: base_directory_set} mapping in the controller with weak key references.\n\nThe second way allows for easy expansion of controller responsibilities later on, as putting things in the controller tends to do -- for example, if I decided I later wanted to determine the set of all the base directories for all those widgets.\nThere may be some piece of MVC knowledge I'm missing that solves this kind of problem well.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":519,"Q_Id":1686235,"Users Score":2,"Answer":"The anomaly (from the MVC viewpoint) that makes this design difficult to make MVC-conformant is that you want to display information that, by your conceptualization, \"does not live in a model\".  There is no such thing as \"information that does not live in a model\" in MVC: its conceptual root is \"the models hold all the information, the views just do presentation tasks, the controllers mediate user interaction\".\nIt's quite possible that the information you're displaying doesn't \"correspond to any business data\", but (in an MVC worldview) this does not mean that info is \"independent of the model\", because there is no such thing -- it just means you need another model class (beyond whatever you're using to hold \"business data\"), to hold this \"non-business\" data!-)\nSo when the user \"instantiates a widget\" (creates a directory-display view, presumably by some user action on some master\/coordinating view, possibly on another existing widget if \"cloning\" is one of the ways to instantiate a widget), the controller's responsible for creating both a widget object and an instance of the \"directory-display model class\", and establish connection between them (normally by setting on the widget a reference to the relevant model instance), as well as telling the model to do its initial loading of information.  When the user action on the widget implies an action on the model, the controller retrieves from the widget involved in the event the reference to the model instance, and sends that instance the appropriate request(s) (it's the model's business to let the view[s] interested in it know about changes to information -- typically by some observer pattern; it's definitely not the controller's business to feed the view with information -- that's really a very different approach from MVC!).\nIs the architectural investment required by MVC worth it, in your case, compared to a rougher approach where the information flows are less pristine and the model that should be there just doesn't exist?  I'm a pragmatist and I definitely don't worship at the altar of MVC, but I think in this case the (relatively small) investment in sound, clear architecture may indeed repay itself in abundance.  It's a question of envisioning the likely directions of change -- for example, what functionality that you don't need right now (but may well enter the picture soon afterwards) will be trivial to add if you go the proper MVC route, and would be a nightmare of ad-hoc kludges otherwise (or require a somewhat painful refactoring of the whole architecture)?  All sort of likely things, from wanting to display the same directory information in different widgets to having a smarter \"directory-information watching\" model that can automatically refresh itself when needed (and supply the new info directly to interested views via the usual observer pattern, with no involvement by the controller), are natural and trivially easy with MVC (hey, that's the whole point of MVC, after all, so this is hardly surprising!-), kludgy and fragile with an ad-hoc corner-cutting architecture -- small investment, large potential returns, go for it!\nYou may notice from the tone of the previous paragraph that I don't worship at the \"extreme programming\" altar either -- as a pragmatist, I will do a little \"design up front\" (especially in terms of putting in place a clean, flexible, extensible architecture, from the start, even if it's not indispensable right now) -- exactly because, in my experience, a little forethought and very modest investment, especially on the architectural front, pays back for itself many times over during a project's life (in such varied currencies as scalability, flexibility, extensibility, maintainability, security, and so forth, though not all of them will apply to every project -- e.g., in your case, security and scalability are not really a concern... but the other aspects will likely be!-).\nJust for generality, let me point out that this pragmatic attitude of mine does not justify excessive energy and time spent on picking an architecture (by definition of the word \"excessive\";-) -- being familiar with a few fundamental architectural patterns (and MVC is surely one of those) often reduces the initial investment in terms of time and effort -- once you recognize that such a classic architecture will serve you well, as in this case, it's really easy to see how to embody it (e.g., reject the idea of an \"MVC without a M\"!-), and it doesn't really take much more code compared to the kludgiest, ad-hoccest shortcuts!-)","Q_Score":4,"Tags":"python,model-view-controller,user-interface","A_Id":1738316,"CreationDate":"2009-11-06T08:37:00.000","Title":"wxPython: How should I organize per-widget data in the controller?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I need an IronPython\\Python example that would show C#\/VB.NET developers how awesome this language really is.  \nI'm looking for an easy to understand code snippet or application I can use to demo Python's capabilities.\nAny thoughts?","AnswerCount":13,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":1848,"Q_Id":1708103,"Users Score":10,"Answer":"Rewrite any small C# app in IronPython, and show them how many lines of code it took you. If that's not impressing, I don't know what is.\nI'm referring to one of your internal apps.","Q_Score":10,"Tags":"python,ironpython","A_Id":1708382,"CreationDate":"2009-11-10T13:49:00.000","Title":"How to impress developers with IronPython\/Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need an IronPython\\Python example that would show C#\/VB.NET developers how awesome this language really is.  \nI'm looking for an easy to understand code snippet or application I can use to demo Python's capabilities.\nAny thoughts?","AnswerCount":13,"Available Count":2,"Score":0.0461211021,"is_accepted":false,"ViewCount":1848,"Q_Id":1708103,"Users Score":3,"Answer":"I have to agree Geo. Show a C# or VB app next to the same app written in IronPython. When I've done my IronPython talks, I've had a lot of success morphing C# code into Python. It makes for a very dramatic presentation.\nI'm also a big fan of showing off how duck typing makes your code more testable.","Q_Score":10,"Tags":"python,ironpython","A_Id":1711358,"CreationDate":"2009-11-10T13:49:00.000","Title":"How to impress developers with IronPython\/Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I easily translate standard buttons (Yes, No) from QMessageBox? I can't use self.tr on those arguments, so I would like to achieve it in some other simple way. Do I have to use whole translation system?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":5231,"Q_Id":1709528,"Users Score":0,"Answer":"If you want to have Yes\/No translated into the current language, usually setting the system language should be enough. Otherwise try with Natim's suggestion. \nIf you want custom texts: The static methods like question() etc. don't allow custom button texts. That's unfortunate, as \"Yes\"\/\"No\" dialogs are considered bad style (they are not descriptive, one has to read the whole message, and its easy to misunderstand what means Yes and what means No and accidentally negating them). For custom texts, you have to use QMessageBox directly. I'd suggest to write your own static methods accepting optional button texts.","Q_Score":4,"Tags":"python,qt,pyqt,translation,button","A_Id":4627449,"CreationDate":"2009-11-10T17:03:00.000","Title":"PyQt: translating standard buttons","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I easily translate standard buttons (Yes, No) from QMessageBox? I can't use self.tr on those arguments, so I would like to achieve it in some other simple way. Do I have to use whole translation system?","AnswerCount":4,"Available Count":2,"Score":0.1488850336,"is_accepted":false,"ViewCount":5231,"Q_Id":1709528,"Users Score":3,"Answer":"Are you sure you have to translate them yourself? In other toolkits, standard buttons are automatically translated to the language that the user is using.","Q_Score":4,"Tags":"python,qt,pyqt,translation,button","A_Id":1709930,"CreationDate":"2009-11-10T17:03:00.000","Title":"PyQt: translating standard buttons","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a couple of questions.\nI have an algorithm that will generate a couple of pictures in python that must be displayed on a form. I am using PyGt for this. My question is: where should I run my code? Right from the initializer? In that case from what I tested, the form won't show up. \n\nShould I set up a timer in the\nconstructor that starts my algorithm\nhalf a second later?\nWill running the algorithm freeze my\nform making it impossible to see the\npicture itself? I don't mind that the\nbuttons, checkboxes, etc freeze while\nit is computing, as long as the\ncurrent picture is still visible.\nShould I use something like c#'s\nOnFormLoad()? If yes, how can I set\nit? Through connect()?\nHow does threading work on python?\nI've heard, but I'm not too sure\nabout it, that it was a pain to deal\nwith. Is it? In c# it is as easy as\nwriting 4 lines. I'd like to use it\nif possible, but if it is going to be\nhard to implement it I can live\nwithout it.\n\nThanks","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":155,"Q_Id":1715098,"Users Score":1,"Answer":"You can run the algorithm in a separate thread, placing the data into a Queue when finished. The main thread (GUI) will periodically sample the queue and display the data when it arrives.","Q_Score":1,"Tags":"python,pyqt,pyqt4","A_Id":1715113,"CreationDate":"2009-11-11T13:12:00.000","Title":"Couple of questions regarding PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to load large models and other structured binary data on an older CD-based game console as efficiently as possible. What's the best way to do it? The data will be exported from a Python application. This is a pretty elaborate hobby project.\nRequierements:\n\nno reliance on fully standard compliant STL - i might use uSTL though.\nas little overhead as possible. Aim for a solution so good. that it could be used on the original Playstation, and yet as modern and elegant as possible.\nno backward\/forward compatibility necessary.\nno copying of large chunks around - preferably files get loaded into RAM in background, and all large chunks accessed directly from there later.\nshould not rely on the target having the same endianness and alignment, i.e. a C plugin in Python which dumps its structs to disc would not be a very good idea.\nshould allow to move the loaded data around, as with individual files 1\/3 the RAM size, fragmentation might be an issue. No MMU to abuse.\nrobustness is a great bonus, as my attention span is very short, i.e. i'd change saving part of the code and forget the loading one or vice versa, so at least a dumb safeguard would be nice.\nexchangeability between loaded data and runtime-generated data without runtime overhead and without severe memory management issues would be a nice bonus.\n\nI kind of have a semi-plan of parsing in Python trivial, limited-syntax C headers which would use structs with offsets instead of pointers, and convenience wrapper structs\/classes in the main app with getters which would convert offsets to properly typed pointers\/references, but i'd like to hear your suggestions.\nClarification: the request is primarily about data loading framework and memory management issues.","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":270,"Q_Id":1727594,"Users Score":0,"Answer":"Consider storing your data as BLOBs in a SQLite DB. SQLite is extremely portable and lighweight, ANSI C, has both C++ and Python interfaces. This will take care of large files, no fragmentation, variable-length records with fast access, and so on. The rest is just serialization of structs to these BLOBs.","Q_Score":3,"Tags":"c++,python,embedded,playstation","A_Id":1727732,"CreationDate":"2009-11-13T06:56:00.000","Title":"Optimal datafile format loading on a game console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to load large models and other structured binary data on an older CD-based game console as efficiently as possible. What's the best way to do it? The data will be exported from a Python application. This is a pretty elaborate hobby project.\nRequierements:\n\nno reliance on fully standard compliant STL - i might use uSTL though.\nas little overhead as possible. Aim for a solution so good. that it could be used on the original Playstation, and yet as modern and elegant as possible.\nno backward\/forward compatibility necessary.\nno copying of large chunks around - preferably files get loaded into RAM in background, and all large chunks accessed directly from there later.\nshould not rely on the target having the same endianness and alignment, i.e. a C plugin in Python which dumps its structs to disc would not be a very good idea.\nshould allow to move the loaded data around, as with individual files 1\/3 the RAM size, fragmentation might be an issue. No MMU to abuse.\nrobustness is a great bonus, as my attention span is very short, i.e. i'd change saving part of the code and forget the loading one or vice versa, so at least a dumb safeguard would be nice.\nexchangeability between loaded data and runtime-generated data without runtime overhead and without severe memory management issues would be a nice bonus.\n\nI kind of have a semi-plan of parsing in Python trivial, limited-syntax C headers which would use structs with offsets instead of pointers, and convenience wrapper structs\/classes in the main app with getters which would convert offsets to properly typed pointers\/references, but i'd like to hear your suggestions.\nClarification: the request is primarily about data loading framework and memory management issues.","AnswerCount":4,"Available Count":3,"Score":0.1488850336,"is_accepted":false,"ViewCount":270,"Q_Id":1727594,"Users Score":3,"Answer":"I note that nowhere in your description do you ask for \"ease of programming\".  :-)\nThus, here's what comes to mind for me as a way of creating this:\n\nThe data should be in the same on-disk format as it would be in the target's memory, such that it can simply pull blobs from disk into memory with no reformatting it.  Depending on how much freedom you want in putting things into memory, the \"blobs\" could be the whole file, or could be smaller bits within it; I don't understand your data well enough to suggest how to subdivide it but presumably you can.  Because we can't rely on the same endianness and alignment on the host, you'll need to be somewhat clever about translating things when writing the files on the host-side, but at least this way you only need the cleverness on one side of the transfer rather than on both.\nIn order to provide a bit of assurance that the target-side and host-side code matches, you should write this in a form where you provide a single data description and have some generation code that will generate both the target-side C code and the host-side Python code from it.  You could even have your generator generate a small random \"version\" number in the process, and have the host-side code write this into the file header and the target-side check it, and give you an error if they don't match.  (The point of using a random value is that the only information bit you care about is whether they match, and you don't want to have to increment it manually.)","Q_Score":3,"Tags":"c++,python,embedded,playstation","A_Id":1728074,"CreationDate":"2009-11-13T06:56:00.000","Title":"Optimal datafile format loading on a game console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to load large models and other structured binary data on an older CD-based game console as efficiently as possible. What's the best way to do it? The data will be exported from a Python application. This is a pretty elaborate hobby project.\nRequierements:\n\nno reliance on fully standard compliant STL - i might use uSTL though.\nas little overhead as possible. Aim for a solution so good. that it could be used on the original Playstation, and yet as modern and elegant as possible.\nno backward\/forward compatibility necessary.\nno copying of large chunks around - preferably files get loaded into RAM in background, and all large chunks accessed directly from there later.\nshould not rely on the target having the same endianness and alignment, i.e. a C plugin in Python which dumps its structs to disc would not be a very good idea.\nshould allow to move the loaded data around, as with individual files 1\/3 the RAM size, fragmentation might be an issue. No MMU to abuse.\nrobustness is a great bonus, as my attention span is very short, i.e. i'd change saving part of the code and forget the loading one or vice versa, so at least a dumb safeguard would be nice.\nexchangeability between loaded data and runtime-generated data without runtime overhead and without severe memory management issues would be a nice bonus.\n\nI kind of have a semi-plan of parsing in Python trivial, limited-syntax C headers which would use structs with offsets instead of pointers, and convenience wrapper structs\/classes in the main app with getters which would convert offsets to properly typed pointers\/references, but i'd like to hear your suggestions.\nClarification: the request is primarily about data loading framework and memory management issues.","AnswerCount":4,"Available Count":3,"Score":0.1973753202,"is_accepted":false,"ViewCount":270,"Q_Id":1727594,"Users Score":4,"Answer":"On platforms like the Nintendo GameCube and DS, 3D models are usually stored in a very simple custom format:\n\nA brief header, containing a magic number identifying the file, the number of vertices, normals, etc., and optionally a checksum of the data following the header (Adler-32, CRC-16, etc).\nA possibly compressed list of 32-bit floating-point 3-tuples for each vector and normal.\nA possibly compressed list of edges or faces.\nAll of the data is in the native endian format of the target platform.\nThe compression format is often trivial (Huffman), simple (Arithmetic), or standard (gzip). All of these require very little memory or computational power.\n\nYou could take formats like that as a cue: it's quite a compact representation.\nMy suggestion is to use a format most similar to your in-memory data structures, to minimize post-processing and copying. If that means you create the format yourself, so be it. You have extreme needs, so extreme measures are needed.","Q_Score":3,"Tags":"c++,python,embedded,playstation","A_Id":1728071,"CreationDate":"2009-11-13T06:56:00.000","Title":"Optimal datafile format loading on a game console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having an issue with an embedded 64bit Python instance not liking PIL. Before i start exhausting more methods to get a compiled image editor to read the pixels for me (such as ImageMagick) i am hoping perhaps anyone here can think of a purely Python solution that will be comparable in speeds to the compiled counterparts.\nNow i am aware that the compiled friends will always be much faster, but i am hoping that because i \"just\" want to read the alpha of a group of pixels, that perhaps a fast enough pure Python solution can be conjured up. Anyone have any bright ideas?\nThough, i have tried PyPNG and that is far too slow, so i'm not expecting any magic solutions. None the less, i had to ask.\nThanks to any replies!\nAnd just for reference, the images i'll be reading will be on average around 512*512 to 2048*2048, and i'll be reading anywhere from one to all of the pixels alpha (multiplied by a few million times, but the values can be stored so reading twice isn't done).","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":955,"Q_Id":1732761,"Users Score":2,"Answer":"Getting data out of a PNG requires unpacking data and decompressing it.  These are likely going to be too slow in Python for your application.  One possibility is to start with PyPNG and get rid of anything in it that you don't need.  For example, it is probably storing all of the data it reads from the PNG, and some of the slow speed you see may be due to the memory allocations.","Q_Score":1,"Tags":"python,png","A_Id":1732962,"CreationDate":"2009-11-14T00:30:00.000","Title":"Reading Alpha of a PNG Pixel. Fast way via pure Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyQt to capture my screen with QPixmap.grabWindow(QApplication.desktop().winId()) and I was wondering if there was a way I could display my screengrab fullscreen (no window borders, etc.) I'm trying to find a way to desaturate my display with PyQt","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3562,"Q_Id":1732935,"Users Score":9,"Answer":"Passing QtCore.Qt.FramelessWindowHint to the QWidget constructor in symphony with self.showFullScreen() in the image widget's code achieves this.","Q_Score":4,"Tags":"python,pyqt,screenshot,fullscreen","A_Id":1733241,"CreationDate":"2009-11-14T01:36:00.000","Title":"PyQt display fullscreen image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know this is a long shot, but I was wondering if Python had a way to manipulate the screen buffer. Specifically, I want to be able to gray-out my desktop and highlight my windows when I press a key combination. Is this in the realm of possibility?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1923,"Q_Id":1734575,"Users Score":2,"Answer":"Instead of \"graying out\" the desktop, try to overlay a gray, semi-transparent image over the entire screen and then make sure your window is on top of that. You may face a couple of minor limitations; for example, I don't know off the top of my head if it's possible to overlay the mac menubar (and I'm not sure you'd want to).","Q_Score":1,"Tags":"python,screen,buffer","A_Id":1737577,"CreationDate":"2009-11-14T15:34:00.000","Title":"Manipulate screen buffer in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to put QGraphicsScene's (0,0) to top-left corner of QGraphicsView?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1081,"Q_Id":1737624,"Users Score":1,"Answer":"Try doing setCenterOn(0,0) on the QGraphicsView?","Q_Score":2,"Tags":"python,qt,pyqt","A_Id":4600372,"CreationDate":"2009-11-15T14:17:00.000","Title":"QGraphicsScene and positioning","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have some project about game programming, which have to use blender with phanthom ,Don't know possible to do it","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":305,"Q_Id":1740299,"Users Score":0,"Answer":"If you mean Phantom Omni, the haptic feedback device, and you mean Blender, the rendering program, then I don't see any reason why you can't use the API for both of them in a program, together to make a game.\nIn short, if your questions means what I think it does, of course.","Q_Score":0,"Tags":"python,blender","A_Id":1740306,"CreationDate":"2009-11-16T05:48:00.000","Title":"Can i integrate Blender with Phanthom Omni","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it). \nAny ideas how to reach this elements and make them testable?","AnswerCount":4,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":3825,"Q_Id":1741023,"Users Score":2,"Answer":"I'm experimenting with code for a tool for automating PowerBuilder-based GUIs as well. From what I can see, your best bet would be to use the PowerBuilder Native Interface (PBNI), and call PowerScript code from within your NVO.\nIf you like, feel free to send me an email (see my profile for my email address), I'd be interested in exchanging ideas about how to do this.","Q_Score":6,"Tags":"python,testing,powerbuilder","A_Id":1741142,"CreationDate":"2009-11-16T09:23:00.000","Title":"How to make PowerBuilder UI testing application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it). \nAny ideas how to reach this elements and make them testable?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":3825,"Q_Id":1741023,"Users Score":1,"Answer":"I've seen in AutomatedQa support that they a recipe recommending using msaa and setting some properties on the  controls. I do not know if it works.","Q_Score":6,"Tags":"python,testing,powerbuilder","A_Id":2328021,"CreationDate":"2009-11-16T09:23:00.000","Title":"How to make PowerBuilder UI testing application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"From the web I've gleaned that WSGI is a CGI for python web development\/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don't know the performance difference between the two in reference to the languages python and C\/++.","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":25057,"Q_Id":1747266,"Users Score":27,"Answer":"They are two different things. WSGI is a Python specific interface for writing web applications. There are wrappers for about any web server protocol to provide the WSGI interface. FastCGI (FCGI) is one of such web server protocols. So, WSGI is an abstraction layer, while CGI \/ FastCGI \/ mod_python are how the actual web servers talk to the application. Some code has to translate the native interface to WSGI (there is a CGI module in wsgiref, there is flup for FastCGI, etc.). There is also mod_wsgi for Apache, which does the translation directly in an Apache module, so you don't need any Python wrapper.","Q_Score":39,"Tags":"python,wsgi,fastcgi","A_Id":1747336,"CreationDate":"2009-11-17T07:59:00.000","Title":"Is there a speed difference between WSGI and FCGI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"From the web I've gleaned that WSGI is a CGI for python web development\/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don't know the performance difference between the two in reference to the languages python and C\/++.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":25057,"Q_Id":1747266,"Users Score":80,"Answer":"Correct, WSGI is a Python programmatic API definition and FASTCGI is a language agnostic socket wire protocol definition. Effectively they are at different layers with WSGI being a higher layer. In other words, one can implement WSGI on top of something that so happened to use FASTCGI to communicate with a web server, but not the other way around.\nIn general, FASTCGI being a socket wire protocol means that you always need some type of programmatic interface on top to use it. For Python one such option is WSGI. As FASTCGI is just a means to an end, one can't really compare its performance to WSGI in that case because WSGI isn't a comparable socket wire protocol, but a user of FASTCGI itself.\nOne could try and compare performance of different language interfaces on top of FASTCGI, but in general that is quite meaningless in itself as the lower network layer and server request handling aren't the bottleneck. Instead your application code and database will be.","Q_Score":39,"Tags":"python,wsgi,fastcgi","A_Id":1748161,"CreationDate":"2009-11-17T07:59:00.000","Title":"Is there a speed difference between WSGI and FCGI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"What experiences do you have with Stackless Python and PyQt?\nIssues i would be happy if people address:\n\nCompilation of PyQt for Stackless: does PyQt need to be compiled especially for Stackless? is the compilation smooth? problems with bindings etc.\nStability: any unexpected crashes, freezes, pauses and other weirdities?\nMemory Management: any hints of memory leaks. comparison of RAM needed for a Stackless\/Plain Vanilla PyQt applications\nSoftware Engineering Empowerment: very short outline of flow-of-control models for Stackless-powered PyQt applications\nLessons learned: any painful lesson learned, traps to be avoided, problems to tackle you might have experienced\n\nBe Happy","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1679,"Q_Id":1749818,"Users Score":0,"Answer":"I tried to go down this path several months ago and decided it was not worth the effort.\nI was able to run a binary install of PyQt (on Windows) against a stackless version of Python, but I found that I had to manually go in and change some of the files.  I was getting an error message (sorry, I forget what it was), and google search led to a solution from several years ago.  Newer code did not include the old fix, so the change was not too difficult and (if I remember correctly) it was in python, so no recompile was necessary.\nBut that was a deal breaker for me. Qt updates come out regularly, as do updates to PyQt, and I didn't want to be continually fixing the code.  Stackless and PyQt are simply not used enough together to be checked out thoroughly.  I found the risk of difficult to debug issues pretty high. This is especially true given the author of stackless has moved on to PyPy.  Let me apologize in advance - I wish I had the references I found for the author stopping development on stackless python and more detail on the errors I had to fix - I wasn't expecting to regurgitate the details on Stack Overflow.\nSo I chose to run PyQt on a vanilla Python instead of stackless.\nBTW, I also thought that mixing signals\/slots with stackless code would be confusing, as they are completely different methods of solving multi-threading problems.\nGood luck!","Q_Score":4,"Tags":"python,pyqt,pyqt4,stackless,python-stackless","A_Id":2047183,"CreationDate":"2009-11-17T15:52:00.000","Title":"Stackless Python and PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The documentation for pyWebKitGTK is pretty scarce. I've looked through their python .def files but they don't seem to contain the words cookie, session, (lib)soup or (lib)curl.. so maybe it isn't possible, huh. I've also looked through the WebKitGTK docs (for the C-based library) and aside from a brief mention of libsoup there doesn't appear to be anything there either. But on the other hand cookie support seems like pretty fundamental stuff. Could anyone confirm \/ deny PyWebKitGTK's support of cookies?\nNote: am currently using the GTK version, but I don't mind switching to the Qt one if the feature is there.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2065,"Q_Id":1761473,"Users Score":-1,"Answer":"webkit is a html renderer, not a complete browser. I guess you must deal with persisting the cookies yourself.","Q_Score":2,"Tags":"python,cookies,webkit","A_Id":1762266,"CreationDate":"2009-11-19T07:20:00.000","Title":"How to enable cookie support with pyWebKit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The problem I have is that I have this Python script to launch a application. After the application is launched (the GUI is shown on screen), I want to make it de-activated. It can be done manually by activating another window, or minimizing this app, or pressing the Show Desktop key for WindowsXP.\nSo is there any way that I can do this by Python? Core or 3rd party library would be all ok.\nThanks!","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1789,"Q_Id":1767575,"Users Score":0,"Answer":"I've used AutoIt (via it's COM interface) a lot of times","Q_Score":2,"Tags":"python,windows,keyboard","A_Id":1773644,"CreationDate":"2009-11-20T00:24:00.000","Title":"Are there any libraries for Python to simulate keyboard action?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an existing Python 2.4 and it is working properly with tkinter as I tested it using \npython\nimport _tkinter\n\n\n\nimport Tkinter\n      Tkinter._test() \n\n\n\nNow, I have installed python 2.5.2 but when I try the same tests (with the newer version), it returns (but the same tests are working for the previous version)\nImportError: No module named _tkinter\nI know that tcl8.5 and tk8.5 are installed on my machine as the following commands return there locations\nwhereis tcl\ntcl: \/usr\/lib\/tcl8.4 \/usr\/local\/lib\/tcl8.5 \/usr\/local\/lib\/tcl8.4 \/usr\/share\/tcl8.4\nwhereis tk\ntk: \/usr\/lib\/tk8.4 \/usr\/local\/lib\/tk8.5 \/usr\/share\/tk8.4\nAny ideas how do I make my newer python version work with tkinter?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":1073,"Q_Id":1773222,"Users Score":3,"Answer":"The files you found are for linking directly to tcl\/tk. Python depends on another library as well: _tkinter.so. It should be in \/usr\/lib\/python2.5\/lib-dynload\/_tkinter.so.\nHow did you install python2.5? If you are using Debian or Ubuntu you need to install the python-tk package to get Tkinter support.\nIf the _tkinter.so file is there, your environment could be causing problems.\nIf \n\npython -E -c \"import\n  Tkinter;Tkinter._test()\"\n\nsuceeds, but \n\npython -c \"import\n  Tkinter;Tkinter._test()\"\n\nfails, then the problem is with how your environment is set up. Check the value of PYTHONPATH is set correctly.","Q_Score":0,"Tags":"python,tcl,tkinter,tk","A_Id":1773435,"CreationDate":"2009-11-20T21:02:00.000","Title":"Linking Tcl\/Tk to Python 2.5","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a web developer looking to get my feet wet with coding up a little desktop app for Ubuntu in Python. I've scoured the web looking for the pros and cons of PyGTK vs. PyQT and can't really find any good comparisons.\nWhat do you guys think? Do they both produce native-looking widgets on a GNOME system? Is one easier to use than the other? Any opinions would be nice.\nSorry for the subjective question.","AnswerCount":4,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":3384,"Q_Id":1779004,"Users Score":13,"Answer":"I've written reasonably large apps in both PyGTK and PyQt.  On balance, my personal opinion is that PyQt is superior, but not by so much that it's worth worrying about.  If you're only worried about supporting Ubuntu, then use PyGTK; it'll give a better look and feel.  If you think you may want to port this app to other platforms, then use PyQt; PyQt is far and away the superior crossplatform solution.","Q_Score":9,"Tags":"python,ubuntu,pyqt,pygtk","A_Id":1818306,"CreationDate":"2009-11-22T15:21:00.000","Title":"Is PyGTK or PyQT preferred for making GTK-native Python apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a web developer looking to get my feet wet with coding up a little desktop app for Ubuntu in Python. I've scoured the web looking for the pros and cons of PyGTK vs. PyQT and can't really find any good comparisons.\nWhat do you guys think? Do they both produce native-looking widgets on a GNOME system? Is one easier to use than the other? Any opinions would be nice.\nSorry for the subjective question.","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":3384,"Q_Id":1779004,"Users Score":1,"Answer":"In my experience, having made both PyGTK and PyQT apps, there is little difference on the underlying programming side of things.  PyQT seems more consistent across different flavors of Linux, where GTK is constantly changing and breaking on older distributions.\nPyQT has QTCreator, which is a great GUI designer.  PyGTK has Glade3, which is getting better, but not as good.  Until recently Glade was a bad joke.  If you need to draw GUIs in an editor, PyQT is probably the better choice.  Otherwise, I'd go with PyGTK for coding because the online PyGTK documentation is excellent.\nOne bizarre thing I've found is PyQT has poor support for dynamic menu item callbacks.  Maybe I just didnt use it right, but PyGTK is a bit more flexible in comparison.  \nIt's a tough choice, really.  But if you design your application right, the interface should be irrelevant; you could design your app with multiple interfaces...","Q_Score":9,"Tags":"python,ubuntu,pyqt,pygtk","A_Id":1901957,"CreationDate":"2009-11-22T15:21:00.000","Title":"Is PyGTK or PyQT preferred for making GTK-native Python apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a web developer looking to get my feet wet with coding up a little desktop app for Ubuntu in Python. I've scoured the web looking for the pros and cons of PyGTK vs. PyQT and can't really find any good comparisons.\nWhat do you guys think? Do they both produce native-looking widgets on a GNOME system? Is one easier to use than the other? Any opinions would be nice.\nSorry for the subjective question.","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":3384,"Q_Id":1779004,"Users Score":1,"Answer":"In my opinion use PYQT as its definately superior for a few reasons. There is no worries with pixmaps ever, there is only one library coded in the same style and conventions. In pygtk you need to learn up to 4 libraries coded in a different style. You have to learn GLIB constants at least if not GLIB variable names as well even though they are a complete 1 to 1 swap with the stdlib C type itself, but why use standard types everyone else uses when as the master of your toolkit you can use pretty useless special purpose types which then can be forced onto everyone else. Gnome developers need a serious wake up. \nGo with PYQT its sane easy to use and wont make you constantly look up documentation to find out why you cant use standard code.","Q_Score":9,"Tags":"python,ubuntu,pyqt,pygtk","A_Id":13670093,"CreationDate":"2009-11-22T15:21:00.000","Title":"Is PyGTK or PyQT preferred for making GTK-native Python apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a web developer looking to get my feet wet with coding up a little desktop app for Ubuntu in Python. I've scoured the web looking for the pros and cons of PyGTK vs. PyQT and can't really find any good comparisons.\nWhat do you guys think? Do they both produce native-looking widgets on a GNOME system? Is one easier to use than the other? Any opinions would be nice.\nSorry for the subjective question.","AnswerCount":4,"Available Count":4,"Score":0.2449186624,"is_accepted":false,"ViewCount":3384,"Q_Id":1779004,"Users Score":5,"Answer":"PyGTK application will look more native on a Gnome system.  PyQt application will look more native on a KDE system.\nAs I found PyGTK have better documentation then PyQt.\nIt will take the same time to write a program on PyQt and PyGTK.","Q_Score":9,"Tags":"python,ubuntu,pyqt,pygtk","A_Id":1779036,"CreationDate":"2009-11-22T15:21:00.000","Title":"Is PyGTK or PyQT preferred for making GTK-native Python apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to make a StaticText red, what should I use?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":28120,"Q_Id":1785227,"Users Score":3,"Answer":"Depending on which color you would need to set, look into SetForegroundColour() or SetBackgroundColour() method.","Q_Score":23,"Tags":"wxpython,static-text","A_Id":1786334,"CreationDate":"2009-11-23T18:57:00.000","Title":"Change the colour of a StaticText, wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Greetings, everybody.\nI'm trying to import the following libraries in python: cx_Oracle and kinterbasdb.\nBut, when I try, I get a very similar message error.\n*for cx_Oracle:\nTraceback (most recent call last):\n  File \"\", line 1, in \nImportError: DLL load failed: N\u00e3o foi poss\u00edvel encontrar o procedimento especificado.\n(translation: It was not possible to find the specified procedure)\n*for kinterbasdb:\nTraceback (most recent call last):\n  File \"C:\\\", line 1, in \n  File \"c:\\Python26\\Lib\\site-packages\\kinterbasdb__init__.py\", line 119, in \n    import _kinterbasdb as _k\nImportError: DLL load failed: N\u00e3o foi poss\u00edvel encontrar o m\u00f3dulo especificado.\n(translation: It was not possible to find the specified procedure)\nI'm using python 2.6.4 in windows XP. cx_Oracle's version is 5.0.2. kinterbasdb's version is 3.3.0.\nEdit: I've solved it for cx_Oracle, it was a wrong version problem. But I believe I'm using the correct version, and I downloaded it from the Firebird site ( kinterbasdb-3.3.0.win32-setup-py2.6.exe ). Still need assistance with this, please.\nCan anyone lend me a hand here?\nMany Thanks\nDante","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":767,"Q_Id":1799475,"Users Score":-1,"Answer":"oracle is a complete pain.  i don't know the details for windows, but for unix you need ORACLE_HOME and LD_LIBRARY_PATH to both be defined before cx_oracle will work.  in windows this would be your environment variables, i guess.  so check those.\nalso, check that they are defined in the environment in which the program runs (again, i don't know windows specific details, but in unix it's possible for everything to work when you run it from your account by hand, but still not work when run as a batch job because the environment is different).","Q_Score":2,"Tags":"python,cx-oracle,kinterbasdb","A_Id":1803407,"CreationDate":"2009-11-25T19:43:00.000","Title":"importing cx_Oracle and kinterbasdb returns error","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to develop a desktop application framework in Python, much like QT, but how to go about it? Any tutorials or links related to it would be helpful!","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":813,"Q_Id":1811940,"Users Score":2,"Answer":"Well the best way to start is to look at the source code of the framework the other answers are talking about.\nFirst, try to use them all to build the same application with the functionalities you expect from a framework. Them, look at how it works under the hood.\nSecondly, build your framework, starting by writing your first widgets, then notice the problems with your current architecture, and re factor. Start again, until you have something stable and usable.\nEventually, find out this was nice as training experience, but useless as a contribution to the software communities since you will never reach out the qualities of existing tools.\nThen give up and try to code your own MMORPG.","Q_Score":2,"Tags":"python,frameworks,desktop","A_Id":1813171,"CreationDate":"2009-11-28T08:04:00.000","Title":"I want to develop a framework in Python for desktop based applications. How should I go about it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The usual way to use Qt widgets from Python seems to be to subclass them.\nQt widget classes have a great many methods, so inevitably I'm going to end up adding a method to the subclass, with the same name as one inherited from the Qt widget. In Python, all methods are virtual, so what I'm concerned about is that some Qt code might end up calling my method instead of the expected Qt one - in the worst-case scenario, breaking some edge case that doesn't easily show up in testing.\nOn the other hand, maybe all the PyQt methods are just wrappers for C++ code, which would of course be unaffected by anything I do in terms of Python subclassing.\nAnyone know offhand which is the case?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1972,"Q_Id":1828567,"Users Score":3,"Answer":"If the underlaying C++ methods are virtual, your Python methods that override them will be called any time C++ code calls them. If they are just regular methods, any C++ code will call the original C++ methods by default (Python code will call the Python methods though, because it sees the Python object and all methods are \"virtual\" there).","Q_Score":4,"Tags":"python,qt,qt4,pyqt,pyqt4","A_Id":1828607,"CreationDate":"2009-12-01T20:10:00.000","Title":"PyQt subclassing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to render wikitext (pulled from the database of a mediawiki of it's relevant) and display in some other format (ultimately to be rendered as a PDF, but basically any other format will do).\nI can definately hack together something that does the job but ultimately I'll be writing it as I go along, and I can see that the overhead of implementing new tags as people in my team use them will eat up a lot of my time.\nIs there a project to do this?\nI saw TiddlyWiki which is written in python, which I will look into borrowing their library, but in the meantime I figured there may be a project that's a bit more niche that someone knows?\nCheers","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":2209,"Q_Id":1836884,"Users Score":-1,"Answer":"pywikipedia i have found to be best","Q_Score":1,"Tags":"python,mediawiki,wikitext","A_Id":2321542,"CreationDate":"2009-12-03T00:29:00.000","Title":"Render wikitext with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In PyQt 4.5, I have a layout inside another layout.  I'd like to remove the sublayout from its parent, and hide it.  I can say parent_layout.removeItem(child_layout) to remove the layout from its parent, but it still shows on the widget.  I can't find any way to hide it in one step, as QLayout doesn't have a hide() method like QWidget does.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2317,"Q_Id":1844630,"Users Score":4,"Answer":"The easy solution would be to have an interior widget, not an interior layout.  You could assign the layout you desire to the widget, then just remove\/hide the widget when you want to do so.  A good rule of thumb is if you just want to arrange how widgets appear, then use a layout; if you want to hide\/show them as a group, use a widget.","Q_Score":3,"Tags":"python,qt4,pyqt","A_Id":1844678,"CreationDate":"2009-12-04T03:19:00.000","Title":"Remove a sublayout in qt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a GTK layout with a widget on the left of an HBox deciding the maximum height I want, and a VBox on the right containing three buttons, each containing only an image and no text. The images are a GTK stock icon, and so have the stock storage type.\nUsing expand=True, fill=True packing the buttons without images are exactly the height I want - some arbitrary small width, and 1\/3 each the height of the left half of the HBox. However with an image, they are either too tall - 3 * ICON_SIZE_MENU is too tall in many themes - or if I force the button's height request, they get clipped. I would rather scale them to the size of the parent button.\nDo I have to make my own pixbufs for each of the stock icons I'm using (and regenerate them if the size changes)? Or can GTK automatically size the image to fit the button, rather than the other way around? Since the images are only a few pixels off from fitting in every theme I've tried, is there a way to just disable the button's clipping?\nThis application is written in Python using PyGTK, but solutions in any language are appreciated.\n(I tried just making it an icon name storage type, but one of the icons is REVERT_TO_SAVED, which turned into the broken stock image when I tried to force it to a particular pixel height. Plus, I'd rather not force it to any fixed pixel height.)","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2476,"Q_Id":1851862,"Users Score":2,"Answer":"There's no way to automatically do you want you want. You might want to subclass gtk.Image and in your subclass, scale a pixbuf to your widget's allocation size. The advantage of this is that you'll have a reusable widget and you'll be able to have it resize your image on the fly.\nThe downside is that you'll have an ugly, scaled up pixmap. You may want to look into scalable vector graphics.","Q_Score":2,"Tags":"python,user-interface,pygtk,gtk","A_Id":1872356,"CreationDate":"2009-12-05T10:48:00.000","Title":"Scaling an image to its parent button size in GTK?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know that IronPython is a dynamically typed language so what I am asking sounds pretty stupid, but is it possible to do something with an IronPython script to make sure the changing of the CLR libraries it references will not result in a runtime error when the script is executed?\nThe reason I ask is that I have written a library referenced by IronPython scripts in C#, and I want a way to know if I've broken any of the interfaces used by the IronPhon scripts when I change the C# library. This is easy to do with another C# project by just compiling the code and seeing compile errors, but this doesn't seem to work when compiling the IronPython scripts.\nAny ideas?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":244,"Q_Id":1852897,"Users Score":2,"Answer":"No, there is no way to statically verify at compile time that the interface changes have not broken your IronPython code.  This is the nature of dynamic languages.  Such errors are instead presented at runtime","Q_Score":4,"Tags":"ironpython,dynamic-language-runtime","A_Id":1852956,"CreationDate":"2009-12-05T17:51:00.000","Title":"IronPython compile-time checks against CLR libraries?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know that IronPython is a dynamically typed language so what I am asking sounds pretty stupid, but is it possible to do something with an IronPython script to make sure the changing of the CLR libraries it references will not result in a runtime error when the script is executed?\nThe reason I ask is that I have written a library referenced by IronPython scripts in C#, and I want a way to know if I've broken any of the interfaces used by the IronPhon scripts when I change the C# library. This is easy to do with another C# project by just compiling the code and seeing compile errors, but this doesn't seem to work when compiling the IronPython scripts.\nAny ideas?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":244,"Q_Id":1852897,"Users Score":1,"Answer":"A good set of fast running unit tests would be a good alternative to compile time checking.","Q_Score":4,"Tags":"ironpython,dynamic-language-runtime","A_Id":1866436,"CreationDate":"2009-12-05T17:51:00.000","Title":"IronPython compile-time checks against CLR libraries?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to pyglet and i have a problem with video..\nI'm trying to play a video using pyglet .. but instead of playing the video in the window it just exits immediately and terminates ..\ndo you guys have any solution for this problem how can i hold the window to play vedio?? \n i use windows vista 64x with python 2.5\nplease help \nand here is the code :\n\n\n\n\nvidPath=\"vid.avi\"\n      widnow = pyglet.window.Window()\n      source = pyglet.media.StreamingSource()\n      MediaLoad = pyglet.media.load(vidPath)\n      player = pyglet.media.Player()\n      player.queue(MediaLoad)\n      player.play()\n@window.event\n      ...def on_draw():\n      ...  player.get_texture.blit(0,0)\n\n\n\n\nthank u very much for your time","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4199,"Q_Id":1859195,"Users Score":0,"Answer":"I think calling \"pyglet.app.run()\" is missing.","Q_Score":1,"Tags":"python,video,pyglet","A_Id":1860559,"CreationDate":"2009-12-07T10:38:00.000","Title":"problem with pyglet playing video","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hey--I'm trying to design my first game using the Pygame library for Python, and I was wondering what the best practices are for level design in general. I would love to hear what you guys think are good object oriented design patterns for managing levels. Also, I'm fairly new to Python--thanks!","AnswerCount":3,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":5646,"Q_Id":1871672,"Users Score":6,"Answer":"If this is your first Pygame application, don't spend time worrying about \"object oriented design patterns for managing levels\". What you need to do now is to figure out how to make Pygame do what you want it to do.\n\nCan you display everything you want to?\nIs your display flicker-free?\nCan you read the user input controls properly?\netc.\n\nObject oriented patterns for managing levels comes later, much later.","Q_Score":3,"Tags":"python,design-patterns,oop,pygame","A_Id":1871698,"CreationDate":"2009-12-09T05:01:00.000","Title":"Level Design in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hey--I'm trying to design my first game using the Pygame library for Python, and I was wondering what the best practices are for level design in general. I would love to hear what you guys think are good object oriented design patterns for managing levels. Also, I'm fairly new to Python--thanks!","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":5646,"Q_Id":1871672,"Users Score":1,"Answer":"Generally speaking, a simple way to do it is using matrices (or multidimensional arrays - they work the same way here).\nBasically, each Map is an Array, with each item in the array being a square on the grid. \nFor example a 3 by 3 grid would be as follows:\n(Psuedocode)\nvar Map = [[1,2,3][1,2,3][1,2,3]];\nIn place of numbers, you could put strings for a function to parse and draw or take action based on what the value of the cell is.","Q_Score":3,"Tags":"python,design-patterns,oop,pygame","A_Id":1871700,"CreationDate":"2009-12-09T05:01:00.000","Title":"Level Design in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hey--I'm trying to design my first game using the Pygame library for Python, and I was wondering what the best practices are for level design in general. I would love to hear what you guys think are good object oriented design patterns for managing levels. Also, I'm fairly new to Python--thanks!","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":5646,"Q_Id":1871672,"Users Score":7,"Answer":"With this type of game your maps are in terms of tiles (I'm assuming that by level you mean an individual level, not managing all of your levels). Each tile has\n\nan associated picture (what it looks like on the display)\na type (ie, a wall, the ground, a trap, etc.)\n\nWhen I create tile-based games in Pygame, I usually have a Map class which contains the current map:\n\nthe pygame.Surface of the map (what you'll be blitting to the display)\na list of lists (ie, a matrix) where each item is a Tile object (I've also done games where you just have a string that tells you what type of tile it is, and then you don't need a separate Tile class)\n\nThe map should be relatively static - you could have that traps become normal tiles after you step on them (this is pretty easy - when you do collision detection and it's a hit, just change that tile to a different Tile object (presumably the one for an empty tile)), but you don't want characters or movable blocks in the map if you can help it. Since the movable blocks have their own rules for how they can be moved, it's not as simple as just changing a tile - you'd have a whole set of logic, and at least two tiles would have to be changed (and what if you could move the blocks onto traps - you'd then have to remember, separately, what was below it - bleh). In my opinion it's easier to just have a class for each moving object and item.\nIn short, you have:\n\nTile\nMap\nBlock\nother movable objects\/sprites\n\nAnd that's basically your whole level. For multiple levels, if individual levels are always the same, you can just have a list of Map objects, one for each level.","Q_Score":3,"Tags":"python,design-patterns,oop,pygame","A_Id":1873480,"CreationDate":"2009-12-09T05:01:00.000","Title":"Level Design in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPython program where I want to be able to drag groups of controls around to reorder them.  Each group of controls is on a panel, and I want the panel object to handle the drag-and-drop.\nCurrently it works if you click and drag on the panel itself, but it doesn't work if you click on any control inside the panel.  This is because the wx.EVT_LEFT_DOWN event that I am using to trigger the drag is not a command event, so is not propagated up to the parent panel.\nThe only way I can think of to get round this is to bind that event to the panel's handler for every control on the panel.\nThis does not seem very elegant to me - either I have to explicitly do it when I create each child event, which breaks encapsulation, or the panel recurses through the child controls and does the binding - this seems dangerous, since the individual controls may already be using that event for other purposes.  Ideally I would like the controls on the panel to not need to know anything about the DnD.\nDoes anyone know of any alternative solutions?  Are there any command events that I could use to initiate dragging?  Or anything else I haven't thought of?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1099,"Q_Id":1877402,"Users Score":1,"Answer":"IMO the best way is, Panel should bind to control's wx.EVT_LEFT_DOWN and drag only when special key combination e.g. cntrl-alt-d are pressed\nPanel can do it recursively or have a function in Panel, addControl and only such control will be hooked.\nYour point that \"individual controls may already be using that event for other purposes\" is not valid because either you can use that event for dragging or not, you can't have both way.\nIf you want drag on control to be used as drag of whole group, then you MUST override such event, but with doing dragging only inspecial key combination or modes you can let child control have their behaviour too.","Q_Score":0,"Tags":"python,drag-and-drop,wxpython","A_Id":1935002,"CreationDate":"2009-12-09T22:32:00.000","Title":"wxPython: Handling drag-and-drop in a parent object - problem with event propagation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application in which I would like to connect whatever signal is emitted when a pyqt4 dialog is displayed in order to do execute an initial method. I don't want the method to be called in the __init__ method for a number of reasons. I've spent quite some time searching but I have yet to find an answer. I'm sure there is a simple solution that because of my inexperience I am overlooking as I can do this in wxPython. Suggestions?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":114,"Q_Id":1878353,"Users Score":3,"Answer":"There is no signal emitted on first display, instead, you will have to intercept the first resizeEvent or paintEvent by overloading these methods (as you don't want to initialize from the __init__ method).\nAnother option would be to add your own showAndInit method, that initializes and then calls show.","Q_Score":1,"Tags":"python,qt,pyqt4","A_Id":1879368,"CreationDate":"2009-12-10T02:49:00.000","Title":"What signal can be connected to an initial dialog display in pyqt4 (qt)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been programming in Python for a while now, and I'd like to learn a more \"hireable\" language like Java or the C\/C++\/C# family. I'm acquainted with (though not necessarily good at) all of them. I'm leaning towards Java because it runs just about everywhere, and I'd like to start developing for the Android. \nComing from a dynamic language, what is the best way for me to learn Java? Or should I learn a C based language instead?","AnswerCount":9,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":18209,"Q_Id":1883455,"Users Score":8,"Answer":"Java and C# will be less of a step away from Python than would C or C++ because Java, C#, and Python all have automatic memory management. A good Java book is Thinking in Java by Bruce Eckel. It starts at an introductory level, but also has a lot of depth.\nThe big difference with the language coming from Python is the fact that all variables are typed. The other hard thing with Java has to do with the bewildering array of Java APIs out there. The fact that you are interested in Android is an advantage here. After becoming comfortable with the core language, I suggest you start learning the Android API and focus on becoming an Android expert. I think Android will be a growing market for a while.\nGood luck!","Q_Score":20,"Tags":"java,python","A_Id":1883690,"CreationDate":"2009-12-10T19:41:00.000","Title":"Learn Java from Python background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been programming in Python for a while now, and I'd like to learn a more \"hireable\" language like Java or the C\/C++\/C# family. I'm acquainted with (though not necessarily good at) all of them. I'm leaning towards Java because it runs just about everywhere, and I'd like to start developing for the Android. \nComing from a dynamic language, what is the best way for me to learn Java? Or should I learn a C based language instead?","AnswerCount":9,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":18209,"Q_Id":1883455,"Users Score":0,"Answer":"I don't think you should use a special way to learn Java because you know Python. Just start with HelloWorld.java and move on step by step. Your basic skills in programming will help you.","Q_Score":20,"Tags":"java,python","A_Id":1883538,"CreationDate":"2009-12-10T19:41:00.000","Title":"Learn Java from Python background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been programming in Python for a while now, and I'd like to learn a more \"hireable\" language like Java or the C\/C++\/C# family. I'm acquainted with (though not necessarily good at) all of them. I'm leaning towards Java because it runs just about everywhere, and I'd like to start developing for the Android. \nComing from a dynamic language, what is the best way for me to learn Java? Or should I learn a C based language instead?","AnswerCount":9,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":18209,"Q_Id":1883455,"Users Score":0,"Answer":"I suppose one could ease his\/her way into .NET and Java by starting with IronPython and Jython respectively. This will not teach you the new language syntax but open up respective libraries so you can explore what is \"out there\", learn development tools, build process etc. Syntax is by far the easiest to switch but the know-how and best practices in each language are not.","Q_Score":20,"Tags":"java,python","A_Id":1884743,"CreationDate":"2009-12-10T19:41:00.000","Title":"Learn Java from Python background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been programming in Python for a while now, and I'd like to learn a more \"hireable\" language like Java or the C\/C++\/C# family. I'm acquainted with (though not necessarily good at) all of them. I'm leaning towards Java because it runs just about everywhere, and I'd like to start developing for the Android. \nComing from a dynamic language, what is the best way for me to learn Java? Or should I learn a C based language instead?","AnswerCount":9,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":18209,"Q_Id":1883455,"Users Score":0,"Answer":"1) It depends what you would do with an \"hireable\" language. For instance, if you were interested in programming web applications and distributed\/client\/server app, Java would be a good choice. \nC# is maybe a bit less client \/ server oriented, and maybe more valuable for small non IT companies and for most retail software companies.\nC and C++ are still great languages, but are more \"system\", embeded and \"critical apps\" oriented. And they are not suitable to be runned on differents mobile phones.\n2) The best way to learn java, according to me, is firstable to learn the basics, then look for more specialized stuff like J2ME and Android software framework.","Q_Score":20,"Tags":"java,python","A_Id":1883705,"CreationDate":"2009-12-10T19:41:00.000","Title":"Learn Java from Python background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been programming in Python for a while now, and I'd like to learn a more \"hireable\" language like Java or the C\/C++\/C# family. I'm acquainted with (though not necessarily good at) all of them. I'm leaning towards Java because it runs just about everywhere, and I'd like to start developing for the Android. \nComing from a dynamic language, what is the best way for me to learn Java? Or should I learn a C based language instead?","AnswerCount":9,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":18209,"Q_Id":1883455,"Users Score":9,"Answer":"I would take a project you've implemented in Python and try converting it to Java.  Since you already know basic programming fundamentals, it'll probably be easier if you take things you know how to do and figure out how you'd do the same sort of operations in Java (or whatever new language you want to learn).\nIn the end, the only way to learn to write code, is to write more code.","Q_Score":20,"Tags":"java,python","A_Id":1883585,"CreationDate":"2009-12-10T19:41:00.000","Title":"Learn Java from Python background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a python script that should run in the background and notify a user of changes, and I'd quite like it to work cross-platform. Main problem is, I don't have access to a mac at all, so coding specifically for it could be very difficult. wxPython seems like massive overkill for simple popups, so is there anything with a lighter footprint?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2853,"Q_Id":1893213,"Users Score":4,"Answer":"Does Python on Windows and Mac also ship with Tk wrappers? If so, you might be able to roll your own notification box. I do not think they have a dead-simple notification API (i.e. you pass it a string and a cute box pops up for 5 seconds) however at least you will only have one codebase to maintain.\nI am thinking about other cross-platform apps such as Skype, Dropbox, and Thunderbird. Skype and Thunderbird seem to have rolled their own, and Dropbox went the platform-specific route.","Q_Score":9,"Tags":"python,cross-platform,notifications","A_Id":1893404,"CreationDate":"2009-12-12T12:06:00.000","Title":"Cross-Platform Python Notification Library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've started building an app with Flex\/Air but am getting sick of it's clunkyness.\nThe app that I'm building has similar behaviour to Prezi (www.prezi.com) but in a completely different field.\nI'm looking for something on the desktop which has flex like capabilities, such as drawing vectors then zooming in\/out, rotating etc, gui widgets would be a bonus but not essential.\nIf it was written in Python\/Ruby or had an abstraction in either language that would be great.\nI've had a quick look at PyGame and Pyglet but am not sure of their suitability.\nAny ideas?\nCheers,\nChris","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":384,"Q_Id":1907736,"Users Score":0,"Answer":"If you have any .NET experience I would recommend Silverlight.  I have worked with it in the academic setting and it has impressed me very much.  Some of the examples are pretty mind blowing, for the web applications at least.  I also know they did focus on making silverlight into exactly what your question asks, a framework for building \"visually rich\" desktop applications also.  There is a set of tools called expression blend that interact directly with visual studio to build the GUI and it's pretty impressive the control their GUI gives you in making your GUI.  At least worth a look.","Q_Score":0,"Tags":"python,vector,svg","A_Id":1907972,"CreationDate":"2009-12-15T14:13:00.000","Title":"Framework for building visually rich desktop applications?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a scrollbar widget that ALWAYS hides the last 15 px under the resize button, is there an option to stop this happening on mac or a padding \"under\" the widget option?\\\nthanks!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":204,"Q_Id":1927475,"Users Score":0,"Answer":"No, there isn't an option. You need to adjust your padding so that the scrollbar doesn't extend all the way to the bottom of the window. Perhaps the easiest way is to add a statusbar that extends across the bottom of the window.","Q_Score":1,"Tags":"python,user-interface,tkinter","A_Id":1927946,"CreationDate":"2009-12-18T10:44:00.000","Title":"Python - Tkinter - Padding woes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a scrollbar widget that ALWAYS hides the last 15 px under the resize button, is there an option to stop this happening on mac or a padding \"under\" the widget option?\\\nthanks!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":204,"Q_Id":1927475,"Users Score":0,"Answer":"Or, you could also try switching to the place() layout manager.","Q_Score":1,"Tags":"python,user-interface,tkinter","A_Id":1927968,"CreationDate":"2009-12-18T10:44:00.000","Title":"Python - Tkinter - Padding woes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a python application that has a glade gui. Using subprocess to execute some shell commands in the background.\nUsing a glade GUI which has a scrolledwindow widget and a textview widget inside the scrolledwindow widget. The textview gets populated as the subprocess.Popen object run and display their stdout and stderr to this textview.\nMy problem is that the textview is constantly populated, but stays still @ scroll position 0, 0 (top-most, left-most)\nI want this scrolledwindow widget to stays at bottom-most, left-most at all times... \nDoes anyone have any idea which method I need to call scroll this thing downwards?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2933,"Q_Id":1940957,"Users Score":0,"Answer":"look at gtk.ScrolledWindow.set_placement.\n(never tried)","Q_Score":3,"Tags":"python,pygtk,subprocess,glade","A_Id":1941109,"CreationDate":"2009-12-21T16:03:00.000","Title":"howto scroll a gtk.scrolledwindow object from python code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I want to make the background of a textview widget black and the foreground white.\nBeen trying the .modify_bg and .modify_fg methods, but none affect the way this thing looks.\nCan anyone suggest anything or is this just not possible?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1612,"Q_Id":1948396,"Users Score":2,"Answer":"Use gtk.Widget.modify_text and gtk.Widget.modify_base instead of fg and bg.","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":1948993,"CreationDate":"2009-12-22T18:52:00.000","Title":"pygtk: howto change background of a gtk.TextView widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have installed PyQt GPL v4.6.2 for Python v3.1 and Qt by Nokia v4.6.0 (OpenSource), but the documentation in PyQt is not coming up. Example docs are all blank, too.\nWould anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get text to come up for the PyQt documentation?\nEdit: The programs are running on Windows, and the documentation is not coming up in PyQt GPL v4.6.2 for Python v3.1 > Examples > PyQt Examples and Demos and PyQt GPL v4.6.2 for Python v3.1 > Assistant. What needs to done to let both programs access the docs?","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":16124,"Q_Id":1962273,"Users Score":1,"Answer":"The PyQt documentation is exactly as provided on the website, and as\nincluded in the installer. It is not integrated with Assistant (it will be\nin a future version). If you want to use Assistant then you can use the Qt\ndocumentation instead (a lot of people do) and translate between C++ and\nPython as you read it.","Q_Score":7,"Tags":"python,qt,pyqt","A_Id":1966523,"CreationDate":"2009-12-25T23:56:00.000","Title":"PyQt documentation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have installed PyQt GPL v4.6.2 for Python v3.1 and Qt by Nokia v4.6.0 (OpenSource), but the documentation in PyQt is not coming up. Example docs are all blank, too.\nWould anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get text to come up for the PyQt documentation?\nEdit: The programs are running on Windows, and the documentation is not coming up in PyQt GPL v4.6.2 for Python v3.1 > Examples > PyQt Examples and Demos and PyQt GPL v4.6.2 for Python v3.1 > Assistant. What needs to done to let both programs access the docs?","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":16124,"Q_Id":1962273,"Users Score":1,"Answer":"If you installed the Qt documentation, you should have an app named Assistant. This is a simple-minded browser for a local copy of the Qt doc as found at doc.qt.nokia.com. It is written for C++ but the mental translation to Python is not difficult, and it is nicely formatted and richly cross-linked. I keep Assistant running all the time I'm coding in PyQt4 and find it very helpful.\nThe PyQt doc, as given at www.riverbankcomputing.co.uk\/static\/Docs\/PyQt4\/html\/classes.html, is merely this same Nokia text with its formatting and many of the internal links stripped out and edited to python class and function syntax.","Q_Score":7,"Tags":"python,qt,pyqt","A_Id":8174151,"CreationDate":"2009-12-25T23:56:00.000","Title":"PyQt documentation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting to learn both Python and wxPython and as part of the app I'm doing, I need to have a simple browser on the left pane of my app. I'm wondering how do I do it? Or at least point me to the right direction that'll help me more on how to do one. Thanks in advance!\nEDIT:\na sort of side question, how much of wxPython do I need to learn? Should I use tools like wxGlade?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":6299,"Q_Id":1962592,"Users Score":1,"Answer":"You can take a look at the wxPython examples, they also include code samples for almost all of the widgets supported by wxPython. If you use Windows they can be found in the Start Menu folder of WxPython.","Q_Score":4,"Tags":"python,wxpython","A_Id":1962595,"CreationDate":"2009-12-26T04:02:00.000","Title":"How do I make a simple file browser in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions.\nIs it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type import <mymodule>? Or even better, from <mymodule> import <function>?\nEdit: I can do PyRun_SimpleString(\"from mymodule import myfunction\") just after Py_Initialize(); - I was just wondering if there is another way of doing this..?\nEdit 2: In other words, I have an application written in C which embeds a Python interpreter. That application provides some functionality which I want to expose to the users so they can write simple Python scripts for the app. All I want is to remove the need of writing from mymodule import myfunction1, myfunction2 because, since it is very specialized app and the script wont work without the app anyway, it doesn't make sense to require to import ... all the time.","AnswerCount":5,"Available Count":2,"Score":0.1194272985,"is_accepted":false,"ViewCount":697,"Q_Id":1963453,"Users Score":3,"Answer":"Even if you implement a module in Python, the user would have to import it. This is the way Python works, and it's actually a good thing - it's one of the great pluses of Python - the namespace\/module system is robust, easy to use and simple to understand.\nFor academic exercises only, you could of course add your new functionality to Python itself, by creating a custom interpreter. You could even create new keywords this way. But for any practical purpose, this isn't recommended.","Q_Score":1,"Tags":"python,c,import,python-c-api,python-embedding","A_Id":1963510,"CreationDate":"2009-12-26T14:05:00.000","Title":"Extending Python: pre-load my C module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions.\nIs it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type import <mymodule>? Or even better, from <mymodule> import <function>?\nEdit: I can do PyRun_SimpleString(\"from mymodule import myfunction\") just after Py_Initialize(); - I was just wondering if there is another way of doing this..?\nEdit 2: In other words, I have an application written in C which embeds a Python interpreter. That application provides some functionality which I want to expose to the users so they can write simple Python scripts for the app. All I want is to remove the need of writing from mymodule import myfunction1, myfunction2 because, since it is very specialized app and the script wont work without the app anyway, it doesn't make sense to require to import ... all the time.","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":697,"Q_Id":1963453,"Users Score":0,"Answer":"Nope. You could add it to the Python interpreter itself, but that would mean creating a custom Python version, which, I guess, is not what you want.\nThat import <mymodule> is not just for loading the module, it's also for making this module visible in the (main|current) namespace. Being able to do that, w\/o hacking the actual Python interpreter, would run against \"Explicit is better than implicit\" very strongly.","Q_Score":1,"Tags":"python,c,import,python-c-api,python-embedding","A_Id":1963505,"CreationDate":"2009-12-26T14:05:00.000","Title":"Extending Python: pre-load my C module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?","AnswerCount":7,"Available Count":7,"Score":-0.0285636566,"is_accepted":false,"ViewCount":724,"Q_Id":1967888,"Users Score":-1,"Answer":"If you're used to a more command line approach, this would be a bad idea. Responding to user input is a completely different paradigm, and you're not likely to get it right the first time.\nIf you're just talking about the difference between wxPython and another GUI, don't worry about it.","Q_Score":12,"Tags":"python,wxpython","A_Id":1967976,"CreationDate":"2009-12-28T03:53:00.000","Title":"Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?","AnswerCount":7,"Available Count":7,"Score":0.0,"is_accepted":false,"ViewCount":724,"Q_Id":1967888,"Users Score":0,"Answer":"Since you are new to GUI programming, your approach is perfectly valid. It will likely result in a less than optimal UI, but that's OK for now. And in fact, there are some very successful multi-million dollar commercial projects that are built this way.\nArguably a better approach is to first design the UI since that is the most important part. After that is completel you can then create a back-end that can support that UI. This approach still results in separate front- and back-ends but puts the emphasis on the needs of the user, where it should be.","Q_Score":12,"Tags":"python,wxpython","A_Id":1970144,"CreationDate":"2009-12-28T03:53:00.000","Title":"Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?","AnswerCount":7,"Available Count":7,"Score":-0.0285636566,"is_accepted":false,"ViewCount":724,"Q_Id":1967888,"Users Score":-1,"Answer":"What level of interactivity do you need? If you need rich feedback and interaction, then you need an OO program model, then you can ad the GUI on top of the objects.\nIf you just have filters and functions (no real feedback, or just a results window) than a library or component model would be better.\nEither way, you are better off coding your logic separate to the GUI, so you can test it more easily.","Q_Score":12,"Tags":"python,wxpython","A_Id":1967968,"CreationDate":"2009-12-28T03:53:00.000","Title":"Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?","AnswerCount":7,"Available Count":7,"Score":0.0285636566,"is_accepted":false,"ViewCount":724,"Q_Id":1967888,"Users Score":1,"Answer":"Separation of the user interface from the engine code is the unixy way to do it and there's a lot of merit to doing it that way. It results in modular re-usable programs and code that can play nicely with other programs and fit into a larger tool chain.\nHaving said that, such an approach tends to discount the value of creating a really usable UI experience. It's very difficult and rare for a program's internal model to match the user model when you design your program's functionality first and then the user interface later. As a result, you need to impedance-match the two sides after creating them independently. This results in either creating a compromise in usability (your ui becomes nothing more than a front-end to the command line switches your program takes) or a large glue layer between the UI and the core program which tends to be messy and buggy.\nIf your program is primarily designed to be run through a user interface interactively with a user, then it probably makes sense to design the user interface in parallel with your actual functionality. \nSo:\n\nit would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app\n\nIf your UI is the main means of operating your program, then that UI is part of the program design. Not something to be painted over the program when its done.","Q_Score":12,"Tags":"python,wxpython","A_Id":1968045,"CreationDate":"2009-12-28T03:53:00.000","Title":"Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?","AnswerCount":7,"Available Count":7,"Score":0.057080742,"is_accepted":false,"ViewCount":724,"Q_Id":1967888,"Users Score":2,"Answer":"That depends on the problem domain. An image processing tool would be rather difficult to implement without reference to a GUI. For most apps, though, I would argue strongly in favour of separating the two parts. It is much, much easier to develop, test and evolve a UI-free back-end. The gains will vastly outweigh the cost of defining a clean API between the front and back end. In fact, the process of defining the API will yield a better design overall.","Q_Score":12,"Tags":"python,wxpython","A_Id":1967904,"CreationDate":"2009-12-28T03:53:00.000","Title":"Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?","AnswerCount":7,"Available Count":7,"Score":0.0,"is_accepted":false,"ViewCount":724,"Q_Id":1967888,"Users Score":0,"Answer":"IMHO, that would rather be a better idea. To keep the underlying business logic not tied down to the UI is a better approach that we can worry more about the underlying logic than bogging down too much about the interface. \nAt the same time, it is also important to have some basic design for your interface so that it helps you have an idea about what kind of inputs and outputs are involved, and making the underlying logic support a wide range of inputs\/outputs or simply wide range of interfaces.","Q_Score":12,"Tags":"python,wxpython","A_Id":1967905,"CreationDate":"2009-12-28T03:53:00.000","Title":"Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?","AnswerCount":7,"Available Count":7,"Score":1.2,"is_accepted":true,"ViewCount":724,"Q_Id":1967888,"Users Score":16,"Answer":"This is a viable approach. In fact, some programmers use it for the advantages it brings:\n\nModular non-GUI code can then be tied in with different GUIs, not just a single library\nIt can also be used for a command-line application (or a batch interface to a GUI one)\nIt can be reused for a web application\nAnd most importantly: it can make unit-testing of the code easier.\n\nHowever keep in mind that it requires some careful design. You'll want your \"logic code\" to be free from GUI constraints, and sometimes it is difficult (especially when the code relies on GUI idioms like an event loop).","Q_Score":12,"Tags":"python,wxpython","A_Id":1967900,"CreationDate":"2009-12-28T03:53:00.000","Title":"Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have downloaded python 2.5. I would like to know if Tkinter is included with python or is it a separate download?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1047,"Q_Id":1994760,"Users Score":0,"Answer":"If you are using linux just open your terminal and type python and in the python interpreter type  from Tkinter import* if it doesn't show any error messages you are good to go. You can try this to check every package of python like Pygame just replace Tkinter by Pygame","Q_Score":0,"Tags":"python,tkinter","A_Id":27392691,"CreationDate":"2010-01-03T11:58:00.000","Title":"Is Tkinter included with Python 2.5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently writing a fsm editor with tkinter. But, I stuck on connecting two states. I have two questions:\n1) How can make the transition arrow growable according to mouse movement?\n2) How can I stick the starting point of the arrow on a state and the end point of the arrow on another state?\nPS. Do you think the documentation of tkinter is good enough?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":2543,"Q_Id":1996377,"Users Score":3,"Answer":"Tkinter is perfectly fine for this sort of application. In the past I've worked on tools that were boxes connected with arrows that stayed connected as you move the boxes around (which is what I think you are asking about). Don't let people who don't know much about Tkinter sway you -- it's a perfectly fine toolkit and the canvas is very flexible. \nThe solution to your problem is simple math. You merely need to compute the coordinates of the edges or corners of boxes to know where to anchor your arrows. To make it \"grow\" as you say, simply make a binding on mouse movements and update the coordinates appropriately.\nTo make the line growable all you have to do is adjust the coordinates of the line each time the mouse moves. The easiest thing to do is make liberal use of canvas tags. With the tags you can know which arrows connect to which boxes so that when you move the box you adjust the coordinates of any arrows that point to or from it.","Q_Score":3,"Tags":"python,tkinter,fsm","A_Id":1997043,"CreationDate":"2010-01-03T21:25:00.000","Title":"How to connect two state circles with an arrow in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can anyone tell me why my app quits with:\n\npygame error: display Surface quit.","AnswerCount":9,"Available Count":3,"Score":0.0886555158,"is_accepted":false,"ViewCount":28022,"Q_Id":1997710,"Users Score":4,"Answer":"Replace if event.type == pygame.quit(): by if event.type == pygame.QUIT:","Q_Score":8,"Tags":"python,pygame","A_Id":52403647,"CreationDate":"2010-01-04T05:49:00.000","Title":"Pygame error: display surface quit: Why?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can anyone tell me why my app quits with:\n\npygame error: display Surface quit.","AnswerCount":9,"Available Count":3,"Score":0.0444152037,"is_accepted":false,"ViewCount":28022,"Q_Id":1997710,"Users Score":2,"Answer":"Make sure if you write pygame.QUIT: and not pygame.quit():\nI know it sounds weird, but I had the same problem.","Q_Score":8,"Tags":"python,pygame","A_Id":59687711,"CreationDate":"2010-01-04T05:49:00.000","Title":"Pygame error: display surface quit: Why?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can anyone tell me why my app quits with:\n\npygame error: display Surface quit.","AnswerCount":9,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":28022,"Q_Id":1997710,"Users Score":11,"Answer":"I had similar problem and discovered that Surface objects don't like to be deepcopied. When I used copy.deepcopy() on such object and then accessed the copy, I got that strange error message (without calling pygame.quit()). Maybe you experience similar behavior?","Q_Score":8,"Tags":"python,pygame","A_Id":4317744,"CreationDate":"2010-01-04T05:49:00.000","Title":"Pygame error: display surface quit: Why?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPython application that uses pyinotify (via ThreadedNotifier) to check when a certain file gets modified. When this happens, the application stops watching the file and does some stuff. Everything works fine, except that often the call to ThreadedNotifier.stop() takes a noticeable time, about 4 seconds... Other times, it exits immediately.\nAnyone else experienced this? Is this expected?\n(Xubuntu 9.04)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":408,"Q_Id":2005443,"Users Score":1,"Answer":"Could it be that it is a polling mechanism with a timeout of about 4 seconds? And that the thread is only really stopped when it is entering the run() stage?\nThat might have something to do with the threading library. \nYou could test that by using a notifier with a different timeout.","Q_Score":0,"Tags":"python,inotify,pyinotify","A_Id":2005571,"CreationDate":"2010-01-05T10:46:00.000","Title":"Slow pyinotify.ThreadedNotifier.stop()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project that has a glade GUI.\nI need the main window to have 2 section, divided by a gtk.Hpaned widget (horizontal panes).\nThe left pane would have a tool-bar like layout of buttons, maybe 3 or more.\nWhat I need is a way to create different windows and display them on the right pane of the main window. This way, when I click button 1, subwindow1 will appear in the right pane. Click button2, subwindow2 will appear on the right pane.\nInstead of having windows pop-up left and right, I want to reparent them to the right pane of this gtk.Hpaned widged.\nHow do you do this in python with pygtk?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1643,"Q_Id":2007299,"Users Score":0,"Answer":"Instead of creating windows you could put a notebook in the right pane.  Then create all the previous windows as pages.  Click on the button can then show the appropriate page in the notebook.","Q_Score":2,"Tags":"python,pygtk","A_Id":2016770,"CreationDate":"2010-01-05T16:09:00.000","Title":"pygtk: cannot set parent on toplevel widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a cherrypy application with a wxpython ui. The problem is both libraries use closed loop event handlers. Is there a way for this to work? If I have the wx ui start cherrypy is that going to lock up the ui?","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":1519,"Q_Id":2022376,"Users Score":1,"Answer":"One way to decouple them would be to start them up as two separate processes and have them communicate via some kind of IPC mechanism. You might have to write a small adaptor to have them speak a common protocol.\nSince you're doing CherryPy, you might also be able to expose a control interface via HTTP which the wx GUI can use to drive your server.","Q_Score":7,"Tags":"python,wxpython,cherrypy","A_Id":2022467,"CreationDate":"2010-01-07T17:48:00.000","Title":"cherrypy and wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need a tile\/sprite editor kind of like Pixen, but I couldn't find one for Windows so I thought it might be a good exercise for me to try and put one together. I use Python, so are there any libraries out there that are suited to the task of putting together a simple tile\/sprite editor?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":8722,"Q_Id":2028025,"Users Score":2,"Answer":"So, the fact is that creating a complex app with a nice UI takes time - I am just expanding a little bit on the answer by THC4k.  \nPIL, at least PIL alone is useless for this: it does have some functions to manipulate images, but the complicate task here is creating and tunning your desired UI. \nThat's where the widgets toolkits come in: You would have to pick a toolkit platform that can offer you buttons, images, load and save the image files, maybe some specialzed widgets you can use to create your color swatches, etc.\nboth GTK+ and QT4.5 have a liberal license, are very complete and very unpythonic on their use :-( \n(While you are at it, when using these libraries and toolkits our app can easily be multiplatform: you don't have to make it windows specific, it is equally easy to create an app that will run on Windows, Linux and Mac using python and either GTK+ or Qt4)\nOne thing I would suggest is for you to learn to proper use GIMP: it is an Image editor, and certainly it will lack a lot of tools you are needing for sprites: but you can expand it's capabilities with Python plug-ins. On the other hand GIMP does have thousands of features that you'd no longer will need to create for your stand-alone app. (think on layer support, color filters, image rotation etc...)\nCheck around on how to install GIMP with Python support on Windows, then spend some hours learning the app, with some book-like text around preferably so you can find the hidden features. \nAh, ok, finally:\nIf you want a very simple thing, just for the taste of \"i did it\" - you can use Pygame: You have to do all the drawing on the window, including text - but have straighter access to pixels, colors, mouse clicks and coordinates than with GTK+ or Qt, in a sense it would be a lot less of overhead for you to learn in terms of API's and internal working.","Q_Score":6,"Tags":"python,image-editor","A_Id":2029356,"CreationDate":"2010-01-08T14:01:00.000","Title":"Creating an image editing application in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need a tile\/sprite editor kind of like Pixen, but I couldn't find one for Windows so I thought it might be a good exercise for me to try and put one together. I use Python, so are there any libraries out there that are suited to the task of putting together a simple tile\/sprite editor?","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":8722,"Q_Id":2028025,"Users Score":6,"Answer":"You just need a gui toolkit (gtk, qt, wx) a image library (PIL) and 500 hours of free time ...","Q_Score":6,"Tags":"python,image-editor","A_Id":2028056,"CreationDate":"2010-01-08T14:01:00.000","Title":"Creating an image editing application in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm downloading Python 3.1.1 and that comes with the IDLE correct?\nI'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. \nWhat projects should I try to make in order to grasp some of the goodies Python brings to the table?\nThanks a bunch SO.","AnswerCount":9,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":44661,"Q_Id":2034932,"Users Score":0,"Answer":"A project I wish someone would write: a friendly GUI that wraps around the scanner library and the PDF library, and lets the user easily scan and file documents.\nIt would have a toolbar with big buttons: \"scan letter\", \"scan brochure\", \"scan photo\".  These would respectively choose high-resolution black-and-white, medium-resolution color, and high-resolution color.\nThe user would plop down the document and hit one of those buttons.  Python would wake up the scanner and have it scan, and then would use Python Image Library or something to auto-detect the size of the actual scanned document and auto-crop down to minimal size.\nFor \"scan photo\" you would get a JPEG.  For the others, you would get a PDF.  And it would have an option where you could scan several pages and then select the scanned pages, and say \"group\" and it would make a single PDF out of them.\nOther useful toolbar buttons would be: \"Copy Letter\", \"Copy Brochure\", \"Copy Photo\".  These would scan and then immediately print on an appropriate output device (or just on the default output device for your first version).\nIf you want to go crazy, you could add an OCR function to try to recover searchable text from the scanned images, and put that in the PDF as tags or something.\nSomeday I will write this if nobody else does...","Q_Score":7,"Tags":"python","A_Id":2035429,"CreationDate":"2010-01-09T21:00:00.000","Title":"What are some good projects to make for a newbie Python (but not new to programming) developer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm downloading Python 3.1.1 and that comes with the IDLE correct?\nI'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. \nWhat projects should I try to make in order to grasp some of the goodies Python brings to the table?\nThanks a bunch SO.","AnswerCount":9,"Available Count":4,"Score":0.0665680765,"is_accepted":false,"ViewCount":44661,"Q_Id":2034932,"Users Score":3,"Answer":"Do the next project you intended to program with your prefered language with Python.","Q_Score":7,"Tags":"python","A_Id":2035296,"CreationDate":"2010-01-09T21:00:00.000","Title":"What are some good projects to make for a newbie Python (but not new to programming) developer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm downloading Python 3.1.1 and that comes with the IDLE correct?\nI'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. \nWhat projects should I try to make in order to grasp some of the goodies Python brings to the table?\nThanks a bunch SO.","AnswerCount":9,"Available Count":4,"Score":0.022218565,"is_accepted":false,"ViewCount":44661,"Q_Id":2034932,"Users Score":1,"Answer":"Write a simple Text Editor.\nThat was one of the projects i started when i first learned python. It gets you used to the GUI framework, file IO, many types, OOP, lots... It's something that you can grow over time as your confidence builds and it's cross platform so it's handy.","Q_Score":7,"Tags":"python","A_Id":2035019,"CreationDate":"2010-01-09T21:00:00.000","Title":"What are some good projects to make for a newbie Python (but not new to programming) developer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm downloading Python 3.1.1 and that comes with the IDLE correct?\nI'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. \nWhat projects should I try to make in order to grasp some of the goodies Python brings to the table?\nThanks a bunch SO.","AnswerCount":9,"Available Count":4,"Score":0.022218565,"is_accepted":false,"ViewCount":44661,"Q_Id":2034932,"Users Score":1,"Answer":"If you are new to python, why not start with some simpler command line projects?  I know you said you are not new to development, but maybe you should spend some time with the core python stuff before tacking on a GUI framework.  Just a suggestion.  \nAlso, I would point out that Python 3+ code looks a bit different than a lot of the python 2.x code samples you will see around the internet.  I have found Python 3 to be not the best in terms of backward compatibility.  You might want to start out with a 2.x version of Python to get the most out of the plethora of Python tutorials on the internet, then move to Python 3 if you need it.","Q_Score":7,"Tags":"python","A_Id":2034997,"CreationDate":"2010-01-09T21:00:00.000","Title":"What are some good projects to make for a newbie Python (but not new to programming) developer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct?\nHaving said that, if I create my application in QT For Windows, will it run flawlessly in Linux\/Mac as well?\nThanks.","AnswerCount":6,"Available Count":5,"Score":0.1651404129,"is_accepted":false,"ViewCount":1271,"Q_Id":2035249,"Users Score":5,"Answer":"As other posters mentioned, the key issue is making sure you never touch a different non-Qt non-cross-platform API.  Or really even a different non-Qt crossplatform API, if you use Qt you kind of need to commit to it, it's a comprehensive framework and for the most part sticking with Qt is easier than going to anything else.  There's some nice advantages as the basic primitives in your program will work the same way all over the place.  (i.e. a QString in your networking code will be the same as a QString in your interface code.)  Portability-wise, if you stay within the API Qt provides you, it should work on multiple platforms.\nThere will be areas where you may need to call some Qt functions which provide specific cross-platform tweaks more important to some platforms than others (e.g. dock icons) and you won't immediately have a polished application on all three platforms.  But in general, you should remain very close to an application that compiles and runs on all three.  (Try to use qmake or a similar build system too, as the build process for Qt applications varies depending on the platform.  Different flags, etc.)\nThere's some odd issues that come up when you mix Qt with other APIs like OpenGL, in particular the way windows locks GL contexts differs from the way OS X and Linux does, so if you intend to use OpenGL with multiple threads, try to periodically compile on the other platforms to make sure nothing is completely busted.  This will also quickly point out areas where you might have inadvertently used a non-cross-platform system API.\nI've used Qt with a team to build a multi-threaded 3-d multiplayer real-time networked game (read: non-trivial application that fully utilized many many areas of Qt) and we were nothing but blown away by the effectiveness of Qt's ability to support multiple platforms.  (We developed on OS X while targeting Windows and I regularly made sure it still ran on Linux as well.)  We encountered only a few platform specific bugs, almost all of which arose from the use of non-Qt APIs such as OpenGL.  (Which should really tell you something, that OpenGL was more of a struggle to use cross platform than Qt was.)\nAt the end of the experience we were pleased at how little time we needed to spend dealing with platform-specific bugs.  It was surprising how well we could make a GUI app for windows given almost none of the team actually used it as a primary development platform through the project.\nBut do test early and often.  I don't think your approach of writing an entire application and then testing is a good idea.  It's possible with Qt, but unlikely if you don't have experience writing portable code and\/or are new to Qt.","Q_Score":5,"Tags":"python,qt,cross-platform","A_Id":2040550,"CreationDate":"2010-01-09T22:40:00.000","Title":"If I use QT For Windows, will my application run great on Linux\/Mac\/Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct?\nHaving said that, if I create my application in QT For Windows, will it run flawlessly in Linux\/Mac as well?\nThanks.","AnswerCount":6,"Available Count":5,"Score":0.0333209931,"is_accepted":false,"ViewCount":1271,"Q_Id":2035249,"Users Score":1,"Answer":"Generally - as long as you don't use code that is not covered by Qt classes - yes.\nI have several time just recompiled applications I wrote in Linux(64bit) under Windows, and the other way arround. It works for me every time.\nDepends on your needs, you might also find compiler problems, but I am sure you will know how to work around them. Other people mentioned some issues you should look for, just read the other posts in the question.","Q_Score":5,"Tags":"python,qt,cross-platform","A_Id":2035284,"CreationDate":"2010-01-09T22:40:00.000","Title":"If I use QT For Windows, will my application run great on Linux\/Mac\/Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct?\nHaving said that, if I create my application in QT For Windows, will it run flawlessly in Linux\/Mac as well?\nThanks.","AnswerCount":6,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":1271,"Q_Id":2035249,"Users Score":0,"Answer":"It might run well, but it will take some testing, and of course Qt only handles the GUI portability, not the myriad of other things that might cause portability problems.\nQt apps generally don't fit in very well on MacOS because they don't have Applescript support by default and don't necessarily have the right keybindings.  But if you do the work to fix those issues, they work, but not nicely.  On the Mac, it's far better to build a native UI.  If this is an in-house app, Qt is probably OK, but if it's for sale, you won't make many sales and will create yourself some support hassles.","Q_Score":5,"Tags":"python,qt,cross-platform","A_Id":2035265,"CreationDate":"2010-01-09T22:40:00.000","Title":"If I use QT For Windows, will my application run great on Linux\/Mac\/Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct?\nHaving said that, if I create my application in QT For Windows, will it run flawlessly in Linux\/Mac as well?\nThanks.","AnswerCount":6,"Available Count":5,"Score":1.2,"is_accepted":true,"ViewCount":1271,"Q_Id":2035249,"Users Score":8,"Answer":"Yes. No. Maybe. See also: Java and \"write once, run anywhere\".\nFilesystem layout, external utilities, anything you might do with things like dock icons, character encoding behaviors, these and more are areas you might run into some trouble.\nUsing Qt and Python, and strenuously avoiding anything that seems tied to Windows-specific libraries or behaviors whenever possible will make running the application on Mac and Linux much easier, but for any non-trivial application, the first time someone tries it, it will blow up in their face.\nBut through careful choice of frameworks and libraries, making the application work cross-platform will be much more like bug fixing than traditional \"porting\".","Q_Score":5,"Tags":"python,qt,cross-platform","A_Id":2035272,"CreationDate":"2010-01-09T22:40:00.000","Title":"If I use QT For Windows, will my application run great on Linux\/Mac\/Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct?\nHaving said that, if I create my application in QT For Windows, will it run flawlessly in Linux\/Mac as well?\nThanks.","AnswerCount":6,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":1271,"Q_Id":2035249,"Users Score":0,"Answer":"As the others said, everything which is done using Qt-Functionality will most likely run quite flawlessly, WHEN you dont use platform specific functionality of qt.\nThere isnt that much (most of it has to do with window-manager stuff) , but some things might not work on other systems. \nBut such things are surely mentiond in the documentation of Qt.\nStill there are things which cant be done using Qt, so you will have to do that yourself using plain Python...\nYeah \"Python\" itself is platform-independent (well it should), but there are lots of other things involved ... well mainly the OS.\nAnd how the OS reacts you will plainly have to findout yourself by testing the application on all target OS.\nRecently i wrote an quite simple GUI-application, while it ran flawlessy on Windows, it didnt run on Linux, because on Linux Python interpreted files encoded in unicode differently than on Windows.\nAdditionally a small script which should return the hostname of the machine, which it did on Windows, only returned \"localhost\" on Linux, which was obviously not what i wanted.","Q_Score":5,"Tags":"python,qt,cross-platform","A_Id":2035601,"CreationDate":"2010-01-09T22:40:00.000","Title":"If I use QT For Windows, will my application run great on Linux\/Mac\/Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I try to explain the situation:\n\nI have a QT application written in C++ and QT.\nThis QT application starts a separate console C++ application that runs in the background.\nThese two communicate using perhaps sockets, don't know yet.\nConsole C++ application needs to start and stop my gnuradio python script. Also it needs to send parameters to it.\nOnce started, this gnuradio script runs independedly in infinite loop sending information to either the console or the QT application using sockets perhaps.\nMy console application needs to stop this gnuradio script from running when the order is given by the QT application.\n\nThe question is how can I stop this separate python script from my C++ console application ? Also is there anything I could do to make this more simple ?\nRegards,\nSpitz","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":903,"Q_Id":2040769,"Users Score":2,"Answer":"Spawn python script as a new process using fork() and execv(). execv() (or any other function of the exec family) lets you pass arguments to the Python script. Use the child process ID to send a kill signal when you are done with the Python script.","Q_Score":3,"Tags":"c++,python,qt,gnuradio","A_Id":2040813,"CreationDate":"2010-01-11T09:05:00.000","Title":"Best way to start, stop and send parameters to separate Python script from C++ application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im trying to embed a display from an alien application (python OCC) into (Py)Qt using the winId of the widget. But when i pass it to  OCC i get an overflow error.\nInspecting the winId qt returns its 4318283408 which is more than a 32bit number. Im running 64bits (osx) and both libraries are compiled for 64bit, but i have a hunch that OCC only likes 32bit numbers still. So my question is, is there any way to control the range of the winId that Qt return?\nThanks\nHenrik","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":394,"Q_Id":2053949,"Users Score":0,"Answer":"Looking in Qt's source code, in the file src\/gui\/kernel\/qwindowdefs.h, you'll find that WId is typedef'd to long for 64-bits OSX (it's int for 32-bits OSX). A long on 64-bits OSX is 8 bytes long (or 64 bits), and therefore 4318283408 is a valid value.\nIf you want to force winId() to return a 32 bits value, you will need to link to a 32-bits version of the Qt's library.","Q_Score":0,"Tags":"python,qt,pyqt4","A_Id":2060398,"CreationDate":"2010-01-13T02:16:00.000","Title":"Qt winId() forcing 32bit values","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently develop many applications in a Qt heavy C++\/Python environment on Linux, porting to PC\/Mac as needed. I use Python embedded in C++ as well as in a stand alone GUI. Qt is used fro xml parsing\/event handling\/GUI\/threading and much more. Right now all my Python work is in PyQt and I wanted to see how everyone views PySide. I'm interested because it is in house and as such should support more components with hopefully better integration. What are your experiences?\nI know this has been asked before, but I want to revive the conversation.","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":9387,"Q_Id":2058492,"Users Score":8,"Answer":"We were recently thinking about using PySide, but we haven't found any information about whether it is supported by py2exe. That's why we kept to PyQt. If you need to develop for Windows, it's safer to use good ol' PyQt :-)","Q_Score":18,"Tags":"c++,python,qt,pyqt,pyside","A_Id":2058512,"CreationDate":"2010-01-13T16:45:00.000","Title":"PyQt vs PySide comparison","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently develop many applications in a Qt heavy C++\/Python environment on Linux, porting to PC\/Mac as needed. I use Python embedded in C++ as well as in a stand alone GUI. Qt is used fro xml parsing\/event handling\/GUI\/threading and much more. Right now all my Python work is in PyQt and I wanted to see how everyone views PySide. I'm interested because it is in house and as such should support more components with hopefully better integration. What are your experiences?\nI know this has been asked before, but I want to revive the conversation.","AnswerCount":3,"Available Count":3,"Score":-0.0665680765,"is_accepted":false,"ViewCount":9387,"Q_Id":2058492,"Users Score":-1,"Answer":"PySide currently does not run on Windows, which limits your capability. If you were developing on Linux and needed to avoid pure GPL, then PySide is a candidate. \nFrom an API standpoint, I find the signal\/slots capability feels more \"Pythonic\".","Q_Score":18,"Tags":"c++,python,qt,pyqt,pyside","A_Id":2058548,"CreationDate":"2010-01-13T16:45:00.000","Title":"PyQt vs PySide comparison","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently develop many applications in a Qt heavy C++\/Python environment on Linux, porting to PC\/Mac as needed. I use Python embedded in C++ as well as in a stand alone GUI. Qt is used fro xml parsing\/event handling\/GUI\/threading and much more. Right now all my Python work is in PyQt and I wanted to see how everyone views PySide. I'm interested because it is in house and as such should support more components with hopefully better integration. What are your experiences?\nI know this has been asked before, but I want to revive the conversation.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":9387,"Q_Id":2058492,"Users Score":0,"Answer":"As of PySide 1.0 beta (Qt 4.7.1), there is an official Windows installer that works. It doesn't include QtDesigner and other tools, only uic.","Q_Score":18,"Tags":"c++,python,qt,pyqt,pyside","A_Id":4828827,"CreationDate":"2010-01-13T16:45:00.000","Title":"PyQt vs PySide comparison","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using PyGTK to build a GUI application. I want to update the textview widget from another thread but the widget is not getting updated everytime i try an update. What should i do to get a reliable GUI updating?","AnswerCount":4,"Available Count":2,"Score":-0.049958375,"is_accepted":false,"ViewCount":3639,"Q_Id":2066767,"Users Score":-1,"Answer":"the same may be achieved using gobject.idle_add method whose syntax is same as above,you have to import the module gobject","Q_Score":8,"Tags":"python,multithreading,pygtk","A_Id":2069788,"CreationDate":"2010-01-14T19:04:00.000","Title":"GUI not updated from another thread when using PyGtk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using PyGTK to build a GUI application. I want to update the textview widget from another thread but the widget is not getting updated everytime i try an update. What should i do to get a reliable GUI updating?","AnswerCount":4,"Available Count":2,"Score":-0.049958375,"is_accepted":false,"ViewCount":3639,"Q_Id":2066767,"Users Score":-1,"Answer":"What Johannes said is correct, however since GTK is a wrapper for the glib and gobject things, you would actually want to use gtk.idle_add(). No need for the unnecessary imports.","Q_Score":8,"Tags":"python,multithreading,pygtk","A_Id":3030804,"CreationDate":"2010-01-14T19:04:00.000","Title":"GUI not updated from another thread when using PyGtk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I don't know if this is a stupid question, but is there any way to not show focus in wxPython? For example, I built a simple GUI with a few buttons and I don't want the dotted rectangle to show up on the button I have just clicked. \nIf I remember correctly in Excel VBA you could just set TakeFocusOnClick tag to False. What would be the equivalent in wxPython?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":197,"Q_Id":2069739,"Users Score":0,"Answer":"You could also give the focus to another control in your event handler for the buttons. Just call the SetFocus() method on any other control. This might make your application more usable as a side effect if you for example return focus to a text field that is likely to be typed in next.","Q_Score":0,"Tags":"wxpython,focus","A_Id":2135083,"CreationDate":"2010-01-15T05:46:00.000","Title":"Not showing focus in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPython window. How can I check its event handler table? (i.e. which handler is handling each event.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":230,"Q_Id":2088175,"Users Score":1,"Answer":"Even though you got your answer from the mailing list, we may as well replicate the answer here:\nRobin Dunn wrote:\n\nThere isn't a way to access the event\n  table currently, although I've often\n  thought that it would be a good idea.\n\nShame.","Q_Score":1,"Tags":"event-handling,wxpython,wxwidgets","A_Id":2097941,"CreationDate":"2010-01-18T18:13:00.000","Title":"Listing the event handlers for a wxPython window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We embed ironpython in our app sob that scripts can be executed in the context of our application.\nI use Python.CreateEngine() and ScriptScope.Execute() to execute python scripts.\nWe have out own editor(written in C#) that can load ironpython scripts and run it.\nThere are 2 problems I need to solve.\n\nIf I have a print statement in ironpython script, how can i show it my editor(how will I tell python engine to redirect output to some handler in my C# code)\nI plan to use unittest.py for running unittest. When I run the following \nrunner = unittest.TextTestRunner()\nrunner.run(testsuite)\n\nthe output is redirected to standard output but need a way for it to be redirected to my C# editor output window so that user can see the results.\nThis question might be related to 1\nAny help is appreciated\nG","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":4586,"Q_Id":2089998,"Users Score":6,"Answer":"You can provide a custom Stream or TextWriter which will be used for all output.  You can provide those by using one of the ScriptRuntime.IO.SetOutput overloads.  Your implementation of Stream or TextWriter should receive the strings and then output them to your editor window (potentially marshalling back onto the UI thread if you're running the script on a 2ndary execution thread).","Q_Score":4,"Tags":"ironpython","A_Id":2090745,"CreationDate":"2010-01-18T23:31:00.000","Title":"Streaming Ironpython output to my editor","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"In a game that I am writing, I use a 2D vector class which I have written to handle the speeds of the objects. This is called a large number of times every frame as there are a lot of objects on the screen, so any increase I can make in its speed will be useful.\nIt is pretty simple, consisting mostly of wrappers to the related math functions. It would be quite trivial to rewrite in C, but I am not sure whether doing so will make any significant difference as all it really does is call the underlying math functions, add, multiply or divide.\nSo, my question is under what circumstances does it make sense to rewrite in C? Where will you see a significant speed boost, and where can you see a reasonable speed boost without rewriting an extensive amount of the program?","AnswerCount":5,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":429,"Q_Id":2096334,"Users Score":9,"Answer":"First measure then optimize","Q_Score":4,"Tags":"python,c,optimization","A_Id":2096358,"CreationDate":"2010-01-19T19:19:00.000","Title":"When Does It Make Sense To Rewrite A Python Module in C?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making an application that analyses one or more series of data using several different algorithms (agents). I came to the idea that each of these agents could be implemented as separate Python scripts which I run using either the Python C API or Boost.Python in my app.\nI'm a little worried about runtime overhead TBH, as I'm doing some pretty heavy duty data processing and I don't want to have to wait several minutes for each simulation. I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external \"agents\"; am I better of just hardcoding everything in the app, or will the performance drop be tolerable? \nAlso, are there any other interpreted languages I can use other than Python?","AnswerCount":7,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":2474,"Q_Id":2103728,"Users Score":0,"Answer":"you could probably create an embedded language using C++ templates and operator overloading, see for example ublas or ftensor matrix languages.  i do not think python or other interpreted languages of is suitable for having numbercrunching\/data processing.","Q_Score":7,"Tags":"c++,python,perl,performance,lua","A_Id":2103784,"CreationDate":"2010-01-20T18:04:00.000","Title":"Selecting An Embedded Language","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making an application that analyses one or more series of data using several different algorithms (agents). I came to the idea that each of these agents could be implemented as separate Python scripts which I run using either the Python C API or Boost.Python in my app.\nI'm a little worried about runtime overhead TBH, as I'm doing some pretty heavy duty data processing and I don't want to have to wait several minutes for each simulation. I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external \"agents\"; am I better of just hardcoding everything in the app, or will the performance drop be tolerable? \nAlso, are there any other interpreted languages I can use other than Python?","AnswerCount":7,"Available Count":3,"Score":0.0285636566,"is_accepted":false,"ViewCount":2474,"Q_Id":2103728,"Users Score":1,"Answer":"For millions of calls (from I'm assuming c++, because you mentioned boost) into python, yes: you will notice a performance hit.  This may or may not be significant - perhaps the speed gain of trying out new 'agents' would be greater than the hit. Python does have fast numerical libraries (such as numpy) that might help, but you'll still incur overhead of marshalling data, calling into python, the gil, etc.\nYes, you can embed many other languages:  check out lua.  Also, check out swig.org, which can connect to many other languages besides python.","Q_Score":7,"Tags":"c++,python,perl,performance,lua","A_Id":2103831,"CreationDate":"2010-01-20T18:04:00.000","Title":"Selecting An Embedded Language","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making an application that analyses one or more series of data using several different algorithms (agents). I came to the idea that each of these agents could be implemented as separate Python scripts which I run using either the Python C API or Boost.Python in my app.\nI'm a little worried about runtime overhead TBH, as I'm doing some pretty heavy duty data processing and I don't want to have to wait several minutes for each simulation. I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external \"agents\"; am I better of just hardcoding everything in the app, or will the performance drop be tolerable? \nAlso, are there any other interpreted languages I can use other than Python?","AnswerCount":7,"Available Count":3,"Score":0.1418931938,"is_accepted":false,"ViewCount":2474,"Q_Id":2103728,"Users Score":5,"Answer":"Tcl was designed from the ground up to be an embedded language.","Q_Score":7,"Tags":"c++,python,perl,performance,lua","A_Id":2104152,"CreationDate":"2010-01-20T18:04:00.000","Title":"Selecting An Embedded Language","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I successfully installed PyQt in both mac and PC. To do so I had to install mingw (on PC), Xcode (on MAC) and Qt4.6 library. Now that I have PyQt working perfectly, I would like to uninstall mingw, Xcode and Qt Library from both mac and PC. \nI know I can remove Xcode and mingw, but what care should I take before removing Qt library. I know PyQt is still using it but it is not using whole 1.5Gig of files installed by Qt installer. So which files should I copy before removing Qt and where should I copy it to.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":148,"Q_Id":2106178,"Users Score":1,"Answer":"You can remove the demos and examples directories inside your qt installation directory... they take up over 1GB of space and are not required. I would leave the rest there, unless you are really worried about space.\nIf you do try to clean up the QT installation directory, start by renaming larger files\/directories (e.g. add a .old suffix to the name), and see if the features you use in QT still function.  If it breaks, just rename the files\/directories back (remove .old).","Q_Score":3,"Tags":"python,pyqt4","A_Id":2184315,"CreationDate":"2010-01-21T00:50:00.000","Title":"PyQt post installation question","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing an application working with plugins. There are two types of plugins: Engine and Model. Engine objects have an update() method that call the Model.velocity() method.\nFor performance reasons these methods are allowed to be written in C. This means that sometimes they will be written in Python and sometimes written in C.\nThe problem is that this forces to do an expensive Python function call of Model.velocity() in Engine.update() (and also reacquiring the GIL). I thought about adding something like Model.get_velocity_c_func() to the API, that would allow Model implementations to return a pointer to the C version of their velocity() method if available, making possible for Engine to do a faster C function call.\nWhat data type should I use to pass the function pointer ? And is this a good design at all, maybe there is an easier way ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":366,"Q_Id":2106324,"Users Score":1,"Answer":"The CObject (PyCOBject) data type exists for this purpose. It holds a void*, but you can store any data you wish. You do have to be careful not to pass the wrong CObject to the wrong functions, as some other library's CObjects will look just like your own.\nIf you want more type security, you could easily roll your own PyType for this; all it has to do, after all, is contain a pointer of the right type.","Q_Score":0,"Tags":"python,c,function-pointers","A_Id":2106391,"CreationDate":"2010-01-21T01:29:00.000","Title":"Passing C function pointers between two python modules","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In the 'old days' when there was just cpython, most extensions were written in c (as platform independent as possible) and compiled into pyd's (think PyCrypto for example).  Now there is Jython, IronPython and PyPy and the pyd\u2019s do not work with any of them (Ironclad aside).  It seems they all support ctypes and that the best approach MIGHT be to create a platform independent dll or shared library and then use ctypes to interface to it.\nBut I think this approach will be a bit slower than the old fashion pyd approach.  You could also program a pyd for cpython, a similar c# dll for IronPython and a java class or jar for Jython (I'm not sure about PyPy.  But while this approach will appeal to platform purists it is very labor intensive.  So what is the best route to take today?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":501,"Q_Id":2114627,"Users Score":1,"Answer":"If you're wrapping an existing native library, the ctypes is absolutely the way to go.\nIf you're trying to speed up the hot spots in a Python extension, then making a custom extension for each interpreter (and a pure-Python fallback) is tractable because the bulk of the code is pure Python that can be shared, but undesirable and labour-intensive, as you said. You could use ctypes in this case as well.","Q_Score":4,"Tags":"python,ironpython,jython","A_Id":2119710,"CreationDate":"2010-01-22T02:44:00.000","Title":"Python extensions that can be used in all varieties of python (jython \/ IronPython \/ etc.)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In the 'old days' when there was just cpython, most extensions were written in c (as platform independent as possible) and compiled into pyd's (think PyCrypto for example).  Now there is Jython, IronPython and PyPy and the pyd\u2019s do not work with any of them (Ironclad aside).  It seems they all support ctypes and that the best approach MIGHT be to create a platform independent dll or shared library and then use ctypes to interface to it.\nBut I think this approach will be a bit slower than the old fashion pyd approach.  You could also program a pyd for cpython, a similar c# dll for IronPython and a java class or jar for Jython (I'm not sure about PyPy.  But while this approach will appeal to platform purists it is very labor intensive.  So what is the best route to take today?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":501,"Q_Id":2114627,"Users Score":2,"Answer":"Currently, it seems the ctypes is indeed the best approach.  It works today, and it's so convenient that it's gonna conquer (most of) the world.\nFor performance-critical APIs (such as numpy), ctypes is indeed problematic.  The cleanest approach would probably be to port Cython to produce native IronPython \/ Jython \/ PyPy extensions.\nI recall that PyPy had plans to compile ctypes code to efficient wrappers, but as far as I google, there is nothing like that yet...","Q_Score":4,"Tags":"python,ironpython,jython","A_Id":2116557,"CreationDate":"2010-01-22T02:44:00.000","Title":"Python extensions that can be used in all varieties of python (jython \/ IronPython \/ etc.)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am attempting to create my first OS-level GUI using wxPython.  I have the book wxPython in Action and have looked at the code demos.  I have no experience with event-driven programming (aside from some Javascript), sizers, and all of the typical GUI elements.  The book is organized a little strangely and assumes I know far more about OS GUI programming than I actually do.  I'm fairly recent to object-oriented programming, as well.  I'm aware that I am clearly out of my depth.  \nMy application, on the GUI side, is simple: mostly a set of reminder screens (\"Turn on the scanner,\" \"Turn on the printer,\" etc) and background actions in Python either in the filesystem or from hitting a web service, but it is just complex enough that the Wizard class does not quite seem to cover it.  I have to change the names on the \"Back\" and \"Next\" buttons, disable them at times, and so forth.\nWhat is the standard process for an application such as mine?  \n1) Create a single wxFrame, then put all of my wxPanels inside of it, hiding all but one, then performing a sequence of hides and shows as the \"Next\" button (or the current equivalent) are triggered?  \n2) Create multiple wxFrames, with one wxPanel in each, then switch between them?  \n3) Some non-obvious fashion of changing the names of the buttons in wxWizard and disabling them?\n4) Something I have not anticipated in the three categories above.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":290,"Q_Id":2119067,"Users Score":1,"Answer":"I don't have a good understanding of your application, but trying to force wxWizard to suit your needs sounds like a bad idea.\nI suggest checking out the Demos available from the wxPython website.  Go through each demo and I bet you'll find one that suits your needs.\nI've personally never used wxWizard as I find it too cumbersome.  Instead, I create a sequence of dialogs that do what I need.","Q_Score":3,"Tags":"python,wxpython","A_Id":2120967,"CreationDate":"2010-01-22T17:16:00.000","Title":"In wxPython, What is the Standard Process of Making an Application Slightly More Complex Than a Wizard?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a way to lock the window. I found window.set_resizable(False), but that resizes the window to its requested size and then locks it. I would like to be able to resize my window, and then lock it into the size I have resized it to.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1153,"Q_Id":2124296,"Users Score":3,"Answer":"Perhaps you could set_size_request() with the current window size (from window_get_size()) before you call set_resizable()?","Q_Score":0,"Tags":"python,gtk,window,pygtk,resizable","A_Id":2124325,"CreationDate":"2010-01-23T18:58:00.000","Title":"PyGTK, how can I lock a window so it cannot be resized?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a way to lock the window. I found window.set_resizable(False), but that resizes the window to its requested size and then locks it. I would like to be able to resize my window, and then lock it into the size I have resized it to.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1153,"Q_Id":2124296,"Users Score":0,"Answer":"You can use this:\nwindow.set_geometry_hints(window, min_width, min_height, max_width, max_height)","Q_Score":0,"Tags":"python,gtk,window,pygtk,resizable","A_Id":15961711,"CreationDate":"2010-01-23T18:58:00.000","Title":"PyGTK, how can I lock a window so it cannot be resized?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Pygame\/SDL's joystick module to get input from a gamepad. Every time I call its get_hat() method it prints to the console. This is problematic since I use the console to help me debug and now it gets flooded with SDL_JoystickGetHat value:0: 60 times every second. Is there a way I can disable this? Either through an option in Pygame\/SDL or suppress console output while the function calls? I saw no mention of this in the Pygame documentation.\nedit: This turns out to be due to debugging being turned on when the SDL library was compiled.","AnswerCount":8,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":97342,"Q_Id":2125702,"Users Score":2,"Answer":"I use pythonw.exe (on Windows) instead of python.exe.\nIn other OSes, you could also redirect output to \/dev\/nul.\nAnd in order to still see my debug output, I am using the logging module.","Q_Score":47,"Tags":"python,sdl,pygame","A_Id":5063983,"CreationDate":"2010-01-24T02:43:00.000","Title":"How to suppress console output in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a application written in PyGtk. I need to convert a particular line number into its corresponding window co-ordinates in a GtkTextView. How can this be done?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":131,"Q_Id":2137517,"Users Score":0,"Answer":"It can't be done, in general.  If you're talking about a line of your pygtk program, then you would need an API for your IDE (development environment) to find out where a particular source code line is currently displayed on the screen, if anywhere.  If by \"line number\" you mean something else, then as Ignacio says, you'll need to provide a lot more detail.","Q_Score":0,"Tags":"python,pygtk,gtk","A_Id":2137653,"CreationDate":"2010-01-26T04:26:00.000","Title":"Convert Line Number Into its corresponding co-ordinates","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. \n\nImportError: DLL load failed: The specified module could not be found.\n\nI've checked my System Path, and C:\\Python31\\Lib\\site-packages\\PyQt4\\bin is on there.\nI can't run any of the examples, but the Designer, Assistant and Linguist run fine.\nI am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed.\n\nEdit:\nI've copied the QtCore4 and GtGui4 dlls to C:\\Python31\\Lib\\site-packages\\PyQt4. That fixes some of the examples, but I still can't use the example browser.","AnswerCount":8,"Available Count":5,"Score":0.024994793,"is_accepted":false,"ViewCount":24135,"Q_Id":2140836,"Users Score":1,"Answer":"PyQt installation also depends on the version of python installed on your platform.Python3.+ is incompatible with Python version < 3.x.\nI was facing the same problem as I have Python 2.7 installed on my machine but I downloaded the latest binary which was PyQt-Py3.2-x86-gpl-4.9.exe. If you see here the binary has python version also mentioned in name after PyQt which is Py3.2. I uninstalled PyQt and installed PyQt-Py2.7-x86-gpl-4.9.exe which points to Python 2.7 and it fixed the problem.\nProbably they could have mentioned the naming convention online or in some documentation to be more simpler.","Q_Score":11,"Tags":"python,windows,pyqt,importerror","A_Id":10279385,"CreationDate":"2010-01-26T16:33:00.000","Title":"PyQt 4.7 - ImportError after installing on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. \n\nImportError: DLL load failed: The specified module could not be found.\n\nI've checked my System Path, and C:\\Python31\\Lib\\site-packages\\PyQt4\\bin is on there.\nI can't run any of the examples, but the Designer, Assistant and Linguist run fine.\nI am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed.\n\nEdit:\nI've copied the QtCore4 and GtGui4 dlls to C:\\Python31\\Lib\\site-packages\\PyQt4. That fixes some of the examples, but I still can't use the example browser.","AnswerCount":8,"Available Count":5,"Score":0.049958375,"is_accepted":false,"ViewCount":24135,"Q_Id":2140836,"Users Score":2,"Answer":"Just wanted to chime in that I had the same problem on a WinXP install of:\n\npython 2.7 \nQt 4.7.1 (10.05)\nPyQt 4.8.1\n\nI used the windows installer version of all 3 of those items.\nCopying the contents of the C:\\Python27\\Lib\\site-packages\\PyQt4\\bin folder up to the main PyQt folder (C:\\Python27\\Lib\\site-packages\\PyQt4) stopped the 'dll not found' errors that python was throwing.","Q_Score":11,"Tags":"python,windows,pyqt,importerror","A_Id":4452810,"CreationDate":"2010-01-26T16:33:00.000","Title":"PyQt 4.7 - ImportError after installing on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. \n\nImportError: DLL load failed: The specified module could not be found.\n\nI've checked my System Path, and C:\\Python31\\Lib\\site-packages\\PyQt4\\bin is on there.\nI can't run any of the examples, but the Designer, Assistant and Linguist run fine.\nI am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed.\n\nEdit:\nI've copied the QtCore4 and GtGui4 dlls to C:\\Python31\\Lib\\site-packages\\PyQt4. That fixes some of the examples, but I still can't use the example browser.","AnswerCount":8,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":24135,"Q_Id":2140836,"Users Score":0,"Answer":"I think there are at least two possible error conditions\n1. ImportError: DLL load failed: The specified module could not be found.\nthen you have to check your PyQT version is comptible with your python. In other words, if you use python 3.3, then you can only use PyQT for python3.3 and python 3.3 will not work with PyQT for python3.4\nThis was the problem I met. I solved it with re-install it\n2. Import Error: DLL load failed: %1 then something strange on a different encoding Win32.\nthen it would be a OS problem. If you use 32bit Python then you have to use 32bit PyQt, so do 64bit","Q_Score":11,"Tags":"python,windows,pyqt,importerror","A_Id":27086381,"CreationDate":"2010-01-26T16:33:00.000","Title":"PyQt 4.7 - ImportError after installing on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. \n\nImportError: DLL load failed: The specified module could not be found.\n\nI've checked my System Path, and C:\\Python31\\Lib\\site-packages\\PyQt4\\bin is on there.\nI can't run any of the examples, but the Designer, Assistant and Linguist run fine.\nI am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed.\n\nEdit:\nI've copied the QtCore4 and GtGui4 dlls to C:\\Python31\\Lib\\site-packages\\PyQt4. That fixes some of the examples, but I still can't use the example browser.","AnswerCount":8,"Available Count":5,"Score":0.024994793,"is_accepted":false,"ViewCount":24135,"Q_Id":2140836,"Users Score":1,"Answer":"I had the same problem. I got my program running from within Eclipse but when I tried running it directly from the command line I still got the same error.\nI solved it by renaming the C:\\Users\\Me\\AppData\\Roaming\\Python\\Python27\\site-packages\\PyQt4 directory. (I'm guessing leftovers from a previous PyQt install)\nI am using ActivePython.","Q_Score":11,"Tags":"python,windows,pyqt,importerror","A_Id":11774820,"CreationDate":"2010-01-26T16:33:00.000","Title":"PyQt 4.7 - ImportError after installing on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui. \n\nImportError: DLL load failed: The specified module could not be found.\n\nI've checked my System Path, and C:\\Python31\\Lib\\site-packages\\PyQt4\\bin is on there.\nI can't run any of the examples, but the Designer, Assistant and Linguist run fine.\nI am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed.\n\nEdit:\nI've copied the QtCore4 and GtGui4 dlls to C:\\Python31\\Lib\\site-packages\\PyQt4. That fixes some of the examples, but I still can't use the example browser.","AnswerCount":8,"Available Count":5,"Score":0.024994793,"is_accepted":false,"ViewCount":24135,"Q_Id":2140836,"Users Score":1,"Answer":"Also chiming in. I installed both python 2.6 and PyQt 4.8.3 on a Windows 7 machine using the windows installers (I did NOT run 'python setup.py install').\nI tried to run spyder (which requires PyQt 4.4 or greater) and failed because it couldn't find the PyQt .dlls. I copied all the .dlls from the \\Lib\\site-packages\\PyQt4\\bin folder to the \\Lib\\site-packages\\PyQt4 folder, and spyder launches just fine.","Q_Score":11,"Tags":"python,windows,pyqt,importerror","A_Id":5795870,"CreationDate":"2010-01-26T16:33:00.000","Title":"PyQt 4.7 - ImportError after installing on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I convert a .wav file to some other format such as .mp3 in pygame? \nUpdate:\nWhy not Gstreamer or Pygame: \nI want to use native Windows environment to install a package that can do this (i.e. don't want to install cygwin). I am searching for a package which has a binary installer available for windows (with Python 2.6) or atleast where I can do \"python setup.py install\" without a need to install any dependencies.","AnswerCount":2,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":410,"Q_Id":2141315,"Users Score":-2,"Answer":"Pygame is an SDL wrapper. Not a multimedia framework. Why do you want to do audio format conversions in Pygame? Can't you use something else like maybe the gstreamer bindings for Python?","Q_Score":3,"Tags":"python,pygame","A_Id":2141369,"CreationDate":"2010-01-26T17:39:00.000","Title":"pygame saving audio files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a game which uses procedurally generated levels, and when I'm testing I'll often want to reproduce a level. Right now I haven't made any way to save the levels, but I thought a simpler solution would be to just reuse the seed used by Python's random module. However I've tried using both random.seed() and random.setstate() and neither seem to reliably reproduce results. Oddly, I'll sometimes get the same level a few times in a row if I reuse a seed, but it's never completely 100% reliable. Should I just save the level normally (as a file containing its information)?\nEdit:\nThanks for the help everyone. It turns out that my problem came from the fact that I was randomly selecting sprites from groups in Pygame, which are retrieved in unordered dictionary views. I altered my code to avoid using Pygame's sprite groups for that part and it works perfectly now.","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2510,"Q_Id":2143463,"Users Score":0,"Answer":"At the point when you want another level, you should initially create another levelRandom object, and give that object to a level-generator to produce the level (if you are using one)","Q_Score":4,"Tags":"python,random,pygame","A_Id":64776255,"CreationDate":"2010-01-26T23:19:00.000","Title":"What's the easiest way to reproduce a randomly generated level in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a game which uses procedurally generated levels, and when I'm testing I'll often want to reproduce a level. Right now I haven't made any way to save the levels, but I thought a simpler solution would be to just reuse the seed used by Python's random module. However I've tried using both random.seed() and random.setstate() and neither seem to reliably reproduce results. Oddly, I'll sometimes get the same level a few times in a row if I reuse a seed, but it's never completely 100% reliable. Should I just save the level normally (as a file containing its information)?\nEdit:\nThanks for the help everyone. It turns out that my problem came from the fact that I was randomly selecting sprites from groups in Pygame, which are retrieved in unordered dictionary views. I altered my code to avoid using Pygame's sprite groups for that part and it works perfectly now.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":2510,"Q_Id":2143463,"Users Score":1,"Answer":"Best would be to create a levelRandom class with a data slot for every randomly produced result when generating a level. Then separate the random-generation code from the level-construction code. When you want a new level, first generate a new levelRandom object, then hand that object to the level-generator to produce your level. Later, to get the same level again, you can just reuse the levelRandom instance.","Q_Score":4,"Tags":"python,random,pygame","A_Id":2143490,"CreationDate":"2010-01-26T23:19:00.000","Title":"What's the easiest way to reproduce a randomly generated level in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using Python and PyGTK I've got a GtkMenu with various GtkCheckMenuItems in it.  When the user clicks one of the checkboxes the menu closes. I'd like for the user to be able to check a series of checkboxes without the menu closing each time.\nI've looked at using the activate callback to show the menu but this doesn't seem to work.  Any suggestions?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":749,"Q_Id":2150899,"Users Score":-1,"Answer":"Try digging into source and it's documentation. I have found this to be the easiest way and best shortcut.","Q_Score":6,"Tags":"python,menu,gtk,pygtk","A_Id":2152012,"CreationDate":"2010-01-27T22:46:00.000","Title":"Making a Python\/GTK CheckMenuItem, when clicked, not close the menu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In my Python2_6\/include directory is a folder with pygame headers. I assumed that my python C module can access pygame stuff directly in C. Is this the case? How do I integrate a C module that wants to use pygame, with a python script using pygame? Right now my brain sees:\npygame <-- MyCModule <-- MyScript --> pygame\nie. Two pygame instances. So is it possible to integrate them so that my module and my app use the same instance? Why are there pygame headers in my python include directory, can I use those somehow, for direct access?\nThanks for any help.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":390,"Q_Id":2171746,"Users Score":0,"Answer":"I assumed that my python C module can\n  access pygame stuff directly in C. Is\n  this the case?\n\nNo, that stuff is most likely just there because it was necessary to compile the pygame Python extension.\nI don't understand what you mean when you say you see 2 pygame instances. There are as many instances as you create, no more, no less. If you have script that creates pygame objects, and your extension also creates pygame objects, then of course you will have 2 sets of objects. As the writer of the application you need to decide which part of it will have responsibility for interfacing with pygame. If the other part requires access to those pygame objects, then you pass them in as arguments.","Q_Score":1,"Tags":"python,module,pygame","A_Id":2176010,"CreationDate":"2010-01-31T13:07:00.000","Title":"Integrating pygame with a C module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a program and I need some extra functionality from the gtk.Notebook widget, so I have taken to creating my own.\nMy only problem is styling my tabs so that they look like the tabs in gtk.Notebook and will change according to the user's theme.\nI really don't know where to start so any advice would be much appreciated, thanks :)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":682,"Q_Id":2174873,"Users Score":0,"Answer":"Just for the record, if you are going to create something similar to a gtk.Notebook, I'll recomment you to subclass gtk.Notebook to save a lot of work.","Q_Score":1,"Tags":"python,coding-style,tabs,pygtk","A_Id":2786548,"CreationDate":"2010-02-01T05:43:00.000","Title":"PyGTK: How do I make a custom widget look like a gtk.Notebook tab?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a program and I need some extra functionality from the gtk.Notebook widget, so I have taken to creating my own.\nMy only problem is styling my tabs so that they look like the tabs in gtk.Notebook and will change according to the user's theme.\nI really don't know where to start so any advice would be much appreciated, thanks :)","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":682,"Q_Id":2174873,"Users Score":0,"Answer":"I solved the problem eventually by getting the colours from gtk.Notebook's style.","Q_Score":1,"Tags":"python,coding-style,tabs,pygtk","A_Id":2212682,"CreationDate":"2010-02-01T05:43:00.000","Title":"PyGTK: How do I make a custom widget look like a gtk.Notebook tab?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently have a dual-monitor setup with Eclipse on monitor 2. When I run the code that launches the wxPython GUI, I would like for this GUI to appear on monitor 1. Currently, the GUI consistently appears on monitor 2, covering Eclipse, and I have to drag it to monitor 1 every time. Is there a solution to this problem -- either a configuration change I can make in Eclipse or some addition I can make to the GUI code?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":441,"Q_Id":2174904,"Users Score":0,"Answer":"The best kludge I found was the Kubuntu global shortcut \"Ctrl-Shift-Space\". This moves a window to the other screen, mitigating the hassle of dragging with the mouse.","Q_Score":0,"Tags":"python,eclipse,wxpython","A_Id":2182198,"CreationDate":"2010-02-01T05:50:00.000","Title":"Making wxPython GUI launch on a different screen from Eclipse","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently have a dual-monitor setup with Eclipse on monitor 2. When I run the code that launches the wxPython GUI, I would like for this GUI to appear on monitor 1. Currently, the GUI consistently appears on monitor 2, covering Eclipse, and I have to drag it to monitor 1 every time. Is there a solution to this problem -- either a configuration change I can make in Eclipse or some addition I can make to the GUI code?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":441,"Q_Id":2174904,"Users Score":0,"Answer":"Kludge #2: If I run the code from Eclipse on screen 2 then click someplace on screen 1 before the GUI appears, the GUI will appear on screen 1.","Q_Score":0,"Tags":"python,eclipse,wxpython","A_Id":2189730,"CreationDate":"2010-02-01T05:50:00.000","Title":"Making wxPython GUI launch on a different screen from Eclipse","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Often times when we're drawing a GUI, we want our GUI to update based on the data changing in our program.  At the start of the program, let's say I've drawn my GUI based on my initial data.  That data will be changing constantly, so how can I redraw my GUI constantly?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1096,"Q_Id":2192993,"Users Score":0,"Answer":"You could create a thread to update the GUI constantly, just pass to it references to the graphical widgets that need to be updated","Q_Score":1,"Tags":"python,pyqt","A_Id":2193028,"CreationDate":"2010-02-03T15:21:00.000","Title":"How to start a \"drawing loop\" in PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"QGraphicsView is often hooked up to a QGraphicsScene.  What if I want to swap that QGraphicsScene for a new one?  How can I accomplish this?  Doing it right now is just drawing over the old one.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":249,"Q_Id":2194829,"Users Score":0,"Answer":"To swap the scene just call your view's setScene() again with a different QGraphicsScene object.","Q_Score":1,"Tags":"python,pyqt","A_Id":2194899,"CreationDate":"2010-02-03T19:31:00.000","Title":"How to swap the QGraphicsScene from a QGraphicsView?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a trick to sizing controls for wx.lib.CUstomTreeCtrl?  I've been trying to create my own custom controls (just panels with sub-controls in them) and add them as items in my CustomTreeCtrl, but when the tree renders, it's as if the panels aren't expanded to the appropriate size.  I can set the panel size manually by using SetSize() but if I do that, the tree doesn't seem to be aware of the size (the rows aren't scaled to the appropriate size) and the items are rendered on top of each other.  I've tried to override DoGetBestSize() but it seems to not have any effect.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":143,"Q_Id":2219514,"Users Score":0,"Answer":"Can you put a self contained sample code and we can try to fix that.\nHave you tried adding custom items which return correct height for your panel?","Q_Score":0,"Tags":"python,wxpython","A_Id":2309469,"CreationDate":"2010-02-08T04:05:00.000","Title":"Sizing controls for items in wx.lib.CustomTreeCtrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to write a small gui app in pygtk which needs an html-rendering widget.  I'd like to be able to use it in a windows environment.\nCurrently I'm using pywebkitgtk on my GNU\/Linux system, and it works extremely well, but it seems it's not possible to use this on Windows at this time.\nCan anyone give me any suggestions on how to proceed?  Do I need to work out how to embed IE using COM objects under Windows, and stick with pywebkitgtk on GNU\/Linux?\nI'm at an early stage, and am prepared to jettison pygtk in favour of another toolkit, say pyqt, if it affords a simpler solution (though I'd sooner stick with pygtk if possible).","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1076,"Q_Id":2227770,"Users Score":2,"Answer":"In my experience, having developed cross-platform applications with both PyQt and PyGTK, you should consider moving to PyQt. It comes with a browser widget by default which runs fine on all platforms, and support for non-Linux platforms is outstanding compared to PyGTK. For PyGTK, you will have to be prepared building PyGObject\/PyCairo\/PyGTK, or even the full stack, yourself on Windows and Mac OS X.","Q_Score":0,"Tags":"python,cross-platform,pyqt,pygtk,html-rendering","A_Id":2227957,"CreationDate":"2010-02-09T08:48:00.000","Title":"cross-platform html widget for pygtk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having a class library. I'm able to access that assembly from iron python console as normal. \nMy goal is to create a Silverlight class library which uses a python script to access that WPF class library what I'm having. Is it possible? Is there any other way to achieve this or any work around.\nI can provide a sample of what I'm doing now, If more details are needed.\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":433,"Q_Id":2251296,"Users Score":2,"Answer":"You will not be able to use the class library unless its code is compatible with Silverlight libraries and is re-compiled targeting the Silverlight ones.","Q_Score":1,"Tags":"c#,silverlight,ironpython","A_Id":2253386,"CreationDate":"2010-02-12T11:05:00.000","Title":"How to access WPF class library from Silverlight using iron python. Is it possible?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a treeview and I am watching for the cursor-changed and row-activated signals.  The problem is that in order to trigger the row-activate I first have to click on the row (triggering cursor-changed) and then do the double click, requiring 3 clicks.\nIs there a way to respond to both signals with 2 clicks?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":3862,"Q_Id":2256794,"Users Score":3,"Answer":"The cursor-changed signal is emitted even when single clicking on the same (selected) row. Still, the row-activated signal is emitted when you double click on a row, whether it was selected before the double click or not. Thus you don't need 3 clicks to trigger a row-activated.\nAs Jon mentioned, you want to connect to the selection's changed signal in stead of cursor-changed.","Q_Score":1,"Tags":"python,gtk,pygtk,gtktreeview","A_Id":3100214,"CreationDate":"2010-02-13T07:09:00.000","Title":"GtkTreeView's row-activated and cursor-changed signals","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a timer program in Python using PyGTK. It is precise to the hundredths place. Right now, I am using a constantly updated label. This is a problem, because if I resize the window while the timer is running, Pango more often than not throws some crazy error and my program terminates. It's not always the same error, but different ones that I assume are some form of failed draw. Also, the label updates slower and slower as I increase the font size.\nSo, I am wondering if there is a more correct way to display the timer. Is there a more stable method than constantly updating a label?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1048,"Q_Id":2259386,"Users Score":2,"Answer":"Updating a label should work perfectly reliably, so I suspect you're doing something else wrong. Are you using threads? What does your code look like? How small can you condense your program (by removing functionality, not by obfuscating the code), without making the problem go away?","Q_Score":1,"Tags":"python,gtk,pygtk,pango","A_Id":2259437,"CreationDate":"2010-02-13T22:41:00.000","Title":"How should I display a constantly updating timer using PyGTK?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to write a code that runs similar to normal calculators in such a way that it displays the first number I type in, when i press the operand, the entry widget still displays the first number, but when i press the numbers for my second number, the first one gets replaced. I'm not to the point in writing the whole code yet, but I'm stuck at the point where when I press the 2nd number(s), the first set gets replaced. I was thinking about if key == one of the operands, than I set the num on the entry as variable first, then I do ent.delete(0,end) to clear the screen and ent.insert(0,first) to display the first num in the entry widget. Now I don't know what to do to clear the entry widget when the 2nd number(s) is pressed.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1214,"Q_Id":2264371,"Users Score":2,"Answer":"What you need here is a concept of state. Each time a key is pressed, you check the state and determine what action to take.\nIn the initial state, you take input of numbers.\nWhen an operand button is pressed, you store the operand, and change the state.\nWhen another number is pressed, you store the number, clear the numeric input, and start the number input again.\nThen when the equals button is pressed, you perform the operation, using your stored number and operand with the current number in the numeric input.\nNote that with a dynamic language like Python, instead of using a variable and if statements to check the state, you can just change the function that handles key\/button pressed depending on what the state is.","Q_Score":1,"Tags":"python,user-interface,calculator","A_Id":2264618,"CreationDate":"2010-02-15T06:41:00.000","Title":"Creating a GUI Calculator in python similar to MS Calculator","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a PyQt application.  Currently, there's a status panel (defined as a QWidget) which contains a QHBoxLayout.  This layout is frequently updated with QPushButtons created  by another portion of the application.\nWhenever the buttons which appear need to change (which is rather frequently) an update effect gets called.  The existing buttons are deleted from the layout (by calling layout.removeWidget(button) and then button.setParent(None)) and the new buttons are added to the layout.\nGenerally, this works.  But occasionally, when I call button.setParent(None) on the button to delete, it causes it to pop out of the application and start floating in its own stand-alone frame.\nHow can I remove a button from the layout and ensure it doesn't start floating?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":304,"Q_Id":2264482,"Users Score":2,"Answer":"Try calling QWidget::hide() on the button before removing from the layout if you don't want to delete your button.","Q_Score":3,"Tags":"python,qt,qt4,pyqt,pyqt4","A_Id":2265975,"CreationDate":"2010-02-15T07:26:00.000","Title":"How do I prevent Qt buttons from appearing in a separate frame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to create an application that has 3-4 frames (or windows) where each frame is attached\/positioned to a side of the screen (like a task bar). When a frame is inactive I would like it to auto hide (just like the Windows task bar does; or the dock in OSX). When I move my mouse pointer to the position on the edge of the screen where the frame is hidden, I would like it to come back into focus.\nThe application is written in Python (using wxPython for the basic GUI aspects). Does anyone know how to do this in Python? I'm guessing it's probably OS dependent? If so, I'd like to focus on Windows first.\nI don't do GUI programming very often so my apologies if this makes no sense at all.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":877,"Q_Id":2268315,"Users Score":0,"Answer":"I think you could easily just make a window that is the same size as the desktop then do some while looping for an inactivity variable based on mouse position, then thread off a timer for loop for the 4 inactivity variables. I'd personally design it so that when they reach 0 from 15, they change size and position to become tabular and create a button on them to reactivate. lots of technical work on this one, but easily done if you figure it out","Q_Score":1,"Tags":"python,animation,wxpython,mouseevent","A_Id":44916099,"CreationDate":"2010-02-15T19:11:00.000","Title":"Can you auto hide frames\/dialogs using wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to create an application that has 3-4 frames (or windows) where each frame is attached\/positioned to a side of the screen (like a task bar). When a frame is inactive I would like it to auto hide (just like the Windows task bar does; or the dock in OSX). When I move my mouse pointer to the position on the edge of the screen where the frame is hidden, I would like it to come back into focus.\nThe application is written in Python (using wxPython for the basic GUI aspects). Does anyone know how to do this in Python? I'm guessing it's probably OS dependent? If so, I'd like to focus on Windows first.\nI don't do GUI programming very often so my apologies if this makes no sense at all.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":877,"Q_Id":2268315,"Users Score":0,"Answer":"Personally, I would combine the EVT_ENTER_WINDOW and EVT_LEAVE_WINDOW that FogleBird mentioned with a wx.Timer. Then whenever it the frame or dialog is inactive for x seconds, you would just call its Hide() method.","Q_Score":1,"Tags":"python,animation,wxpython,mouseevent","A_Id":9066380,"CreationDate":"2010-02-15T19:11:00.000","Title":"Can you auto hide frames\/dialogs using wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When starting up a new project, as a beginner, which would you use?  \nFor example, in my situation.  I'm going to have a program running on an infinite loop, constantly updating values.  I need these values to be represented as a bar graph as they're updating.  At the same time, the GUI has to be responsive to user feedback as there will be some QObjects that will be used to updated parameters within that infinite loop.  So these need to be on separate threads, if I'm not mistaken.  Which choice would give the most\/least hassle?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":445,"Q_Id":2268853,"Users Score":1,"Answer":"If I understood your question correctly, updating the GUI has a little to do with the way you programmed it.\nFrom my experience, it's easier to design a main window (or whatever your top level object is) in Designer, and add some dynamically updated content in a widget(s) created in your code. In most cases, it saves your time spent on digging through QT documentation, and additionally, you are able to visually inspect positioning, aligning etc.\nYou don't lose anything by using a Designer, every part of the GUI can be modified in your code afterwards, if it needs some custom behavior.\nHaving said that, without knowing all the details of your project is hard to tell which option (QT or in-code) is faster.","Q_Score":2,"Tags":"python,user-interface,pyqt","A_Id":2271799,"CreationDate":"2010-02-15T20:58:00.000","Title":"QtDesigner or doing all of the Qt boilerplate by hand?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When starting up a new project, as a beginner, which would you use?  \nFor example, in my situation.  I'm going to have a program running on an infinite loop, constantly updating values.  I need these values to be represented as a bar graph as they're updating.  At the same time, the GUI has to be responsive to user feedback as there will be some QObjects that will be used to updated parameters within that infinite loop.  So these need to be on separate threads, if I'm not mistaken.  Which choice would give the most\/least hassle?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":445,"Q_Id":2268853,"Users Score":0,"Answer":"Your right threading is your answer.  Use the QT threads they work very well.  \nWhere I work when people start out using QT a lot of them start with designer but eventually end up hand coding it.  I think you will end up hand coding it but if you are someone who really likes GUIs you may want to start with Designer.  I know that isn't a definitive answer but it really depends.","Q_Score":2,"Tags":"python,user-interface,pyqt","A_Id":2269180,"CreationDate":"2010-02-15T20:58:00.000","Title":"QtDesigner or doing all of the Qt boilerplate by hand?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When starting up a new project, as a beginner, which would you use?  \nFor example, in my situation.  I'm going to have a program running on an infinite loop, constantly updating values.  I need these values to be represented as a bar graph as they're updating.  At the same time, the GUI has to be responsive to user feedback as there will be some QObjects that will be used to updated parameters within that infinite loop.  So these need to be on separate threads, if I'm not mistaken.  Which choice would give the most\/least hassle?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":445,"Q_Id":2268853,"Users Score":0,"Answer":"First of all, the requirements that you've mentioned don't (or shouldn't) have much affect on this decision.\nEither way, you're going to have to learn something.  You might as well investigate both options, and make the decision yourself.  Write a couple of \"Hello, World!\" apps, then start adding some extra widgets\/behavior to see how each approach scales.\nSince you asked, I would probably use Qt Designer.  But I'm not you, and I'm not working on (nor do I know much of anything about) your project.","Q_Score":2,"Tags":"python,user-interface,pyqt","A_Id":2269317,"CreationDate":"2010-02-15T20:58:00.000","Title":"QtDesigner or doing all of the Qt boilerplate by hand?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was thinking of trying OpenCV for a project and noticed that it had C, C++ and Python.\nI am trying to figure out whether I should use C++, C or Python -- and would like to use whatever has the best OpenCV support.  \nJust from looking at the index page for the various documentation it looks like the C++ bindings might have more features than the others? Is this true?\nIf C++ has more bindings, it seems that would be a more obvious choice for me, but I was just curious if it really has more features, etc than the others?\nThanks!","AnswerCount":4,"Available Count":3,"Score":0.1973753202,"is_accepted":false,"ViewCount":7757,"Q_Id":2278228,"Users Score":4,"Answer":"I think it depends how proficient you are in C++. The Mat interface does appear more modern than the old IPLImage C interface. The problem I'm having is that most of the examples you'll find on the web, or even here on stackoverflow are for the C interface (e.g. cvCvtColor), not for the C++ interface. So I'm really struggling to port the C examples to C++.","Q_Score":27,"Tags":"c++,python,c,opencv","A_Id":10057553,"CreationDate":"2010-02-17T04:04:00.000","Title":"OpenCV Image Processing -- C++ vs C vs Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was thinking of trying OpenCV for a project and noticed that it had C, C++ and Python.\nI am trying to figure out whether I should use C++, C or Python -- and would like to use whatever has the best OpenCV support.  \nJust from looking at the index page for the various documentation it looks like the C++ bindings might have more features than the others? Is this true?\nIf C++ has more bindings, it seems that would be a more obvious choice for me, but I was just curious if it really has more features, etc than the others?\nThanks!","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":7757,"Q_Id":2278228,"Users Score":13,"Answer":"The Python interface is still being developed whereas the C++ interface (especially with the new Mat class) is quite mature. If you're comfortable in C++, I would highly recommend using it - else, you can start using Python and contribute back any features you think OpenCV needs :)","Q_Score":27,"Tags":"c++,python,c,opencv","A_Id":2278331,"CreationDate":"2010-02-17T04:04:00.000","Title":"OpenCV Image Processing -- C++ vs C vs Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was thinking of trying OpenCV for a project and noticed that it had C, C++ and Python.\nI am trying to figure out whether I should use C++, C or Python -- and would like to use whatever has the best OpenCV support.  \nJust from looking at the index page for the various documentation it looks like the C++ bindings might have more features than the others? Is this true?\nIf C++ has more bindings, it seems that would be a more obvious choice for me, but I was just curious if it really has more features, etc than the others?\nThanks!","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":7757,"Q_Id":2278228,"Users Score":1,"Answer":"Even if you're very proficient in C or C++, you should use python to speed up your development (I should guess a 4x factor). Performance are really quite the same.","Q_Score":27,"Tags":"c++,python,c,opencv","A_Id":16210061,"CreationDate":"2010-02-17T04:04:00.000","Title":"OpenCV Image Processing -- C++ vs C vs Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I set a gtk.Button enabled or disabled in PyGTK?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":12047,"Q_Id":2281373,"Users Score":0,"Answer":"If you don't want to see the object then you could button.set_visible(False) to hide it or button.set_visible(True) to show it. This will prevent users from seeing the button.","Q_Score":18,"Tags":"python,pygtk","A_Id":70261450,"CreationDate":"2010-02-17T14:23:00.000","Title":"Enable or disable gtk.Button in PyGTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've a PyQt 4 installed (I can't find PyQt 3 for Windows) and I would like to open a QtDesigner ui file which has been created with QtDesigner 3.3.\nWhen I open this file I've the following message:\nPlease use uic3 -convert to convert to Qt4\nUnfortunately, I don't see the uic3 tool in the bin folder of my install.\nDoes anybody know how can I can convert this file to QtDesigner 4?\nAdditional quastion: Where to download PyQy3 binaries for Windows?\nThanks in advance","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":900,"Q_Id":2294956,"Users Score":1,"Answer":"Try finding pyuic3 or rather pyuic4. Since you are using PyQt all your qt tools have py in front (like pyrcc4 or pyuicc4).\nI am not sure, that there are pyqt3 binaries for windows. Are you sure that Phil Thompson did PyQt3 also for windows at the time? If so, they would be on riverbank site, I guess, but I can't find them there. Tried compiling the source yourself?","Q_Score":0,"Tags":"python,qt,pyqt,qt-designer","A_Id":2296460,"CreationDate":"2010-02-19T08:41:00.000","Title":"How to open a Pyqt 3.3 ui file with QtDesigner 4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If Python was so fast as C, the latter would be present in python apps\/libraries?\nExample: if Python was fast as C would PIL be written completely in Python?","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":196,"Q_Id":2303683,"Users Score":2,"Answer":"It makes sense to use C modules in Python for:\n\nPerformance\nLibraries that won't be ported to Python (because of performance reasons, for example) or that use OS-specific functions\nScripting. For example, many games use Python, Lua and other languages as scripting languages. Therefore they expose C\/C++ functions to Python.\n\nAs to your example: Yes, but Python is inherently slower than C. If both were equally fast, it would make sense to use Python because C code is often more prone to attacks (buffer overflows and stuff).","Q_Score":1,"Tags":"python,c,performance,bytecode","A_Id":2303703,"CreationDate":"2010-02-20T20:55:00.000","Title":"Is there any purpose for a python application use C other than performance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If Python was so fast as C, the latter would be present in python apps\/libraries?\nExample: if Python was fast as C would PIL be written completely in Python?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":196,"Q_Id":2303683,"Users Score":0,"Answer":"To access hardware.","Q_Score":1,"Tags":"python,c,performance,bytecode","A_Id":2303876,"CreationDate":"2010-02-20T20:55:00.000","Title":"Is there any purpose for a python application use C other than performance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If Python was so fast as C, the latter would be present in python apps\/libraries?\nExample: if Python was fast as C would PIL be written completely in Python?","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":196,"Q_Id":2303683,"Users Score":7,"Answer":"To access \"legacy\" C libraries and OS facilities.","Q_Score":1,"Tags":"python,c,performance,bytecode","A_Id":2303685,"CreationDate":"2010-02-20T20:55:00.000","Title":"Is there any purpose for a python application use C other than performance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"In Python using tkinter, what is the difference between root.destroy() and root.quit() when closing the root window?\nIs one prefered over the other? Does one release resources that the other doesn't?","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":35380,"Q_Id":2307464,"Users Score":30,"Answer":"root.quit() causes mainloop to exit. The interpreter is still intact, as are all the widgets. If you call this function, you can have code that executes after the call to root.mainloop(), and that code can interact with the widgets (for example, get a value from an entry widget).\nCalling root.destroy() will destroy all the widgets and exit mainloop. Any code after the call to root.mainloop() will run, but any attempt to access any widgets (for example, get a value from an entry widget) will fail because the widget no longer exists.","Q_Score":39,"Tags":"python,tkinter","A_Id":42928131,"CreationDate":"2010-02-21T21:09:00.000","Title":"What is the difference between root.destroy() and root.quit()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In Python using tkinter, what is the difference between root.destroy() and root.quit() when closing the root window?\nIs one prefered over the other? Does one release resources that the other doesn't?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":35380,"Q_Id":2307464,"Users Score":0,"Answer":"My experience with root.quit() and root.destroy() ...\nI have a dos python script, which calls a tkinter script (to choose from set of known values from combobox), then returns to the dos script to complete other things. \nThe TKinter script I've added onto the parent script. I may convert all to tkinter, but a combo works for the time being. It works in the following way:\nTo get rid of the windows box after selection was implemented, I needed to\n1)  root.quit() inside the callback function where all my keypresses were being processed.\n2) root.destroy() after mainloop to destroy the windows box.\nIf I used root.destroy() inside the callback, I got an error message saying tkinter objects were no longer accessable.\nWithout the root.destroy() after mainloop, the windows box STAYED ONSCREEN until the whole parent script had completed.","Q_Score":39,"Tags":"python,tkinter","A_Id":61423826,"CreationDate":"2010-02-21T21:09:00.000","Title":"What is the difference between root.destroy() and root.quit()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to try to write a GUI application in Python. I found out that there are a lot of ways to do it (different toolkits). And, in this context, I have several basic (and I think simple) question?\n\nIs it, in general, a good idea to write a GUI application in Python?\nWhat is the standard (easiest and most stable) way to create a GUI applications in Python?\nDoes anybody can give me a link to a simple Hello World GUI application written in Python?","AnswerCount":6,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":20880,"Q_Id":2310130,"Users Score":2,"Answer":"As an answer for #1: Yes.  It is quite good for this; scripting languages with GUI toolkits are often a good way to put a GUI on an application.  They can also be used to wrap applications written in low level languages such as C or C++.  Python offers good integration to quite a few toolkits.  The posting linked above gives a pretty good cross section of the options with code samples.\nFor #2: TkInter comes with the standard distribution.  It is easy to use but not as sophisticated as (say) QT or WxWidgets.","Q_Score":11,"Tags":"python,user-interface","A_Id":2310200,"CreationDate":"2010-02-22T10:11:00.000","Title":"How to write GUI in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to use NLTK (Natural Language Toolkit) for Python using IronPython and call from an exisiting WPF\/c# project.\nIs it possible to reference NLTK from within WPF in this way.  For example to use Named Entity Recognition from NTLK?\nAny advice or guidance appreciated.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1242,"Q_Id":2318335,"Users Score":2,"Answer":"It definitely is possible, as long as NLTK doesn't use any C extensions. It will be much easier if you use VS2010 though, because of the dynamic keyword. Look at the Microsoft.Scripting.Hosting library from IronPython, it will get you started towards loading the NLTK code and executing methods on it.","Q_Score":5,"Tags":"wpf,nltk,ironpython","A_Id":2320322,"CreationDate":"2010-02-23T13:16:00.000","Title":"NLTK in IronPython from WPF","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I print contents of a Python Tkinter.Canvas widget?\nI've read that it's possible to print to a postscript printer from this control but examples are hard to come by.\nSo, any ideas what is needed to print the contents (including images)?\nIf you've got a cross-platform method all the better!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1143,"Q_Id":2326753,"Users Score":0,"Answer":"AFAIK it can only be done using the postscript method from the Canvas. This generates a postscript file with the canvas contents.\nCheck the documentation for details about this method.","Q_Score":1,"Tags":"python,printing,tkinter-canvas","A_Id":2326802,"CreationDate":"2010-02-24T14:40:00.000","Title":"How to print contents of a tkinter.Canvas widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So if I go into QtDesigner and build a UI, it'll be saved as a .ui file.  How can I make this as a python file or use this in python?","AnswerCount":12,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":135115,"Q_Id":2398800,"Users Score":3,"Answer":"in pyqt5 to convert from a ui file to .py file\npyuic5.exe youruifile.ui -o outputpyfile.py -x","Q_Score":83,"Tags":"python,user-interface,qt,pyqt,qt-designer","A_Id":54119368,"CreationDate":"2010-03-08T01:27:00.000","Title":"Linking a qtDesigner .ui file to python\/pyqt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So if I go into QtDesigner and build a UI, it'll be saved as a .ui file.  How can I make this as a python file or use this in python?","AnswerCount":12,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":135115,"Q_Id":2398800,"Users Score":0,"Answer":"Using Anaconda3 (September 2018) and QT designer 5.9.5.\nIn QT designer, save your file as ui.\nOpen Anaconda prompt. Search for your file: cd C:.... (copy\/paste the access path of your file).\nThen write: pyuic5 -x helloworld.ui -o helloworld.py (helloworld = name of your file). Enter.\nLaunch Spyder. Open your file .py.","Q_Score":83,"Tags":"python,user-interface,qt,pyqt,qt-designer","A_Id":52304139,"CreationDate":"2010-03-08T01:27:00.000","Title":"Linking a qtDesigner .ui file to python\/pyqt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to create a 'kiosk mode' in wxpython under Windows (98 - 7) where the application disables you from breaking out of the app using Windows keys, alt-tab, alt-f4, and ctrl+alt+delete?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":753,"Q_Id":2399812,"Users Score":0,"Answer":"wxPython alone cannot be done with that. \nYou need to do Low Level Keyboard Hook with C\/C++ or with equivalent ctypes, for\nWindows keys, alt-tab, alt-f4, \nbut Ctrl-Alt-Del, I don't think so for Windows XP and above.","Q_Score":0,"Tags":"python,wxpython,mode,kiosk","A_Id":2399853,"CreationDate":"2010-03-08T07:12:00.000","Title":"Kiosk mode in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Some friends and I wanted to develop a game. Any language will do. I've been programming in C for years, but never wrote a game before. One of us knows SDL a little bit. It would also be a nice excuse to learn Python+pygame.\nWe wish our game to be 'standalone'. By standalone, I mean most users (at least Linux, Mac and Windows) will not have to manually download and install anything else apart from a package. It is ok if the installation automatically handles missing dependencies. If the packages contain binaries, we wish to be able to generate them using cross-compilation from Linux.\nHow should we package and structure the project, and what language is best suited?","AnswerCount":6,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1603,"Q_Id":2401599,"Users Score":0,"Answer":"For casual gaming I would recommend Flash","Q_Score":6,"Tags":"python,c,cross-platform,packaging,cross-compiling","A_Id":2467317,"CreationDate":"2010-03-08T13:34:00.000","Title":"Game cross-compiling and packaging","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any UI widgets available to the python side of Google App Engine? I'd like something like the collapsed\/expanded views of Google Groups threads.  Are these type things limited to the GWT side?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2260,"Q_Id":2402128,"Users Score":3,"Answer":"There is no difference in the amount of built in widgets available to the python and java sides of app engine.  Neither side has any!  App Engine is primarily a back end technology. It allows you to use pretty much whatever web framework you want for your presentation layer, subject to constraints that Alex mentions.\nGWT is completely unrelated to App Engine, besides being developed by Google.  It is a client side toolkit, and can be used just fine with any web app as a backend, whether created in java, python or [your favorite language].  (Admittedly, you get a few bonus features if your backend is in java.)","Q_Score":5,"Tags":"python,user-interface,google-app-engine","A_Id":2404551,"CreationDate":"2010-03-08T14:52:00.000","Title":"Google App Engine UI Widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I've been using sikuli for awhile, however I have an issue with it... It's not sensitive enough. I'm trying to match something on the screen that is -EXACT-, and there are a few other items on the screen that look similar enough that sikuli is mistaking them for what I'm actually looking for, so I need to make it look for ONLY this item with no variances at all.\nHow can I do this?\nOh and to explain my issue a bit further, I am writing a loop for a game, once a progress bar has reached 100% - it needs to allow the loop to finish (And start over again), however the progress bar is just a plain bar - so when sikuli looks for it on the screen, it finds the partially complete bar (Since apparently it matches different lengths\/widths\/sizes of the image it is looking for), and triggers.","AnswerCount":4,"Available Count":2,"Score":0.1488850336,"is_accepted":false,"ViewCount":6449,"Q_Id":2407212,"Users Score":3,"Answer":"If you are using Sikuli IDE click image miniature, for which you want to change sensitivity. You will be presented screenshot of your desktop with and occurrences of pattern(your image). Below there is a slider witch changes sensitivity. While changing it you will notice that highlighted occurrences of the pattern increase or decrease accordingly.\nThis method assumes that you have your game on screen (so windowed mode, not fullscreen), but even if you don't you still can adjust sensitivity, just you won't see 'live' results of search.  \nIf you call sikuli from Java code, you have to use Pattern(image.png).similar(y.xx)\nwhere the argument of simmilar is something between 0.00 and 1.00.\nI haven't used second method so you may need to experiment with it.","Q_Score":5,"Tags":"python,sikuli","A_Id":3884131,"CreationDate":"2010-03-09T07:10:00.000","Title":"Change Sikuli's sensitivity?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been using sikuli for awhile, however I have an issue with it... It's not sensitive enough. I'm trying to match something on the screen that is -EXACT-, and there are a few other items on the screen that look similar enough that sikuli is mistaking them for what I'm actually looking for, so I need to make it look for ONLY this item with no variances at all.\nHow can I do this?\nOh and to explain my issue a bit further, I am writing a loop for a game, once a progress bar has reached 100% - it needs to allow the loop to finish (And start over again), however the progress bar is just a plain bar - so when sikuli looks for it on the screen, it finds the partially complete bar (Since apparently it matches different lengths\/widths\/sizes of the image it is looking for), and triggers.","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":6449,"Q_Id":2407212,"Users Score":7,"Answer":"You can do the following in the Sikuli IDE:\n\nClick on the image\nIn Pattern Settings > Matching Preview, drag the Similarity bar to 1.0 (all the way to the right)\nClick OK","Q_Score":5,"Tags":"python,sikuli","A_Id":3885229,"CreationDate":"2010-03-09T07:10:00.000","Title":"Change Sikuli's sensitivity?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering what options are available for Python 3.x? I know Tkinter is available as well as qt, but what about the other libraries? Any word on when some of them may be ported over to 3.x?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":968,"Q_Id":2411886,"Users Score":0,"Answer":"I use exclusively Tkinter, and though it's somewhat limited in terms of images, it's remarkably easy to work with and follows the standard easy-to-read Python syntax very nicely.  I'm not familiar with other GUI options, but Tkinter is great from my experience.","Q_Score":4,"Tags":"python,user-interface,python-3.x","A_Id":29502724,"CreationDate":"2010-03-09T19:21:00.000","Title":"GUI options with python 3.x","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've wrote a piece of code in python and pygtk for an embeded mplayer in a gui.\nI assume I use GtkSocket and the slave mode of mplayer with the -wid option.\nBut I've got an issue, when the size of my GTK window is smaller than my stream, the stream appears to be cropped. And when the size of my window is bigger than my stream, the stream appear centred inside the widget which embed MPlayer. (a gtk.Frame but I've also try with a gtk.DrawingArea)\nI would like to know how I can get my stream resize dynamically depending on the window's size.\nI don't want to use Glade or any GUI builder.\nThanks in advance for any help, and please excuse my poor english.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1512,"Q_Id":2417705,"Users Score":1,"Answer":"You need to tell mplayer to zoom video according to window size. This can be done either in command line (-zoom) or in the configuration file (zoom = 1).","Q_Score":0,"Tags":"python,gtk,pygtk,mplayer","A_Id":2944206,"CreationDate":"2010-03-10T14:39:00.000","Title":"Dynamic resize with MPlayer and PyGTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i am using PyQt but my question is a general Qt one:\nI have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal cellChanged() for every cell.\nThe signal cellChanged() is connected to a function on_tableWidget_cellChanged that reads the contents of the changed cell and writes it back to DATASET. This is necessary to allow the user to change the data manually.\nSo everytime the table is updated, its contents are written back to DATASET.\nIs there a way to distinguish if the cell was changed by the user or by updateTable?\ni thought of disconnecting on_tableWidget_cellChanged by updateTable temporarily but that seems to be a little dirty.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":5819,"Q_Id":2431844,"Users Score":1,"Answer":"It seems, that this is the only signal in QTableWidget at least for 4.6. You could post a feature request, but I don't know if it is accepted and you might wait for long time ;-)\nMaybe you could try to write a subclass of QTableWidget and emit own signals, when cell is changed internally.\nAnyway, disconnecting for the time of updating the cell isn't that bad, since you can't connect to specific signal.","Q_Score":4,"Tags":"python,qt,pyqt,signals,qtablewidget","A_Id":2432210,"CreationDate":"2010-03-12T10:02:00.000","Title":"QTableWidget signal cellChanged(): distinguish between user input and change by routines","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i am using PyQt but my question is a general Qt one:\nI have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal cellChanged() for every cell.\nThe signal cellChanged() is connected to a function on_tableWidget_cellChanged that reads the contents of the changed cell and writes it back to DATASET. This is necessary to allow the user to change the data manually.\nSo everytime the table is updated, its contents are written back to DATASET.\nIs there a way to distinguish if the cell was changed by the user or by updateTable?\ni thought of disconnecting on_tableWidget_cellChanged by updateTable temporarily but that seems to be a little dirty.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":5819,"Q_Id":2431844,"Users Score":1,"Answer":"I would recommend changing from a QTableWidget to a QTableView with an appropriate model.  From the sounds of it, you have a database or other data object holding and arranging the data anyway, so it would hopefully be fairly easy to do.  This would then allow you to distinguish between edits (setData is called on your model) and updates (data is called on your model).","Q_Score":4,"Tags":"python,qt,pyqt,signals,qtablewidget","A_Id":2449334,"CreationDate":"2010-03-12T10:02:00.000","Title":"QTableWidget signal cellChanged(): distinguish between user input and change by routines","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On a click of a button named \"Add Textbox\" it calls a function which creates a single textbox using (gtk.Entry) function. So each time i click that button it creates a textbox. I have a submit button which should fetches all the values of the text boxes(say 10 textboxes) generated with the name of \"entry\". It works for one textbox but not for multiple. In php we can create dynamix textboxes mentioning as an array name=entry[]. Do we have similar functionality in python ?\nEnviroment : FC10 , Glade 3 , Python 2.5 , GTK.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1035,"Q_Id":2432468,"Users Score":1,"Answer":"You could be a bit clearer, it's not obvious what you do with your GtkEntry after creating it. The easiest thing would be to just add it to a Python list, so you can iterate over all created GtkEntry widgets later.\nOr, you could \"tag\" the widgets with something to make them identifiable, and iterate over the containing widgets (assuming you really do add the widget to a window or something).","Q_Score":0,"Tags":"python,gtk,pygtk,glade","A_Id":2432881,"CreationDate":"2010-03-12T11:55:00.000","Title":"Getting values from Multiple Text Entry using Pygtk and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a Python+Qt4 application that would ideally need to pop up a window every once in a while, to display pdf documents and allow very basic operations, namely scrolling through the different pages and printing the document.\nI've found the reportLab to create pdf files, but nothing about pdf viewers. Does anyone knows anything that might help. i was really hoping for the existence of something like the QWebView widget...\nthanks in advance to all","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":6219,"Q_Id":2435470,"Users Score":-1,"Answer":"what about okular? It is a full app, but it can always be call from another app.","Q_Score":8,"Tags":"python,pdf,qt4,pyqt4","A_Id":2435561,"CreationDate":"2010-03-12T19:59:00.000","Title":"pdf viewer for pyqt4 application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to show a webpage (a complex page with script and stuff, no static html) in a frame or something. It's for a desktop application, I'm using python 2.6 + wxPython 2.8.10.1. I need to catch some events too (mostly about changing page). I've found some samples using the webview module in a gtk application, but I couldn't have it works on wx.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":788,"Q_Id":2439039,"Users Score":1,"Answer":"You can embed IE, but I think that's about it. wxWebKit is working on a wx add-on to use WebKit as an embedded browser in wx, but I think it's still a work in progress.","Q_Score":0,"Tags":"python,wxwidgets","A_Id":2439208,"CreationDate":"2010-03-13T16:22:00.000","Title":"how to embed a webpage using wx?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a newbie with a little experience writing in BASIC, Python and, of all things, a smidgeon of assembler (as part of a videogame ROM hack). I wanted to create small tool for modifying the hex values at particular points, in a particular file, that would have a GUI interface.\nWhat I'm looking for is the ability to create small GUI program, that I can distribute as an EXE (or, at least a standalone directory). I'm not keen on the idea of the .NET languages, because I don't want to force people to download a massive .NET framework package. I currently have Python with IDLE and Boa Constructor set up, and the application runs there. I've tried looking up information on compiling a python app that relies on Wxwidgets, but the search results and the information I've found has been confusing, or just completely incomprehensible. \nMy questions are:\n\nIs python a good language to use for this sort of project?\nIf I use Py2Exe, will WxWidgets already be included? Or will my users have to somehow install WxWidgets on their machines? Am I right in thinking at Py2Exe just produces a standalone directory, 'dist', that has the necessary files for the user to just double click and run the application?\nIf the program just relies upon Tkinter for GUI stuff, will that be included in the EXE Py2Exe produces? If so, are their any 'visual' GUI builders \/ IDEs for Python with only Tkinter?\n\nThankyou for your time,\nJBMK","AnswerCount":4,"Available Count":2,"Score":0.1488850336,"is_accepted":false,"ViewCount":640,"Q_Id":2439520,"Users Score":3,"Answer":"If you're not afraid to learn a new language, consider Tcl\/Tk. The reason I mention this is Tcl's superior-to-almost-everything distribution mechanism which makes it really easy to wrap up a single file exe that includes everything you need -- the Tcl\/Tk runtime, your program, icons, sound files, etc. inside an embedded virtual filesystem. And the same technique you use for one platform works for all. You don't have to use different tools for different platforms. \nIf that intrigues you, google for starpack (single file that has it all), starkit (platform-independent application) and tclkit (platform-specific runtime). \nTcl\/Tk isn't everyone's cup of tea, but as a getting-started GUI language it's hard to beat IMO. If it has an Achilles heel is that it has no printing support. It's surprising, though, how many GUIs don't need printing support these days.","Q_Score":7,"Tags":"python,wxwidgets,tkinter,py2exe","A_Id":2440302,"CreationDate":"2010-03-13T18:40:00.000","Title":"As a newbie, where should I go if I want to create a small GUI program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a newbie with a little experience writing in BASIC, Python and, of all things, a smidgeon of assembler (as part of a videogame ROM hack). I wanted to create small tool for modifying the hex values at particular points, in a particular file, that would have a GUI interface.\nWhat I'm looking for is the ability to create small GUI program, that I can distribute as an EXE (or, at least a standalone directory). I'm not keen on the idea of the .NET languages, because I don't want to force people to download a massive .NET framework package. I currently have Python with IDLE and Boa Constructor set up, and the application runs there. I've tried looking up information on compiling a python app that relies on Wxwidgets, but the search results and the information I've found has been confusing, or just completely incomprehensible. \nMy questions are:\n\nIs python a good language to use for this sort of project?\nIf I use Py2Exe, will WxWidgets already be included? Or will my users have to somehow install WxWidgets on their machines? Am I right in thinking at Py2Exe just produces a standalone directory, 'dist', that has the necessary files for the user to just double click and run the application?\nIf the program just relies upon Tkinter for GUI stuff, will that be included in the EXE Py2Exe produces? If so, are their any 'visual' GUI builders \/ IDEs for Python with only Tkinter?\n\nThankyou for your time,\nJBMK","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":640,"Q_Id":2439520,"Users Score":0,"Answer":"Python would fit your needs.\nwxWidgets and Python are completely different things. I think you mean wxPython, which is a GUI toolkit for Python. I am not sure whether Py2Exe would include this, as I have never used Py2Exe - I build the packages and their dependencies manually.\nPretty sure tkinter would be included. I use tkinter a bit and it works well enough.","Q_Score":7,"Tags":"python,wxwidgets,tkinter,py2exe","A_Id":2440232,"CreationDate":"2010-03-13T18:40:00.000","Title":"As a newbie, where should I go if I want to create a small GUI program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to know if it's possible to put a frame or a panel over a menubar using wxpython?\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":123,"Q_Id":2439677,"Users Score":1,"Answer":"Your only chance is to write some Custom Menu, which could be bit difficult but doable. So basically instead of using system menu etc, you create windows inside your main frame which look like menu.","Q_Score":0,"Tags":"python,wxpython","A_Id":2463869,"CreationDate":"2010-03-13T19:21:00.000","Title":"Is it possible to put a wx.window (frame\/panel) over a wx.MenuBar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to change the wxpython menubar colours.\nHow can I do it?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":1776,"Q_Id":2439708,"Users Score":-1,"Answer":"don't think it's doable -- it defaults to the platform's native look","Q_Score":1,"Tags":"python,wxpython","A_Id":2440868,"CreationDate":"2010-03-13T19:30:00.000","Title":"How can we change a wx.MenuBar background and foreground colour using wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been trying to add some check boxes in a pylons mako. However I don't know how to get their values in the controller. It seems that it can only get the first value of the check boxes. I tried using form encode but i got several errors. Is there an easier way to do this?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1306,"Q_Id":2456926,"Users Score":0,"Answer":"I'm assuming that \"I can only get the first value\" means you've got a series of checkboxes with the same value for the 'name' attribute within your form?    \nNow, if that's the case and you're wanting a list of boolean values based on whether or not the boxes are checked or not, you'll need to do two things:\nFirst, when you define your form elements using form encode on your checkbox, set it up such that a missing value on a checkbox element returns 'False.' This way, as the browser won't send a value over unless a checkbox is \"on\", you validation coerces the missing value to False.\n\n\n    class Registration(formencode.Schema):  \n        box = formencode.validators.StringBoolean(if_missing=False)\n\n\nNext, assuming you want a list returned, you'll not be able to name all of your elements the same.  Pylons supports a nested structure, though.  Look at formencode.variabledecode.NestedVariables. In short, you'll need to define a NestedVariables instance as one of your class attributes and your form 'name' attributes will need to change in order to contain explicit indexes.   \nEdit.. here's a complete example I did real quick:\n\n\nimport logging\nimport pprint\n\nimport formencode\nfrom pylons import request, response, session, tmpl_context as c, url\nfrom pylons.controllers.util import abort, redirect\nfrom pylons.decorators import validate\n\nfrom testproj.lib.base import BaseController, render\n\nlog = logging.getLogger(__name__)\n\nclass CheckList(formencode.Schema):\n    box = formencode.validators.StringBoolean(if_missing=False)\n    hidden = formencode.validators.String()\n\nclass EnclosingForm(formencode.Schema):\n    pre_validators = [formencode.NestedVariables()]\n    boxes = formencode.ForEach(CheckList())\n\nclass MyformController(BaseController):\n\n    def index(self):\n        schema = EnclosingForm()\n        v = schema.to_python(dict(request.params))\n        # Return a rendered template\n        #return render('\/myform.mako')\n        # or, return a response\n        response.content_type = 'text\/plain'\n        return pprint.pformat(v)\n\n\n\nAnd then the query string?\n\nboxes-0.box=true&boxes-0.hidden=hidden&boxes-1.box=true&\nboxes-1.hidden=hidden&boxes-2.hidden=hidden\nAnd lastly, the response:\n\n{'boxes': [{'box': True, 'hidden': u'hidden'},\n           {'box': True, 'hidden': u'hidden'},\n           {'box': False, 'hidden': u'hidden'}]}\n\nHTH","Q_Score":1,"Tags":"python,pylons","A_Id":2457303,"CreationDate":"2010-03-16T18:11:00.000","Title":"Checkboxes with pylons","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I've got a pile of C code that I'd like to unit test using Python's unittest library (in Windows), but I'm trying to work out the best way of interfacing the C code so that Python can execute it (and get the results back). Does anybody have any experience in the easiest way to do it?\nSome ideas include:\n\nWrapping the code as a Python C extension using the Python API\nWrap the C code using SWIG\nAdd a DLL wrapper to the C code and load it into Python using ctypes\nAdd a small XML-RPC server to the c-code and call it using xmlrpclib (yes, I know this seems a bit far-out!)\n\nIs there a canonical way of doing this? I'm going to be doing this quite a lot, with different C modules, so I'd like to find a way which is least effort.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":12704,"Q_Id":2482270,"Users Score":8,"Answer":"I think that the exact solution depends on your code. Not all libraries are easily suitable for wrapping as a DLL. If your is, then ctypes is certainly the easiest way - just make a DLL out of your library and then test it with ctypes. An added bonus is that you now have your library conveniently wrapped as a standalone DLL which helps to decouple your application.\nSometimes, however, a more thorough interaction will be required between your C code and the testing Python code. Then, it's probably best to hook it as an extension, for which SWIG is a pretty good tool that will automate away most things you'll find boring about the process.","Q_Score":25,"Tags":"python,c,unit-testing,swig","A_Id":2489948,"CreationDate":"2010-03-20T07:12:00.000","Title":"Easiest way of unit testing C code with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting a computer graphics course, and I have to choose a language.\nChoices are between C++ and Python. I have no problem with C++, python is a work in progress. So i was thinking to go down the python road, using pyopengl for graphics part.\nI have heard though, that performance is an issue.\nIs python \/ pyopengl mature enough to challenge C++ on performance?\nI realize its a long shot, but I'd like to hear your thoughts, experiences on uses of pyopengl.","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":10480,"Q_Id":2488730,"Users Score":30,"Answer":"It depends a LOT on the contents of your computer graphics course. If you are doing anything like the introductory course I've taught in the past, it's basically spinning cubes and spheres, some texture mapping and some vertex animation, and that's about it. In this case, Python would be perfectly adequate, assuming you can get around the Unpythonic (and, lets be honest, un-C++) OpenGL state-machine paradigm.\nFor things like doing your matrix maths you can use Numpy, the core of which is written in C and is really quite quick. You'll be up and running faster, iterate faster and most likely have more fun.\nIf, however, you are doing some hardcore, cutting edge, millions-of-triangles-per-scene-skinned-animated-everything computer graphics course, stick with C++.\nIf your class has given you the choice it's probably a safe bet that Python will be ok.\nIf you want to leverage your knowledge into a real job in computer graphics though, pretty much every game and graphics engine is written in C or C++, while Python (or Lua) is left as a scripting language.","Q_Score":15,"Tags":"python,c++,opengl,3d,pyopengl","A_Id":2489409,"CreationDate":"2010-03-21T21:10:00.000","Title":"pyopengl: Could it replace c++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting a computer graphics course, and I have to choose a language.\nChoices are between C++ and Python. I have no problem with C++, python is a work in progress. So i was thinking to go down the python road, using pyopengl for graphics part.\nI have heard though, that performance is an issue.\nIs python \/ pyopengl mature enough to challenge C++ on performance?\nI realize its a long shot, but I'd like to hear your thoughts, experiences on uses of pyopengl.","AnswerCount":5,"Available Count":2,"Score":0.0798297691,"is_accepted":false,"ViewCount":10480,"Q_Id":2488730,"Users Score":2,"Answer":"Python is an awesome language, but it's not the right tool for graphics. And if you want to do anything remotely advanced you'll have to use unpythonic libraries and will end up with ugly C code written in Python.","Q_Score":15,"Tags":"python,c++,opengl,3d,pyopengl","A_Id":2488775,"CreationDate":"2010-03-21T21:10:00.000","Title":"pyopengl: Could it replace c++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to Python and am starting to teach myself GUI programming (hopefully) using PyQT4.7 and Python 2.6\nI just downloaded the whole PyQT\/QT4 package (including QTDesigner) from the PyQT website, however it seems QTDesigner, which looks amazing to use as a newbie (since you can see all the attributes\/properties\/defaults etc) of each widget and visually edit the properties is great, but PyQT seems not to set QTDesigner to integrate directly with with PyQT and PyQTs python code generation scripts: \ni.e.: Hitting \"View Code\", tries to run the Designer->C++ script called (uic) instead of the pyuic.py script, etc.\nIs there a way to get QTDesigner to integrate closely with PyQT for code generation on the fly like it does with C++?\nIf not, does that mean I have to code the entire QT GUI within my Python IDE and lookup all the documentation and boilerplate code for every widget? (seems very inefficient and inelegant compared to just having QTDesigner+Python integration).\nWhat is the customary toolchain\/\/production flow of using Designer with PyQT? (If no direct integration is possible -- do python+pyQT users just skip using QTDesigner all together and manually write all the QT GUI code in python?)\nAny additional tips\/suggestions for a PyQT newbie would be appreciated. Thanks!\nps I know a bunch of you are probably going to tell me to just suck it up and code all the QT UI by hand, but if I use Designer while learning as asked above, please provide a way to do that so  I can learn it more easily, thanks!","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":11299,"Q_Id":2489643,"Users Score":1,"Answer":"You can run pyuic (or rather pyuic4) from hand, in your console. You can make your GUI using designer with Python, just as you would do it with C++.\nBy the way: I have written all GUI stuff for my app (10k of code) by hand. I don't really like GUI designers and working with generated code, when you need to tweak something.","Q_Score":20,"Tags":"python,qt4,pyqt4,qt-designer","A_Id":2494652,"CreationDate":"2010-03-22T02:08:00.000","Title":"Using QTDesigner with PyQT and Python 2.6","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to Python and am starting to teach myself GUI programming (hopefully) using PyQT4.7 and Python 2.6\nI just downloaded the whole PyQT\/QT4 package (including QTDesigner) from the PyQT website, however it seems QTDesigner, which looks amazing to use as a newbie (since you can see all the attributes\/properties\/defaults etc) of each widget and visually edit the properties is great, but PyQT seems not to set QTDesigner to integrate directly with with PyQT and PyQTs python code generation scripts: \ni.e.: Hitting \"View Code\", tries to run the Designer->C++ script called (uic) instead of the pyuic.py script, etc.\nIs there a way to get QTDesigner to integrate closely with PyQT for code generation on the fly like it does with C++?\nIf not, does that mean I have to code the entire QT GUI within my Python IDE and lookup all the documentation and boilerplate code for every widget? (seems very inefficient and inelegant compared to just having QTDesigner+Python integration).\nWhat is the customary toolchain\/\/production flow of using Designer with PyQT? (If no direct integration is possible -- do python+pyQT users just skip using QTDesigner all together and manually write all the QT GUI code in python?)\nAny additional tips\/suggestions for a PyQT newbie would be appreciated. Thanks!\nps I know a bunch of you are probably going to tell me to just suck it up and code all the QT UI by hand, but if I use Designer while learning as asked above, please provide a way to do that so  I can learn it more easily, thanks!","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":11299,"Q_Id":2489643,"Users Score":0,"Answer":"QtDesigner uses uic.exe to generate on the fly C++ code. uic.exe is a command-line tool, it gets file names as input parameters. For integration with python, you can write a python program that uses pyuic.py, match it inputs with uic.exe's input (order, switchs etc.), convert it to an executable (using py2exe) and rename the executable to uic.exe. then replace it with uic.exe in Qt's bin directory (uic.exe dont exist in PyQt as I know). You should just be careful about input arguments of uic.exe and your hand-written macro (they should match together).\nI think your program will need to know python's path (in order to use pyuic). if you are using windows, you could obtain the path from registry.","Q_Score":20,"Tags":"python,qt4,pyqt4,qt-designer","A_Id":3595979,"CreationDate":"2010-03-22T02:08:00.000","Title":"Using QTDesigner with PyQT and Python 2.6","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am dealing with image buffers, and I want to be able to access data a few lines into my image for analysis with a c library.  I have created my 8-bit pixel buffer in Python using create_string_buffer.  Is there a way to get a pointer to a location within that buffer without re-creating a new buffer?  My goal is to analyze and change data within that buffer in chunks, without having to do a lot of buffer creation and data copying.\nIn this case, ultimately, the C library is doing all the manipulation of the buffer, so I don't actually have to change values within the buffer using Python.  I just need to give my C function access to data within the buffer.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3210,"Q_Id":2494288,"Users Score":0,"Answer":"You can also use ctypes.cast(buf, ctypes.c_void_p)","Q_Score":5,"Tags":"python,ctypes","A_Id":2494539,"CreationDate":"2010-03-22T17:18:00.000","Title":"ctypes and pointer manipulation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hello fellow software developers.\nI want to distribute a C program which is scriptable by embedding the Python interpreter.\nThe C program uses Py_Initialize, PyImport_Import and so on to accomplish Python embedding.\nI'm looking for a solution where I distribute only the following components:  \n\nmy program executable and its libraries\nthe Python library (dll\/so)  \na ZIP-file containing all necessary Python modules and libraries.\n\nHow can I accomplish this? Is there a step-by-step recipe for that?\nThe solution should be suitable for both Windows and Linux.\nThanks in advance.","AnswerCount":6,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5060,"Q_Id":2494468,"Users Score":0,"Answer":"There's a program called py2exe.  I don't know if it's only available for Windows.  Also, the latest version that I used does not wrap everything up into one .exe file.  It creates a bunch of stuff that has to be distributed - a zip file, etc..","Q_Score":11,"Tags":"python,c,dll,distribution","A_Id":2540638,"CreationDate":"2010-03-22T17:43:00.000","Title":"How to create an application which embeds and runs Python code without local Python installation?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Any ideas how I can display an image file (bmp or png) centered on the screen as an application splash screen when running a Windows console script based on a batch file, vbscript\/wscript or Python console script?\nI'm not interested in a wxPython solution - that's too much overhead just to implement a cosmetic feature like a splash screen.\nThank you,\nMalcolm","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5541,"Q_Id":2502385,"Users Score":0,"Answer":"Try TK, it is included with python.  Also, PyGtk is lighter than wxPython, but I ended up bitting the bullet and using wxPython for the same purpose recently, it is heavy, but it didn't have any affect on the script performance.","Q_Score":2,"Tags":"python,image,vbscript,batch-file,console-application","A_Id":2502963,"CreationDate":"2010-03-23T18:02:00.000","Title":"Display an image as a splash screen when running Windows batch file, vbscript\/wscript or Python console script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"How to create pygtk entry with placeholder like in HTML 5 input element?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":981,"Q_Id":2503562,"Users Score":1,"Answer":"You can use PyGobject instead of pygtk, and then setting a placeholder is a piece of cake:\n    entry.set_placeholder_text(\"some string\")","Q_Score":3,"Tags":"python,pygtk","A_Id":14070047,"CreationDate":"2010-03-23T20:56:00.000","Title":"Pygtk entry placeholder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have FigureCanvasWxAgg instance with a figure displayed on a frame. If user clicks on the canvas another frame with a new FigureCanvasWxAgg containing the same figure will be shown. By now closing the new frame can result in destroying the C++ part of the figure so that it won't be available for the first frame. \nHow can I save the figure? Python deepcopy from copy module does't work in this case.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1759,"Q_Id":2513786,"Users Score":1,"Answer":"I'm not familiar with the inner workings, but could easily imagine how disposing of a frame damages the figure data. Is it expensive to draw? Otherwise I'd take the somewhat chickenish approach of simply redrawing it ;)","Q_Score":8,"Tags":"python,wxpython,copy,matplotlib","A_Id":3120753,"CreationDate":"2010-03-25T07:45:00.000","Title":"How to copy matplotlib figure?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running python 2.6.5 and pygame 1.9.1 It seems to me I've tried everything but it keeps showing 'module not found' errors... Please help!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":997,"Q_Id":2541254,"Users Score":1,"Answer":"Well I've just finished installing it on my Mac - you have to watch out for the Python Platform under Tools and File. The default is Jython, but you want to change it to point to your python version in the Frameworks file of your Library.\nDoes that make sense?","Q_Score":0,"Tags":"python,netbeans,import,module,pygame","A_Id":2908642,"CreationDate":"2010-03-29T21:01:00.000","Title":"Can't import pygame to Netbeans on Mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know how to reference an existing .dll to IronPython, but is there any way to add my project as a reference like I can between Visual Studio projects?\nOr is it best practice to create a separate class library?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1069,"Q_Id":2550370,"Users Score":3,"Answer":"You can't add reference to a project since it's a Visual Studio thing. \nI suggest that during the development process, call import (IronPython) or require (IronRuby) with the full path of your project assembly like c:\\dev\\MyProject\\bin\\Debug\\MyProject.dll.","Q_Score":2,"Tags":"c#,visual-studio,ironpython,ironruby","A_Id":2550627,"CreationDate":"2010-03-31T03:45:00.000","Title":"Any way to add my C# project as a reference in IronPython \/ IronRuby?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been browsing documentation, but haven't been able to find a straightforward tutorial, so I apologize if this is a really simple question.\nAnyway, I have eclipse with pydev installed on MAC OSX, and I want configure wxPython to work with eclipse, how do I do this? Once I've downloaded wxpython, what steps do I take to allow wxPython development from eclipse?\nThanks!","AnswerCount":3,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":8700,"Q_Id":2561542,"Users Score":3,"Answer":"wxPython install by default to the following path \/usr\/local\/lib\/wxPython-2.9.4.0\nWhen adding a path to the Interpreter libraries section in the eclipse preferences add this path: \n\/usr\/local\/lib\/wxPython-2.9.4.0\/lib\/python2.7\/site-packages\/wx-2.9.4-osx_cocoa","Q_Score":3,"Tags":"python,eclipse,wxpython","A_Id":12983874,"CreationDate":"2010-04-01T15:28:00.000","Title":"Configuring Eclipse with wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I've been browsing documentation, but haven't been able to find a straightforward tutorial, so I apologize if this is a really simple question.\nAnyway, I have eclipse with pydev installed on MAC OSX, and I want configure wxPython to work with eclipse, how do I do this? Once I've downloaded wxpython, what steps do I take to allow wxPython development from eclipse?\nThanks!","AnswerCount":3,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":8700,"Q_Id":2561542,"Users Score":7,"Answer":"Vinay's answer above is correct.  However, if code completion is not picking it up, you might need to add the WX directory to the Pydev's interpreter library path.\n\nWindow | Preferences | Pydev |\n  Interpreter - Python | Libraries\n\nIf wx is not present, New Folder and select the install directory.","Q_Score":3,"Tags":"python,eclipse,wxpython","A_Id":2562141,"CreationDate":"2010-04-01T15:28:00.000","Title":"Configuring Eclipse with wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm using gtk.combo_box_new_text() to make combobox list, this uses a gtk.ListStore to store only strings, so there are some way to add a separator between items without use a complex gtk.TreeModel? \nIf this is not possible, what is the simplest way to use a gtk.TreeModel to able secuential widget addition?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":825,"Q_Id":2571202,"Users Score":4,"Answer":"I think that you should use ComboBox.set_row_separator_func to set a separator function where you would determine which items of your list will be separators. Since ListStore implements TreeModel interface, you should have no problem simply using it in your case.\nP.S.: nothing is easy in GTK :)","Q_Score":4,"Tags":"python,user-interface,gtk,pygtk,gnome","A_Id":2571279,"CreationDate":"2010-04-03T12:07:00.000","Title":"How to add a separator in a PyGTK combobox?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Qt3.3 used to allow for multiple selections in the QTextEdit widget by calling the setSelection() function and specifying a different selection id (selNum) as the last argument in that function. \nIn Qt4, to create a selection, I do it by creating a QTextCursor object and call the setPosition() or movePosition() methods. I have no problems being able to create a single selection of text. I am, however, unable to find a way to create multiple selections. The methods in Qt4 do not have an argument which allows you to set a selection id, nor can i find any other function in the QTextCursor or QTextEdit which looks like it might allow me to do so. \nHas this feature been completely removed from Qt4? or has is there a new and different way of doing it?\nThanks.\nRonny","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1173,"Q_Id":2574195,"Users Score":0,"Answer":"How about creating multiple cursors (QTextCursor), each selection a different portion of the text. Would that work for you?","Q_Score":1,"Tags":"python,qt,qt4,pyqt","A_Id":2574214,"CreationDate":"2010-04-04T10:55:00.000","Title":"how to create multiple selections in text edit box in qt4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Qt3.3 used to allow for multiple selections in the QTextEdit widget by calling the setSelection() function and specifying a different selection id (selNum) as the last argument in that function. \nIn Qt4, to create a selection, I do it by creating a QTextCursor object and call the setPosition() or movePosition() methods. I have no problems being able to create a single selection of text. I am, however, unable to find a way to create multiple selections. The methods in Qt4 do not have an argument which allows you to set a selection id, nor can i find any other function in the QTextCursor or QTextEdit which looks like it might allow me to do so. \nHas this feature been completely removed from Qt4? or has is there a new and different way of doing it?\nThanks.\nRonny","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1173,"Q_Id":2574195,"Users Score":1,"Answer":"The solution, i realise now is actually quite simple. \nTo graphically visualise all the various selections (separate QTextCursor objects), instead of calling the setTextCursor() method for the QTextEdit widget for each of the selections, i change the background color of each of those sections of text by calling the setCharFormat() method for each of those QTextCursor objects.","Q_Score":1,"Tags":"python,qt,qt4,pyqt","A_Id":2574559,"CreationDate":"2010-04-04T10:55:00.000","Title":"how to create multiple selections in text edit box in qt4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to display a gtk.Image with a high level of zoom, but scale the image to a new pixbuf with the gtk.gdk.Pixbuf methods waste a lot of memory and processor.\nAre there some simply way to display a zoomed image?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":822,"Q_Id":2581687,"Users Score":1,"Answer":"it is not possible with gdk, i'm afraid.\ntry cairo or opengl.","Q_Score":1,"Tags":"python,gtk,pygtk,gnome","A_Id":2586546,"CreationDate":"2010-04-05T23:00:00.000","Title":"Zoomed PyGTK image without scale pixbuf","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know what Cythons purpose is.  It's to write compilable C extensions in a Python-like language in order to produce speedups in your code.  What I would like to know (and can't seem to find using my google-fu) is if Cython can somehow compile into an executable format since it already seems to break python code down into C.\nI already use Py2Exe, which is just a packager, but am interested in using this to compile down to something that is a little harder to unpack (Anything packed using Py2EXE can basically just be extracted using 7zip which I do not want)\nIt seems if this is not possible my next alternative would just be to compile all my code and load it as a module and then package that using py2exe at least getting most of my code into compiled form, right?","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":37475,"Q_Id":2581784,"Users Score":1,"Answer":"Aftershock's answer is good, what I want to say is about run app without console. Most like Aftershock's answer, if you want your application run without console, two points are important:\n\nReplace all the main() function in the \".c\" file made by cython --embed with wmain()\nAdd \/subsystem:windows \/entry:wmainCRTStartup to the end of cl.exe ...  command","Q_Score":53,"Tags":"python,compilation,cython","A_Id":50452413,"CreationDate":"2010-04-05T23:34:00.000","Title":"Can Cython compile to an EXE?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"A line created using the DrawLine method of wx.DC has the onClick and onMouseOver events?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":81,"Q_Id":2583646,"Users Score":0,"Answer":"No wx.DC just draw to a device and those are all plain pixels, wx.DC doesn't track mouse events or any other events.\nIf you want such behavior you will have to track mouse movement on your drawing area and on click check which area it may have clicked e.g. if near by the line show a msg etc.","Q_Score":0,"Tags":"python,wxpython","A_Id":2583745,"CreationDate":"2010-04-06T08:58:00.000","Title":"Does wx.DC line has events?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For some code as follows, \n\n    opts, args = getopt.getopt(sys.argv[1:], \"c:\", ...\n    for o,v in opts:\n...\n        elif o in (\"-c\", \"--%s\" % checkString):\n            kCheckOnly = True\n            clientTemp = v\n\nIf I don't give the parameter after the -c, I get the error messages as follows.\n\nTraceback (most recent call last):\n  File \"niFpgaTimingViolationMain.py\", line 100, in \n    opts, args = getopt.getopt(sys.argv[1:], \"hdc:t:\",[helpString, debugString, checkString, twxString])\n  File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/getopt.py\", line 91, in getopt\n    opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])\n  File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/getopt.py\", line 195, in do_shorts\n    opt)\ngetopt.GetoptError: option -c requires argument\n\nIs there any way to catch this error, and process it to print something like this? It seems that just wrapping the code in try\/except doesn't work.\n\nERROR: You forgot to give the file name after -c option","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":752,"Q_Id":2585803,"Users Score":3,"Answer":"You can catch getopt.GetoptError and check the 'opt' and 'msg' attributes yourself:\n\ntry:\n    opts, args = getopt.getopt(sys.argv[1:], \"c:\", ...\nexcept getopt.GetoptError, e:\n    if e.opt == 'c' and 'requires argument' in e.msg:\n        print >>sys.stderr, 'ERROR: You forgot to give the file name after -c option'\n        sys.exit(-1)","Q_Score":2,"Tags":"python,getopt","A_Id":2585839,"CreationDate":"2010-04-06T14:52:00.000","Title":"How to process python generated error messages my own way?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For some code as follows, \n\n    opts, args = getopt.getopt(sys.argv[1:], \"c:\", ...\n    for o,v in opts:\n...\n        elif o in (\"-c\", \"--%s\" % checkString):\n            kCheckOnly = True\n            clientTemp = v\n\nIf I don't give the parameter after the -c, I get the error messages as follows.\n\nTraceback (most recent call last):\n  File \"niFpgaTimingViolationMain.py\", line 100, in \n    opts, args = getopt.getopt(sys.argv[1:], \"hdc:t:\",[helpString, debugString, checkString, twxString])\n  File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/getopt.py\", line 91, in getopt\n    opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])\n  File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/getopt.py\", line 195, in do_shorts\n    opt)\ngetopt.GetoptError: option -c requires argument\n\nIs there any way to catch this error, and process it to print something like this? It seems that just wrapping the code in try\/except doesn't work.\n\nERROR: You forgot to give the file name after -c option","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":752,"Q_Id":2585803,"Users Score":3,"Answer":"the correct answer is to use the OptionParser module instead of trying to \"roll your own\".","Q_Score":2,"Tags":"python,getopt","A_Id":2585858,"CreationDate":"2010-04-06T14:52:00.000","Title":"How to process python generated error messages my own way?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Looking at Python modules and at code in the \"lib-dnyload\" directory in the Python framework, I noticed whenever code is creating some kind of GUI or graphic it imports a non-Python file with a .so extension. And there are tons .so files in \"lib-dnyload\". \nFrom googling things I found that these files are called shared objects and are written in C or C++. I have a Mac and I use GCC. How do I make shared object files that are accessible via Python? Mainly just how to make shared objects with GCC using Mac OS X.","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4363,"Q_Id":2610421,"Users Score":0,"Answer":"You can write python extensions in many ways, including Cython, SWIG, boost.python ...\nYou can also write a shared library and use the \"ctypes\" library to access it.","Q_Score":1,"Tags":"python,macos,gcc,distutils,shared-objects","A_Id":2611684,"CreationDate":"2010-04-09T19:44:00.000","Title":"How to create make .so files from code written in C or C++ that are usable from Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"There is a python module called \"_Qt\". PyQt is not what I want. I was wondering if there was any documentation for the _Qt module installed with python as a standard module. I have a mac.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":232,"Q_Id":2611593,"Users Score":0,"Answer":"That's QuickTime, nothing to do with Qt.\nIn your question it's not really clear if you intended to use Qt or QuickTime.","Q_Score":0,"Tags":"python,qt,module","A_Id":2611862,"CreationDate":"2010-04-09T23:28:00.000","Title":"How to use the _Qt python module?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to put together a simple program that will let me visualize a series of consecutive cuts on a wood panel using a router with a particular cutting head.  I'm trying to find a geometry library that is capable of subtractively modifying 3D shapes or solids by sweeping other 3D solids through them.\nSpecifically, I'd like to be able to define a rectangular solid (the wood panel) and then define a bit profile shape, and take cuts through the rectangular solid (sometimes on a straight line, sometimes on a circular arc).  Does anyone know of anything that will do this?","AnswerCount":8,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2504,"Q_Id":2611606,"Users Score":0,"Answer":"While not exactly a library, one way of doing this might be to build on top of the 2D-to-3D extrusion ability that most of these libraries do support.   A tentative algorithm for doing this might be:\n\nGet bit profile as a 2D shape (you're likely to have this already).\nExtrude that profile along the line or arc that is the toolpath, creating a 3D solid that is the shape of the cut.\nAt each vertex (say, where a straight path joins a curved one), do a \"rotate extrude\" or \"revolve extrude\" of the bit profile to generate the corner radius -- most libraries should support this operation as well.\nRepeat from 2 until done with all toolpaths.\nDo a CSG boolean subtraction of (workpiece - set_of_toolpaths).\n\nThat algorithm seems like it might be fraught with edge cases, but I haven't been able to think of any so far.   I'm wondering why, if it's this simple, there aren't more packages already doing it.","Q_Score":2,"Tags":"c++,python,geometry,cad","A_Id":10033868,"CreationDate":"2010-04-09T23:31:00.000","Title":"Subtractively sweep a solid through another in python (or C++)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I do understand that this topic has been covered in some way at StackOverflow but I'm still not able to figure out the exact answer: can I treat IronPython as a Pythonic replacement to C#?\nI use CPython every day, I love the Zen :) but my current task is a Windows-only application with a complex GUI and some other features which I would like to implement using .NET.","AnswerCount":6,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":1073,"Q_Id":2617007,"Users Score":13,"Answer":"IronPython is NOT equivalent to \"other languages that run on .NET\", as the language has support for substantially fewer CLR runtime features.\nIronPython classes are not \"real\" .NET classes, and DLR APIs need to be used when calling IronPython code from traditional CLR-based languages; this means that if you want genuinely easy interoperability, you're stuck writing glue to \"hide\" the DLR.\nBoo is a much more complete Pythonically-inspired language targeting the CLR. Its (dynamically inferrable) static typing (which can be replaced with duck typing on a variable-by-variable basis) also allows libraries written in Boo to be natively used from C# and other CLR-based languages, without needing to make any allowances for the language in use.","Q_Score":12,"Tags":"python,.net,ironpython,cpython,python.net","A_Id":2617936,"CreationDate":"2010-04-11T12:38:00.000","Title":"Can I treat IronPython as a Pythonic replacement to C#?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I do understand that this topic has been covered in some way at StackOverflow but I'm still not able to figure out the exact answer: can I treat IronPython as a Pythonic replacement to C#?\nI use CPython every day, I love the Zen :) but my current task is a Windows-only application with a complex GUI and some other features which I would like to implement using .NET.","AnswerCount":6,"Available Count":4,"Score":0.0333209931,"is_accepted":false,"ViewCount":1073,"Q_Id":2617007,"Users Score":1,"Answer":"The question \"Can I treat IronPython as a Pythonic replacement for C#?\" has been answered pretty well by jalf.  If the question were \"Is IronPython a Pythonic .NET Language?\" though, then the answer would absolutely be yes.  The principles of Zen - esp. least surprise - absolutely apply to IronPython's integration with the CLR as well.","Q_Score":12,"Tags":"python,.net,ironpython,cpython,python.net","A_Id":2617900,"CreationDate":"2010-04-11T12:38:00.000","Title":"Can I treat IronPython as a Pythonic replacement to C#?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I do understand that this topic has been covered in some way at StackOverflow but I'm still not able to figure out the exact answer: can I treat IronPython as a Pythonic replacement to C#?\nI use CPython every day, I love the Zen :) but my current task is a Windows-only application with a complex GUI and some other features which I would like to implement using .NET.","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":1073,"Q_Id":2617007,"Users Score":0,"Answer":"\"Complex\" UI usually entails not \"writing\" it but building it within Visual Studio with point and click. All the callbacks and eventing code is inserted by itself. There is almost nothing like that on python side. I'd say go for C# straight out.\nThere is one nagging thing though. If you are true Pythonista, the static typing will get to you very very quickly and you will want to start throwing heavy objects at random people.\nIf that point comes think about building out the UI with C# and embedding IronPython as a scripting engine for implementing your business logic. That could be a tolerable middle ground.","Q_Score":12,"Tags":"python,.net,ironpython,cpython,python.net","A_Id":3042636,"CreationDate":"2010-04-11T12:38:00.000","Title":"Can I treat IronPython as a Pythonic replacement to C#?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I do understand that this topic has been covered in some way at StackOverflow but I'm still not able to figure out the exact answer: can I treat IronPython as a Pythonic replacement to C#?\nI use CPython every day, I love the Zen :) but my current task is a Windows-only application with a complex GUI and some other features which I would like to implement using .NET.","AnswerCount":6,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":1073,"Q_Id":2617007,"Users Score":10,"Answer":"That depends on what it is about C# that you need, and which needs replacing.\nIf the reason you use C# is that you need a reasonably high performance statically typed language then no, IronPython is likely not going to be a replacement.\nIf the reason you use it is simply \"I need something that runs on .NET and can access .NET libraries\", then yes, any language that runs on .NET can be used to replace it.\nIf you use C# because you're working with a team of programmers who only know C-like languages, C# might also be difficult to replace with IronPython.\nIt depends on what characteristics about C# it is that you care about, and need to find replacements for.","Q_Score":12,"Tags":"python,.net,ironpython,cpython,python.net","A_Id":2617019,"CreationDate":"2010-04-11T12:38:00.000","Title":"Can I treat IronPython as a Pythonic replacement to C#?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"The PyQt4 QTableWidget has both cellPressed and cellClicked signals. From the name, and the little experimentation I did with them, they appear to do exactly the same thing. Is there a difference between the two?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1577,"Q_Id":2619446,"Users Score":3,"Answer":"These signals on cells are not sharply documented (that I can find) but I'd interpret them by analogy with the pressed, clicked, and released signals on buttons:\npressed means the mouse's left button's been pressed down inside the widget,\nreleased means the mouse's left button's been released (let up) inside the widget,\nclicked means the mouse's left button's been pressed, then released (let up), both inside the widget\nSo if you press the button down inside the widget, hold it down, move the mouse elsewhere, and only then release the mouse's button, then you should only see the pressed signal, but neither of the other two; while any clicked signal always implies both pressed and released have also been signaled.\nI believe that normal UI behavior should be to respond to clicked only, unless you want to do something special if the button's pressed and not released for a certain time (i.e., held down for a prolonged time).","Q_Score":1,"Tags":"python,pyqt4","A_Id":2619472,"CreationDate":"2010-04-12T01:43:00.000","Title":"Difference between cellPressed and cellClicked signals of PyQt4 QTableWidget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As per the title, is there any way to programatically change the selected item in a ComboBox and have it raise an event?\nI am setting the selected item using myComboBox.SetSelection(index), but this doesn't raise the wx.EVT_COMBOBOX event.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1192,"Q_Id":2629841,"Users Score":0,"Answer":"I use C++ version of wxWidget. Look up documentation on these two functions:\nvoid wxPostEvent(wxEvtHandler *dest, wxEvent& event)\nvoid AddPendingEvent(wxEvent& event)","Q_Score":1,"Tags":"combobox,wxpython,wxwidgets","A_Id":2629895,"CreationDate":"2010-04-13T13:23:00.000","Title":"Triggering wx.EVT_COMBOBOX after programatically changing ComboBox selection?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I always see people mention that \"Python binding\" and \"C Sharp binding\" etc. when I am actually using their C++ libraries. What does binding mean? If the library is written in C, and does Python binding means that they use SWIG kind of tool to mock a Python interface?\nNewbie in this field, and any suggestion will be welcomed.","AnswerCount":4,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":1840,"Q_Id":2632466,"Users Score":0,"Answer":"In short, yes. A binding is just that, an interface to a library or program written in another language, though it need not be generated using SWIG.\nSWIG is just a tool for automatic generation of the same...","Q_Score":6,"Tags":"c++,python,binding","A_Id":2632489,"CreationDate":"2010-04-13T19:11:00.000","Title":"What does binding mean exactly?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I always see people mention that \"Python binding\" and \"C Sharp binding\" etc. when I am actually using their C++ libraries. What does binding mean? If the library is written in C, and does Python binding means that they use SWIG kind of tool to mock a Python interface?\nNewbie in this field, and any suggestion will be welcomed.","AnswerCount":4,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":1840,"Q_Id":2632466,"Users Score":2,"Answer":"When someone talks about something like a \"C# binding\" of a library, they are indicating that you and API is being provided in C# for a library written in a different language. This may or may not involve an autogeneration tool like SWIG.","Q_Score":6,"Tags":"c++,python,binding","A_Id":2632491,"CreationDate":"2010-04-13T19:11:00.000","Title":"What does binding mean exactly?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I always see people mention that \"Python binding\" and \"C Sharp binding\" etc. when I am actually using their C++ libraries. What does binding mean? If the library is written in C, and does Python binding means that they use SWIG kind of tool to mock a Python interface?\nNewbie in this field, and any suggestion will be welcomed.","AnswerCount":4,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":1840,"Q_Id":2632466,"Users Score":0,"Answer":"You're right, for a general library, a \"binding\" essentially means \"easily callable from\". The binding may or may not have been created with SWIG, that's just one way to do it.","Q_Score":6,"Tags":"c++,python,binding","A_Id":2632492,"CreationDate":"2010-04-13T19:11:00.000","Title":"What does binding mean exactly?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I always see people mention that \"Python binding\" and \"C Sharp binding\" etc. when I am actually using their C++ libraries. What does binding mean? If the library is written in C, and does Python binding means that they use SWIG kind of tool to mock a Python interface?\nNewbie in this field, and any suggestion will be welcomed.","AnswerCount":4,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":1840,"Q_Id":2632466,"Users Score":0,"Answer":"If the library is written in C, and\n  does Python binding means that they\n  use SWIG kind of tool to mock a Python\n  interface?\n\nYes, you are right. That will be called a Python binding of the respective library.","Q_Score":6,"Tags":"c++,python,binding","A_Id":2632493,"CreationDate":"2010-04-13T19:11:00.000","Title":"What does binding mean exactly?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I'm going through the beginning stages of producing a game in Python, and I'm looking for a library that is able to manipulate pixels and blit them relatively fast.\nMy first thought was pygame, as it deals in pure 2D surfaces, but it only allows pixel access through pygame.get_at(), pygame.set_at() and pygame.get_buffer(), all of which lock the surface each time they're called, making them slow to use. I can also use  the PixelArray and surfarray classes, but they are locked for the duration of their lifetimes, and the only way to blit them to a surface is to either copy the pixels to a new surface, or use surfarray.blit_array, which requires creating a subsurface of the screen and blitting it to that, if the array is smaller than the screen (if it's bigger I can just use a slice of the array, which is no problem).\nI don't have much experience with PyOpenGL or Pyglet, but I'm wondering if there is a faster library for doing pixel manipulation in, or if there is a faster method, in Pygame, for doing pixel manupilation. I did some work with SDL and OpenGL in C, and I do like the idea of adding vertex\/fragment shaders to my program.\nMy program will chiefly be dealing in loading images and writing\/reading to\/from surfaces.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2106,"Q_Id":2633900,"Users Score":0,"Answer":"I checked out pyglet, and saw that it works well for static per pixel collision, when the image is not manipulated too much; however, I'm not sure how well it works with a dynamic image.\nIn short, I'm looking for a library that's able to quickly display a buffer of pixels. This buffer will be constantly changing, so fast access and blitting is essential. This could be done in C with relative ease using SDL; however, I'm looking for a similar method in Python. I'm not even too worried about hardware acceleration at this point, although it would certainly be nice.","Q_Score":2,"Tags":"python","A_Id":2634849,"CreationDate":"2010-04-13T23:28:00.000","Title":"Python pixel manipulation library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Frustrated by lack of a simple ACDSee equivalent for OS X, I'm looking to hack one up for myself. I'm looking for a gui library that accommodates:\n\nFull screen image display\nHigh quality image fit-to-screen (for display)\nLow memory usage\nFast display\nReasonable learning curve (the simpler the better)\n\nLooks like there are several choices, so which is the best? Here are some I've run across:\n\nPyOpenGL\nPyGame\nPyQT\nwxpython\n\nI don't have any particular experience with any of these, nor any strong desire to become an expert - I'm looking for the simplest solution.\nWhat do you recommend?\n[Update]\nFor those not familiar with ACDSee, here's what it does that I care about:\n\nSimple list\/thubmnail display of images in a directory\nSort by name\/size\/type\nAbility to view images full screen\nSingle-key delete while viewing full screen\nMove to next\/previous image while viewing full screen\nAbility to select a group of images for: \n\n\nmove to \/ copy to directory\ndelete\nresize\n\n\nACDSee has a bunch of niceties as well, such as remembering directories you've moved images to in the past, remembering your resize settings, displaying the total size of the images you've selected, etc.\nI've tried most of the options I could find (including Xee) and none of them quite get there. Please keep in mind that this is a programming\/library question, not a criticism of any of the existing tools.","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1562,"Q_Id":2634119,"Users Score":0,"Answer":"Use an App like Picasa (now available on mac).  Use AppleScript through Python to control it from your application.\nFailing that, use PyObjC to create Cocoa image display component and dialogs, and so on.","Q_Score":3,"Tags":"python,macos,opengl,wxpython,pyqt","A_Id":2999881,"CreationDate":"2010-04-14T00:24:00.000","Title":"Python: OSX Library for fast full screen jpg\/png display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Frustrated by lack of a simple ACDSee equivalent for OS X, I'm looking to hack one up for myself. I'm looking for a gui library that accommodates:\n\nFull screen image display\nHigh quality image fit-to-screen (for display)\nLow memory usage\nFast display\nReasonable learning curve (the simpler the better)\n\nLooks like there are several choices, so which is the best? Here are some I've run across:\n\nPyOpenGL\nPyGame\nPyQT\nwxpython\n\nI don't have any particular experience with any of these, nor any strong desire to become an expert - I'm looking for the simplest solution.\nWhat do you recommend?\n[Update]\nFor those not familiar with ACDSee, here's what it does that I care about:\n\nSimple list\/thubmnail display of images in a directory\nSort by name\/size\/type\nAbility to view images full screen\nSingle-key delete while viewing full screen\nMove to next\/previous image while viewing full screen\nAbility to select a group of images for: \n\n\nmove to \/ copy to directory\ndelete\nresize\n\n\nACDSee has a bunch of niceties as well, such as remembering directories you've moved images to in the past, remembering your resize settings, displaying the total size of the images you've selected, etc.\nI've tried most of the options I could find (including Xee) and none of them quite get there. Please keep in mind that this is a programming\/library question, not a criticism of any of the existing tools.","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1562,"Q_Id":2634119,"Users Score":0,"Answer":"it's not an answer to your coding question but for (a big part of) the lack of ACDsee equivalent (requires OSX 10.5+):\n\nSimple list\/thubmnail display of images in a directory: Finder.app\nSort by name\/size\/type: Finder.app will do name & type, not image size (but does file size)\nAbility to view images full screen: quick preview (spacebar \/ eye icon)\nSingle-key delete while viewing full screen: command-backspace while viewing in quickpreview, both windowed and fullscreen\nMove to next\/previous image while viewing full screen: both quickprewiew (after selecting a group of images or whole directory with cmd-a) and Preview.app\nAbility to select a group of images for[...]: Finder.app will does all but resize\n\nseems like you have everything except resize just pressing the spacebar while in finder.\nPreview.app will resize both a single image or multiple ones in one batch.","Q_Score":3,"Tags":"python,macos,opengl,wxpython,pyqt","A_Id":2647147,"CreationDate":"2010-04-14T00:24:00.000","Title":"Python: OSX Library for fast full screen jpg\/png display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to use boost.python library in a C++ project (Windows + VS9) but it always tries to link against pyton25.lib.\nIs it possible to link with version 2.6.x of python?\nthanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":712,"Q_Id":2635933,"Users Score":0,"Answer":"You could try putting -lpython26 when linking","Q_Score":2,"Tags":"python,boost","A_Id":2636724,"CreationDate":"2010-04-14T08:35:00.000","Title":"boost python version","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to use boost.python library in a C++ project (Windows + VS9) but it always tries to link against pyton25.lib.\nIs it possible to link with version 2.6.x of python?\nthanks","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":712,"Q_Id":2635933,"Users Score":1,"Answer":"You need to recompile boost-python library pointing Boost.Build to needed python version.\nP.S. This heals a problem of undefined references while linking with library needed. I beleive you've already turned of autolinking.","Q_Score":2,"Tags":"python,boost","A_Id":2636711,"CreationDate":"2010-04-14T08:35:00.000","Title":"boost python version","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Where can I download this programm?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":324,"Q_Id":2640880,"Users Score":4,"Answer":"Any recent version of Python should come with Tkinter support.  To my knowledge, you shouldn't need to install anything else.","Q_Score":0,"Tags":"python,installation,download,tkinter","A_Id":2640895,"CreationDate":"2010-04-14T20:41:00.000","Title":"Installation of Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I haven't gotten far enough into Python to make GUIs yet, so I thought I'd ask here. Can a python app be made with the windows default style GUI, or will it have its own style? The only screenshots I've seen of a python app running with a GUI had this ugly win95 look to it.","AnswerCount":5,"Available Count":1,"Score":0.1194272985,"is_accepted":false,"ViewCount":6722,"Q_Id":2649882,"Users Score":3,"Answer":"Yes, you can use PyQt, or PySide (another Qt binding), or wxPython. They all support native look & feel.\nThere's also PyGTK, but gtk apps don't to look so native ..\nI personally prefer Qt, so I'd suggest PyQt. If you have issues with the GPL, then you can use PySide (LGPL).","Q_Score":16,"Tags":"python,user-interface","A_Id":2649957,"CreationDate":"2010-04-16T00:34:00.000","Title":"Can a native-looking GUI be made with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to do some basic encryption of server messages which would be encrypted with C++ and decrypted using Python server side.  I was wondering if anyone knew if there were good solutions that were simpler or more lightweight than Keyczar.  I see that supports both C++ and python, but would using Crypto++ and PyCrypto be simpler for a newbie that just wants to get something up and running for the time being?\nOr should I use Keyczar for python and Crypto++ for the C++ end?  The C++ libraries seem to have dependencies to hundreds of files.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":942,"Q_Id":2650073,"Users Score":2,"Answer":"The C++ libraries seem to have dependencies to hundreds of files.\nI don't know much about Python, but that is absolutely normal for C++. I'd recommend Crypto++ -- it's a great easy to use library, and it's public domain, meaning you won't have any license problems with it.\nEDIT: Keep in mind a large library with lots of code does not mean that you're going to pay in terms of object code. If there are functions you don't use (Crypto++ supports hundreds of algorithms) they won't be compiled into the resulting binary.","Q_Score":1,"Tags":"python,c++,encryption,cryptography","A_Id":2650311,"CreationDate":"2010-04-16T01:41:00.000","Title":"Lightweight cryptography toolkit(s) for C++ and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to include a rich text editor in a pygtk drawing area for an application i am developing. The editor ( a small resizable widget ) should be able to move around the drawing area like a rectangle. I am not sure how to start as I am pretty new to PyGTK. thank you !","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2291,"Q_Id":2650591,"Users Score":0,"Answer":"gtk.TextView is \"rich\", in that it can display all types of formatting and even embedded widgets.\nIf you want the functionality of editing rich text, you will have to write something yourself, though others have tried in applications like BloGTK. From which you could steal codes.","Q_Score":1,"Tags":"python,pygtk","A_Id":2788540,"CreationDate":"2010-04-16T04:21:00.000","Title":"Py GTK Drawing area and Rich Text Editor","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there something similar to scene.mouse.getclick in the visual module (VPython)?\nI need it for a rollover.\nThanks in advance.\nEDIT: I need a function for doing something when the mouse moves inside a special area without clicking.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":594,"Q_Id":2655747,"Users Score":0,"Answer":"scene.mouse.getclick will tell you where the mouse was when it was last clicked. This is different from scene.mouse.clicked which tells you if someone clicked.\nThere is no correspoding way to see if someone had their mouse over a particular object. One thing you can do is use a while loop that continually checks scene.mouse.pick to see if it is the mouse is currently over an object of interest.","Q_Score":2,"Tags":"python,mouseevent,rollover,vpython","A_Id":2718009,"CreationDate":"2010-04-16T19:52:00.000","Title":"mouse rollover event in Python (VPython)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there something similar to scene.mouse.getclick in the visual module (VPython)?\nI need it for a rollover.\nThanks in advance.\nEDIT: I need a function for doing something when the mouse moves inside a special area without clicking.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":594,"Q_Id":2655747,"Users Score":1,"Answer":"As mentioned by mathmike, it would seem that you could use scene.mouse.pick to get the object that is currently under the mouse, and as for the 'scene-position', I think scene.mouse.pickpos is what you're looking for - if not, you should be able to calculate it from the global mouse position (through getEvent()). \nOtherwise, look at getting your information from the getEvent() function, and possibly writing an event loop for yourself.","Q_Score":2,"Tags":"python,mouseevent,rollover,vpython","A_Id":2726099,"CreationDate":"2010-04-16T19:52:00.000","Title":"mouse rollover event in Python (VPython)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new in using Python. I would like to develop Windows GUI Application using Python. After some research, I found that I have 2 options:-\n\nIronPython + .NET Framework\nPython + PyQt\n\nMay I know which one is better for Windows Application development? Which option has more features (e.g. database support, etc)?\nOther than the .NET support, is there any big difference between IronPython and Python? Which one is a better choice for me?\nThank you.\nPatrick.L","AnswerCount":5,"Available Count":5,"Score":0.1586485043,"is_accepted":false,"ViewCount":5960,"Q_Id":2657036,"Users Score":4,"Answer":"Per my play with both PyQt (as interface to Qt) and IronPython (as an interface to WinForms) the bag is mixed.\nBoth are basically \"bindings\" for underlying platforms. PyQt is practically \"autogenerated\" from Qt's API and slightly more \"mature\" as a wrapper because of significant use on Linux. \nIronPython goes a little deeper and seems to \"rebox\" system objects with small unfilled gaps between cPython and .Net libs (gzip, zip, subprocess etc).\nIn both cases, you need to look through Python into the toolkit and say to yourself if you like the toolkit. All python is doing is repackaging the toolkit's API to the objects. Again, forget about Python aspect. Look at the underlying toolkit API and think to yourself if you can live with that.\nI personally find the C++ nature of Qt's API too un-pythonic to be happy with it. C# and Python are so alike that if you remove curlies and type declaration from C# you would not know if it's C# or Python. As a result, for a Python programmer, C#-based .Net API, code and examples as provided in MSDN and elsewhere are instantly applicable with very minor tweaks.\nIn the end, a more correct comparison would be between PyQt (Qt bindings for cPython) and Win32py (Windows ABI bindings for cPython). IronPython is almost a reinvention of same language on a different platform, with all the problems (lacking functionality) that comes with that.","Q_Score":8,"Tags":".net,python,user-interface,ironpython,pyqt","A_Id":3042547,"CreationDate":"2010-04-17T02:52:00.000","Title":"\"IronPython + .NET\" vs \"Python + PyQt\". Which one is better for Windows App development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new in using Python. I would like to develop Windows GUI Application using Python. After some research, I found that I have 2 options:-\n\nIronPython + .NET Framework\nPython + PyQt\n\nMay I know which one is better for Windows Application development? Which option has more features (e.g. database support, etc)?\nOther than the .NET support, is there any big difference between IronPython and Python? Which one is a better choice for me?\nThank you.\nPatrick.L","AnswerCount":5,"Available Count":5,"Score":0.1973753202,"is_accepted":false,"ViewCount":5960,"Q_Id":2657036,"Users Score":5,"Answer":"I faced the same issue and have, with misgivings, decided to go with IronPython\/C#\/.Net.  I liked Qt but got cold feet when it was sold to Nokia because I just wasn't sure Nokia's goals in owning Qt were consistent with my needs for a windows UI.  That said, Nokia has made some positive moves by combining separate platform licenses into a single license and dropping GPL licensing in favor or LGPL.  \nTechnically, Qt is well designed but relies heavily on hard to debug C# macros.  I'm not sure why.  The best thing about Qt is that it is open source.  If you need to, you can fix it.  I don't have direct experience with PyQt but it has been around for quite a while.  \n.Net is .Net and as usual with Microsoft, a moving target.  You will sacrifice speed for ease of coding.  The IronPython group seems good but I'm not sure if Microsoft's commitment is there.  Visual Studio support isn't there yet although the plans sound good. After all, MS only really cares if they own everything, which is not the case for Python.   What I really expect is MS will create a dynamic version of C#, interpreter and all, and tell all the Python programmers that it is better and supported and well integrated with .Net.  They will then through their considerable weight behind crushing Python like they've done to Java.  \nGood luck.  It's a big decision.","Q_Score":8,"Tags":".net,python,user-interface,ironpython,pyqt","A_Id":2668271,"CreationDate":"2010-04-17T02:52:00.000","Title":"\"IronPython + .NET\" vs \"Python + PyQt\". Which one is better for Windows App development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new in using Python. I would like to develop Windows GUI Application using Python. After some research, I found that I have 2 options:-\n\nIronPython + .NET Framework\nPython + PyQt\n\nMay I know which one is better for Windows Application development? Which option has more features (e.g. database support, etc)?\nOther than the .NET support, is there any big difference between IronPython and Python? Which one is a better choice for me?\nThank you.\nPatrick.L","AnswerCount":5,"Available Count":5,"Score":0.1194272985,"is_accepted":false,"ViewCount":5960,"Q_Id":2657036,"Users Score":3,"Answer":"PyQt is a great library, but .NET is the best way to go for Windows.  That is because you can use any GUI controls that C# would be able to use in Python.  Furthermore, in addition to WinForms, IronPython can be used to create WPF applications, which look good.\nThe main difference is the features, and PyQt has more cross-platform features, and .NET definitely has the edge in Windows.","Q_Score":8,"Tags":".net,python,user-interface,ironpython,pyqt","A_Id":2658657,"CreationDate":"2010-04-17T02:52:00.000","Title":"\"IronPython + .NET\" vs \"Python + PyQt\". Which one is better for Windows App development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new in using Python. I would like to develop Windows GUI Application using Python. After some research, I found that I have 2 options:-\n\nIronPython + .NET Framework\nPython + PyQt\n\nMay I know which one is better for Windows Application development? Which option has more features (e.g. database support, etc)?\nOther than the .NET support, is there any big difference between IronPython and Python? Which one is a better choice for me?\nThank you.\nPatrick.L","AnswerCount":5,"Available Count":5,"Score":0.0399786803,"is_accepted":false,"ViewCount":5960,"Q_Id":2657036,"Users Score":1,"Answer":"I haven't used IronPython with .NET, but I have written a lot of PyQt code. From my experience, PyQt is a great library. It is a very well executed bindings to Qt, which is a very well known and widely used library.\nSince it's standard Python you're writing, you can enjoy all the Python standard library which gives you a ton of capabilities, in addition to several useful Qt modules imported with PyQt. Writing PyQt code is productive, and the GUIs come out pretty and responsive. And you can't ignore the portability benefit: with just the tiniest modifications, if any, you can just run these programs on Linux and they will just work.","Q_Score":8,"Tags":".net,python,user-interface,ironpython,pyqt","A_Id":2657263,"CreationDate":"2010-04-17T02:52:00.000","Title":"\"IronPython + .NET\" vs \"Python + PyQt\". Which one is better for Windows App development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new in using Python. I would like to develop Windows GUI Application using Python. After some research, I found that I have 2 options:-\n\nIronPython + .NET Framework\nPython + PyQt\n\nMay I know which one is better for Windows Application development? Which option has more features (e.g. database support, etc)?\nOther than the .NET support, is there any big difference between IronPython and Python? Which one is a better choice for me?\nThank you.\nPatrick.L","AnswerCount":5,"Available Count":5,"Score":0.1194272985,"is_accepted":false,"ViewCount":5960,"Q_Id":2657036,"Users Score":3,"Answer":"First, there are lots more than 2 options (python has more GUI libraries than you can shake a stick at), but let's go on your premise for a minute. \"Better\" being subjective begs the question: \"what do you want to learn?\"\nIf the goal is Windows GUI Applications development, than I'd go with .Net.  .Net is well respected, there is lots of work for .Net programmers, and it's windows centric nature (yeah I know there's Mono but still) means you aren't trying to think about details of three+ sets of user expectations.\nIf the goal is to learn widely used Python libraries and techniques, I'd go with PyQt (and recently did).  It's cross-platform, well respected, and has a large community.  But you lose the chance to learn the .Net platform as part of this project.\nI don't think you can loose either way if your goal is to learn.  If your goal is to get something done, think about the long-term plans for the project and where its going over the long run. Do you want something that's well integrated into the Windows user-interface, and uses standard widgets?  Do you want something that can easily be adapted to other platforms in the future?","Q_Score":8,"Tags":".net,python,user-interface,ironpython,pyqt","A_Id":2657059,"CreationDate":"2010-04-17T02:52:00.000","Title":"\"IronPython + .NET\" vs \"Python + PyQt\". Which one is better for Windows App development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed PyScript to try it out but it just wont start. It only gives me the error:\n\"Error126: Could not open Dll \"python26.dll\" followed by:\n\"Python could not be properly initialized. We must quit.\"\nI think this may have something to do with the PYTHONPATH but since I'm a newbie and dont know what it is or exactly what to put in the PYTHONPATH, after some googling, I ask here.\nAlso, when I tried to install wxPython it was impossible becouse the PYTHONPATH could not be found.(Just a side note)","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":22256,"Q_Id":2658779,"Users Score":0,"Answer":"I just copied python26.dll from my python folder to pyscripter folder and it worked well... dont know it that is a good way to do it...","Q_Score":5,"Tags":"python,pythonpath,pyscripter","A_Id":13216653,"CreationDate":"2010-04-17T14:58:00.000","Title":"How do I make PyScripter work? Says it cant find python26.dll","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed PyScript to try it out but it just wont start. It only gives me the error:\n\"Error126: Could not open Dll \"python26.dll\" followed by:\n\"Python could not be properly initialized. We must quit.\"\nI think this may have something to do with the PYTHONPATH but since I'm a newbie and dont know what it is or exactly what to put in the PYTHONPATH, after some googling, I ask here.\nAlso, when I tried to install wxPython it was impossible becouse the PYTHONPATH could not be found.(Just a side note)","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":22256,"Q_Id":2658779,"Users Score":0,"Answer":"I finally got it working by (a) not changing the directory it gets installed in to something else...just left it in c:\/programfiles\/pyscripter ...and (B) going into the pyscripter folder and in the lib folder extracting the rpyc folder so that there is another rpyc folder inside the lib folder that isnt compressed! hope that helps","Q_Score":5,"Tags":"python,pythonpath,pyscripter","A_Id":23843782,"CreationDate":"2010-04-17T14:58:00.000","Title":"How do I make PyScripter work? Says it cant find python26.dll","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed PyScript to try it out but it just wont start. It only gives me the error:\n\"Error126: Could not open Dll \"python26.dll\" followed by:\n\"Python could not be properly initialized. We must quit.\"\nI think this may have something to do with the PYTHONPATH but since I'm a newbie and dont know what it is or exactly what to put in the PYTHONPATH, after some googling, I ask here.\nAlso, when I tried to install wxPython it was impossible becouse the PYTHONPATH could not be found.(Just a side note)","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":22256,"Q_Id":2658779,"Users Score":0,"Answer":"Install python. should solve all your problems..","Q_Score":5,"Tags":"python,pythonpath,pyscripter","A_Id":2658872,"CreationDate":"2010-04-17T14:58:00.000","Title":"How do I make PyScripter work? Says it cant find python26.dll","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Pygame program that needs text input. The way it does this is to get keyboard input and when a key is pressed it renders that key so it is added to the screen. Essentially it acts like a text field. The problem is, when you hold shift it doesn't do anything. I realize this is because the program ignores shift input and instead writes the text if it's number is under 128. I have thought of setting a variable when shift is pressed then capitalizing if it was true, but string capitalization only woks on letters, not things like numbers or semicolons. Is there maybe a number I can add to the ASCII number typed to modify it if shift is pressed, or something else?\nEdit:\nEssentially, I just want to know if there is a number to add to ascii characters to make it seem like they were typed with shift held down. After reading over my original question it seemed slightly obscure.","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":5694,"Q_Id":2671589,"Users Score":3,"Answer":"I can use the 'event.unicode' attribute to get the value of the key typed.","Q_Score":3,"Tags":"python,ascii,character,pygame,shift","A_Id":2785753,"CreationDate":"2010-04-19T23:27:00.000","Title":"Pygame program that can get keyboard input with caps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Pygame program that needs text input. The way it does this is to get keyboard input and when a key is pressed it renders that key so it is added to the screen. Essentially it acts like a text field. The problem is, when you hold shift it doesn't do anything. I realize this is because the program ignores shift input and instead writes the text if it's number is under 128. I have thought of setting a variable when shift is pressed then capitalizing if it was true, but string capitalization only woks on letters, not things like numbers or semicolons. Is there maybe a number I can add to the ASCII number typed to modify it if shift is pressed, or something else?\nEdit:\nEssentially, I just want to know if there is a number to add to ascii characters to make it seem like they were typed with shift held down. After reading over my original question it seemed slightly obscure.","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":5694,"Q_Id":2671589,"Users Score":0,"Answer":"I wrote a function that converts the strings after getting not enough help. It converts everything manually.","Q_Score":3,"Tags":"python,ascii,character,pygame,shift","A_Id":2683802,"CreationDate":"2010-04-19T23:27:00.000","Title":"Pygame program that can get keyboard input with caps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to develop a multiplatform software that takes screenshots from opengl games without affecting the game in performance, it will run in the background and will add a watermark to my screenshots.\nWhat language should i use? I thought of Perl \/ Python.\nAnyone can point me out something to start?\nThanks!","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":502,"Q_Id":2691289,"Users Score":0,"Answer":"Do you need to add a watermark right when you take the screenshot? It would be a lot easier to simply add the watermark later to the static image, as many applications can do this (e.g. Photoshop).","Q_Score":1,"Tags":"python,perl,opengl","A_Id":2691789,"CreationDate":"2010-04-22T13:40:00.000","Title":"Programming language for opengl screenshot software","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to develop a multiplatform software that takes screenshots from opengl games without affecting the game in performance, it will run in the background and will add a watermark to my screenshots.\nWhat language should i use? I thought of Perl \/ Python.\nAnyone can point me out something to start?\nThanks!","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":502,"Q_Id":2691289,"Users Score":1,"Answer":"I would suggest C++. That way you can use OpenGL and DirectX libraries and API calls natively. Libraries that provide such functionality to other languages typically abstract the good stuff away from reach.","Q_Score":1,"Tags":"python,perl,opengl","A_Id":2691336,"CreationDate":"2010-04-22T13:40:00.000","Title":"Programming language for opengl screenshot software","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to develop a multiplatform software that takes screenshots from opengl games without affecting the game in performance, it will run in the background and will add a watermark to my screenshots.\nWhat language should i use? I thought of Perl \/ Python.\nAnyone can point me out something to start?\nThanks!","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":502,"Q_Id":2691289,"Users Score":0,"Answer":"The language you know best that has some sort of OpenGL Bindings.\nMy personal preference for such kind of applications is C, C++ or (if available) C# but it's a simple matter of preference.","Q_Score":1,"Tags":"python,perl,opengl","A_Id":2691318,"CreationDate":"2010-04-22T13:40:00.000","Title":"Programming language for opengl screenshot software","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to write a C++ application with Qt, but build a prototype first using Python and then gradually replace the Python code with C++.\nIs this the right approach, and what tools (bindings, binding generators, IDE) should I use?\nIdeally, everything should be available in the Ubuntu repositories so I wouldn't have to worry about incompatible or old versions and have everything set up with a simple aptitude install.\nIs there any comprehensive documentation about this process or do I have to learn every single component, and if yes, which ones?\nRight now I have multiple choices to make:\nQt Creator, because of the nice auto completion and Qt integration.\nEclipse, as it offers support for both C++ and Python.\nEric (haven't used it yet)\nVim\nPySide as it's working with CMake and Boost.Python, so theoretically it will make replacing python code easier.\nPyQt as it's more widely used (more support) and is available as a Debian package.\nEdit: As I will have to deploy the program to various computers, the C++-solution would require 1-5 files (the program and some library files if I'm linking it statically), using Python I'd have to build PyQt\/PySide\/SIP\/whatever on every platform and explain how to install Python and everything else.","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":5460,"Q_Id":2693558,"Users Score":3,"Answer":"If you are just learning Qt and want to leverage the speed of prototyping that Python gives you, then I would recommend you make a sample project using PyQt.  As you said, there is a debian package, so you are just a simple apt-get away from making your first application.\nI personally use gVim as my Python\/Qt editor, but you can really use any Python-friendly editor without much trouble.  I liked WingIDE and they have auto-complete for Qt but once you sip from the vim kool-aid it's hard to switch.\nI would say that PySide is 95%+ compatible with PyQt and the LPGL license is nice, but if you are just trying to prototype your first Qt app, then I don't think there is a real reason to use PySide.  Although, I do like the PySide docs better, you can also just use them and replace all the library references with PyQt.\nDepending on the complexity of the application you are building, it might be better off to just start from scratch with a C++ version than to try to do a bunch SIP refactoring black magic.  Once you have a solid grasp of the Qt framework, you should be able to switch between the C++ and Python bindings pretty effortlessly.","Q_Score":25,"Tags":"c++,python,qt,pyqt,pyside","A_Id":2694114,"CreationDate":"2010-04-22T18:49:00.000","Title":"Prototyping Qt\/C++ in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a very large file editor (where the editor only stores a part of the buffer in memory at a time), but I'm stuck while building my textview object.  Basically- I know that I have to be able to update the text view buffer dynamically, and I don't know hot to get the scrollbars to relate to the full file while the textview contains only a small buffer of the file.\nI've played with Gtk.Adjustment on a Gtk.ScrolledWindow and ScrollBars, but though I can extend the range of the scrollbars, they still apply to the range of the buffer and not the filesize (which I try to set via Gtk.Adjustment parameters) when I load into textview.  I need to have a widget that \"knows\" that it is looking at a part of a file, and can load\/unload buffers as necessary to view different parts of the file.  So far, I believe I'll respond to the \"change_view\" to calculate when I'm off, or about to be off the current buffer and need to load the next, but I don't know how to get the scrollbars to have the top relate to the beginning of the file, and the bottom relate to the end of the file, rather than to the loaded buffer in textview.\nAny help would be greatly appreciated, thanks!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":494,"Q_Id":2698533,"Users Score":1,"Answer":"You probably should create your own Gtk.TextBuffer implementation, as the default one relies on storing whole buffer in memory.","Q_Score":4,"Tags":"python,gtk,pygtk","A_Id":2698565,"CreationDate":"2010-04-23T12:43:00.000","Title":"Gtk: How can I get a part of a file in a textview with scrollbars relating to the full file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im trying to do simple audio player, but I want use a image(icon) as a pushbutton.","AnswerCount":5,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":30515,"Q_Id":2711033,"Users Score":5,"Answer":"You can use QToolButton with set autoraise property true and there you can set your image also.","Q_Score":13,"Tags":"python,qt,pyqt,pyqt4","A_Id":6515261,"CreationDate":"2010-04-26T03:42:00.000","Title":"how code a Image button in PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a (single line) TextCtrl. The user types data into this. When they press enter, the contents of the box need to be extracted so they can be processed. I can't figure out how to catch enter being pressed.\nAccording to the docs, with the style wx.TE_PROCESS_ENTER set on my TextCtrl, it should generate a wx.EVT_COMMAND_TEXT_ENTER event when enter is pressed in the box, which I could then catch. However, wx.EVT_COMMAND_TEXT_ENTER seems not to exist (I get \"module has no attribute EVT_COMMAND_TEXT_ENTER), so I'm a bit stuck. Googling just gets a couple of hits of people complaining wx.EVT_COMMAND_TEXT_ENTER doesn't work, so I guess I need another way of doing it.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":7028,"Q_Id":2725362,"Users Score":6,"Answer":"I've never seen wx.EVT_COMMAND_TEXT_ENTER. I have used wx.EVT_TEXT_ENTER though...","Q_Score":8,"Tags":"python,wxpython,wxwidgets","A_Id":2725392,"CreationDate":"2010-04-27T21:44:00.000","Title":"Get text when enter is pressed in a text box in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for an easy-to-use graphics lib for python that can output to screen as well as pdf. So, I would use code to draw some stuff (simple prims like ovals, rectangles, lines and points) to screen and then when things look good, have it output to pdf.","AnswerCount":6,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":9999,"Q_Id":2725735,"Users Score":0,"Answer":"Creating PDFs is always a pain, it doesn't make sense if you do not aim to lose sanity.\nWith that said, you are aiming to do two completely different things: when you draw to screen you draw into a raster bitmap, while PDFs are mostly dynamic, like HTML. (unlike HTML they are more prone to be the same over different platforms, but that's beside the point)\nIf you really want to do that, the solution might be finding something that outputs PDFs, and then showing the generated PDF on screen at every step.\nI guess that's the only way to have WYSIWYG results.","Q_Score":3,"Tags":"python,pdf,graphics","A_Id":2725787,"CreationDate":"2010-04-27T22:56:00.000","Title":"Recommendations for a simple 2D graphics python library that can output to screen and pdf?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for an easy-to-use graphics lib for python that can output to screen as well as pdf. So, I would use code to draw some stuff (simple prims like ovals, rectangles, lines and points) to screen and then when things look good, have it output to pdf.","AnswerCount":6,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":9999,"Q_Id":2725735,"Users Score":3,"Answer":"If you use Tkinter, you can draw on a Canvas widget, then use its .postscript method to save the contents as a PostScript file, which you can convert to PDF using ps2pdf.\n\npostscript(self, cnf={}, **kw)\n  Print the contents of the canvas to a postscript\n  file. Valid options: colormap, colormode, file, fontmap,\n  height, pageanchor, pageheight, pagewidth, pagex, pagey,\n  rotate, witdh, x, y.","Q_Score":3,"Tags":"python,pdf,graphics","A_Id":2725883,"CreationDate":"2010-04-27T22:56:00.000","Title":"Recommendations for a simple 2D graphics python library that can output to screen and pdf?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Imagine I have a video playing.. Can I have some sort of motion graphics being played 'over' that video.. Like say the moving graphics is on an upper layer than the video, which would be the lower layer..\nI am comfortable in a C++ and Python, so a solution that uses these two will be highly appreciated.. \nThank you in advance,\nRishi..","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":169,"Q_Id":2759738,"Users Score":0,"Answer":"I'm not sure I understand the question correctly but a video file is a sequence of pictures that you can extract (for instance with the opencv library C++ interface) and then you can use it wherever you want. You can play the video on the sides of an opengl 3D cube (available in all opengl tutorials) and other 3D elements around it.\nOf course you can also displays it in a conventional 2D interface and draw stuff on top of it, but for this you need a graphical ui.\nIs it what you thought or am I completely lost?","Q_Score":0,"Tags":"c++,python,graphics,video,video-processing","A_Id":2760860,"CreationDate":"2010-05-03T17:00:00.000","Title":"Navigation graphics overlayed over video","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i converted recently from wxpython to pyqt and im still facing alot of problems since im still noob in pyqt\nso is it possible to detected if user pressed (CTRL+key ) in pyqt ? and how ?\n\n\ni've been trying to find an answer for this for 3 days . if you know website or a good place to learn pyqt, it will be highly appreciated \n\n\nthanx in advance","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5552,"Q_Id":2761512,"Users Score":8,"Answer":"Add a QShortcut and listen to its activated() signal, then perform the action in the slot.\nOr you could reimplement QWidget and define keyPressEvent to what you like. Check for the event parameter's modifiers() and key() to see if they match with what you want. This listens for shortcut keys when the QWidget has focus.","Q_Score":3,"Tags":"python,qt,qt4,pyqt,pyqt4","A_Id":2761528,"CreationDate":"2010-05-03T22:01:00.000","Title":"getting keyboard events with pyqt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python application which need a gui HTML editor, I know FCKeditor is nice, so how to embed the FCKeditor in a python desktop app?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":340,"Q_Id":2777919,"Users Score":1,"Answer":"To embed FCKeditor (or maybe better the current CKeditor?), you basically need to embed a full-fledged browser (with Javascript) -- I believe wxPython may currently be the best bet for that, as I hear it has wxIE for Windows and wxWebKitCtrl for the Mac (I don't know if old summer-of-code ideas about making something suitable for Linux ever panned out, though).  Most \"HTML viewer\" widgets, in most GUIs, don't support Javascript, and that's a must for (F?)CKeditor.","Q_Score":0,"Tags":"python,html,editor","A_Id":2778024,"CreationDate":"2010-05-06T01:41:00.000","Title":"Embed FCKeditor in python app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python application which need a gui HTML editor, I know FCKeditor is nice, so how to embed the FCKeditor in a python desktop app?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":340,"Q_Id":2777919,"Users Score":0,"Answer":"In order of difficulty:\nIf you just need to support Windows, you can embed IE in wx - see the docs and demos.\nwxWebKit is looking a bit more mature, but it's still in development.\nYou could just use the web-browser using webbrowser.open(url). Things will be very crude, and interaction will be a pain.\nA fourth option - you could try out pyjamas for your whole GUI, then run it all in a web-browser.","Q_Score":0,"Tags":"python,html,editor","A_Id":2778087,"CreationDate":"2010-05-06T01:41:00.000","Title":"Embed FCKeditor in python app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working with geodjango and I want to breakup a 2D Rectangular Polygon into smaller ones.\nMy input is a big rectangle and I want to subdivide it in smaller rectangles. The sum of the smaller rectangles must be the original rectangle.\nAll subrectangles should be equal size.\nHow can I do that?\nThank you.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1964,"Q_Id":2783075,"Users Score":2,"Answer":"Pick any point inside the rectangle\nDraw two lines through it parallel to the edges of the rectangle.  Now you've divided your rectangle into four smaller ones.","Q_Score":2,"Tags":"python,geometry,gis,geodjango","A_Id":2783174,"CreationDate":"2010-05-06T17:22:00.000","Title":"Break up a polygon into smaller ones","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I find if a GTKBuilder Checkbutton is checked?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":703,"Q_Id":2788927,"Users Score":1,"Answer":"Use checkbutton.get_active(). What's this got to do with GtkBuilder?","Q_Score":0,"Tags":"python,gtk,pygtk,glade,gtkbuilder","A_Id":2789043,"CreationDate":"2010-05-07T13:35:00.000","Title":"Python Glade GTKBuilder Checkbutton","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a fairly simple PyQt application in which I'm placing instances of a QGraphicsWidget in a QGraphicsGridLayout and want to connect the widgets with lines drawn with a QGraphicsPath. Unfortunately, no matter what I try, I always get (0, 0) back as the position for both the start and end widgets.\nI'm constructing the graph with a recursive function that adds widgets to the scene and layout. Once the recursive function is complete, the layout is added to a new widget, which is added to the scene to show everything. The edges are added to the scene as widgets are created.\nHow do I get a non-zero position of any of the widgets in the grid layout?\nUpdate: I forgot to mention that I've tried both pos() and scenePos() on the widgets in the grid layout. Both always return (0, 0) as the position for every widget in the grid.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2688,"Q_Id":2799776,"Users Score":1,"Answer":"If you use the QGraphicsItem::pos(), it gives you the position of the item in the parent coordinates. When using QGraphicsLayout, the parent is probably the cell containing the object thus the coordinate is equal to zero.\nSince you want to connect widgets with path, you will need scene coordinate to define the control points: use QGraphicsItem::scenePos() to obtain the position of your QGraphicsWidget in the scene.","Q_Score":3,"Tags":"python,qt,pyqt","A_Id":2801458,"CreationDate":"2010-05-10T00:45:00.000","Title":"PyQt: Get the position of QGraphicsWidgets in a QGraphicsGridLayout","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a graphics library for 3D reconstruction research to develop my specific viewer based on some library. OpenGL seems in a low level and I have to remake the wheel everywhere. And I also tried VTK(visualization toolkit). However, it seems too abstract that I need to master many conceptions before I start. Is there any other graphics library? I prefer to program in python. So I would like the library has a python wrapper. I think something like O3D would be better. But O3D is for javascript and it seems that Google already stops the development.","AnswerCount":5,"Available Count":1,"Score":-0.0399786803,"is_accepted":false,"ViewCount":2730,"Q_Id":2823907,"Users Score":-1,"Answer":"I used openGL with C++ a few years back - found it quite low level. I also have used Java3D which seemed to be a bit higher level. If you are not stuck on using python - try Java3D - very simple to get up and running.","Q_Score":3,"Tags":"python,opengl,graphics","A_Id":2826036,"CreationDate":"2010-05-13T01:22:00.000","Title":"Is there any graphics library in a higher level than OpenGL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project idea, but unsure if using Python would be a good idea.\nFirstly, I'm a C++ and C# developer with some SQL experience.  My day job is C++.  I have a project idea i'd like to create and was considering developing it in a language I don't know.  Python seems to be popular and has piqued my interests.  I definitely use OOP in programming and I understand Python would work fine with that style.  I could be way off on this, I've only read small bits and pieces about the language.\nThe project won't be public or anything, just purely something of my own creation do dabble in at home.\nSo the project would essentially represent a simple game idea I have.  The game would consist roughly these things:\n\nData structures to hold specific information (would be strongly typed).\nA way to output the gamestate for the players.  This is completely up in the air, it can be graphical or text based, I don't really care at this point.\nA way to save off game data for the players in something like a database or file system.\nA relatively easy way for me to input information and a 'GO' button which processes the changes and obviously creates a new gamestate.\nThe game would function similar to a board game.\n\nReally nothing out of the ordinary when I look back at that list.  Would this be a fun way to learn Python or should I select another language?","AnswerCount":4,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":823,"Q_Id":2823983,"Users Score":6,"Answer":"I find that the best way to learn a new language is by doing something like this (small project of your own). Python is no different. \nEverything you wrote can be done in Python, so I can't find any reason not to use it, if you want to learn.","Q_Score":2,"Tags":"python,oop","A_Id":2824002,"CreationDate":"2010-05-13T01:45:00.000","Title":"Idea for a small project, should I use Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project idea, but unsure if using Python would be a good idea.\nFirstly, I'm a C++ and C# developer with some SQL experience.  My day job is C++.  I have a project idea i'd like to create and was considering developing it in a language I don't know.  Python seems to be popular and has piqued my interests.  I definitely use OOP in programming and I understand Python would work fine with that style.  I could be way off on this, I've only read small bits and pieces about the language.\nThe project won't be public or anything, just purely something of my own creation do dabble in at home.\nSo the project would essentially represent a simple game idea I have.  The game would consist roughly these things:\n\nData structures to hold specific information (would be strongly typed).\nA way to output the gamestate for the players.  This is completely up in the air, it can be graphical or text based, I don't really care at this point.\nA way to save off game data for the players in something like a database or file system.\nA relatively easy way for me to input information and a 'GO' button which processes the changes and obviously creates a new gamestate.\nThe game would function similar to a board game.\n\nReally nothing out of the ordinary when I look back at that list.  Would this be a fun way to learn Python or should I select another language?","AnswerCount":4,"Available Count":4,"Score":0.1488850336,"is_accepted":false,"ViewCount":823,"Q_Id":2823983,"Users Score":3,"Answer":"I've already voted for del-boy's answer, but I would like to go further and say that if your goals are to (1) have fun, (2) learn a new language, and (3) write your own game, then Python is a slam-dunk, no-brainer, awesome choice to achieve all three.\nThe language excels at all the things you seem to be looking for (see Alex Martelli's answer for the caveat on strong typing), and in my opinion is not much of a \"stretch\" from the C family of languages (I think you will find most things simply easier, rather than strange), compared to other good languages such as Ruby or Lua.","Q_Score":2,"Tags":"python,oop","A_Id":2824090,"CreationDate":"2010-05-13T01:45:00.000","Title":"Idea for a small project, should I use Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project idea, but unsure if using Python would be a good idea.\nFirstly, I'm a C++ and C# developer with some SQL experience.  My day job is C++.  I have a project idea i'd like to create and was considering developing it in a language I don't know.  Python seems to be popular and has piqued my interests.  I definitely use OOP in programming and I understand Python would work fine with that style.  I could be way off on this, I've only read small bits and pieces about the language.\nThe project won't be public or anything, just purely something of my own creation do dabble in at home.\nSo the project would essentially represent a simple game idea I have.  The game would consist roughly these things:\n\nData structures to hold specific information (would be strongly typed).\nA way to output the gamestate for the players.  This is completely up in the air, it can be graphical or text based, I don't really care at this point.\nA way to save off game data for the players in something like a database or file system.\nA relatively easy way for me to input information and a 'GO' button which processes the changes and obviously creates a new gamestate.\nThe game would function similar to a board game.\n\nReally nothing out of the ordinary when I look back at that list.  Would this be a fun way to learn Python or should I select another language?","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":823,"Q_Id":2823983,"Users Score":1,"Answer":"Well, if you do C++\/C#, I'd say go for it - I personally love C++ because it is (in my opinion) self-intuitive and easy. The 'grammar' of Python doesn't make much sense. Plus, if you already know another language, why learn Python for fun? I mean, if you want to create a simple project for fun, it's really not worth it, and you'll end up working for several weeks at least, before you can begin your game. So yeah, you should definitely use C++. \n\nHowever, if you're just trying to learn a new language, there's nothing wrong with that; Python certainly is pretty popular. Javascript is pretty easy as well, as it uses automatic inference and all that jazz.","Q_Score":2,"Tags":"python,oop","A_Id":2824020,"CreationDate":"2010-05-13T01:45:00.000","Title":"Idea for a small project, should I use Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project idea, but unsure if using Python would be a good idea.\nFirstly, I'm a C++ and C# developer with some SQL experience.  My day job is C++.  I have a project idea i'd like to create and was considering developing it in a language I don't know.  Python seems to be popular and has piqued my interests.  I definitely use OOP in programming and I understand Python would work fine with that style.  I could be way off on this, I've only read small bits and pieces about the language.\nThe project won't be public or anything, just purely something of my own creation do dabble in at home.\nSo the project would essentially represent a simple game idea I have.  The game would consist roughly these things:\n\nData structures to hold specific information (would be strongly typed).\nA way to output the gamestate for the players.  This is completely up in the air, it can be graphical or text based, I don't really care at this point.\nA way to save off game data for the players in something like a database or file system.\nA relatively easy way for me to input information and a 'GO' button which processes the changes and obviously creates a new gamestate.\nThe game would function similar to a board game.\n\nReally nothing out of the ordinary when I look back at that list.  Would this be a fun way to learn Python or should I select another language?","AnswerCount":4,"Available Count":4,"Score":0.2449186624,"is_accepted":false,"ViewCount":823,"Q_Id":2823983,"Users Score":5,"Answer":"Python seems very suitable to your purposes (e.g., pygame and other popular third party extensions make it easy to achieve nice graphics, and you can also choose curses for structured textual I\/O, etc) with the single exception of what you probably mean by \"strongly typed\".\nPython is strongly typed (there is no way you can erroneously use a string for an operation for which an integer is required, and vice versa, for example), but it's dynamic strong typing: each object has a strong type, but names (in the wide sense, including barenames, compound names, items in containers, ...) do not have types -- each name refers to an object, the object has the type, not the name.  You can rebind the name to a different object, and that object may have a different (strong;-) type than whatever object was previously bound to that same name.\nDynamic languages all have this character, even though many go further than Python in \"type laxity\" (\"confusing\" strings and numbers, and different kinds of numbers, while Python distinguishes strings from integers from floating-point numbers, for example) -- Python is quite \"type-picky\"... in the dynamic sense where names, per se, have no types, though;-).","Q_Score":2,"Tags":"python,oop","A_Id":2824031,"CreationDate":"2010-05-13T01:45:00.000","Title":"Idea for a small project, should I use Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do i add SOCKS support to my application? and where can i get the libs?\nany help appreciated thanks","AnswerCount":2,"Available Count":1,"Score":-0.2913126125,"is_accepted":false,"ViewCount":867,"Q_Id":2829637,"Users Score":-3,"Answer":"VC++ has extensive support if you want to try on Windows. \nGoogle \"Windows sockets for beginners msdn\", great info for windows sockets...\nIf linux, try C sockets by beej... Just google beej's guide for sockets...","Q_Score":2,"Tags":"c++,python,c,perl,socks","A_Id":2829664,"CreationDate":"2010-05-13T19:21:00.000","Title":"SOCKS in C\/C++ or another language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using the wxWizard widget in wxPython. Is there any way I could change the text of the next button on a page? Can i change the visibility of the navigation buttons on any page? Can I enable\/disable the navigation buttons?\nI tried looking for answers to these questions on the wxPython site but it doesn't seem to be documented.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":211,"Q_Id":2829993,"Users Score":0,"Answer":"Use wx.FindWindowById(wx.ID_FORWARD) this will return a wxWindow object representing the Next button. Call methods on it. e.g. \nwx.FindWindowById(wx.ID_FORWARD).disable() would disable the Next Button.","Q_Score":0,"Tags":"python,wxpython","A_Id":5441284,"CreationDate":"2010-05-13T20:17:00.000","Title":"Access properties of navigation buttons in wxPython's wxWizard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a simple gtk.TreeView with a gtk.ListStore model and set_reorderable(True), I want to catch the signal\/event emited when the user reorder through drag&drop the list, but the documentation does not help much: \n\"The application can listen to these changes by connecting to the model's signals\"\nSo I tried to connect the model (ListStore) signals... but surprise! ListStore has no signals, so you are dispatched to TreeModel signals, then I tried to connect with the TreeModel \"rows-reordered\" signal with no lucky.\nHow should I catch the list reorder performed by the user?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1654,"Q_Id":2831779,"Users Score":3,"Answer":"There is no way to do that in PyGTK currently.  \"rows-reordered\" is the correct signal, but it is impossible to derive any information from it in PyGTK other than \"somehow reordered\".  In C GTK+ you could use the same signal and get the required information in callback, but not in Python.","Q_Score":1,"Tags":"python,gtk,pygtk,gtktreeview","A_Id":2835863,"CreationDate":"2010-05-14T04:10:00.000","Title":"Catch PyGTK TreeView reorder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was working on a program,that I need to support new additions. Hmmm. Let me give you some background on the program.\nIt is an educational software program that has quizzes for the user to take, just to gain odd knowledge. Now, It currently supports 6 subjects, all organized with directores on the HDD ( i.e. the Science directory is called science. ) and the way you launch the subject to see what quizzes you have to take is by pushing a button on the home screen. \nThis sort of thing prevents easy subject additions. I want to be able to add a subject later on without having to recode the home screen and re organize all the buttons. I would use a Listbox and os.listdir(...), but I was kind of wanting something prettier than a Listbox. I am using Tkinter on Windows. The Python version I am using is 2.6\nIs there a \"fancy\" listbox sort of thing that can be styled to work with the background?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":72,"Q_Id":2853708,"Users Score":0,"Answer":"You can add buttons dynamically just fine, nothing is forcing you into the listbox. That said, I don't know why you care so much about \"prettiness\" since you're using Tkinter, which is very ugly by default.","Q_Score":1,"Tags":"python,tkinter","A_Id":2853858,"CreationDate":"2010-05-17T23:42:00.000","Title":"Automatically support new changes with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I randomly add buttons to a Tkinter GUI? I need it to be able to create a button, then put it anywhere on the window, is this possible? I am using Python 2.6 on Windows.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1244,"Q_Id":2853933,"Users Score":0,"Answer":"There are several options to choose from. For example, you could design on a grid where you have six buttons per row. Then it's just a matter of starting at row 0, incrementing the column for each button. When you get to the last column, reset the column to 0 and increment the row by one.\nAnother option is to use a text widget as the container, and embed your buttons in the text widget with wrapping enabled. With this trick the buttons will fill a row automatically and wrap if the user grows or shrinks the main windows. It's a tiny bit more work, but it works well if that's the behavior you want.","Q_Score":0,"Tags":"python,windows,random,tkinter,button","A_Id":2864899,"CreationDate":"2010-05-18T00:40:00.000","Title":"Randomly add buttons to Tkinter GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to write an app in python to control a motor using serial. This all works in a CLI situation fine and is generally stable. but I was wondering how simple it was to add a GUI on top of this code base?\nI assume there will be more code, but is there a simple way of detecting something like GTK, so it only applied the code when GTK was present?\nAlso, GUI creation in Python in general: is it best to keep as little GUI specifics out of the code and use something like GTK's XML based approach (using gtk.glade.XML() function)? Are there other GUI toolkits that have a similar approach to the Glade \/ XML \/ \"Explode in Code\" approach?\nThanks for any advice.\nAndy","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1570,"Q_Id":2857634,"Users Score":0,"Answer":"I don't recommend doing a GUI in XML. All the XML does is give you a mini language for describing a layout. Why use a mini language when you can have the full power of python?\nAs for detecting GTK, I wouldn't suggest that. Instead, add a command line argument to determine whether to create a GUI or not (eg: myprogram -g). It then becomes easy to create a desktop shortcut or command line alias to start in GUI mode, while still being able to use the command line tool from any terminal.\nYou do, however, want to keep the GUI code separate from the bits that do the real work. Give youself a class that contains all the business logic, then have the GUI and CLI both access this object to do work.","Q_Score":2,"Tags":"python,xml,user-interface,gtk,glade","A_Id":2857711,"CreationDate":"2010-05-18T13:24:00.000","Title":"How can I create a GUI on top of a Python APP so it can do either GUI or CLI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm doing a little program and I want to distribute it using this recipe:\n\nsingle directory with __main__.py in it\nzip this directory and adding a shebang on it #!\/usr\/bin\/env python\nmaking it executable\n\nThe problem is that in this package I have also extra files (I'm using pygtk toolkit and I need images and ui xml files). When I try to access these files I have the error that the resource is unavailable (the path that I'm trying to open is something like file.zip\/gui\/gui.ui ).\nHow can I handle this situation?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2816,"Q_Id":2859413,"Users Score":8,"Answer":"I figured out by myself, It's sufficient to use pkgutil.get_data to access the data inside a package.","Q_Score":4,"Tags":"python,packaging,zipapp","A_Id":2861524,"CreationDate":"2010-05-18T17:06:00.000","Title":"Distributing an executable zip file with __main__.py, how to access extra data?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am about to begin a project where I will likely use PyQt or Pyside.\nI will need to interface with a buggy 3rd party piece of server software that provides C++ and Java APIs.  The Java APIs are a lot easier to use because you get Exceptions where with the C++ libraries you get segfaults.  Also, the Python bindings to the Java APIs are automatic with Jython whereas the Python bindings for the C++ APIs don't exist.\nSo, how would a CPython PyQt client application be able to communicate with these Java APIs?  How would you go about it?\nWould you have another separate Java process on the client that serializes \/ pickles objects and communicates with the PyQt process over a socket?\nI don't want to re-invent the wheel... is there some sort of standard interface for these types of things?  Some technology I should look into?  RPC, Corba, etc?\nThanks,\n~Eric","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1047,"Q_Id":2860650,"Users Score":0,"Answer":"If the criteria is not reinventing the wheel, there is the SimpleXMLRPCServer and xmlrpclib modules available in the standard library. They should work in Jython too.","Q_Score":3,"Tags":"python,qt,pyqt,process,jython","A_Id":2861467,"CreationDate":"2010-05-18T19:58:00.000","Title":"Integrating Jython Cpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Just curious if anyone knows of good sites for learning and understanding PyGame.\nI've programmed a bunch in Python, so I'm well-equipped with that. Just curious if anyone knows a good site or more for learning PyGame.\nThanks for any help!","AnswerCount":7,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":7938,"Q_Id":2865003,"Users Score":0,"Answer":"No one has mentioned this yet as a source of games written in pygame, but check out www.pyweek.org - it's a week-long programming competition featuring games built in python. In many cases they use pygame, though there are other libs such as pyglet and opengl that are used.","Q_Score":13,"Tags":"python,pygame","A_Id":2897004,"CreationDate":"2010-05-19T11:25:00.000","Title":"Best resources for learning PyGame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using cx_Freeze to freeze my python program. On running cx_Freeze, a bunch of PYD files are created, a whole bunch of PYC files are put into a archive named library.zip and a few DLL files are there too.\nCould someone tell me the difference between the PYC and the PYD files?\nWhat's the reason for the PYD files not in the library.zip? \nIs it possible to put the PYD files into the archive as well?\nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3772,"Q_Id":2875530,"Users Score":6,"Answer":"Disclaimer: I haven't used cx_Freeze in awhile......\n.PYD files are DLL machine-code files that contain specific python-required functions. \n.PYC files are .py files that have been compiled into bytecode.\nso PYDs are machine code and PYCs are bytecode\nNow as for why the PYDs aren't in the .zip....I'd imagine it's because those .PYDs are needed by the python interpreter to run the program. What cx_Freeze does is basically this:\n\ncompile all .py files and throw the .pyc files in a zip\nput all needed .pyd files in the zip\ncreate a stub .py file and put it in the output directory\ncopy the python.exe and rename to myprogram.exe\ncopy all .pyd files needed to open the .zip and run the contents\n\nSo you're not actually compiling your python file, you're instead renaming the interpeter and freezing all the source files. \nI hope this helps.","Q_Score":3,"Tags":"python,cx-freeze","A_Id":2875948,"CreationDate":"2010-05-20T15:55:00.000","Title":"cx_Freeze and PYC\/PYD files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a Python application using wxPython and freezing it using cxFreeze. All seems to be going fine apart from this following bit:\nWhen I run the executable created by cxFreeze, a blank console window pops up. I don't want to show it. Is there any way I could hide it? \nIt doesn't seem to be documented on the cxFreeze site and Googling didn't turn up much apart from some similar sorta problems with Py2Exe.\nThanks.","AnswerCount":4,"Available Count":1,"Score":0.1488850336,"is_accepted":false,"ViewCount":18074,"Q_Id":2880316,"Users Score":3,"Answer":"If you're using Windows, you could rename your \"main\" script's extension (that launches the app) to .pyw","Q_Score":31,"Tags":"python,wxpython,cx-freeze","A_Id":2881979,"CreationDate":"2010-05-21T07:37:00.000","Title":"How can I hide the console window when freezing wxPython applications with cxFreeze?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am trying really hard to make a sliding frame containing widgets in tkinter in python. There is this frame inside a big window with different widgets. And as soon as i click on the next button on that frame the frame should slowly slide towards the left and vanish ultimately. As soon as it vanishes, i want new frame with widgets to come sliding towards right. \nWhat should i do? \nAnticipating your suggestions and ideas.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1113,"Q_Id":2882060,"Users Score":0,"Answer":"How you do it depends on the geometry manager, but the basic idea is simply to set the width of the frame to smaller and smaller values until it has a width of zero. You don't need a loop though -- the code is already running in the event loop, so take advantage of that. Use 'after' to schedule a job that changes the width a tiny bit, then reschedules itself for a few milliseconds later.","Q_Score":0,"Tags":"python,user-interface,tkinter,frame,sliding","A_Id":2896537,"CreationDate":"2010-05-21T12:38:00.000","Title":"Creating a sliding frame containing widgets in tkinter in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Could someone show me how I could return a value from a wxPython Frame? When the use clicks close, I popup a message dialog asking him a question. I would like to return the return code of this message dialog to my calling function.\nThanks","AnswerCount":8,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":7486,"Q_Id":2889255,"Users Score":0,"Answer":"I don't think a wxFrame can return a value since it is not modal.  If you don't need to use a wxFrame, then a modal dialog could work for you.  If you really need a frame, I'd consider using a custom event.  \nIt would go something like this:\n(1) User clicks to close the wxFrame\n(2) You override OnClose (or something like that) to pop up a dialog to ask the user a question\n(3) Create and post the custom event\n(4) Close the wxFrame\n(5) Some other code processes your custom event","Q_Score":7,"Tags":"python,wxpython","A_Id":2893253,"CreationDate":"2010-05-22T18:27:00.000","Title":"Return value from wxPython Frame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a working QListView, but from the documentation, I can't figure out how to get a signal to fire with the index of the newly selected item. Any ideas?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":3622,"Q_Id":2911991,"Users Score":1,"Answer":"Imho, an easier way to achieve this would be to use a QListWidget instead of a QListView, this way you could use the itemClicked signal, which sends the selected item to the callback function.","Q_Score":1,"Tags":"python,pyqt4,qlistview","A_Id":2912399,"CreationDate":"2010-05-26T10:16:00.000","Title":"clicked() signal for QListView in PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm rewriting this post to clarify some things and provide a full class definition for the Virtual List I'm having trouble with.  The class is defined like so:\n\nfrom wx import ListCtrl, LC_REPORT, LC_VIRTUAL, LC_HRULES, LC_VRULES, \\\n  EVT_LIST_COL_CLICK, EVT_LIST_CACHE_HINT, EVT_LIST_COL_RIGHT_CLICK, \\\n  ImageList, IMAGE_LIST_SMALL, Menu, MenuItem, NewId, ITEM_CHECK, Frame, \\\n  EVT_MENU\n\nclass VirtualList(ListCtrl):\n  def __init__(self, parent, datasource = None,\n               style = LC_REPORT | LC_VIRTUAL | LC_HRULES | LC_VRULES):\n    ListCtrl.__init__(self, parent, style = style)\n\n    self.columns = []\n    self.il = ImageList(16, 16)\n\n    self.Bind(EVT_LIST_CACHE_HINT, self.CheckCache)\n    self.Bind(EVT_LIST_COL_CLICK, self.OnSort)\n\n    if datasource is not None:\n      self.datasource = datasource\n      self.Bind(EVT_LIST_COL_RIGHT_CLICK, self.ShowAvailableColumns)\n\n      self.datasource.list = self\n\n      self.Populate()\n\n  def SetDatasource(self, datasource):\n    self.datasource = datasource\n\n  def CheckCache(self, event):\n    self.datasource.UpdateCache(event.GetCacheFrom(), event.GetCacheTo())\n\n  def OnGetItemText(self, item, col):\n    return self.datasource.GetItem(item, self.columns[col])\n\n  def OnGetItemImage(self, item):\n    return self.datasource.GetImg(item)\n\n  def OnSort(self, event):\n    self.datasource.SortByColumn(self.columns[event.Column])\n    self.Refresh()\n\n  def UpdateCount(self):\n    self.SetItemCount(self.datasource.GetCount())\n\n  def Populate(self):\n    self.UpdateCount()\n\n    self.datasource.MakeImgList(self.il)\n\n    self.SetImageList(self.il, IMAGE_LIST_SMALL)\n\n    self.ShowColumns()\n\n  def ShowColumns(self):\n    for col, (text, visible) in enumerate(self.datasource.GetColumnHeaders()):\n      if visible:\n        self.columns.append(text)\n        self.InsertColumn(col, text, width = -2)\n\n  def Filter(self, filter):\n    self.datasource.Filter(filter)\n\n    self.UpdateCount()\n\n    self.Refresh()\n\n  def ShowAvailableColumns(self, evt):\n    colMenu = Menu()\n\n    self.id2item = {}\n\n    for idx, (text, visible) in enumerate(self.datasource.columns):\n      id = NewId()\n\n      self.id2item[id] = (idx, visible, text)\n\n      item = MenuItem(colMenu, id, text, kind = ITEM_CHECK)\n      colMenu.AppendItem(item)\n\n      EVT_MENU(colMenu, id, self.ColumnToggle)\n\n      item.Check(visible)\n\n    Frame(self, -1).PopupMenu(colMenu)\n\n    colMenu.Destroy()\n\n  def ColumnToggle(self, evt):\n    toggled = self.id2item[evt.GetId()]\n\n    if toggled[1]:\n      idx = self.columns.index(toggled[2])\n\n      self.datasource.columns[toggled[0]] = (self.datasource.columns[toggled[0]][0], False)\n\n      self.DeleteColumn(idx)\n\n      self.columns.pop(idx)\n\n    else:\n      self.datasource.columns[toggled[0]] = (self.datasource.columns[toggled[0]][0], True)\n\n      idx = self.datasource.GetColumnHeaders().index((toggled[2], True))\n\n      self.columns.insert(idx, toggled[2])\n\n      self.InsertColumn(idx, toggled[2], width = -2)\n\n    self.datasource.SaveColumns()\n\nI've added functions that allow for Column Toggling which facilitate my description of the issue I'm encountering.  On the 3rd instance of this class in my application the Column at Index 1 will not display String values.  Integer values are displayed properly.  If I add print statements to my OnGetItemText method the values show up in my console properly.  This behavior is not present in the first two instances of this class, and my class does not contain any type checking code with respect to value display.\nIt was suggested by someone on the wxPython users' group that I create a standalone sample that demonstrates this issue if I can.  I'm working on that, but have not yet had time to create a sample that does not rely on database access.  Any suggestions or advice would be most appreciated.  I'm tearing my hair out on this one.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1183,"Q_Id":2914816,"Users Score":0,"Answer":"Are you building on the wxPython demo code for virtual list controls? There are a couple of bookkeeping things you need to do, like set the ItemCount property.\nOne comment about your OnGetItemText method: Since there's no other return statement, it will return None if data is None, so your test has no effect.\nHow about return data or \"\" instead?","Q_Score":2,"Tags":"python,wxpython,listctrl","A_Id":2915460,"CreationDate":"2010-05-26T16:17:00.000","Title":"wxPython ListCtrl Column Ignores Specific Fields","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm rewriting this post to clarify some things and provide a full class definition for the Virtual List I'm having trouble with.  The class is defined like so:\n\nfrom wx import ListCtrl, LC_REPORT, LC_VIRTUAL, LC_HRULES, LC_VRULES, \\\n  EVT_LIST_COL_CLICK, EVT_LIST_CACHE_HINT, EVT_LIST_COL_RIGHT_CLICK, \\\n  ImageList, IMAGE_LIST_SMALL, Menu, MenuItem, NewId, ITEM_CHECK, Frame, \\\n  EVT_MENU\n\nclass VirtualList(ListCtrl):\n  def __init__(self, parent, datasource = None,\n               style = LC_REPORT | LC_VIRTUAL | LC_HRULES | LC_VRULES):\n    ListCtrl.__init__(self, parent, style = style)\n\n    self.columns = []\n    self.il = ImageList(16, 16)\n\n    self.Bind(EVT_LIST_CACHE_HINT, self.CheckCache)\n    self.Bind(EVT_LIST_COL_CLICK, self.OnSort)\n\n    if datasource is not None:\n      self.datasource = datasource\n      self.Bind(EVT_LIST_COL_RIGHT_CLICK, self.ShowAvailableColumns)\n\n      self.datasource.list = self\n\n      self.Populate()\n\n  def SetDatasource(self, datasource):\n    self.datasource = datasource\n\n  def CheckCache(self, event):\n    self.datasource.UpdateCache(event.GetCacheFrom(), event.GetCacheTo())\n\n  def OnGetItemText(self, item, col):\n    return self.datasource.GetItem(item, self.columns[col])\n\n  def OnGetItemImage(self, item):\n    return self.datasource.GetImg(item)\n\n  def OnSort(self, event):\n    self.datasource.SortByColumn(self.columns[event.Column])\n    self.Refresh()\n\n  def UpdateCount(self):\n    self.SetItemCount(self.datasource.GetCount())\n\n  def Populate(self):\n    self.UpdateCount()\n\n    self.datasource.MakeImgList(self.il)\n\n    self.SetImageList(self.il, IMAGE_LIST_SMALL)\n\n    self.ShowColumns()\n\n  def ShowColumns(self):\n    for col, (text, visible) in enumerate(self.datasource.GetColumnHeaders()):\n      if visible:\n        self.columns.append(text)\n        self.InsertColumn(col, text, width = -2)\n\n  def Filter(self, filter):\n    self.datasource.Filter(filter)\n\n    self.UpdateCount()\n\n    self.Refresh()\n\n  def ShowAvailableColumns(self, evt):\n    colMenu = Menu()\n\n    self.id2item = {}\n\n    for idx, (text, visible) in enumerate(self.datasource.columns):\n      id = NewId()\n\n      self.id2item[id] = (idx, visible, text)\n\n      item = MenuItem(colMenu, id, text, kind = ITEM_CHECK)\n      colMenu.AppendItem(item)\n\n      EVT_MENU(colMenu, id, self.ColumnToggle)\n\n      item.Check(visible)\n\n    Frame(self, -1).PopupMenu(colMenu)\n\n    colMenu.Destroy()\n\n  def ColumnToggle(self, evt):\n    toggled = self.id2item[evt.GetId()]\n\n    if toggled[1]:\n      idx = self.columns.index(toggled[2])\n\n      self.datasource.columns[toggled[0]] = (self.datasource.columns[toggled[0]][0], False)\n\n      self.DeleteColumn(idx)\n\n      self.columns.pop(idx)\n\n    else:\n      self.datasource.columns[toggled[0]] = (self.datasource.columns[toggled[0]][0], True)\n\n      idx = self.datasource.GetColumnHeaders().index((toggled[2], True))\n\n      self.columns.insert(idx, toggled[2])\n\n      self.InsertColumn(idx, toggled[2], width = -2)\n\n    self.datasource.SaveColumns()\n\nI've added functions that allow for Column Toggling which facilitate my description of the issue I'm encountering.  On the 3rd instance of this class in my application the Column at Index 1 will not display String values.  Integer values are displayed properly.  If I add print statements to my OnGetItemText method the values show up in my console properly.  This behavior is not present in the first two instances of this class, and my class does not contain any type checking code with respect to value display.\nIt was suggested by someone on the wxPython users' group that I create a standalone sample that demonstrates this issue if I can.  I'm working on that, but have not yet had time to create a sample that does not rely on database access.  Any suggestions or advice would be most appreciated.  I'm tearing my hair out on this one.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1183,"Q_Id":2914816,"Users Score":0,"Answer":"There's a problem with the native object in Windows.  If GetImg returns None instead of -1 the list has a problem with column 1 for some reason.  That from Robin over on the Google Group post for this issue.","Q_Score":2,"Tags":"python,wxpython,listctrl","A_Id":2954639,"CreationDate":"2010-05-26T16:17:00.000","Title":"wxPython ListCtrl Column Ignores Specific Fields","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a window with 2 QTableWidgets, having their scrolling synchronized.\nThe 1st one usually has horizontal scroll, while the 2nd usually (automatically) not.\nIn order for them to show consistent data (row against row) I make the 2nd have the scroll (through property HorizontalScrollBar -> AlwaysOn).\nBut sometimes the 1st table doesn't have the scroll. What's event worse, it may have it or not depending on the window size (when making window wider the scroll disappears). As far as I see there's no signal for resize of window or control (widget).\nI can, of course, use some constantly running timer to check if 1st table has scroll, but I wounder if there's more pure solution.\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":695,"Q_Id":2916052,"Users Score":0,"Answer":"The answer was to reimplement the resizeEvent and check table.horizontalScrollBar().isVisible()","Q_Score":0,"Tags":"python,pyqt4","A_Id":3012347,"CreationDate":"2010-05-26T19:20:00.000","Title":"Track window\/control resize in PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application that displays some HTML in a QWebview, which references images on the local file system. This works fine directly running the python. When compiling via py2exe, the images no longer load. Google doesn't seem to know the answer, any ideas?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1402,"Q_Id":2924781,"Users Score":2,"Answer":"Only png support is native, jpg (and others) is supplied via plugins.\nDon't recall the exact paths (and I don't know your platform) but search for the PyQt plugins folder and:\n\nCopy the plugins folder to: $yourprogram\/PyQt4\/plugins (along with qt.conf)\nEdit qt.conf, and change prefix to $yourprogram\/PyQt4\n\nYou might also need to convince py2exe to also include this folder (verbatim).","Q_Score":1,"Tags":"python,pyqt4,py2exe,qwebview","A_Id":2925711,"CreationDate":"2010-05-27T20:46:00.000","Title":"Images not loading in QWebview in PyQt4 in py2exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am writing a wxPython application that remains open after closing all of its windows - so you can still drag & drop new files onto the OSX dock icon (I do this with myApp.SetExitOnFrameDelete(False)).\nUnfortunately if I close all the windows, the OSX menubar will only contain a \"Help\" menu. I would like to add at least a File\/Open menu item, or just keep the menubar of the main window. Is this somehow possible in wxPython?\nIn fact, I would be happy with a non-wxPython hack as well (for example, setting the menu in pyobjc, but running the rest of the GUI in wxPython). wxPython development in OSX is such a hack anyway ;)\nUPDATE: I managed to solve this problem using the tip from Lyndsey Ferguson. Here's what I have done:\n\nOn startup I create a window which I show and hide immediately. I set its position to (-10000,-10000) so that it does not flicker on the screen (aargh, what a dirty hack!)\nI create an empty EVT_CLOSE event handler in that window so that it cannot be closed.\nIt seems that destroying a window resets the OSX menu, but hiding does not... So when the last window is closed, I need to show and hide this window again (hiding is necessary so that the user cannot switch to this window using the Window menu or Cmd-`)\n\nYeah, this is really ugly... I will be very grateful if someone comes up with a prettier solution.\nUPDATE 2: Actually it can be solved in a much easier way: if we do not close the last window, only hide it. And ensure that it does not respond to menu events anymore.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1471,"Q_Id":2934435,"Users Score":1,"Answer":"Can you create a hidden window that is offscreen somewhere? It is a hack, but I remember having to do a lot of hacks to make my wxPython-based application work correctly on Mac OS X.\nNote:You'll have to disable the close button and set up that hidden window so that it doesn't show up in the Window menu.\nAside:Have you considered factoring out your GUI portion of your Python application and using PyObjC on Mac OS X? You'll get more native behaviours...","Q_Score":5,"Tags":"python,macos,wxpython,pyobjc","A_Id":2958571,"CreationDate":"2010-05-29T09:02:00.000","Title":"How to change the OSX menubar in wxPython without any opened window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have a QWebview in a grid layout, along with other widgets. When the user resizes the window, the QWebview doesn't resize, but the other widgets do. How can I make the QWebview resize correctly?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1113,"Q_Id":2938874,"Users Score":0,"Answer":"in the dialog class's resizeEvent, one that extends QDialog, call webView->setGeometry, and this->resize, this->update.\nhint: check if size changed via the QResizeEvent *ptr","Q_Score":0,"Tags":"python,grid,resize,pyqt4,qwebview","A_Id":6977293,"CreationDate":"2010-05-30T13:51:00.000","Title":"PyQT4 QWebView not resizing correctly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a media player. Right now it's a simple window with a button to load .wav files. The problem is I would like to implement a pause button now. But, when playing a audio file the GUI isn't accessible again (no buttons can be pushed) till the file is done playing. How can I make the GUI dynamic while an audio file is playing? \nI'm using PyAudio, and their implementation doesn't allow this.","AnswerCount":3,"Available Count":1,"Score":0.2605204458,"is_accepted":false,"ViewCount":3328,"Q_Id":2939224,"Users Score":4,"Answer":"Probably you have to use threads for that. You have to play your audio file in a different thread than the gui mainloop so that the GUI keeps responding user input.\nIMHO, wxpython is not so complicated and has some utility functions that would help to do what you want. Check the wxpython demo, you have several examples there.","Q_Score":0,"Tags":"python,tkinter,media,pyaudio,audio-player","A_Id":2939414,"CreationDate":"2010-05-30T15:30:00.000","Title":"Python\/Tkinter Audio Player","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a small script in python with ttk and I have a problem where a function runs where it shouldn't. The button code looks as follows:\n\nbtReload = ttk.Button(treeBottomUI, text=\"Reload\", width=17, command=loadModelTree(treeModel))\nbtReload.pack(side=\"left\")\n\nand the function is as this:\n\ndef loadModelTree(tree):\n    print (\"Loading models...\")\n    allModels = os.listdir(confModPath)\n    for chunk in allModels:\n        ...\n\nFor some reason, the function runs without the button being pressed. Why?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":3407,"Q_Id":2947817,"Users Score":2,"Answer":"Markus, yes, that's the right solution, but it is not because you can't use multi-argument commands in widget callouts. Consider, in your original code, ...command=loadModelTree(treeModel)... is an invocation of the method. Lambda allows you to abstract the command so you can have an arbitrary number of arguments without confusing the interpreter by invoking it, e.g., ...command=lambda arg1=myarg1, arg2=myarg2, arg3=myarg3: myCallout(arg1, arg2, arg3)....\nI hope that makes what is going on a bit clearer.","Q_Score":1,"Tags":"python,function,button,ttk","A_Id":11642028,"CreationDate":"2010-06-01T06:58:00.000","Title":"Python ttk.Button -command, runs without button being pressed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a small script in python with ttk and I have a problem where a function runs where it shouldn't. The button code looks as follows:\n\nbtReload = ttk.Button(treeBottomUI, text=\"Reload\", width=17, command=loadModelTree(treeModel))\nbtReload.pack(side=\"left\")\n\nand the function is as this:\n\ndef loadModelTree(tree):\n    print (\"Loading models...\")\n    allModels = os.listdir(confModPath)\n    for chunk in allModels:\n        ...\n\nFor some reason, the function runs without the button being pressed. Why?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":3407,"Q_Id":2947817,"Users Score":1,"Answer":"Well, as I found the answer, I'll answer my own question.\nIt appers that ttk.button commands does not support sending arguments to functions so the work around is to do as follows:\n\nbtReload = ttk.Button(treeBottomUI, text=\"Reload\", width=17, command=lambda i=treeModel: loadModelTree(i))\nbtReload.pack(side=\"left\")\n\nSimple as pie!","Q_Score":1,"Tags":"python,function,button,ttk","A_Id":2947926,"CreationDate":"2010-06-01T06:58:00.000","Title":"Python ttk.Button -command, runs without button being pressed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to print the contents of a python tkinter canvas.  I have tried using the postscript method of canvas to create a postscript file, but I get a blank page.  I know this is because I have embedded widgets, and these do not get rendered by the postscript method.\nBefore I rewrite my program to create a more printer-friendly layout, can someone suggest a way to approach this problem?  All of the programming books I have ever read approach the problem of sending output to a printer with a bit of hand-waving, something along the lines of:  \"It's a difficult problem that depends on interacting with the operating system.\"  I also have a hard time finding resources about this because of all the pages related to printing to the screen.\nI am using Python 2.6, on Ubuntu 9.04.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5306,"Q_Id":2951530,"Users Score":0,"Answer":"I think your butting up to the limits of Tkinter. If not for the widgets, another method is to draw the same image on a PIL image-draw object as the two have similar APIs.\nA hacky workaround would be to programatically take a screen grab of the window area you want using ImageGrab in PIL.\nwxPython is a decent alternative. Personally I prefer Qt, it certainly has excellent printer support. Also the Graphics View framework is outstanding.","Q_Score":5,"Tags":"python,printing,tkinter","A_Id":3214960,"CreationDate":"2010-06-01T16:29:00.000","Title":"Printing python tkinter output","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm going to start on a long (~1-year) programming project in Python. I want to use wxPython for my GUI (supports 2.6), but I also want to use 3.1 for the rest of the project (to start using the 3.x syntax).\nIs there any way for me to design a project that mixes 2.x and 3.x modules? Or should I just bite the bullet and use either 2.x (preferred, since I really want to learn wxPython) or 3.x throughout?\nThanks,\nMike","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":4940,"Q_Id":2951982,"Users Score":3,"Answer":"Python 2 and 3 are not that different. If you have learned Python 2 well, it will be a matter of minutes to get acquainted with Python 3. The official recommendation says that you should use Python 2.6 (the current version) and try to be forward-compatible. Python 3 is currently not an option for large projects as virtually none of the popular packages have been translated yet. But development of Python 2 and 3 will continue in parallel for a long time, so you won't lose much by not using Python 3. You can import many syntactical features of 3 (Unicode string literals, division, print function, absolute imports) using the __future__ module, and the standard library remains mostly the same. So I'd recommend using Python 2.","Q_Score":5,"Tags":"python,python-3.x,python-2.x","A_Id":2952037,"CreationDate":"2010-06-01T17:43:00.000","Title":"Can one Python project use both 2.x and 3.x code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm going to start on a long (~1-year) programming project in Python. I want to use wxPython for my GUI (supports 2.6), but I also want to use 3.1 for the rest of the project (to start using the 3.x syntax).\nIs there any way for me to design a project that mixes 2.x and 3.x modules? Or should I just bite the bullet and use either 2.x (preferred, since I really want to learn wxPython) or 3.x throughout?\nThanks,\nMike","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":4940,"Q_Id":2951982,"Users Score":2,"Answer":"mixing the ability to use wxPython (2.x) + with learning new syntax (3.x) \n\nDon't \"mix\".\nWrite Python 2.  Get it to work.\nPlay with Python 3 separately.  Don't \"mix\".\nWhen the various packages and modules are available in Python 3, use the 2to3 conversion to create Python 3.  You'll find some small problems.  Fix your Python 2 so that your package works in Python 2 and also works after the conversion.\nThen, you can drop support for Python 2 and focus on Python 3.  \nDon't \"mix\".","Q_Score":5,"Tags":"python,python-3.x,python-2.x","A_Id":3026057,"CreationDate":"2010-06-01T17:43:00.000","Title":"Can one Python project use both 2.x and 3.x code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a signal that is emitted when a window\/dialog is presented in GTK+?\nExample: when issuing this command to the GTK widget dialog:\ndialog.present()\nis there a resulting signal?  Or is there any signal that denotes the \"showing\" of a window\/dialog?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":317,"Q_Id":2954412,"Users Score":1,"Answer":"I believe the \"show\" signal (inherited from Widget) will do this.","Q_Score":0,"Tags":"python,c,gtk","A_Id":2954934,"CreationDate":"2010-06-02T01:16:00.000","Title":"gtk+ signal emitted when window\/dialog is \"presented\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable. \nThe functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing\/exotic things.\nSeems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that:\n\nIs easy to learn and maintain\nCan be cleanly packaged using py2exe or something similar\nLooks nice\n\n[Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute.","AnswerCount":5,"Available Count":4,"Score":0.1194272985,"is_accepted":false,"ViewCount":4853,"Q_Id":2962194,"Users Score":3,"Answer":"The most beautiful one that I can suggest is PyQt (almost native), otherwise a good idea would be using directly IronPython that is native .net code.\nAnyway nothing beats tkinter for multi-platformness and packaging-friendliness.","Q_Score":3,"Tags":"python,user-interface,wxpython,tkinter","A_Id":2962443,"CreationDate":"2010-06-02T22:54:00.000","Title":"Python: Attractive, clean, packagable windows GUI library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable. \nThe functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing\/exotic things.\nSeems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that:\n\nIs easy to learn and maintain\nCan be cleanly packaged using py2exe or something similar\nLooks nice\n\n[Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":4853,"Q_Id":2962194,"Users Score":1,"Answer":"From using both wxPython and TKinter, I'd say wxPython looks nicer and is easy to learn.\nAlthough you said you are planning on using the program for Windows, it's worth mentioning that I've had problems with TKinter on Mac not working correctly.","Q_Score":3,"Tags":"python,user-interface,wxpython,tkinter","A_Id":2962216,"CreationDate":"2010-06-02T22:54:00.000","Title":"Python: Attractive, clean, packagable windows GUI library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable. \nThe functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing\/exotic things.\nSeems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that:\n\nIs easy to learn and maintain\nCan be cleanly packaged using py2exe or something similar\nLooks nice\n\n[Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":4853,"Q_Id":2962194,"Users Score":1,"Answer":"I've used wxPython in the past (For Mac\/Windows deployments). It has worked good. And it looks nicer than Tk :)","Q_Score":3,"Tags":"python,user-interface,wxpython,tkinter","A_Id":2962200,"CreationDate":"2010-06-02T22:54:00.000","Title":"Python: Attractive, clean, packagable windows GUI library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable. \nThe functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing\/exotic things.\nSeems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that:\n\nIs easy to learn and maintain\nCan be cleanly packaged using py2exe or something similar\nLooks nice\n\n[Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute.","AnswerCount":5,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":4853,"Q_Id":2962194,"Users Score":3,"Answer":"tkinter's major advantage (IMHO!) is that it comes with Python (at least on Windows). It looks ugly, and there's no progress bar or something like that (at least not builtin). Being a thin wrapper around Tk, its API doesn't feel very elegant or intuitive. However, there are quite a few good Tkinter resources on the web so learning it is not necessarily a pain.\nFor any serious GUI attempts, I'd go for wxPython as well. I don't know about packaging, though. But I wouldn't expect any problems.","Q_Score":3,"Tags":"python,user-interface,wxpython,tkinter","A_Id":2962228,"CreationDate":"2010-06-02T22:54:00.000","Title":"Python: Attractive, clean, packagable windows GUI library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble?\nI know C++ gives better performance, but for just learning can I go wrong with PyOpenGL?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3573,"Q_Id":2962571,"Users Score":13,"Answer":"With the caveat that I have done very little OpenGL programming myself, I believe that for the purposes of learning, PyOpenGL is a good choice.  The main reason is that PyOpenGL, like most other OpenGL wrappers, is just that: a thin wrapper around the OpenGL API. \nOne large benefit of PyOpenGL is that while in C you have to worry about calling the proper glVertex3{dfiX} command, Python allows you to just write glVertex3(x,y,z) without worrying about telling Python what type of argument you passed in.  That might not sound like a big deal, but it's often much simpler to use Python's duck-typing instead of being overly concerned with static typing.\nThe OpenGL methods are almost completely all wrapped into Python methods, so while you'll be writing in Python, the algorithms and method calls you'll use are identical to writing OpenGL in any other language.  But since you're writing in Python, you'll have many fewer opportunities to make \"silly\" mistakes with proper pointer usage, memory management, etc. that would just eat up your time if you were to study the API in C or C++, for instance.","Q_Score":9,"Tags":"python,graphics,pyopengl","A_Id":2962599,"CreationDate":"2010-06-03T00:28:00.000","Title":"Is PyOpenGL a good place to start learning opengl programming?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble?\nI know C++ gives better performance, but for just learning can I go wrong with PyOpenGL?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3573,"Q_Id":2962571,"Users Score":0,"Answer":"PyOpenGL\n\nI don't think it is a good choice. In my opinon in C\/C++ it is easier to play around around with your OpenGL code - start with simple app, then add shader, then add some geometry functions, make a texture\/geometry generator, build scene via CSG, etc. You know - to have fun, play around with code, experiment and learn something in process. I honestly just don't see myself doing this in python. Surely it is possible to do OpenGL programming in Python, but I see no reason to actually do it. Plus several OpenGL functions take memory pointers as arguments, and although there probably a class (or dozen of alternatives) for that case, I don't see a reason to use them when a traditional way of doing things is available in C\/C++, especially when I think about amount of wrappers python code uses to pass vector or array of those into OpenGL function. It just looks like making things more complicated without a real reason to do that. Plus there is a noticeable performance drop, especially when you use \"RAW\" OpenGL.\nBesides, if you're going to make games, it is very likely that you'll have to use C++ or some other \"non-python\" language.\nP.S. I've done enough OpenGL programming, a lot of DirectX programming, but I specialize on C++, and use python only for certain algorithmic tests, tools and scripts.","Q_Score":9,"Tags":"python,graphics,pyopengl","A_Id":2963034,"CreationDate":"2010-06-03T00:28:00.000","Title":"Is PyOpenGL a good place to start learning opengl programming?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a toolbar using wxpython and I want to put the Quit button on the right side of it, I don't want to put them sequencially.\nIs it possible to define this position?\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":292,"Q_Id":2964108,"Users Score":0,"Answer":"If you add the quit button last, it will be on the right side.","Q_Score":0,"Tags":"python,button,wxpython,toolbar,position","A_Id":3172009,"CreationDate":"2010-06-03T07:47:00.000","Title":"Is it possible to put a toolbar button on the right side of it using wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am streaming some data down from a webcam. When I get all of the bytes for a full image (in a string called byteString) I want to display the image using OpenCV. Done fast enough, this will \"stream\" video from the webcam to an OpenCV window.\nHere's what I've done to set up the window:\ncvNamedWindow('name of window', CV_WINDOW_AUTOSIZE)\nAnd here's what I do when the byte string is complete:\nimg = cvCreateImage(IMG_SIZE,PIXEL_DEPTH,CHANNELS)\nbuf = ctypes.create_string_buffer(byteString)\nimg.imageData = ctypes.cast(buf, ctypes.POINTER(ctypes.c_byte))\ncvShowImage('name of window', img)\ncvWaitKey(0)\nFor some reason this is producing an error:\nFile \"C:\\Python26\\lib\\site-packages\\ctypes_opencv\\highgui_win32.py\", line 226, in execute\n     return func(*args, **kwargs)\nWindowsError: exception: access violation reading 0x015399E8\nDoes anybody know how to do what I'm trying to do \/ how to fix this crazy violation error?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1712,"Q_Id":2970207,"Users Score":2,"Answer":"I actually solved this problem and forgot to post the solution. Here's how I did it, though it may not be entirely robust:\nI analyzed the headers coming from the MJPEG of the network camera I was doing this to, then I just read from the stream 1 byte at a time, and, when I detected that the header of the next image was also in the bytestring, I cut the last 42 bytes off (since that's the length of the header).\nThen I had the bytes of the JPEG, so I simply created a new Cv Image by using the open(...) method and passing it the byte string wrapped in a StringIO class.","Q_Score":3,"Tags":"python,string,image,opencv,byte","A_Id":2980849,"CreationDate":"2010-06-03T22:20:00.000","Title":"from string of bytes to OpenCV's IplImage in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is NetBeans recommended for developing a GUI for a Python app?  \nDoes it have a form\/screen builder for Python apps, like Dabo?","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":11421,"Q_Id":2971094,"Users Score":2,"Answer":"I haven't seen a built-in GUI builder for CPython.  You could use Jython + Matisse (the built-in Netbeans Java-based GUI builder).","Q_Score":5,"Tags":"python,netbeans","A_Id":2971227,"CreationDate":"2010-06-04T02:15:00.000","Title":"Using NetBeans for Python GUI development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have downloaded the zip archive (my only option) and installed it as suggested by unzipping into the dropin folder. When I try to start a project the problem occurs:\n\"Plug-in org.python.pydev was unable to load class org.python.pydev.ui.wizard.project.PythonProjectWizard\"\nI've googled and the only suggestion is to re-download and re-install as it might be a corrupted install. Done that, no good. Any more suggestions? Seems PyDev have a lot of troubles getting the zip alternative to work... (judging by other similar posts)\nThis is regardless of Eclipse version.\nI run under WinXP.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3435,"Q_Id":2972696,"Users Score":0,"Answer":"I had no luck with this. Eventually I had to download it through Eclipse download manager and it worked. I guess they have some issues with the automatic plugin functionality.","Q_Score":2,"Tags":"python,eclipse,eclipse-plugin,pydev","A_Id":3211758,"CreationDate":"2010-06-04T08:58:00.000","Title":"PyDev problem staring project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Logitech G15 keyboard. It has a screen. Can i program this? I googled it but the one site i found didn't work.. It seems like it is possible, but i cannot grasp how.\nThanks!\nThis site is truly great.","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":977,"Q_Id":2976446,"Users Score":6,"Answer":"I believe the G15 comes with an SDK. You could use that along with the ctypes module to call into the supplied DLLs. Otherwise, I imagine you'd have to use something like Swig or Boost.Python to make a Python module for the G15 from the SDK.","Q_Score":3,"Tags":"python,logitech,g15","A_Id":2976466,"CreationDate":"2010-06-04T17:36:00.000","Title":"Is Python programming for Logitech G15 possible?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"By just adding a datagridview in IronPython Studio it triggers a\n\"DataGridView' object has no attribute 'BeginInit'\". Is there a fix for this? \nThe errors are gone if the lines self._DataGridView1.BeginInit()   and self._DataGridView1.EndInit() are deleted, but that's not what it should be done to fix that","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":773,"Q_Id":2976803,"Users Score":2,"Answer":"There's no fix for this and there's likely not to be one because IronPython Studio isn't supported anymore.  DataGridView.BeginInit is implemented explicitly and IronPython Studio is based upon IronPython 1.1.  You might be able to work around with it by changing that to \"ISupportInitialize.BeginInit(self._DataGridView1)\" after importing ISupportInitialize but I doubt it'll survive round tripping through the designer.\nIf you wanted to fix this yourself the source for IronPython Studio is available and you could try modifying the winforms designer code to notice the explicit interface implementation call and emit this code instead.  That's likely just fixing IronPython's CodeDom generator.\nBut really I'd advise you to move to IronPython Tools and WPF.  Generating code for the WinForms designer doesn't really work that well with IronPython and WPF is much more suitable.  An alternate plan would be to generate the WinForm w\/ the designer in C# and subclass it from Python.","Q_Score":1,"Tags":".net,winforms,ironpython,ironpython-studio","A_Id":2978656,"CreationDate":"2010-06-04T18:37:00.000","Title":"Adding a DataGridView in IronPython Studio Winforms gets a \"'DataGridView' object has no attribute 'BeginInit'\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a dense set of points in the plane. I want them colored so that points that are close to each other have the same color, and a different color if they're far away. For simplicity assume that there are, say, 5 different colors to choose from. Turns out I've not the slightest idea how to do that ..\nI'm using Tkinter with Python, by the way","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":270,"Q_Id":2979697,"Users Score":0,"Answer":"I'd start with identifying the concentrations of the spots in the plane. Find the centers of those agglomerations and assign them each unique color. Then for other spots you could simply calculate the color using the linear principle. For example, if one center is red and the other is yellow, a point somewhere in the middle would become orange.\nI'd probably use some exponential function instead of a linear principle. This will keep the point groups more or less of the same color only giving a noticeable color change to far away points, or, to be more exact, to far away and somewhere in between points.","Q_Score":4,"Tags":"python,geometry,tkinter","A_Id":2979705,"CreationDate":"2010-06-05T08:31:00.000","Title":"Coloring close points","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a dense set of points in the plane. I want them colored so that points that are close to each other have the same color, and a different color if they're far away. For simplicity assume that there are, say, 5 different colors to choose from. Turns out I've not the slightest idea how to do that ..\nI'm using Tkinter with Python, by the way","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":270,"Q_Id":2979697,"Users Score":0,"Answer":"One approach is to go through your points and partition them into sets with a \"center\". Since you have 5 colours, you'll have 5 sets. You compare the distance of the new point from each of the centers and then put it in the same group as the closest one.\nEach set corresponds to a different colour so you can just plot it after this partitioning is done.","Q_Score":4,"Tags":"python,geometry,tkinter","A_Id":2979707,"CreationDate":"2010-06-05T08:31:00.000","Title":"Coloring close points","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm attempting to write a Python wrapper for poker-eval, a c static library. All the documentation I can find on ctypes indicates that it works on shared\/dynamic libraries. Is there a ctypes for static libraries?\nI know about cython, but should I use that or recompile the poker-eval into a dynamic library so that I can use ctypes?\nThanks,\nMike","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":12127,"Q_Id":2983649,"Users Score":1,"Answer":"I can't say for sure there are no modules out there, but the advantages of dynamic libraries (uses less space, can update without recompiling dependent programs) are such that you're probably better off doing just that.","Q_Score":16,"Tags":"python,static-libraries,ctypes","A_Id":2983728,"CreationDate":"2010-06-06T09:03:00.000","Title":"ctypes for static libraries?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"The substance of an app is more important to me than its apperance,  yet GUI always seems to dominate a disproportionate percentage of programmer time, development and target resource requirements\/constraints.\nIdeally I'd like an application architecture that will permit me to develop an app\nusing a lightweight reference GUI\/kit and focus on non gui aspects to produce \na quality app which is GUI enabled\/friendly.\nI would want APP and the GUI to be sufficiently decoupled to maximize the ease \nfor you GUI experts to plug the app into to some target GUI design\/framework\/context.\ne.g. targets such as: termcap GUI, web app GUI framework, desktop GUI, thin client GUI.  \nIn short: How do I mostly ignore the GUI, but avoid painting you into a corner when I don't even know who you are yet?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":141,"Q_Id":2991910,"Users Score":3,"Answer":"Write a core library that handles the functionality and provides hooks for progress notification. Then write the interfaces as separate applications or libraries that use the core library.","Q_Score":2,"Tags":"python,user-interface,portability","A_Id":2991933,"CreationDate":"2010-06-07T17:58:00.000","Title":"How to ignore GUI as much as possible without rendering APP less GUI developer friendly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed VS2010 and IronPython tools. When I start a VB.NET WPFProject everything works fine. But when I start a WPF IronPython project, it creates a button by default which fills all the window, and when you try to add an event to that control or another control dragged from the toolbox, you just cant do it. You double click on them, but the event is never added to the sourcecode. Anyone had this problem?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":355,"Q_Id":2996854,"Users Score":3,"Answer":"Currently we don't have support for double clicking and adding an event handler.  For the time being you'll need to wire it up by hand.  We are going to spend some time on improving the designer experience so that this should eventually work.","Q_Score":1,"Tags":".net,wpf,visual-studio-2010,ironpython","A_Id":3000618,"CreationDate":"2010-06-08T11:29:00.000","Title":"Cant add events for controls in WPF IronPython VS2010","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I make a simple clipboard monitor in Python using the PyGTK GUI?\nI found gtk.clipboard class and but I couldn't find any solution to get the \"signals\" to trigger the event when the clipboard content has changed.\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1505,"Q_Id":3005522,"Users Score":4,"Answer":"Without a proper notification API, such as WM_DrawClipboard messages, you would probably have to resort to a polling loop.  And then you will cause major conflicts with other apps that are trying to use this shared resource.\nDo not resort to a polling loop.","Q_Score":6,"Tags":"python,clipboard,pygtk,monitor","A_Id":3010018,"CreationDate":"2010-06-09T11:54:00.000","Title":"PyGTK: how to make a clipboard monitor?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want get the details of the wave such as its frames into a array of integers.\nUsing fname.getframes we can ge the properties of the frame and save in list or anything for writing into another wav or anything,but fname.getframes gives information not in integers some thing like a \"\/xt\/x4\/0w' etc..\nBut i want them in integer so that would be helpful for manupation and smoothening join of 2 wav files","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":660,"Q_Id":3021046,"Users Score":0,"Answer":"NumPy can load the data into arrays for easy manipulation. Or SciPy. I forget which.","Q_Score":1,"Tags":"python,wav","A_Id":3021073,"CreationDate":"2010-06-11T07:45:00.000","Title":"wav file manupalation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a list of Project objects, that I display in a GtkTreeView. I am trying to open a dialog with a Project's details when the user double-clicks on the item's row in the TreeView. \nRight now I get the selected value from the TreeView (which is the name of the Project) via get_selection(), and search for that Project by name in my own list to corelate the selection with my own model.\nHowever, this doesn't feel quite right (plus, it assumes that a Project's name is unique), and I was wondering if there is a more elegant way of doing it.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":296,"Q_Id":3032905,"Users Score":1,"Answer":"What I ended up doing was extending gtk.ListStore and use my custom list. I also hijacked the append() method so that not only it will append a [str, str, etc] into the ListStore, but also the actual model inside a custom list property of the class that extends ListStore.\nThen, when the user double clicks the row, I fetch the requested model by the row's index in the ListStore, which corresponds to the model's index in the custom list.","Q_Score":1,"Tags":"python,pygtk,gtktreeview","A_Id":3056761,"CreationDate":"2010-06-13T16:09:00.000","Title":"How to correlate gtk.ListStore items with my own models","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When you write an application using Qt, can it just be run right away in different operating systems? And (correct me if I'm wrong) you don't need to have Qt already installed in all of the different platforms where you want to execute your application?\nHow exactly does this work? Does Qt compile to the desired platform, or does it bundle some \"dlls\" (libs), or how does it do it? Is it different from programming a Java application,  that runs cross-platform.\nIf you use Python to write a Qt application with Python bindings, does your end user need to have Python installed?","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":3747,"Q_Id":3045745,"Users Score":15,"Answer":"Qt (ideally) provides source compatibility, not binary compatibility.  You still have to compile the application separately for each platform, and use the appropriate dynamic Qt libraries (which also need to be compiled separately, and have some platform-specific code).  \nFor your final question, the user would need Python, the Qt libraries, and the binding library (e.g. pyqt), but there are various ways to bundle these.","Q_Score":13,"Tags":"python,qt","A_Id":3045754,"CreationDate":"2010-06-15T13:49:00.000","Title":"How does Qt work (exactly)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I force a GTK window object to stay the same size, even when a table inside of it tries to expand?  \nI've tried using gtk.SHRINK when attaching children to the table, but the TextViews within the table still keep expanding to way beyond an acceptable width and expanding the window along with it.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":6353,"Q_Id":3047582,"Users Score":0,"Answer":"Text views won't expand if you pack them into a gtk.ScrolledWindow.  This is not what you directly asked, but I believe should solve your problem in a better way.","Q_Score":1,"Tags":"python,pygtk","A_Id":3048270,"CreationDate":"2010-06-15T17:41:00.000","Title":"How to force GTK window to stay at a certain width, even when widgets try to expand?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it \"virtual\", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":762,"Q_Id":3074175,"Users Score":0,"Answer":"One thing you might do is leave the sub-nodes empty, and catch the expand-node event. Then you check to see if the node's sub-nodes are populated. If they aren't, you add them before expanding the node. If they are populated, you simply ignore the event.","Q_Score":0,"Tags":"python,wxpython,virtual,listctrl,treecontrol","A_Id":3074866,"CreationDate":"2010-06-19T03:15:00.000","Title":"wxPython: VirtualTreeListCtrl with millions of items","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it \"virtual\", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":762,"Q_Id":3074175,"Users Score":0,"Answer":"You're right that the treemixin doesn't make the TreeListCtrl really virtual. I thought about that when I was developing treemixin, but the one thing I didn't know how to solve was how to know which lines to draw to the left of items when the user is looking at items deep down the tree, e.g. 10000 to 10030. If you know of a solution for that I'll gladly adapt treemixin.\nFrank\nAuthor treemixin","Q_Score":0,"Tags":"python,wxpython,virtual,listctrl,treecontrol","A_Id":3074875,"CreationDate":"2010-06-19T03:15:00.000","Title":"wxPython: VirtualTreeListCtrl with millions of items","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it \"virtual\", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":762,"Q_Id":3074175,"Users Score":0,"Answer":"I think what I'll do is use a virtual ListCtrl along with a skip-list for the data model. Initially, the data model will contain the 1 million top-layer nodes. When a node is expanded, I can insert its children into the skip-list in log time (much better than the linear time for an array). I will indent the names of the children in the ListCtrl so that you can visually tell who their parent is. I think the log search time for the skip-list (as opposed to instant random-access time for an array) will be fast enough to handle the user's scrolling. If someone has a better suggestion, please let me know. I will provide an update in the future as to whether my idea worked or not.","Q_Score":0,"Tags":"python,wxpython,virtual,listctrl,treecontrol","A_Id":3087197,"CreationDate":"2010-06-19T03:15:00.000","Title":"wxPython: VirtualTreeListCtrl with millions of items","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have one wx.emptybitmap (1) and one wx.bitmap (2). I want to merge(join) them..\nI want to create a single wx.bitmap that consists on the wx.emptybitmap (1) on the top and wx.bitmap (2) on the bottom.\nHow can I do that?\nThanks in advance! :D","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1043,"Q_Id":3079409,"Users Score":0,"Answer":"You could always use PIL, it has a function to do this. Save the image in memory and convert it into an wx.Bitmap.","Q_Score":1,"Tags":"python,image,wxpython,image-manipulation","A_Id":11616749,"CreationDate":"2010-06-20T13:36:00.000","Title":"How to merge (join) two wx.bitmap using wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I type from Tkinter import ttk it says that there is no module named ttk, and also on many websites online the t in tkinter is always lowercase, but when I type tkinter in Python it throws an error. Why is that?","AnswerCount":4,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":54493,"Q_Id":3080918,"Users Score":12,"Answer":"Tkinter in python 2.6 is capitalized, in python 3 it is lowercase, tkinter","Q_Score":18,"Tags":"python,python-3.x,tkinter","A_Id":3081089,"CreationDate":"2010-06-20T20:58:00.000","Title":"Why can't I use ttk in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Am trying to provide a response from a Managers perspective to the question: What overall performance penalty will we incur if we write the application in IronPython instead of C#?\nThis question is directed at those who might have already undertaken some testing, benchmarking or have completed a migration from C# to IronPython, in order to quantify the penalty.","AnswerCount":4,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":8794,"Q_Id":3081661,"Users Score":-2,"Answer":"Based on my understanding both languages will be compiled into MSIL so theoretically the performance of the application should be identical or very close, but there is a lot more to it, the human factor.\nI can assure you that a program I write in C# could be a lot faster that the same program in iron-python not because C# is faster but because I'm more familiar with C# and I know what choices to make, so if your team is more familiar with C# your application has a better chance at performance if it is written in C# or the other way around.\nThis is just a personal theory so take it with a grain of salt.","Q_Score":7,"Tags":"ironpython","A_Id":3082237,"CreationDate":"2010-06-21T01:27:00.000","Title":"Speed of code execution: IronPython vs C#?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If it doesn't use ironpython, how C# use cpython program(py file)?\nBecause there are some bugs that ironpython load cpython code.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":189,"Q_Id":3083167,"Users Score":0,"Answer":"If you need strict CPython behavior and do not want to change Python program I am afraid that in this case you should spawn separate CPython process and interact with it via  some RPC protocol (there are plenty to choose from) via pipe or network connection to localhost.\nAs alternative to \"serialized\" RPC you might use system's facilities e.g. COM if you're on Windows or D-Bus on Linux - but this would make code platform dependent and not necessarily simpler.","Q_Score":0,"Tags":"c#,python,cpython","A_Id":3083261,"CreationDate":"2010-06-21T08:47:00.000","Title":"How C# use python program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background.\nThe row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, \"#C4C4C4\"), but no colours work well with the colours used to enhance the concept of priority.\nI had the idea to change the selection colour to be a slightly darker version of the colour used as the normal row background, so in the example above, that would be a darker red. I tried calling the function above in response to the treeselection's changed signal, and it works, but with heavy flickering.\nAnother idea was to change the selection to transparent and put a border around it instead, but as far as I can tell, this isn't possible.\n\nHow can I change the selection colour in the way described above without the flickering?\nCan I change show the selection by having only a border around the row?\n\nNote: I'm aware that this violates the theme selected by the user. I feel I have a good reason for it. Having the priority indicated by colour makes it instantly recognisable. The selection colour hides this. If you have alternative suggestions, I am open to them, but it needs to retain the ease at which a user can identify the priority.","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3920,"Q_Id":3099244,"Users Score":0,"Answer":"Calling both ModifyBase and ModifyText worked for me. Calling just ModifyBase changes the text color to White\nExample in GTK C#:\ntreeViewList.ModifyBase(StateType.Selected, treeViewList.Style.Base(StateType.Normal));\ntreeViewList.ModifyText(StateType.Selected, treeViewList.Style.Text(StateType.Normal));","Q_Score":9,"Tags":"python,user-interface,gtk,pygtk,gtktreeview","A_Id":60073336,"CreationDate":"2010-06-23T05:58:00.000","Title":"Changing the selected item colour in a GtkTreeview using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background.\nThe row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, \"#C4C4C4\"), but no colours work well with the colours used to enhance the concept of priority.\nI had the idea to change the selection colour to be a slightly darker version of the colour used as the normal row background, so in the example above, that would be a darker red. I tried calling the function above in response to the treeselection's changed signal, and it works, but with heavy flickering.\nAnother idea was to change the selection to transparent and put a border around it instead, but as far as I can tell, this isn't possible.\n\nHow can I change the selection colour in the way described above without the flickering?\nCan I change show the selection by having only a border around the row?\n\nNote: I'm aware that this violates the theme selected by the user. I feel I have a good reason for it. Having the priority indicated by colour makes it instantly recognisable. The selection colour hides this. If you have alternative suggestions, I am open to them, but it needs to retain the ease at which a user can identify the priority.","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3920,"Q_Id":3099244,"Users Score":0,"Answer":"Not sure what you mean by flickering. A border would require subclassing TreeView.\nI'd make the STATE_SELECTED color identical to STATE_NORMAL to disable the built-in highlighting. Then set a data_func on each column and change some color on the cell renderer depending on whether it's in the selection or not.\nYou're probably already doing this for your priority, so just multiply the color with something to highlight a row.","Q_Score":9,"Tags":"python,user-interface,gtk,pygtk,gtktreeview","A_Id":3099780,"CreationDate":"2010-06-23T05:58:00.000","Title":"Changing the selected item colour in a GtkTreeview using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been annoyed lately by the fact that PyDev doesn't information about classes and function when it code completes wxPython code.\nCan anybody tell me FOSS IDE's or extensions that offer code information (function params, returns etc.) when it code completes for C\/C++ and Python.\nI am a fan of CodeLite, Eclipse CDT and CodeBlocks in that order for C\/C++ (excepting non-FOSS)\nand PyScripter, PyDev for Python in that order.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":144,"Q_Id":3101160,"Users Score":0,"Answer":"I use notepad++ and am vary happy with it.","Q_Score":5,"Tags":"c++,python,c,ide,code-completion","A_Id":3102007,"CreationDate":"2010-06-23T11:30:00.000","Title":"ide code information","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been working with a few RAD gui builders lately. I absolutely despise CSS ( camel is a horse designed by committee etc.) What algorithms are used by packing managers(java\/tk). Most GUI toolkits I've used have some alternative to absolute positioning, sorry for the ambiguity but how do you start thinking about implementing a  packing manger in language X.\n\nThanks for the replies, to clarify - I want to create a generic text file that defines a 'form' this form file can then be used to generated a native(ish) GUI form (eg tk) and also an HTML form.\nWhat I'm looking for is some pointers on how a grid based packing manager is implemented so I can formulate my generic text file based on some form of established logic.\nIf this doesn't make sense to you then you understand me:). Some notes\n1. XML lives in the same stable as the zebra and the camel but not the horse.\n2. Think lightweight markup languages (Markdown\/ReStructuredText) but for simple forms.\n3. This has probably already been implemented, do you know where?\n4. Yes, I have Googled it (many,many times),answer was not between G1 and o2 \nThks","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":306,"Q_Id":3122291,"Users Score":3,"Answer":"Tk has three methods. One is absolute positioning, the other two are called \"grid\" and \"pack\". \ngrid is just what it sounds like: you lay out your widgets in a grid. There are options for spanning rows and columns, expanding (or not) to fill a cell, designating rows or columns which can grow, etc. You can accomplish probably 90% of all layout issues with the grid geometry manager.\nThe other manager is \"pack\" and it works by requesting that widgets be placed on one side or another (top, bottom, left, right). It is remarkably powerful, and with the use of nested containers (called frames in tk) you can accomplish pretty much any layout as well. Pack is particularly handy when you have things stacked in a single direction, such as horizontally for a toolbar, vertically for a main app (toolbar, main area, statusbar). \nBoth grid and pack are remarkably powerful and simple to use, and between them can solve any layout problem you have. It makes me wonder why Java and wxPython have so many and such complicated geometry managers when its possible to get by with no more than three.","Q_Score":0,"Tags":"python,grid,tcl,rad","A_Id":3122400,"CreationDate":"2010-06-26T00:55:00.000","Title":"GUI layout -how?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.\nI want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform?","AnswerCount":6,"Available Count":3,"Score":0.0333209931,"is_accepted":false,"ViewCount":1021,"Q_Id":3123340,"Users Score":1,"Answer":"C++ is very, very fast, and the Qt library is for C++. If you're programming on a mobile phone, Python will be very slow and you'll have to spend ages writing bindings for it.","Q_Score":1,"Tags":"c++,python,symbian,pys60","A_Id":3123427,"CreationDate":"2010-06-26T09:15:00.000","Title":"PyS60 vs Symbian C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.\nI want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform?","AnswerCount":6,"Available Count":3,"Score":0.0333209931,"is_accepted":false,"ViewCount":1021,"Q_Id":3123340,"Users Score":1,"Answer":"I answer this as a user.\nPyS60 is slow and not so much app and sample to start with.\nC++ is good, native, fast, but if you mind deevelop app for most device (current N-series), you will not want to go with Qt, I have a N78 and tested Qt in N82 too, it's slow (more than Python, sadly but true)","Q_Score":1,"Tags":"c++,python,symbian,pys60","A_Id":3124371,"CreationDate":"2010-06-26T09:15:00.000","Title":"PyS60 vs Symbian C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.\nI want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform?","AnswerCount":6,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1021,"Q_Id":3123340,"Users Score":0,"Answer":"What is the purpose of your programming? Are you planning distribute your app through Ovi Store? If so, you should use a tool that could be tested and signed by Symbian Signed. \nWhat does it mean? As far as I know, they don't provide such functionality for Python. So you have to choose native Symbian C++ or Qt. \nBy the way, Qt signing procedure is not quite clear for now. It seems Ovi Store and Symbian Signed are only allow Qt apps for a certain devices (Nokia X6, Nokia N97 mini, maybe some other). I suppose it is a subject for a change, and quite fast change, but you should consider this too.","Q_Score":1,"Tags":"c++,python,symbian,pys60","A_Id":3131900,"CreationDate":"2010-06-26T09:15:00.000","Title":"PyS60 vs Symbian C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In Tkinter I'm trying to make it so when a command is run a widget is automatically selected, so that a one may bind events to the newly selected widget. \nBasically I want it so when I press a button a text widget appears. When it appears normally one would have to click the text widget to facilitate the running of events bound to the text widget. I want that behavior to automatically happen when the user clicks the button. So that one does not have to click the button and then the text widget, but simply the button.  \nI'd also like it so if one started typing after the button was pressed it would automatically start filling the text widget. Again to cut out having to click on the text widget. \nWhat bit of code does the above?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":3125707,"Users Score":0,"Answer":"The terminology which describes what you want is \"focus\" -- you want to set the keyboard focus to your text widget. To do that you need to use the focus_set() and\/or focus_force() methods on the text widget.","Q_Score":0,"Tags":"python,binding,tkinter","A_Id":3126035,"CreationDate":"2010-06-26T22:25:00.000","Title":"Selecting Widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem with widget Gtk.Table - I would like to know, if there is a way how to get a current size of the table (number of rows and columns).\nThank you, very much for help, Tomas","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":881,"Q_Id":3126802,"Users Score":0,"Answer":"In most recent versions of PyGTK you can get\/set those values via table.props.n_columns and table.props.n_rows, which is synonymous with the get_property() (mentioned in the other answers) and set_property() methods.","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":3128879,"CreationDate":"2010-06-27T08:17:00.000","Title":"Getting size of Gtk.Table in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We all knows that C# is a static language while Python is a dynamic language. But I want to know what are the features that Python has and c# does not. Also, is it advisable\/beneficial to use IronPython with c# in the same application? \nAlso what points I should focus to learn before I try to convince my boss to use IronPython?","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":995,"Q_Id":3131703,"Users Score":7,"Answer":"One of IronPython's key advantages is in its function as an extensibility layer to application frameworks written in a .NET language. It is relatively simple to integrate an IronPython interpreter into an existing .NET application framework. Once in place, downstream developers can use scripts written in IronPython that interact with .NET objects in the framework, thereby extending the functionality in the framework's interface, without having to change any of the framework's code base.\nIronPython makes extensive use of reflection. When passed in a reference to a .NET object, it will automatically import the types and methods available to that object. This results in a highly intuitive experience when working with .NET objects from within an IronPython script.\nSource - Wikipedia","Q_Score":2,"Tags":"c#,architecture,ironpython","A_Id":3131716,"CreationDate":"2010-06-28T10:46:00.000","Title":"Why should C# developer learn IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"We all knows that C# is a static language while Python is a dynamic language. But I want to know what are the features that Python has and c# does not. Also, is it advisable\/beneficial to use IronPython with c# in the same application? \nAlso what points I should focus to learn before I try to convince my boss to use IronPython?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":995,"Q_Id":3131703,"Users Score":7,"Answer":"In other words, what points I can give to my boss to convince him to use IronPython?\n\nDon't. If you don't know why you should use a new tool and for what, don't try to convice anybody to use it. At work, you should try to solve problems with the best tools for the task, not throw the fanciest tools avaiable at your problems just because they're fancy.\nLearn IronPython, maybe make a small side project in it, find out what the strenghts are. Then if you think these strengths are useful for the project you're working on (e.g. for \"glue code\", plugins, macros etc.), convice your boss to use them.","Q_Score":2,"Tags":"c#,architecture,ironpython","A_Id":3131741,"CreationDate":"2010-06-28T10:46:00.000","Title":"Why should C# developer learn IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPython application which allows the users to select items from menus that then change what is visible on the screen.  This often requires a recalculation of the layout of panels.  I'd like to be able to call the layout of all the children of a panel (and the children of those children) in reverse order.  That is, the items with no children have their Layout() function called first, then their parents, and so on.\nOtherwise I have to keep all kinds of knowledge about the parents of panels in the codes.  (i.e. how many parents will be affected by a change in this-or-that panel).","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":248,"Q_Id":3136997,"Users Score":0,"Answer":"More in response to your comment to Jon Cage's answer, than to your\noriginal question (which was perfectly answered by Jon):\nThe user might find it irritating, if the position of every element in\nyour dialog changes, when he makes a choice. Maybe it'll look better,\nif only the \"variable part\" is updated. To achieve this, you could\nmake a panel for each set of additional controls. The minimum size of\neach panel should be the minimum size of the largest of these\npanels. Depending on the user's choice you can hide or show the\ndesired panel.\nAlternatively, wxChoicebook might be what you need?","Q_Score":1,"Tags":"python,model-view-controller,wxpython,dry,wxwidgets","A_Id":3137378,"CreationDate":"2010-06-28T23:58:00.000","Title":"How to layout all children of a wxPanel?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?\nIn most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.\nHowever, with Qt I'm not so sure.  It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components).  Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.\nI've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons.  If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.\nThoughts?","AnswerCount":5,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":16818,"Q_Id":3139414,"Users Score":7,"Answer":"With Python you don't have to build your project. That's enough of a time saver I guess. And Pyqt bindings are awesome. I'm definitely more efficient with pyqt than with qt\/C++.","Q_Score":47,"Tags":"c++,python,qt,pyqt","A_Id":3139453,"CreationDate":"2010-06-29T09:32:00.000","Title":"Qt programming: More productive in Python or C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?\nIn most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.\nHowever, with Qt I'm not so sure.  It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components).  Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.\nI've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons.  If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.\nThoughts?","AnswerCount":5,"Available Count":5,"Score":0.1194272985,"is_accepted":false,"ViewCount":16818,"Q_Id":3139414,"Users Score":3,"Answer":"Whether you use python or C++ depends more on the application you are building and not so much on Qt. If you are building an application which is resource heavy and needs lots of resources like CPU and memory, C++ would be a better bet. On the other hand, if you application is more UI driven, python provides lot of other benefits in terms of rapid development and rich libraries.","Q_Score":47,"Tags":"c++,python,qt,pyqt","A_Id":3139458,"CreationDate":"2010-06-29T09:32:00.000","Title":"Qt programming: More productive in Python or C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?\nIn most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.\nHowever, with Qt I'm not so sure.  It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components).  Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.\nI've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons.  If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.\nThoughts?","AnswerCount":5,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":16818,"Q_Id":3139414,"Users Score":33,"Answer":"If one or the other, I'd actually suggest Python in spite of being a C++ enthusiast. With Python code you don't have to bother with the MOC, portability, build times, etc. Just compare the work involved in implementing a QT slot in C++ vs. PyQT or PySide, e.g. I find it to be much less of a pain to deal with widgets this way (much greater productivity). You can still invoke C++ code from Python in cases where you need the added performance.\nIf you do use a combination, consider extending Python rather than embedding it. Python is generally better suited to embed C\/C++ code than to be embedded into a C\/C++ system. It also tends to make more sense that way as applications are generally composed of far more mundane, non-performance critical code than performance-critical code, so writing your application primarily as a python application with C\/C++ functions attached to it fits that kind of system design better.","Q_Score":47,"Tags":"c++,python,qt,pyqt","A_Id":3139451,"CreationDate":"2010-06-29T09:32:00.000","Title":"Qt programming: More productive in Python or C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?\nIn most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.\nHowever, with Qt I'm not so sure.  It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components).  Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.\nI've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons.  If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.\nThoughts?","AnswerCount":5,"Available Count":5,"Score":1.2,"is_accepted":true,"ViewCount":16818,"Q_Id":3139414,"Users Score":31,"Answer":"My Opinion (having tried out C++ and Python in general and specifically in Qt case): Python always wins in terms of 'programmer productivity' and 'peace of mind'. PyQt represent Qt very well and hence question doesn't remain of \"Qt with Python\" or \"Qt with C++\", in general python is more productive unless off-course you need speed or something which isn't available in python.\nBest way for you to arrive at the  answer would be to write a simple project first in C++ and then same project in python and compare, but that could be biased towards python as after coding the project once you may find it easy in Python, so try another project too and first do it in Python and then in C++.","Q_Score":47,"Tags":"c++,python,qt,pyqt","A_Id":3139545,"CreationDate":"2010-06-29T09:32:00.000","Title":"Qt programming: More productive in Python or C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?\nIn most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.\nHowever, with Qt I'm not so sure.  It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components).  Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.\nI've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons.  If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.\nThoughts?","AnswerCount":5,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":16818,"Q_Id":3139414,"Users Score":11,"Answer":"definitely Python. \nYes, people will say that Python is more productive without a reason. Some of the answers mention that you do not have to recompile. I will give you some more details\n\nPython is one layer of abstraction over C++, so you can think and express your designs with less code. Your program might not run as fast, but sure you express faster in code what you want.\nThe most common case is when you launch your application, load some files, setup the environment and open a dialog. There you notice that a button is not working or where it should be. Now that is the point where most people close the application, bind one slot here, one signal there... and start the application, load the files, setup... with python you just write the code and fire up the dialog again, not the whole application. I do not know about you, but that type of task is what I do most of the time with Qt\nPython gives you something that C++ does not have: introspection. You can explore a running program and pull out information about its components on runtime. Qt gives you partially this. You have that MOC layer where meta properties and meta information can be attached to Qt objects. All parts of a Python program can be introspected. Many people debugging Python code, or trying to understand how it works, are addicted to this for a good reason","Q_Score":47,"Tags":"c++,python,qt,pyqt","A_Id":7457626,"CreationDate":"2010-06-29T09:32:00.000","Title":"Qt programming: More productive in Python or C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've just started to learn pygame, and it pretty much needs some coordinates and points in the code in order to position the object. Do you know of any tool or application that I could use as a reference so that I could see a visual representation of the points. \nMaybe a grid with numbers. \nAnd pygame also includes declaring the color by using numbers. \nDo you know of any site or application that I can use as reference to those numbers and corresponding color. Like this one: 230, 170, 0 And what do these numbers mean.\nI'm using windows operating system.","AnswerCount":8,"Available Count":1,"Score":0.024994793,"is_accepted":false,"ViewCount":1295,"Q_Id":3154830,"Users Score":1,"Answer":"You don't need a grid to help you, you just need to know the origin point (easy - it is one of the corners). Since it is all interpreted, I say you just hack around displaying stuff on the screen till it clicks in your head.\nThe other part is easy. It is Red, Blue, Green (each one goes from 0-255, 0 is no-color, 255 is full-color).","Q_Score":1,"Tags":"python,pygame","A_Id":3154895,"CreationDate":"2010-07-01T03:03:00.000","Title":"tools for pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm building a form class in python for producing and validating HTML forms. Each field has an associated widget which defines how the field is rendered.\nWhen the widget is created, it is passed in a (default) value so that it knows what to display the first time it is rendered. After the form is submitted, the widget is asked for a value. I delegate this to the widget rather than just nabbing it from the POST data because a widget may consist of several HTML inputs (think of a month\/day\/year selector). Only the widget knows how to mash these together into one value.\nProblem is, I don't know if I should have the widget always accept a string, and always return a string for consistency, or accept and return a data type consistent with its purpose (i.e., a date selector should probably return a DateTime object).\nThe philosophy behind my form class is \"mix and match\". You choose what widget you want, and what validators\/formatters\/converters you want to run on it. Which I guess lends itself towards \"use strings\" and let the developer decide on the data type afterwords, but... I can't think of a good but. Do you anticipate any problems with this approach?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":80,"Q_Id":3169096,"Users Score":2,"Answer":"While simply passing strings around seems like a useful idea, I think you're going to discover it doesn't work as well as you might hope.\nThink about the date example\u2014instead of passing around a date object, instead you pass around a str of the format \"2010-01-01\".  In order to work with that data, every user of the class needs to know not only that it's a str which represents a date, but what the format of that string is.  In other words, you haven't gained anything.  Worse, you lose the ability to pass a datetime object into the widget (unless you take extra steps to deal with that case).\nThe validator or formatter issue isn't as big a deal as you might think; how often are you going to want to validate a string which doesn't represent a date as if it were a date?","Q_Score":2,"Tags":"python,design-patterns","A_Id":3169254,"CreationDate":"2010-07-02T21:04:00.000","Title":"What data type should my widgets accept\/return?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm building a form class in python for producing and validating HTML forms. Each field has an associated widget which defines how the field is rendered.\nWhen the widget is created, it is passed in a (default) value so that it knows what to display the first time it is rendered. After the form is submitted, the widget is asked for a value. I delegate this to the widget rather than just nabbing it from the POST data because a widget may consist of several HTML inputs (think of a month\/day\/year selector). Only the widget knows how to mash these together into one value.\nProblem is, I don't know if I should have the widget always accept a string, and always return a string for consistency, or accept and return a data type consistent with its purpose (i.e., a date selector should probably return a DateTime object).\nThe philosophy behind my form class is \"mix and match\". You choose what widget you want, and what validators\/formatters\/converters you want to run on it. Which I guess lends itself towards \"use strings\" and let the developer decide on the data type afterwords, but... I can't think of a good but. Do you anticipate any problems with this approach?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":80,"Q_Id":3169096,"Users Score":1,"Answer":"This approach is quite generic and serializing to and from strings should always work fine. You could also save the state of a widget to a file or send it over a network for recreating another widget from it.\nSome potential issues or aspects to consider:\n\nLocalization: how to interpret the string regarding the culture, which format is the canonical format for comparisons.\nPerformance: some transformations might be time consuming, but I assume for human interaction that will be far fast enough.","Q_Score":2,"Tags":"python,design-patterns","A_Id":3169184,"CreationDate":"2010-07-02T21:04:00.000","Title":"What data type should my widgets accept\/return?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a function that calculates the number of images that can be displayed on the screen, if there are more images than the ones that can be put on screen, I resize the images till they all can appear.\nThen, I want to display them with one vertical box sizer and several horizontal box sizers!\nThe horizontal number of box sizers are dynamic, it can be only one or more depending on the number of images.\nHow can I define several box sizers and add them to the vertical box sizer?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":153,"Q_Id":3171256,"Users Score":0,"Answer":"wx.GridSizer is the answer!","Q_Score":1,"Tags":"python,wxpython,sizer","A_Id":3174624,"CreationDate":"2010-07-03T10:55:00.000","Title":"How to make a dynamic number of horizontal BoxSizers?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Suppose you know the three vertices for a spherical triangle. \nThen how do you draw the sides on a sphere in 3D?\nI need some python code to use in Blender 3d modelisation software.\nI already have the sphere done in 3D in Blender.\nThanks & happy blendering.\nnote  1:\ni have the 3 points \/ vertices (p1,p2,p3 ) on the sphere for a spherical triangle\nbut i need to trace the edges  on the sphere in 3D\nso what would be the equations needed to determine  all vertices  between each points pair of the triangle on the sphere\n3 edges  from p1 to p2  -  p2 to p3  and o3  to p1\ni know it has something to do with the Great circle   for Geodesic  on a sphere\nbut cannot   find the proper equations to do the calculations in spherical coordinates!\nThanks\n\nGreat circles\nit   would  have been interesting to see a solution with great circle and see tehsolution in spherical coordinates directly !\nbut still interesting to do it in the euclidiens space \nThanks \n\nok i used this idea of line segment between 2 points \nbut did not do it as  indicated before\ni used an alternative method - Bezier line interpolation**\ni parametrize the line with a bezier line\nthen subdivided  and calculated as shonw ealier the ratio and angle for each of the subdivided bezier point on the chord\nand it works very well and very precise \nbut it would be interesting to see how it is done whit the earlier method\nbut not certain how to do the iteration loop?\nhow do you load up the python code  here\njust past it  with Ctrl-V?\nThanks and happy 2.5\n\ni do use the blenders' forum\nbut no guaranti to get a clear answer all the time!\nthat's why i tried here - took a chance\ni did the first edge seems to work \nnow got to make a loop to  get  multi segment for first edge and then do the other edges also\n2- other subject\n  i open here a post on bezier triangle patch\n i know it's not a usfull tool\nbut just to show how it is done\nhave youeseen a python sript to do theses triangel patch\nand i did ask this questin on blender's foum and no answer\nalso on IRC python and sems to be dead right now \nprobably guys are too busy finishing the 2.5 Beta vesion which should come out  in a week or 2\nHey Thanks a lot  for this math discussion \nif i have problem be back tomorrow\nhappy math and 2.5","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3171,"Q_Id":3172535,"Users Score":0,"Answer":"One cheap and easy method for doing this would be to create the triangle and subdivide the faces down to the level of detail you want, then normalize all the vertices to the radius you want.","Q_Score":3,"Tags":"python,blender","A_Id":3172669,"CreationDate":"2010-07-03T19:03:00.000","Title":"How to draw a spherical triangle on a sphere in 3D?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've recently started using a mac, and I'm curious about how to make a mac app that uses PyQt and is self-contained.\nCan anyone give me any pointers on where to start and what I'll need?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1222,"Q_Id":3173047,"Users Score":1,"Answer":"I've tried the same for some weeks now. Finally i have to say py2app just wont do. I was lucky with pyinstaller1.4. Although you need to add some minor modifications to run flawlessly on OS X. Furthermore the apps it creates are only 1\/4 of the size compared to py2app. And most important it works :) And yet another goodie ... it works with the python framework which ships with OS X so there is no need to install python via MacPorts etc.","Q_Score":2,"Tags":"python,macos,qt","A_Id":4022382,"CreationDate":"2010-07-03T22:26:00.000","Title":"How to create a self contained Python Qt app on mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Installed the IronPython tools for VS 2010 but it didn't associate the *.py files to VS, neither did it (obviously) change the *.py files' icon.\nHow do I do that in Windows 7?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":4332,"Q_Id":3177918,"Users Score":3,"Answer":"I also had this issue. Here is what I did.\n\nRight click on a python program.\nSelect properties.\nYou will find \"opens with\" option in the general tab.\nClick change and select \"python.exe\".\n\nNow, you will have your python icons back for all .py type of files.","Q_Score":1,"Tags":"visual-studio-2010,windows-7,ironpython,file-type,root","A_Id":32558068,"CreationDate":"2010-07-05T08:03:00.000","Title":"How to make *.py files have the python icon in Win7?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i have just received a task to implement a software that paints over pictures (pretty much like microsoft paint )\ni have no idea where to start or how to do that. do anyone have a good reference or idea for painting in qt or pyqt ?\n\nthis will be highly appreciated \nthanks in advance","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1562,"Q_Id":3179469,"Users Score":0,"Answer":"Have you looked at the scribble example included in PyQt? It does basic drawing, saving, loading, etc.","Q_Score":0,"Tags":"python,qt,pyqt,paint","A_Id":3497327,"CreationDate":"2010-07-05T12:34:00.000","Title":"making paint in pyqt or qt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"is it possible to connect a href link in QTextBrowser to a slot?\nI want to make something that looks like a link in a QTextBrowser, but when user clicked on it, it will call one of the methods.\nIs that possible?\nif that is not, what is a good alternative?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":198,"Q_Id":3186576,"Users Score":1,"Answer":"i finally found out how.\nthere's a signal call anchorClicked(QUrl)\nthat should do the trick :)","Q_Score":0,"Tags":"python,pyqt4","A_Id":3187108,"CreationDate":"2010-07-06T13:28:00.000","Title":"is it possible to connect a href link in QTextBrowser to a slot?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any downsides in Python to using a library that is just a binding to a C library? Does that hurt the portability of your application? Anything else I should look out for?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":146,"Q_Id":3190013,"Users Score":0,"Answer":"Portability is one thing. There are even differences between python 2.x and 3.x that can make things difficult with C extensions, if the writer didn't update them.\nAnother thing is that pure python code gives you a bit more possibilities to read, understand and even modify (although it is usually a bad sign if you need to do that for other peoples modules)","Q_Score":1,"Tags":"python","A_Id":3190568,"CreationDate":"2010-07-06T20:35:00.000","Title":"What are the pros and cons in Python of using a c library vs a native python one","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any downsides in Python to using a library that is just a binding to a C library? Does that hurt the portability of your application? Anything else I should look out for?","AnswerCount":3,"Available Count":3,"Score":0.2605204458,"is_accepted":false,"ViewCount":146,"Q_Id":3190013,"Users Score":4,"Answer":"C library is likely to have better performance, but needs to be recompiled for each platform.\nYou can't use C libraries on Google App Engine","Q_Score":1,"Tags":"python","A_Id":3190053,"CreationDate":"2010-07-06T20:35:00.000","Title":"What are the pros and cons in Python of using a c library vs a native python one","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any downsides in Python to using a library that is just a binding to a C library? Does that hurt the portability of your application? Anything else I should look out for?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":146,"Q_Id":3190013,"Users Score":4,"Answer":"Of course using a C library hurts portability. It also prohibites you (in general) to use Jython or IronPython. I would only use a C library if I had no other option. This could happen if direct access to hardware is necessary or if special efficiency requirements apply.","Q_Score":1,"Tags":"python","A_Id":3190035,"CreationDate":"2010-07-06T20:35:00.000","Title":"What are the pros and cons in Python of using a c library vs a native python one","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Me and a friend are developing an application which uses Boost::Python. I have defined an interface in C++ (well a pure virtual class), exposed through Boost::Python to the users, who have to inherit from it and create a class, which the application takes and uses for some callback mechanism.\nEverything that far goes pretty well. Now, the function callback may take some time (the user may have programmed some heavy stuff)...  but we need to repaint the window, so it doesn't look \"stuck\".We wanted to use Boost::Thread for this. Only one callback will be running at a time (no other threads will call python at the same time), so we thought it wouldn't be such a great deal... since we don't use threads inside python, nor in the C++ code wrapped for python.\nWhat we do is calling PyEval_InitThreads() just after Py_Initialize(), then, before calling the function callback inside it's own boost thread, we use the macro PY_BEGIN_ALLOW_THREADS and, and the macro PY_END_ALLOW_THREADS when the thread has ended.\nI think I don't need to say the execution never reaches the second macro. It shows several errors everytime it runs... but t's always while calling the actual callback. I have googled a lot, even read some of the PEP docs regarding threads, but they all talk about threading inside the python module (which I don't sice it's just a pure virtual class exposed) or threading inside python, not about the main application calling Python from several threads.\nPlease help, this has been frustrating me for several hours.\nPs. help!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":511,"Q_Id":3197236,"Users Score":1,"Answer":"Python can be called from multiple threads serially, I don't think that's a problem.  It sounds to me like your errors are just coming from bad C++ code, as you said the errors happened after PY_BEGIN_ALLOW_THREADS and before PY_END_ALLOW_THREADS.\nIf you know that's not true, can you post a little more of your actual code and show exactly where its erroring and exactly what errors its giving?","Q_Score":7,"Tags":"c++,python,boost-thread,boost-python","A_Id":3223165,"CreationDate":"2010-07-07T17:19:00.000","Title":"Problems regarding Boost::Python and Boost::Threads","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Pygame to pageflip different stimuli on the screen. The problem is that pygame's flip function, although syncing the flip to the vertical retrace, does not tell me when the retrace was.\nDoes anyone know of a way to get this information (preferably platform independent) in Python?\nRegards,\nfladd","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":153,"Q_Id":3201685,"Users Score":0,"Answer":"Just poll for the time immediately after the flip call, if that one syncs to the vertical retrace.","Q_Score":0,"Tags":"python,pygame,flip","A_Id":3201723,"CreationDate":"2010-07-08T08:07:00.000","Title":"How to get the point in time of (last) vertical retrace under Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a bit of trouble with the Tkinter grid() manager. It is spacing the rows too far apart. I have two entry widgets to place, and I need one almost directly under the other. When I place them both on the same row and column, but change the pady option, it places them directly on top of each other. I know there has to be a way to fix this, never had this problem before.\nI am using Python 2.6 on Windows XP.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1716,"Q_Id":3219765,"Users Score":2,"Answer":"Don't place them in the same row and column; place the upper in a row, and the lower in row+1, both in the same column. That does the trick.\nNote that the grid manager does not need to have all rows and columns filled with widgets; it ignores empty rows and columns.","Q_Score":1,"Tags":"python,tkinter,grid,tkinter-entry","A_Id":3222439,"CreationDate":"2010-07-10T15:23:00.000","Title":"Tkinter grid() Manager","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A primary reason to use wx.SpinCtrl is to restrict the user to input integers, therefore I think that the text inside it would look better if right-aligned.\nIs there a way to do this in wxPython?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":435,"Q_Id":3252671,"Users Score":1,"Answer":"Actually, there is a control you can use. It's called FloatSpin, which is in the agw sub-library. If you don't already have it, download the wxPython demo and check it out!\n\nMike","Q_Score":0,"Tags":"python,wxpython,alignment,spinner","A_Id":3261410,"CreationDate":"2010-07-15T05:20:00.000","Title":"wxPython: Right-align the numbers in a wx.SpinCtrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running in ubuntu and I can code in python, without problem. I have tried to install pygame and to do make it so, I did:\n\nsudo apt-get instal python-pygame\n\nWhen I go into the python IDLE and write:\n\nimport pygame\n\nI get:\n\nTraceback (most recent call last):\nFile \"\", line 1, in \nImportError: No module named pygame\n\nWhat can I do to solve this problem? I am forgetting something, or doing something wrong?","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":9872,"Q_Id":3264024,"Users Score":1,"Answer":"If you don't like to download an unpack then install manually, you can use apt to install  setuptools . After that you can use easy_install(or easy_install-2.7?) to install many python packages, including pygame, of course.","Q_Score":3,"Tags":"python,ubuntu,pygame,python-idle","A_Id":9820042,"CreationDate":"2010-07-16T10:44:00.000","Title":"pygame not found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running in ubuntu and I can code in python, without problem. I have tried to install pygame and to do make it so, I did:\n\nsudo apt-get instal python-pygame\n\nWhen I go into the python IDLE and write:\n\nimport pygame\n\nI get:\n\nTraceback (most recent call last):\nFile \"\", line 1, in \nImportError: No module named pygame\n\nWhat can I do to solve this problem? I am forgetting something, or doing something wrong?","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":9872,"Q_Id":3264024,"Users Score":1,"Answer":"I just had this same problem!\nI read this and while it works to do the sys.path.append thing, I decided to try and get it to work with out.\nWhat I did was went to the Ubuntu Software center uninstalled the python IDLE i had installed and then installed the IDLE.\nThis seems confusing the way I said it so to clarify you want to download the IDLE that doesn't come with its own version of python, it'll then use the python that already comes with Ubuntu!\nIf this doesn't make since or doesn't help fix your problem let me know!","Q_Score":3,"Tags":"python,ubuntu,pygame,python-idle","A_Id":14076665,"CreationDate":"2010-07-16T10:44:00.000","Title":"pygame not found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running in ubuntu and I can code in python, without problem. I have tried to install pygame and to do make it so, I did:\n\nsudo apt-get instal python-pygame\n\nWhen I go into the python IDLE and write:\n\nimport pygame\n\nI get:\n\nTraceback (most recent call last):\nFile \"\", line 1, in \nImportError: No module named pygame\n\nWhat can I do to solve this problem? I am forgetting something, or doing something wrong?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":9872,"Q_Id":3264024,"Users Score":0,"Answer":"check that you are installing pygame for the right version of python. I think the pygame for python 2.7 won't work on python 3.3. I had the same problem but even after installing the right version it didn't work. So after a little googling I found that I was installing pygame meant for 32-bit but my os is 64-bit. so try to google \"pygame for window 64-bit\" or something like that. I hope it helps.","Q_Score":3,"Tags":"python,ubuntu,pygame,python-idle","A_Id":17222436,"CreationDate":"2010-07-16T10:44:00.000","Title":"pygame not found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I update my objectListView list it flickers\/flashes white, is this normal behaviour or can it be prevented. The list gets updated around every 1-5 seconds using the AddObject method if that makes any difference.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":463,"Q_Id":3268106,"Users Score":0,"Answer":"I seem to have fixed it by using the FastObjectListView class instead...","Q_Score":0,"Tags":"python,user-interface,wxpython,objectlistview","A_Id":3268404,"CreationDate":"2010-07-16T19:14:00.000","Title":"ObjectListView Flickers\/Flashes when adding a new list object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a wxpython list widget that displays alternating row colours even when empty the list is empty? or Is there even one that will display a background colour(other than white) when it is empty?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":843,"Q_Id":3269019,"Users Score":1,"Answer":"You could do it with a wx.Grid or you might look at the new UltimateListCtrl, which is a pure python widget. You can hack it if it doesn't do what you want it to!","Q_Score":0,"Tags":"python,user-interface,listview,wxpython,background-color","A_Id":3269998,"CreationDate":"2010-07-16T21:35:00.000","Title":"Is there a wxpython list widget that displays alternating row colours even when the list is empty?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I am trying to write a rich text editor in PyGTK, and originally used the older, third party script InteractivePangoBuffer from Gourmet to do this. While it worked alright, there were still plenty of bugs with it which made it frustrating to use at times, so I decided to write my own utilizing text tags. I have got them displaying and generally working alright, but now I am stuck at trying to figure out how to export them to a file when saving. I've seen that others have had the same problem I've had, though I haven't seen any solutions. I haven't come across any function (built in or otherwise) which comes close to actually getting the starting and ending position of each piece of text with a texttag applied to it so I can use it.\nI have come up with one idea which should theoretically work, by walking the text by utilizing gtk.TextBuffer.get_iter_at_offset(), gtk.TextIter.get_offset(), gtk.TextIter.begins_tag(), and gtk.TextIter.ends_tag() in order to check each and every character to see if it begins or ends a tag and, if so, put the appropriate code. This would be horribly inefficient and slow, especially on larger documents, however, so I am wondering if anyone has any better solutions?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":276,"Q_Id":3269942,"Users Score":0,"Answer":"You can probably use gtk.TextIter.forward_to_tag_toggle().  I.e. loop over all tags you have and for each tags scan the buffer for the position where it is toggled.","Q_Score":1,"Tags":"python,pygtk","A_Id":3271663,"CreationDate":"2010-07-17T02:05:00.000","Title":"Saving gtk.TextTags to file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python program uses Qt (PyQt4 in fact) and when I launch it from its main.py, I get a console window and the GUI window (on Windows, of course).\nThen I compile my program with py2exe and main.exe is successfully created. However, if I run main.exe (this is what users of program will do) console window of Python still appears and all my debug text is stdout-ed to that window.\nI want to hide cmd line window when my application is running and I want just my GUI to be visible to the user when executed from .exe file.\nIs that possible?","AnswerCount":4,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":19469,"Q_Id":3275293,"Users Score":6,"Answer":"I doubt this has an effect on py2exe, but it's related to the question.  To run a python GUI on windows without the terminal, use pythonw.exe instead of python.exe.  This should happen automatically if you end the filename with \".pyw\".","Q_Score":20,"Tags":"python,pyqt,pyqt4,py2exe","A_Id":3275651,"CreationDate":"2010-07-18T11:17:00.000","Title":"Hiding console window of Python GUI app with py2exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a plugin for some software that I'm planning on selling someday. The software I'm making it for has both a C++ SDK and a Python SDK.\nThe C++ SDK documentation appears incomplete in certain areas and isn't documented that well.\nThe Python SDK docs appear more complete and in general are much easier to work with.\nSo I'm trying to decide if I want to go through the potential trouble of building a C++ plugin instead of a Python plugin to sell. About the only thing that makes me want to do a C++ plugin is that in my mind, a \"C++ plugin\" might be an easier sell than a \"Python plugin\". A lot of programmers out there don't even considered writing Python to be real \"programming\".\nDo you think that potential customers might say \"Why would I pay money for a measly little Python script?\"?  As opposed to \"Oh it was written in C++ so the guy must be a decent programmer\"?\nWriting the Python plugin would be faster. Both plugins would look and behave exactly the same. The C++ plugin might be faster in certain spots, but for the type of plugin this is, that's not a huge deal.\nSo my question is, would a Python plugin be considered not as professional\/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":815,"Q_Id":3277376,"Users Score":0,"Answer":"Python will also have the advantage\/disadvantage (depending on what you want) that the source code must be open. (I think delivering only the .pyc file is not really an option as the Python bytecode format is changing in every release.)\nOtherwise, let's say you are selling to people who don't really know what the difference is between Python\/C++: The outcome is the important thing. If your Python plugin runs and feels stable and fast, it is fine.\nIf they have heard about both languages, there really may be a difference. I must admit, if I had a choice between two plugins which do exactly the same and which are perfectly stable from all user reports, I probably would prefer the C++ plugin. It would be my intuition which would tell me that the C++ code is probably slightly more stable and faster. This is also for Unix tools and other stuff.","Q_Score":3,"Tags":"c++,python","A_Id":3277408,"CreationDate":"2010-07-18T21:42:00.000","Title":"Is Python-based software considered less-professional than C++\/compiled software?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a plugin for some software that I'm planning on selling someday. The software I'm making it for has both a C++ SDK and a Python SDK.\nThe C++ SDK documentation appears incomplete in certain areas and isn't documented that well.\nThe Python SDK docs appear more complete and in general are much easier to work with.\nSo I'm trying to decide if I want to go through the potential trouble of building a C++ plugin instead of a Python plugin to sell. About the only thing that makes me want to do a C++ plugin is that in my mind, a \"C++ plugin\" might be an easier sell than a \"Python plugin\". A lot of programmers out there don't even considered writing Python to be real \"programming\".\nDo you think that potential customers might say \"Why would I pay money for a measly little Python script?\"?  As opposed to \"Oh it was written in C++ so the guy must be a decent programmer\"?\nWriting the Python plugin would be faster. Both plugins would look and behave exactly the same. The C++ plugin might be faster in certain spots, but for the type of plugin this is, that's not a huge deal.\nSo my question is, would a Python plugin be considered not as professional\/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin?","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":815,"Q_Id":3277376,"Users Score":6,"Answer":"A lot of programmers out there don't even considered writing Python to be real \"programming\".\n\nA lot of \"programmers\" out there are incompetent, too.\n\nDo you think that potential customers might say \"Why would I pay money for a measly little Python script?\"?\n\nI'm sure it depends on the type of software, but I can tell you that my program's customers have little interest in what we use to develop our product, and I doubt most of them know that the software is written in C++.  They just care that it works.\n\nSo my question is, would a Python plugin be considered not as professional\/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin?\n\nNo.","Q_Score":3,"Tags":"c++,python","A_Id":3277400,"CreationDate":"2010-07-18T21:42:00.000","Title":"Is Python-based software considered less-professional than C++\/compiled software?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a plugin for some software that I'm planning on selling someday. The software I'm making it for has both a C++ SDK and a Python SDK.\nThe C++ SDK documentation appears incomplete in certain areas and isn't documented that well.\nThe Python SDK docs appear more complete and in general are much easier to work with.\nSo I'm trying to decide if I want to go through the potential trouble of building a C++ plugin instead of a Python plugin to sell. About the only thing that makes me want to do a C++ plugin is that in my mind, a \"C++ plugin\" might be an easier sell than a \"Python plugin\". A lot of programmers out there don't even considered writing Python to be real \"programming\".\nDo you think that potential customers might say \"Why would I pay money for a measly little Python script?\"?  As opposed to \"Oh it was written in C++ so the guy must be a decent programmer\"?\nWriting the Python plugin would be faster. Both plugins would look and behave exactly the same. The C++ plugin might be faster in certain spots, but for the type of plugin this is, that's not a huge deal.\nSo my question is, would a Python plugin be considered not as professional\/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":815,"Q_Id":3277376,"Users Score":0,"Answer":"I think it doesn't matter. It all come down to 'use the right tool for the right job'. Your primary goal should be to make the best plugin you can. So if you feel more at ease with Python use that. It will probably take you less time to write. The client probably doesn't mind it and just want the most stable, reliable, cheapest, easiest to use plugin. So concentrate on that not on the tool.","Q_Score":3,"Tags":"c++,python","A_Id":3277403,"CreationDate":"2010-07-18T21:42:00.000","Title":"Is Python-based software considered less-professional than C++\/compiled software?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What would be the best way to use negative coordinates in pygame?\nAt the moment I have a surface that is 1.5 times the original surface then everything that needs to be drawn is shifted up by a certain amount (to ensure the negative coordinates become positive) and drawn.\nIs there an easier\/alternate way of doing this?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2454,"Q_Id":3279436,"Users Score":0,"Answer":"There is no way to move the origin of a surface from 0,0.\nImplement your own drawing class which transforms all the coordinates passed in into the space of the surface.","Q_Score":2,"Tags":"python,pygame,coordinates,geometry-surface","A_Id":3279476,"CreationDate":"2010-07-19T08:22:00.000","Title":"Negative coordinates in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to run a python script that utilizes TKinter on a web page such that a user could run the script and interact with the TK windows without having to download the script or have the appropriate python interpreter?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":944,"Q_Id":3284779,"Users Score":1,"Answer":"No. There is no way to do this.","Q_Score":0,"Tags":"python,tkinter","A_Id":3284846,"CreationDate":"2010-07-19T20:27:00.000","Title":"Any way to run python TK scripts on web page?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wanting a paradigm in a Qt4 (PyQt4) program where a component is able to respond to a signal without knowing anything about where it is coming from.  \nMy intial reading suggests that I have to explicitly connect signals to slots. But what I want is for any of a number of components to be able to send a signal, and for it to be processed by another component. \nComparing with another toolkits, for example, in wxWidgets I would use events. These automatically propogate up from child windows\/objects to parents.  At each level they can be handled.  This means if I have a lot of children which may emit the same event, I don't have to explicitly connect all of them to the handler.  I can just put the handler in the parent, or some higher level in the window hierarchy.  This means that only the event generator and consumer need to know about the event at all.  The consumer doesn't need to know where the source of the event is, how many such sources there are, or anything else about it.\nIs this possible in Qt - is there another approach?  Maybe there is an alternative event mechanism to signals and slots?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1116,"Q_Id":3286826,"Users Score":0,"Answer":"Signal handlers do NOT know the emitter (only the signal type) and emitters do NOT know what handlers are connected.  Many handlers can connect to the same signal and they are executed in the order of connection.  A signal can be emitted from many places.","Q_Score":3,"Tags":"python,qt4,pyqt,signals","A_Id":8453598,"CreationDate":"2010-07-20T03:36:00.000","Title":"How to broadcast a signal in Qt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wanting a paradigm in a Qt4 (PyQt4) program where a component is able to respond to a signal without knowing anything about where it is coming from.  \nMy intial reading suggests that I have to explicitly connect signals to slots. But what I want is for any of a number of components to be able to send a signal, and for it to be processed by another component. \nComparing with another toolkits, for example, in wxWidgets I would use events. These automatically propogate up from child windows\/objects to parents.  At each level they can be handled.  This means if I have a lot of children which may emit the same event, I don't have to explicitly connect all of them to the handler.  I can just put the handler in the parent, or some higher level in the window hierarchy.  This means that only the event generator and consumer need to know about the event at all.  The consumer doesn't need to know where the source of the event is, how many such sources there are, or anything else about it.\nIs this possible in Qt - is there another approach?  Maybe there is an alternative event mechanism to signals and slots?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1116,"Q_Id":3286826,"Users Score":1,"Answer":"This isn't easily possible - you have to have something that knows about the signaling object and the receiving object to connect the two.  Depending on what you need, however, you might be able to set up a class that mediates between the two (so objects with signals tell the class they exist, and have such-and-such a signal, while objects with slots tell the class they exist and have such-and-such a slot to connect to a given signal, and the mediator class tracks both of those, making connections when necessary).","Q_Score":3,"Tags":"python,qt4,pyqt,signals","A_Id":3292687,"CreationDate":"2010-07-20T03:36:00.000","Title":"How to broadcast a signal in Qt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wanting a paradigm in a Qt4 (PyQt4) program where a component is able to respond to a signal without knowing anything about where it is coming from.  \nMy intial reading suggests that I have to explicitly connect signals to slots. But what I want is for any of a number of components to be able to send a signal, and for it to be processed by another component. \nComparing with another toolkits, for example, in wxWidgets I would use events. These automatically propogate up from child windows\/objects to parents.  At each level they can be handled.  This means if I have a lot of children which may emit the same event, I don't have to explicitly connect all of them to the handler.  I can just put the handler in the parent, or some higher level in the window hierarchy.  This means that only the event generator and consumer need to know about the event at all.  The consumer doesn't need to know where the source of the event is, how many such sources there are, or anything else about it.\nIs this possible in Qt - is there another approach?  Maybe there is an alternative event mechanism to signals and slots?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1116,"Q_Id":3286826,"Users Score":0,"Answer":"Don't you just want a good old fashioned method invocation?  The response is just the return value of the method.","Q_Score":3,"Tags":"python,qt4,pyqt,signals","A_Id":3300104,"CreationDate":"2010-07-20T03:36:00.000","Title":"How to broadcast a signal in Qt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a html window in wxpython and want to print it. Before that I need to enter user input (such as his name or such things ) in the html page. How to do that nicely? \nThanks in advance,","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":614,"Q_Id":3287455,"Users Score":0,"Answer":"There are a couple of approaches that come to my mind. If it's like a form letter where only specific parts will be replaced, then you can just should that to the user and have some text controls for them to fill in. Something like this:\nDear #NAME,\nThank you for contacting #COMPANY, blah blah blah\nAnd then have a text control for each of the replaceable parts. The other method would be to use the RichTextCtrl's Save As HTML functionality. See the wxPython Demo application for an example.","Q_Score":2,"Tags":"python,wxpython,tags","A_Id":3294064,"CreationDate":"2010-07-20T06:13:00.000","Title":"How to insert dynamic string in wxpython html window? (wx.html.htmlwindow)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I need to get the mouse position relative to the tkinter window.","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":9025,"Q_Id":3288047,"Users Score":3,"Answer":"Get the screen coordinates of the mouse move event (x\/y_root) and subtract the screen coordinates of the window (window.winfo_rootx()\/y()).","Q_Score":5,"Tags":"python,tkinter,mouse-position","A_Id":3288196,"CreationDate":"2010-07-20T08:05:00.000","Title":"How do I get mouse position relative to the parent widget in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When the user presses a close Button that I created, some tasks are performed before exiting. However, if the user clicks on the [X] button in the top-right of the window to close the window, I cannot perform these tasks. \nHow can I override what happens when the user clicks [X] button?","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":56249,"Q_Id":3295270,"Users Score":2,"Answer":"The command you are looking for is wm_protocol, giving it \"WM_DELETE_WINDOW\" as the protocol to bind to. It lets you define a procedure to call when the window manager closes the window (which is what happens when you click the [x]).","Q_Score":29,"Tags":"python,button,tkinter","A_Id":3295508,"CreationDate":"2010-07-20T23:46:00.000","Title":"Overriding Tkinter \"X\" button control (the button that close the window)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm confronted with the task of making a C++ app scriptable by users. The app has been in development for several years with no one wasting a thought on this before. It contains all sorts of niceties like multithreading, template wizardry and multiple inheritance. As the scripting language, Python is preferred, but Lua might be accepted if it is significantly easier to implement.\nQuestion 1\nFrom what I have learned so far, there are broadly speaking two ways to integrate Python\/Lua with C++ : \"extending\" and \"embedding\".\nIn this case, it looks like I need both. The scripting language need access to objects, methods and data from the app but needs to be called by the app once the user has written the script - without restarting anything.\nHow is this usually done in the real world?\nQuestion 2\nThere seems to be a bewildering array of of manual solutions and binding generators out there, all of them less than perfect. \n\nswig, pyste, Py++, ctypes, Boost.Python sip, PyCXX, pybindgen, robin, (Cython\/Pyrex, Weave)\nCppLua, Diluculum, Luabind, Luabridge, LuaCpp, Luna\/LunaWrapper, MLuaBind, MultiScript, OOLua, SLB, Sweet Lua, lux\n(this list from the lua wiki)\nCPB, tolua, tolua++, toLuaxx, luna and again swig\n\nMost commments on these found on the web are a little out of date. For example, swig is said to be difficult in non-trivial cases and to generate incomprehensible code. OTOH, it has recently gone to v2.0.\nSome of the above use pygccxml to let gcc analyze the C++ code and then genarate the binding. I find this idea appealing, as gcc probably understands the code better than i do  :-). Does this work well?\nTesting them all might easily cost me half of the time allocated for the whole project.\nSo, which ones do you recommend?","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1926,"Q_Id":3299067,"Users Score":0,"Answer":"My experience may not be much, but I figure it's at least worth what you paid for it ;)\nI've done some basic \"hello world\" python modules, and I couldn't really get into swig - it seemed like a lot of overhead for what I was doing. Of course it's also possible that it's just the right amount for your needs.","Q_Score":12,"Tags":"c++,python,binding,lua,scriptable","A_Id":3299189,"CreationDate":"2010-07-21T12:18:00.000","Title":"How do I make a nasty C++ program scriptable with Python and\/or Lua?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm confronted with the task of making a C++ app scriptable by users. The app has been in development for several years with no one wasting a thought on this before. It contains all sorts of niceties like multithreading, template wizardry and multiple inheritance. As the scripting language, Python is preferred, but Lua might be accepted if it is significantly easier to implement.\nQuestion 1\nFrom what I have learned so far, there are broadly speaking two ways to integrate Python\/Lua with C++ : \"extending\" and \"embedding\".\nIn this case, it looks like I need both. The scripting language need access to objects, methods and data from the app but needs to be called by the app once the user has written the script - without restarting anything.\nHow is this usually done in the real world?\nQuestion 2\nThere seems to be a bewildering array of of manual solutions and binding generators out there, all of them less than perfect. \n\nswig, pyste, Py++, ctypes, Boost.Python sip, PyCXX, pybindgen, robin, (Cython\/Pyrex, Weave)\nCppLua, Diluculum, Luabind, Luabridge, LuaCpp, Luna\/LunaWrapper, MLuaBind, MultiScript, OOLua, SLB, Sweet Lua, lux\n(this list from the lua wiki)\nCPB, tolua, tolua++, toLuaxx, luna and again swig\n\nMost commments on these found on the web are a little out of date. For example, swig is said to be difficult in non-trivial cases and to generate incomprehensible code. OTOH, it has recently gone to v2.0.\nSome of the above use pygccxml to let gcc analyze the C++ code and then genarate the binding. I find this idea appealing, as gcc probably understands the code better than i do  :-). Does this work well?\nTesting them all might easily cost me half of the time allocated for the whole project.\nSo, which ones do you recommend?","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1926,"Q_Id":3299067,"Users Score":0,"Answer":"Try Boost::Python, it has somewhat of a learning curve associated with it but it is the best tool for the job in my view, we have a huge real time system and developed the scripting library for the QA in Boost::Python.","Q_Score":12,"Tags":"c++,python,binding,lua,scriptable","A_Id":3299415,"CreationDate":"2010-07-21T12:18:00.000","Title":"How do I make a nasty C++ program scriptable with Python and\/or Lua?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm confronted with the task of making a C++ app scriptable by users. The app has been in development for several years with no one wasting a thought on this before. It contains all sorts of niceties like multithreading, template wizardry and multiple inheritance. As the scripting language, Python is preferred, but Lua might be accepted if it is significantly easier to implement.\nQuestion 1\nFrom what I have learned so far, there are broadly speaking two ways to integrate Python\/Lua with C++ : \"extending\" and \"embedding\".\nIn this case, it looks like I need both. The scripting language need access to objects, methods and data from the app but needs to be called by the app once the user has written the script - without restarting anything.\nHow is this usually done in the real world?\nQuestion 2\nThere seems to be a bewildering array of of manual solutions and binding generators out there, all of them less than perfect. \n\nswig, pyste, Py++, ctypes, Boost.Python sip, PyCXX, pybindgen, robin, (Cython\/Pyrex, Weave)\nCppLua, Diluculum, Luabind, Luabridge, LuaCpp, Luna\/LunaWrapper, MLuaBind, MultiScript, OOLua, SLB, Sweet Lua, lux\n(this list from the lua wiki)\nCPB, tolua, tolua++, toLuaxx, luna and again swig\n\nMost commments on these found on the web are a little out of date. For example, swig is said to be difficult in non-trivial cases and to generate incomprehensible code. OTOH, it has recently gone to v2.0.\nSome of the above use pygccxml to let gcc analyze the C++ code and then genarate the binding. I find this idea appealing, as gcc probably understands the code better than i do  :-). Does this work well?\nTesting them all might easily cost me half of the time allocated for the whole project.\nSo, which ones do you recommend?","AnswerCount":5,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":1926,"Q_Id":3299067,"Users Score":12,"Answer":"I wouldn't recommend swig as it's hard to get it to generate satisfactory binding in complex situations: been there, done that.  I had to write a horrible script that \"parsed\" the original C++ code to generate some acceptable C++ code that swig could chew and generate acceptable bindings.  So, in general: avoid ANY solution that relies on parsing the original C++ program.\nBetween Lua and Python: I have found Lua MUCH, MUCH better documented and more cleanly implemented.  Python has a GIL (global lock), whereas with Lua, you can have an interpreter instance in each thread, for example.\nSo, if you can choose, I'd recommend Lua. It is smaller language, easier to comprehend, easier to embed (much cleaner and smaller API, with excellent documentation).  I have used luabind for a small project of mine and found it easy to use.","Q_Score":12,"Tags":"c++,python,binding,lua,scriptable","A_Id":3299174,"CreationDate":"2010-07-21T12:18:00.000","Title":"How do I make a nasty C++ program scriptable with Python and\/or Lua?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For a college project, I need to implement a GUI for a console app I wrote. For this I decided to use PyQt. I need only basic functionalities, such as designing a simple form with basic elements and displaying some texts on it.\nCan anyone point me to a nice tutorial for learning PyQt? I really don't want to get into the details of Qt at this stage.","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":9748,"Q_Id":3300182,"Users Score":0,"Answer":"you need to see the orginal pyqt Examples\nyou need time for practice\nyou get Experience \nyou must specify a goal and start Researching about it.","Q_Score":12,"Tags":"python,pyqt","A_Id":10767981,"CreationDate":"2010-07-21T14:15:00.000","Title":"Learning PyQt Quickly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"for python2.x py2app will do the work. But for python3 code which one is alternate to go ahead?\nOr is there any other way to get single .app file?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":231,"Q_Id":3307083,"Users Score":0,"Answer":"py2app claims to support Python 3, so you should be able to use it.","Q_Score":1,"Tags":"python,macos,python-3.x","A_Id":5049583,"CreationDate":"2010-07-22T08:38:00.000","Title":"How to convert python3-pyqt code into .app file for mac os x?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I compiled Python using PCBuild\\build.bat I discovered that several Python external projects like ssl, bz2, ... were not compiled because the compiler did not find them. \nI did run the Tools\\Buildbot\\external.bat and it did download them inside \\Tools\\ but it looks that the build is not looking for them in this location and the PCBuild\\readme.txt does not provide the proper info regarding this.\nIn case it does matter, I do use VS2008 and VS2010 on this system.\nExample:\n\nBuild log was saved at \"file:\/\/C:\\dev\\os\\py3k\\PCbuild\\Win32-temp-Release\\_tkinter\\BuildLog.htm\"     \n_tkinter - 2 error(s), 0 warning(s)                                                                 \nBuild started: Project: bz2, Configuration: Release|Win32                                           \nCompiling...                                                                                        \nbz2module.c                                                                                         \n..\\Modules\\bz2module.c(12) : fatal error C1083: Cannot open include file: 'bzlib.h': No such file or\n directory","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":872,"Q_Id":3307813,"Users Score":2,"Answer":"Tools\\buildbot\\external.bat must be run from py3k root, not from Tools\\buildbot\\ subdir as you did. Also to build release version of python with Tkinter support you have to edit or copy Tools\\buildbot\\external.bat to remove DEBUG=1 so it can build tclXY.dll\/tkXY.dll (without -g suffix).","Q_Score":1,"Tags":"python","A_Id":3683128,"CreationDate":"2010-07-22T10:20:00.000","Title":"How to compile Python with all externals under Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Could someone tell me which is better of the two for bundling Python applications \u2014 cx_Freeze or PyInstaller? I'm looking for a comparison based on factors such as:\n\nPopularity (i.e. larger user base)\nFootprint of the built binary\nCross platform compatibility\nEase of use","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":20447,"Q_Id":3307966,"Users Score":26,"Answer":"I tried both for a current project and decided to use cx_freeze. I found it easier to get started. It has an option to bundle dependencies in a zip archive, which makes it easy to check that everything was properly included.\nI had trouble getting PyInstaller to include certain egg dependencies. It couldn't handle conditional imports as well as I needed and looking through the bundled archive was difficult. On Windows, it requires pywin32 (so it can't be used with virtualenv) and version 1.4 doesn't work with Python 2.6. There's no information on whether Python 2.7 is supported.","Q_Score":37,"Tags":"python,pyinstaller,cx-freeze","A_Id":3368456,"CreationDate":"2010-07-22T10:45:00.000","Title":"Which is better - PyInstaller or cx_Freeze?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am compiling on Ubuntu 10.04 LTS. The Perforce Python API uses their C++ API for some of it. So, I point the setup.py at the C++'s API directory using the --apidir= they say to use. When it starts to compile the C++, I get a whole load of errors (temporary error list link is now gone). No one else has had these errors as far as I can tell. So, my question is, is it my idiocy, or Perforce's?\nP.S. The reason I don't have the flag in the command is because I setup the setup.cfg file to point at the API.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":290,"Q_Id":3324490,"Users Score":0,"Answer":"Woops! Forgot I still needed to install python-dev...","Q_Score":0,"Tags":"c++,python,perforce","A_Id":3324560,"CreationDate":"2010-07-24T09:08:00.000","Title":"Perforce P4Python API Bug","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any difference in speed of copying files from one location to another betwen python or delphi or c++ ? \nI guess that all 3 laguages uses same or similar win api calls and that there is not much performance difference.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":78,"Q_Id":3324870,"Users Score":1,"Answer":"Pythons shutil module does not use the Windows API, but instead uses an open\/read\/write loop. This may or may not be slower than using CopyFile(Ex). Please measure it, everything else is just guessing.","Q_Score":0,"Tags":"python,windows,performance,comparison","A_Id":3324905,"CreationDate":"2010-07-24T11:17:00.000","Title":"python file copying","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a developer on a software project for Linux that uses Python and PyGTK. The program we are writing depends on a number of third-party packages that are available through all mayor distro repositories. One of these is a python binding (written in C) that allows our program to chat with a common C library. Unfortunately, there's a bug in the bindings that affects our program a great deal. A fix\/patch was recently presented, but hasn't been committed yet. We want to include this fix as soon as possible, but are unsure that the best course of action would be. \nBased on the scenario I described, we figured we have the following options. Hopefully someone can give more insight or maybe point us to a solution we haven't considered yet\n\nWait for the python bindings to be updated. The problem with this is that we have no way of knowing when the update would be accepted into distribution repositories, or even if it will be backported to earlier releases. \nInclude a modified version of the python bindings including the fix with our program and have users compile it on installation. This would provide a burden for packagers as every version of every distribution would link against another version of the C library. \nRewrite our program in C++ and avoid dealing with python bindings all together. Yep, actually considering this hehe. \nKeep the ugly hack we have in place intact. Not preferable obviously as it is, well, an ugly hack\n\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":115,"Q_Id":3325161,"Users Score":3,"Answer":"As long as the ugly hack works, use it.  It will have drawbacks local to your package.  Additionally, you can phase it out (significantly) later by requiring a bug-free version of your dependency, when it is released and is available for some time so that distros have a chance to start shipping it.","Q_Score":2,"Tags":"python,linux,repository,packaging","A_Id":3325182,"CreationDate":"2010-07-24T12:54:00.000","Title":"Bug in third-party dependency creates python packaging dilemma","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know how to make an image a button in Tkinter, now how do I make th image a toggle button similar to a radio button?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1795,"Q_Id":3327799,"Users Score":2,"Answer":"Use a checkbutton with \"indicatoron\" set to False. This will turn off the little checkbox so you only see the image (or text), and the relief will toggle between raised and sunken each time it is clicked. \nAnother way is to use a label widget and manage the button clicks yourself. Add a binding for <1> and change the relief to sunken if raised, and raised if sunken. It's easier to use the built-in features of the checkbutton, since it also handles keyboard traversal, activation, etc.","Q_Score":0,"Tags":"python,radio-button,toggle,tkinter","A_Id":3327963,"CreationDate":"2010-07-25T02:49:00.000","Title":"Making a Toggle Button with an image in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a gtk TextView in a maximized window and I want to know how many characters a line can fit before you have to scroll.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":214,"Q_Id":3328241,"Users Score":0,"Answer":"(Friendly reminder, please stop putting answers in the comments, people.)\nTo summarize:\nIt depends on the size of the TextView, size of the window, size of the font, and as Alex Martelli said, the particular font and the usage of letters...\"i\" is a narrow letter, \"m\" is a wide letter, thus you can fit more \"i\"s than you can \"m\"s in a given space.\nSo, in short, there is no way to know for sure.","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":8647405,"CreationDate":"2010-07-25T06:03:00.000","Title":"Get the length in characters of a PyGTK TextView","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What are the usable tools?\nI am aware of wxformbuilder and wxGlade, but none of them seems to be complete yet.","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":831,"Q_Id":3329762,"Users Score":2,"Answer":"Here are a few of the most popular wxPython related GUI builders:\n\nBoa Constructor (mostly dead) \nwxGlade\nwxFormBuilder \nXRCed \nwxDesigner (not FOSS)\nDabo - one of their videos shows a way to interactively design an app...\n\nI personally just use a Python IDE to hand code my applications. My current favorite IDE is Wing.","Q_Score":2,"Tags":"python,wxpython,wxwidgets","A_Id":3345554,"CreationDate":"2010-07-25T15:30:00.000","Title":"What are the existing open-source Python WxWidgets designers?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What are the usable tools?\nI am aware of wxformbuilder and wxGlade, but none of them seems to be complete yet.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":831,"Q_Id":3329762,"Users Score":1,"Answer":"afaik... none. I'll follow the answers to see if someone has one and try it of course but I'm not convinced this will be THAT useful. When using wxPython, you usually work with sizers (at least I think the results are better) so you don't really need to \"place\" the controls on the frame and I think a GUI \"design\" would be longer to do. The only part where I think it could have some interest is to fill atributes for the controls but a good auto-complete with wx (or a good cheat sheet or a \"template class\" with all the options you use) solves the problem in my opinion. I stopped seeking for a GUI designer for wx after trying Pydev that auto-completes wx very nicely (a lot better than everything I tried before... and that's a lot!).","Q_Score":2,"Tags":"python,wxpython,wxwidgets","A_Id":3330832,"CreationDate":"2010-07-25T15:30:00.000","Title":"What are the existing open-source Python WxWidgets designers?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to this post as well as to python GUI programming.I want to make a realtime graphical GUI in wxpython.My requirement is that i have to catch signals from a device and i have to display the data in graphical as well as in textual form.The system should be accurate and be specific with the time constraints.Please can any one guide me in this,and if this be possible in wxpython and if yes how can i and if no what i can use for this is python.\nHoping someone will help me out soon.Thanks in advance and for your concern.\nregards,\nAnil ph","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":179,"Q_Id":3332263,"Users Score":0,"Answer":"If you can connect to this mysterious device and receive data from it from Python, then you can display said data with wxPython or any other GUI toolkit. You don't really say what kind of data it is or what you want to display? Lines? Graphs? Or what? If it's just tabular data, use the wx.ListCtrl (or ObjectListView) widget. If you need graphs, see the Plot widget or Matplotlib.","Q_Score":0,"Tags":"user-interface,wxpython,real-time","A_Id":5598605,"CreationDate":"2010-07-26T04:48:00.000","Title":"Help : Realtime graphical interface in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application where my DataFetch() class \"Wraps\" around my HBHTray() class for the purpose of interacting with the functions\/variables of that class. Unfortunately, I can't seem to be able to get the code to continue execution after my DataFetch() class makes a instance of HBHTray and calls it, and on the Start() method of HBHTray it hangs.\nThis is the relevant code:\n\nclass DataFetch(): # I need the DataFetch class to be wrapping around HBHTray so I can call\/edit certain variables from within functions in DataFetch\n    def init(self):\n        self.Interval, self.Username, self.Password, self.CheckShoutBox = GetOptions('.tray')\n        self.Gui = HBHTray()\n        print '1'\n        self.Gui.Start()\n        print '2'\n    def Login(self):\n        pass # Do stuff (Eg: Edit self.Gui.StatusIcon state or call self.Gui.Notify()\n    def Start(self):\n        print 'hi!'\n        sleep(self.Interval)\n        print 'Hi!'\nclass HBHTray():\n    def init(self):\n        self.StatusIcon = gtk.StatusIcon()\n        self.StatusIcon.set_from_file('img')\n        self.StatusIcon.set_tooltip('No new messages')\n        self.Menu = gtk.Menu()\n            self.CheckBox = gtk.CheckMenuItem('Notify')\n            self.CheckBox.connect('activate', self.ChangeCheckBox)\n            self.CheckBox.set_active(True)\n            self.Menu.append(self.CheckBox)\n        self.MenuItem = gtk.ImageMenuItem('Options')\n        self.MenuItem.connect('activate', self.Options, self.StatusIcon)\n        self.Menu.append(self.MenuItem)\n        self.MenuItem = gtk.ImageMenuItem('About')\n        self.MenuItem.connect('activate', self.About, self.StatusIcon)\n        self.Menu.append(self.MenuItem)\n        self.MenuItem = gtk.ImageMenuItem('Quit')\n        self.MenuItem.connect('activate', self.Quit, self.StatusIcon)\n        self.Menu.append(self.MenuItem)\n        self.StatusIcon.connect('popup-menu', self.PopMenu, self.Menu)\n        self.StatusIcon.set_visible(1)\n    def PopMenu(self, widget, button, time, data = None):\n        if data:\n            data.show_all()\n            data.popup(None, None, gtk.status_icon_position_menu, 3, time, self.StatusIcon)\n    def Notify(self, message):\n        pynotify.init('null')\n        notification = pynotify.Notification('Something', message, 'dialogue')\n        notification.attach_to_status_icon(self.StatusIcon)\n        notification.show()\n    def Start(self):\n        gtk.main()\n    def About(self, a, b):\n        self.Notify('test')\n    def Options(self, a, b):\n        print a, b\n    def ChangeCheckBox(self, null):\n        pass\n    def Quit(self, a, b):\n        raise SystemExit\nif name == 'main':\n    try:\n        gobject.threads_init() # Doesn't work?\n        Monitor = DataFetch()\n        Monitor.Start()\n\nSorry for the terrible formatting, Stack Overflow doesn't seem to like blank lines....\nAnyways, though, \"1\" is printed, but \"2\" is not. So, gtk.main() is obviously where it's hanging. Is there any way to allow me to continue execution and have gtk go do it's own thing?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":356,"Q_Id":3336457,"Users Score":0,"Answer":"Turns out the problem was that I couldn't find a working solution because I was utilizing the Thread module the wrong way and calling run() directly when I should have been calling start(). Because of that, I was thinking that nothing I did worked (especially with no error or complaint from anything) and figured it was a problem relating to how I was wrapping gtk.main()","Q_Score":0,"Tags":"python,multithreading,pygtk,wrapper","A_Id":3337085,"CreationDate":"2010-07-26T15:42:00.000","Title":"Continuing code execution after a pygtk.main() in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application where my DataFetch() class \"Wraps\" around my HBHTray() class for the purpose of interacting with the functions\/variables of that class. Unfortunately, I can't seem to be able to get the code to continue execution after my DataFetch() class makes a instance of HBHTray and calls it, and on the Start() method of HBHTray it hangs.\nThis is the relevant code:\n\nclass DataFetch(): # I need the DataFetch class to be wrapping around HBHTray so I can call\/edit certain variables from within functions in DataFetch\n    def init(self):\n        self.Interval, self.Username, self.Password, self.CheckShoutBox = GetOptions('.tray')\n        self.Gui = HBHTray()\n        print '1'\n        self.Gui.Start()\n        print '2'\n    def Login(self):\n        pass # Do stuff (Eg: Edit self.Gui.StatusIcon state or call self.Gui.Notify()\n    def Start(self):\n        print 'hi!'\n        sleep(self.Interval)\n        print 'Hi!'\nclass HBHTray():\n    def init(self):\n        self.StatusIcon = gtk.StatusIcon()\n        self.StatusIcon.set_from_file('img')\n        self.StatusIcon.set_tooltip('No new messages')\n        self.Menu = gtk.Menu()\n            self.CheckBox = gtk.CheckMenuItem('Notify')\n            self.CheckBox.connect('activate', self.ChangeCheckBox)\n            self.CheckBox.set_active(True)\n            self.Menu.append(self.CheckBox)\n        self.MenuItem = gtk.ImageMenuItem('Options')\n        self.MenuItem.connect('activate', self.Options, self.StatusIcon)\n        self.Menu.append(self.MenuItem)\n        self.MenuItem = gtk.ImageMenuItem('About')\n        self.MenuItem.connect('activate', self.About, self.StatusIcon)\n        self.Menu.append(self.MenuItem)\n        self.MenuItem = gtk.ImageMenuItem('Quit')\n        self.MenuItem.connect('activate', self.Quit, self.StatusIcon)\n        self.Menu.append(self.MenuItem)\n        self.StatusIcon.connect('popup-menu', self.PopMenu, self.Menu)\n        self.StatusIcon.set_visible(1)\n    def PopMenu(self, widget, button, time, data = None):\n        if data:\n            data.show_all()\n            data.popup(None, None, gtk.status_icon_position_menu, 3, time, self.StatusIcon)\n    def Notify(self, message):\n        pynotify.init('null')\n        notification = pynotify.Notification('Something', message, 'dialogue')\n        notification.attach_to_status_icon(self.StatusIcon)\n        notification.show()\n    def Start(self):\n        gtk.main()\n    def About(self, a, b):\n        self.Notify('test')\n    def Options(self, a, b):\n        print a, b\n    def ChangeCheckBox(self, null):\n        pass\n    def Quit(self, a, b):\n        raise SystemExit\nif name == 'main':\n    try:\n        gobject.threads_init() # Doesn't work?\n        Monitor = DataFetch()\n        Monitor.Start()\n\nSorry for the terrible formatting, Stack Overflow doesn't seem to like blank lines....\nAnyways, though, \"1\" is printed, but \"2\" is not. So, gtk.main() is obviously where it's hanging. Is there any way to allow me to continue execution and have gtk go do it's own thing?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":356,"Q_Id":3336457,"Users Score":0,"Answer":"gobject.threads_init() does not magically put your things into separate threads. It only tells the library that you're going to use threads, and sets up some locking. You'll still have to create the threads yourself.","Q_Score":0,"Tags":"python,multithreading,pygtk,wrapper","A_Id":3336490,"CreationDate":"2010-07-26T15:42:00.000","Title":"Continuing code execution after a pygtk.main() in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.\nI'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.\nMy goals:\n1. to make GUI using as less custom components as possible.\n2. to make it as cross-platform as possible\n(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)\nSo - the question is about GUI - what should I choose?","AnswerCount":8,"Available Count":5,"Score":0.1243530018,"is_accepted":false,"ViewCount":6247,"Q_Id":3337725,"Users Score":5,"Answer":"Well, Mono does not come with the base of most Linux distributions.  It's not a terribly lightweight dependency either, and I think Java is considerably more likely for people to already have.  Would you plan on using \"Winforms\" with Mono?  If so, and you don't have experience with Winforms, read about what others have to say :-)  The other .NET GUI toolkit is WPF, which unfortunately Mono has no plans to implement.\nJython would be better too, because you can use SWT, which renders native widgets and provides lots of layout possibilities easily.  Or you can use Jython with Swing, or whatever else -- even AWT if you love ugliness.\nI really like wxPython (which you can use with CPython, which is on most distros by default), because it renders good-looking native widgets in OSX, Windows and Linux (I've only seen the Gnome widgets in person).  wxPython is by far the easiest to use GUI toolkit I've used -- even programatically (i.e. layout without Glade or similar).  I've also used SWT, which I found quite nice, and Swing, which I personally don't really like the looks of, and Winforms, which was a nightmare to try to do even simple layouts with.\nHere's a quick comparison of the existence of the interpreter\/language runtime by OS\n\nCPython\n\nWindows - Probably not installed, and you'd have to make a non-python installer install it with your software :-P\nLinux - Probably installed (Ubuntu, Gentoo and RedHat all have system tools that are written in Python and run on CPython)\nMac - Preinstalled on OSX\n\nJython\n\nWindows - Probably installed at some point in my experience, though it doesn't come with\nLinux - Probably installed, but more importantly nobody would hate you for depending on it like Mono\nMac - Preinstalled on OSX (\"Mac OS X Leopard comes with J2SE 5.0 preinstalled, based on JDK 1.5.0_13_b05\" -- Apple's site)\n\nIronPython\n\nWindows - Will probably run fine because I bet most people have at the very least .NET 2.0 if they have a recent version of Windows\nLinux - Probably not installed -- the only application with which I've used Mono on Linux was Rasterbator, which worked well but I felt weird putting .NET on Linux\nMac - See above\n\n\nI would choose a GUI toolkit first, since that will very much impact the user experience and overall difficulty (I would choose wxPython but SWT would be a close second) then consider the above as well maybe as a tiebreaker.","Q_Score":9,"Tags":"python,user-interface,ironpython,jython,cpython","A_Id":3337830,"CreationDate":"2010-07-26T18:19:00.000","Title":"CPython vs. Jython vs. IronPython for cross-platform GUI development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.\nI'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.\nMy goals:\n1. to make GUI using as less custom components as possible.\n2. to make it as cross-platform as possible\n(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)\nSo - the question is about GUI - what should I choose?","AnswerCount":8,"Available Count":5,"Score":0.049958375,"is_accepted":false,"ViewCount":6247,"Q_Id":3337725,"Users Score":2,"Answer":"Take a look at comparable GUI's written in python\/jython\/ironpython. Look for programs that you like and find out what they use. I guess most if not all will be written in cpython + gtk or cpython + qt. I think all gui toolkits in python are cross platform.","Q_Score":9,"Tags":"python,user-interface,ironpython,jython,cpython","A_Id":3337760,"CreationDate":"2010-07-26T18:19:00.000","Title":"CPython vs. Jython vs. IronPython for cross-platform GUI development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.\nI'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.\nMy goals:\n1. to make GUI using as less custom components as possible.\n2. to make it as cross-platform as possible\n(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)\nSo - the question is about GUI - what should I choose?","AnswerCount":8,"Available Count":5,"Score":0.1243530018,"is_accepted":false,"ViewCount":6247,"Q_Id":3337725,"Users Score":5,"Answer":"I'd say that if cross-platform is a goal, forget IronPython.  A lot of people hate the dependency hell it causes so it'll be too much work to get it up in running in some OSes\/distributions.  Jython will suffer this also, albeit to a lesser degree.","Q_Score":9,"Tags":"python,user-interface,ironpython,jython,cpython","A_Id":3337744,"CreationDate":"2010-07-26T18:19:00.000","Title":"CPython vs. Jython vs. IronPython for cross-platform GUI development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.\nI'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.\nMy goals:\n1. to make GUI using as less custom components as possible.\n2. to make it as cross-platform as possible\n(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)\nSo - the question is about GUI - what should I choose?","AnswerCount":8,"Available Count":5,"Score":0.049958375,"is_accepted":false,"ViewCount":6247,"Q_Id":3337725,"Users Score":2,"Answer":"Java is the most portable platform. Jython is written in 100% pure Java. 'Nuff said.\nBTW I just switched a CPython\/GTK project to Jython (trying to remove as much unmanaged code as possible), the only problem is that Jython is at 2.5 still, which kind of sucks when you're used to 2.6\/2.7\/3 :)","Q_Score":9,"Tags":"python,user-interface,ironpython,jython,cpython","A_Id":3341283,"CreationDate":"2010-07-26T18:19:00.000","Title":"CPython vs. Jython vs. IronPython for cross-platform GUI development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.\nI'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.\nMy goals:\n1. to make GUI using as less custom components as possible.\n2. to make it as cross-platform as possible\n(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)\nSo - the question is about GUI - what should I choose?","AnswerCount":8,"Available Count":5,"Score":0.024994793,"is_accepted":false,"ViewCount":6247,"Q_Id":3337725,"Users Score":1,"Answer":"There are plenty of answers already, but I'd like to add one important thing - regardless of which library you learn, most of the principles will be the same when you move to another library.\nI don't know about Qt, but for most graphics programs (in PyGTK or Tkinter) the best thing to do, as far as editing goes, is to use a PIL image (or something similar) to draw on and then draw that image on your canvas widget, otherwise you can lose pixel data if your window gets covered.","Q_Score":9,"Tags":"python,user-interface,ironpython,jython,cpython","A_Id":3337836,"CreationDate":"2010-07-26T18:19:00.000","Title":"CPython vs. Jython vs. IronPython for cross-platform GUI development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i was wondering how to update a StaticText dynamically in wxpython?\nI have a script that goes every five minutes and reads a status from a webpage, then prints using wxpython the status in a static input.\nHow would i dynamically, every 5 minutes update the statictext to reflect the status?\nthanks alot\n-soule","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":12769,"Q_Id":3339263,"Users Score":1,"Answer":"Call the SetLabel method in your static text instance.  So you don't run into conflict with the size, make sure your StaticText instance is created with enough space to write the future labels you'll want to write to it.","Q_Score":5,"Tags":"python,wxpython,refresh","A_Id":3339765,"CreationDate":"2010-07-26T21:50:00.000","Title":"Dynamically update wxPython staticText","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Just wondering if there is any kind of framework or method of making a Gui that will override (Stay on top of) all other windows in python. Including Games or other programs that seem to \"Take over\" the computers Graphical processes. Any point in the right direction would be much appreciated...\nPS. The OS in question is Windows 7, but a cross platform solution would be appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":99,"Q_Id":3340639,"Users Score":0,"Answer":"For a cross-platform solution, you could use wxPython with a wxSTAY_ON_TOP style bit in a main window.  I believe that this will give you the behavior you desire on Mac and Unix GUIs as well as Microsoft Windows ones.","Q_Score":0,"Tags":"python,user-interface","A_Id":3340779,"CreationDate":"2010-07-27T03:55:00.000","Title":"GUI's Over Running Programs in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What's a good way to handle fatal errors - missing packages, .ui files not compiled, Qt DLLs or shared objects not found, etc. - in a PyQt app (or other Python app)?\nDisplaying a cross-platform message box without Qt DLLs or shared objects seems like a lot of work.  Dumping a message to the console seems not very helpful, since the end user will likely not see the console.  How do other Python apps handle this?  Or do they simply assume that a properly installed app won't run into these problems?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":67,"Q_Id":3358759,"Users Score":1,"Answer":"The distutils model handles installing a python app correctly, or there is a third party setuptools package that is even easier for end users.","Q_Score":0,"Tags":"python,installation,error-handling,pyqt,packages","A_Id":3358864,"CreationDate":"2010-07-29T01:04:00.000","Title":"Handling missing packages or DLLs in a PyQt app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering how to hide\/delete a StaticText in wxPython?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3670,"Q_Id":3367986,"Users Score":0,"Answer":"statictext.Show to show\nand \nstatictext.Hide to hide","Q_Score":4,"Tags":"python,wxpython,hide","A_Id":22358518,"CreationDate":"2010-07-30T00:37:00.000","Title":"Hide\/Delete a StaticText in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering how to hide\/delete a StaticText in wxPython?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":3670,"Q_Id":3367986,"Users Score":5,"Answer":"Have you tried control.Hide() or control.Show(False)?","Q_Score":4,"Tags":"python,wxpython,hide","A_Id":3368074,"CreationDate":"2010-07-30T00:37:00.000","Title":"Hide\/Delete a StaticText in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering how to hide\/delete a StaticText in wxPython?","AnswerCount":3,"Available Count":3,"Score":0.3215127375,"is_accepted":false,"ViewCount":3670,"Q_Id":3367986,"Users Score":5,"Answer":"The widget's Hide\/Show methods should work. If the widget is in a sizer, then you can use the sizer's Detach method to \"hide\" it but not destroy it. Otherwise, the sizer has a Remove method that will remove the widget and destroy it. And there's the widget's own Destroy method.","Q_Score":4,"Tags":"python,wxpython,hide","A_Id":3371640,"CreationDate":"2010-07-30T00:37:00.000","Title":"Hide\/Delete a StaticText in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any examples how to authenticate your desktop Facebook application using PyQT and embedded webkit? \nThis is to provide better user experience than opening Facebook authentication page in a separate browser window.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":640,"Q_Id":3371549,"Users Score":0,"Answer":"I don't believe you can open an \"authentication page\" in a separate window under Facebook's terms (I used to work for Zynga, and we couldn't then, so I don't know how you'd achieve this now legally). \nSecond, you're looking into the QWebkit backwards I believe. From a UI perspective this is supposed to provide access to websites, and interact with them. If you want a good looking page, with all the bells and whistle, it pains me to say it ~ but use Actionscript 3, or Ajax and it's bundle.\nThis post would probably be answered better if tagged in the javascript, php, and as3 sections. As the php guys will know the correct hacks to get your intended result, if possible","Q_Score":4,"Tags":"python,facebook,webkit,pyqt","A_Id":5099848,"CreationDate":"2010-07-30T12:51:00.000","Title":"pyqt, webkit and facebook authentication?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"i have a scene with a multiple (QGraphicsTextItem)s, and  i need to have control over their colors , so how to change a color of a QGraphicsTextItem ? is it possible anyway? i've been trying for 3 days until now . please help\n\nthanks in advance","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":8684,"Q_Id":3377439,"Users Score":2,"Answer":"setDefaultTextColor(col) \"Sets the color for unformatted text to col.\" The documentation is not clear about what \"unformatted text\" means.  I think it means: \"all portions of the contents of the item that have not been styled.\"\nThe contents is a QTextDocument.\nYou style a part of a document using a QTextCursor.  You can't style the QTextDocument per se, only a part that is selected by a QTextCursor (but you can select the whole document.)\nYou can style a QTextCursor using method mergeCharFormat(QTextCharFormat)\nThe QTextCharFormat has methods:\n\nforeground().setColor(QColor)  \nsetForeground(QBrush)\nsetTextOutline(QPen)\n\nForeground is a QBrush that paints several things including \"text\" (but better said: the fill of characters?)\nOne nuance is that certain newly constructed QBrush have (default to) QBrushStyle.NoBrush, which is transparent, even if you setColor().","Q_Score":10,"Tags":"python,qt,qt4,pyqt","A_Id":12565371,"CreationDate":"2010-07-31T08:52:00.000","Title":"how to change the color of a QGraphicsTextItem","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a WxPython app that, among other things, has a integrated file-browser.\nI want to be able to create a system-default file context menu (e.g. what you get if you right-click on a file in windows explorer) when a user right clicks on one of the items within my application.\nNote: I already know how to create my own context menu (e.g. wx.EVT_LIST_ITEM_RIGHT_CLICK), I want the Windows context menu.\nTo clarify, I do not want, or need to modify the existing system context menu, I want to be able to display it for a specific file within my application. \nBasically, I know what was right clicked on, and where the mouse pointer is (if it's needed). I want to create the system context menu there, just like it works in windows explorer.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":741,"Q_Id":3380986,"Users Score":0,"Answer":"If you have python win32 installed, then look under the directory <PYTHON>\/lib\/site-packages\/win32comext\/shell\/demos\/servers.  This contains a file context_menu.py which has sample code for creating a shell extension.\nUpdate: I think you want the folder_view.py sample.","Q_Score":0,"Tags":"python,user-interface,windows-xp,wxpython","A_Id":3380995,"CreationDate":"2010-08-01T06:20:00.000","Title":"Create Explorer.exe's File - Context Menu in WxPython application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I hope to load .net dll in ironpython.\nBut one of static functions in .net dll, has some Named and Optional Arguments.\nlike, Draw(weight:w,height:h, Area=1)\nOnly can I use full arguments?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1159,"Q_Id":3384989,"Users Score":6,"Answer":"Named and optional parameters are fully supported.  .NET has had these for a long time for VB.NET support and so IronPython has supported that same way to do them since the beginning.  The new C# syntax maps to the same underlying metadata as the old VB support.\nFor calling you use f(x = 42) which is Python's named parameter syntax.  For optional parameters you can just leave them out.  In your example case you can probably do Draw(weight, height) and leave Area out.  Or you can call w\/ weight and height as named parameters and leave Area out.\nThe underlying .NET meta data that IronPython looks for is either the OptionalAttribute or DefaultParameterValueAttribute.  For optional we pass in default(T) unless the type is object in which case we pass in Missing.Value.  This generally matches how reflection calls these APIs as well.","Q_Score":3,"Tags":".net,ironpython,optional-parameters,named-parameters","A_Id":3401635,"CreationDate":"2010-08-02T04:28:00.000","Title":"Can I use Named and Optional Arguments in ironpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im planing to do some GUI development using pyqt4 pykde and python3.1 on Kubuntu 10.4. In the research I did I found out that most of the things are available as packages in repositories and some of the packages are preinstalled. Only thing is I'm not able to figure out what to install and what not to. Can someone please give me a list of packages that I need to install to do GUI development using python3.1 pyQt4 and pyKDE.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":333,"Q_Id":3385013,"Users Score":0,"Answer":"I guess you need python-qt4 qt4-designer qt4-dev-tools.","Q_Score":2,"Tags":"python,linux,pyqt4,kubuntu","A_Id":3460599,"CreationDate":"2010-08-02T04:35:00.000","Title":"pyqt installation question","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project using Tkinter and Python. In order to have native theming and to take advantage of the new widgets I'm using ttk in Python 2.6. My problem is how to allow the user to scroll through the tabs in the notebook widget (a la firefox). Plus, I need a part in the right edge of the tabs for a close button. The frame for the active tab would need to fill the available horizontal space (including under the scroll arrows).\nI thought I could do this using the Place geometry manager, but I was wondering if there was a better way? The ttk python docs don't have any methods to deal with this that I could see. \nEdit: looks like there are difficulties for even trying to implement this using place. For one, I'd still need the tabs to scroll and the active panel to stay in the one place.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1350,"Q_Id":3386098,"Users Score":0,"Answer":"I've never used these widgets so I have no idea how possible this is, but what I would try is something akin to the grid_remove() method. If you can move the tabs to an invisible widget, or just make them invisible without losing content, that's what I'd look for\/try.","Q_Score":1,"Tags":"python,user-interface,tkinter,ttk","A_Id":3389225,"CreationDate":"2010-08-02T08:20:00.000","Title":"Using the ttk (tk 8.5) Notebook widget effectively (scrolling of tabs)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project using Tkinter and Python. In order to have native theming and to take advantage of the new widgets I'm using ttk in Python 2.6. My problem is how to allow the user to scroll through the tabs in the notebook widget (a la firefox). Plus, I need a part in the right edge of the tabs for a close button. The frame for the active tab would need to fill the available horizontal space (including under the scroll arrows).\nI thought I could do this using the Place geometry manager, but I was wondering if there was a better way? The ttk python docs don't have any methods to deal with this that I could see. \nEdit: looks like there are difficulties for even trying to implement this using place. For one, I'd still need the tabs to scroll and the active panel to stay in the one place.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1350,"Q_Id":3386098,"Users Score":2,"Answer":"The notebook widget doesn't do scrolling of tabs (or multiple layers of them either) because the developer doesn't believe that they make for a good GUI. I can see his point; such GUIs tend to suck. The best workaround I've seen is to have a panel on the side that allows the selection of which pane to display. You can then apply tricks to that panel to manage the amount of information there (e.g., by making it a treeview widget and holding the info hierarchically, much like most email clients handle mail folders; treeview widgets are scrollable).","Q_Score":1,"Tags":"python,user-interface,tkinter,ttk","A_Id":3650157,"CreationDate":"2010-08-02T08:20:00.000","Title":"Using the ttk (tk 8.5) Notebook widget effectively (scrolling of tabs)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":0.0665680765,"is_accepted":false,"ViewCount":874,"Q_Id":3386377,"Users Score":3,"Answer":"First, results speak for themselves: if you can piece together another version of one of your applications in pyqt, and tell him how long it took, it might be motivation enough.\nOr, next time you're starting a project, you could prototype four or five different versions of the interface in pyqt in the morning, ask his feedback after lunch, and then say, \"if I keep going on these, it'll be done in two days; if I redo this in netbeans, it'll be done in four.\"\nAnd as for the \"never heard of it\", feel free to point out that Google uses python extensively, and even hired many of the python developers.","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3386409,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":0.0,"is_accepted":false,"ViewCount":874,"Q_Id":3386377,"Users Score":0,"Answer":"Just use Netbeans as an IDE and he'll never notice :P\nSpeaking more seriously: a side by side comparison of strong and weak points behind each of technologies will certianly be more convincing. Just don't cheat too much in favor of Python ;)","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3386403,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":1.2,"is_accepted":true,"ViewCount":874,"Q_Id":3386377,"Users Score":12,"Answer":"If your selling skills are not working in discussion format I highly suggest that you document it. Some managers\/bosses really respond well to this.\nMake a matrix of all the metrics that you yourself use to grade the two frameworks (I leave the level of objectivity to you there: for example if objective it should analyze the cost of transition and the loss of institutional experience; but it might not be high).\nFinally, send it by e-mail and viola you have:\n\nmade a report\/analysis of the situation providing options for improvement\nthis shows that you are thinking towards future and that you show initiative\n\nEDIT:\nYou can also ask your boss to show your analysis to his friend if he trust his friend that much, but ask for a written counter-analysis so that you can address the critique.\nIt is a good thing to do it openly and document the decision process well, since ultimately, if your suggestion is accepted, you will share responsibility for the decision.","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3386436,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":0.022218565,"is_accepted":false,"ViewCount":874,"Q_Id":3386377,"Users Score":1,"Answer":"Perhaphs showing him\na)Time spent in developing in Python and Java\nb)lines of code in Python and Java\nwith these two metrics maybe you can make your case stronger","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3386699,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":0.1106561105,"is_accepted":false,"ViewCount":874,"Q_Id":3386377,"Users Score":5,"Answer":"The basic problem here is that your non-technical boss is getting conflicting advice from you and from the friend who advised him in the first place.  If you want him to take your advice seriously you need to prove that your advice is likely to be trustworthy.  And that will only come with taking the lead and being successful with significant projects in the company.  Right now, you haven't earned his confidence.\nThe other thing to consider is how your preferences mesh with the company's objectives.  For instance, you want to be able to write code fast.  But the boss \/ the company needs code that is going to be reliable and maintainable ... if you decide to take another position.  He doesn't want to be left in the awkward situation where the company is contractually committed to deliver code that doesn't really work properly, and the only person who understands it has left.","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3386477,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":0.022218565,"is_accepted":false,"ViewCount":874,"Q_Id":3386377,"Users Score":1,"Answer":"I would guess a lot, in terms of risk management, would depend on the separation\/isolation of the various softwares you develop, and their life cycle.\nIf you don't need to further a central set of libraries, or have (or can develop) Python bindings for those, and the projects are relatively self contained, say a turn around of two to six months, you could give him a quote for a project in Java that is reasonable and he's familiar with (to make sure it doesn't appear artificially inflated). Then give a much reduced quote for the same in py+pyQt, and see if you can get him to invest on your advice.\nWithout tangible evidence coming from inside that a change in route will bring benefit the more management and economics savvy people who are technically ignorant will not buy into a new platform when the old one never prevented from realizing and selling.\nWithout a decent assessment of why he doesn't want to switch platform and what he considers risks it's kinda hard to give more pertinent advice.","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3387150,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":0.022218565,"is_accepted":false,"ViewCount":874,"Q_Id":3386377,"Users Score":1,"Answer":"Have you emphasised the point of the lower development time. Any person that doesn't want a shorter turn around time is an idiot. This is the only main issue i can think for the change. Or what you could do is develop it on the side and when you have errors say this is what i have been doing in my spare time(have a working copy written in python).","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3386396,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":1.0,"is_accepted":false,"ViewCount":874,"Q_Id":3386377,"Users Score":8,"Answer":"The problem is that development time is usually nothing compared to maintenance.  Who cares if it takes two days instead of four if the app has a 1-5 year lifetime?\nYou'll have to convince him that if you get hit by a truck or leave the company (perhaps to work for somebody who uses Python exclusively) that he won't be left in the lurch with a bunch of applications that nobody else knows and can't maintain or upgrade.","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3386487,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working for small company, which operates in the automation industry.\nThe boss hired me because he wants to sell\/give some desktop applications to his\ncurrent costumers.\nHe imposes me to use the Netbeans Platform (a generic desktop application framework).\nA software engineer friend of his advised him to choose this framework. \nAt the moment I created 3 desktop applications with Netbeans Platform.\nI like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.\nUnfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.\nI've already illustrated to my boss the main advantages of Python, but he doesn't like the\nidea to use a language that he never heared of it.\nI'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.\nI'm looking for good motivations to convince him to leave Netbeans Platform for Python\/PyQt.\nP.S: My english is bad, sorry.","AnswerCount":9,"Available Count":9,"Score":0.0444152037,"is_accepted":false,"ViewCount":874,"Q_Id":3386377,"Users Score":2,"Answer":"Some people will tell you to try to convince your boss verbally. Others will tell you to document the time savings you think you can make. My opinion is that you just go ahead and do it. Do it in your own time if you strongly believe its in your best interests.\nI'm yet to meet a software manager who turned down a working piece of software when it comes in on time and under budget. This is by far the best method of persuasion I've used in my career. Its also a great way to show you have initiative. Just be prepared to work for free if it doesnt work out.","Q_Score":5,"Tags":"java,python,netbeans,pyqt","A_Id":3387872,"CreationDate":"2010-08-02T09:07:00.000","Title":"How to convince boss to substitute Java\/Netbeans Platform for Python\/PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"HI all\nI am trying to use SWIG to export C++ code to Python.\nThe C sample I read on the web site does work but I have problem with C++ code.\nHere are the lines I call\n\nswig -c++ -python SWIG_TEST.i\ng++ -c -fPIC SWIG_TEST.cpp SWIG_TEST_wrap.cxx -I\/usr\/include\/python2.4\/\ngcc --shared SWIG_TEST.o SWIG_TEST_wrap.o -o _SWIG_TEST.so -lstdc++\n\nWhen I am finished I receive the following error message\n\nImportError: .\/_SWIG_TEST.so: undefined symbol: Py_InitModule4\n\nDo you know what it is?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":886,"Q_Id":3387663,"Users Score":4,"Answer":"It looks like you aren't linking to the Python runtime library.  Something like adding -lpython24 to your gcc line.  (I don't have a Linux system handy at the moment).","Q_Score":2,"Tags":"c++,python,swig","A_Id":3393617,"CreationDate":"2010-08-02T12:20:00.000","Title":"using SWIG with C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to implement my own key command. However when I do, it does both what I tell it and the default command. How do I disable the default command, so that my command is the only one that runs?\nThis is on Windows 7, BTW.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":226,"Q_Id":3400622,"Users Score":2,"Answer":"Put return 'break' at the end of your event handling function.  This tells Tkinter not to propagate the event to default handlers.","Q_Score":0,"Tags":"python,windows,keyboard-shortcuts,tkinter","A_Id":3401235,"CreationDate":"2010-08-03T20:44:00.000","Title":"How do I disable default Tkinter key commands?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I call QApplication's init without arguments i get\n\nTypeError: arguments did not match any overloaded call:\n  QApplication(list-of-str): not enough arguments\n  QApplication(list-of-str, bool): not enough arguments\n  QApplication(list-of-str, QApplication.Type): not enough arguments\n  QApplication(Display, int visual=0, int colormap=0): not enough arguments\n  QApplication(Display, list-of-str, int visual=0, int cmap=0): not enough arguments\n\nvery interesting! How can I write a class like that?? I mean, every trick for this kind of function overloading I saw did not involve explicit signatures.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1044,"Q_Id":3419282,"Users Score":3,"Answer":"TypeError is just another Exception. You can take *args **kwargs, check those, and raise a TypeError yourself, specify the text displayed - e.g. listing the expected call.\nThat being said, PyQt is a bunch of .pyd == native python extension, written in C or C++ (using Boost::Python). At least the latter supports \"real\" overloads afaik.\nEither way, you shouldn't do this unless you have a really good reason. Python is duck-typed, embrace it.","Q_Score":1,"Tags":"python,overloading","A_Id":3419420,"CreationDate":"2010-08-05T21:24:00.000","Title":"Python method overload based on argument count?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I call QApplication's init without arguments i get\n\nTypeError: arguments did not match any overloaded call:\n  QApplication(list-of-str): not enough arguments\n  QApplication(list-of-str, bool): not enough arguments\n  QApplication(list-of-str, QApplication.Type): not enough arguments\n  QApplication(Display, int visual=0, int colormap=0): not enough arguments\n  QApplication(Display, list-of-str, int visual=0, int cmap=0): not enough arguments\n\nvery interesting! How can I write a class like that?? I mean, every trick for this kind of function overloading I saw did not involve explicit signatures.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1044,"Q_Id":3419282,"Users Score":0,"Answer":"It's quite possible that its init is simply using __init__(self, *args, **kwargs) and then doing its own signature testing against the args list and kwargs dict.","Q_Score":1,"Tags":"python,overloading","A_Id":3419307,"CreationDate":"2010-08-05T21:24:00.000","Title":"Python method overload based on argument count?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Panel with a bunch of pictures placed on it in a GridSizer layout. How can I draw a highlighted color around the edge of an image or its border to show that it has been selected upon a mouse click event?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":233,"Q_Id":3431154,"Users Score":0,"Answer":"You could put each picture in a panel, and use SetBackgroundColour()to set the background color of the panel.","Q_Score":1,"Tags":"python,wxpython","A_Id":3431426,"CreationDate":"2010-08-07T16:25:00.000","Title":"wxPython: Highlight item in GidSizer upon mouse click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a form using wxPython where I want want listctrl's list of values to change based on the selection of another listctrl.  To do this, I'm using methods linked to the controlling object's EVT_LIST_ITEM_SELECTED and EVT_LIST_ITEM_DESELECTED events to call Publisher.sendMessage.  The control to be changed has a method that is a subscriber to that publisher.  This works: when the first listctrl is clicked, the second is refreshed.\nThe problem is that the data must be refreshed from the database and a message is sent for every selection and deselection.  This means that even if I simply click on one item, the database gets queried twice (once for the deselection, then again for the selection).  If I shift-click to multi-select 5 items, then 5 calls get made.  Is there any way to have the listctrl respond to the set, rather than the individual selections?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":940,"Q_Id":3441991,"Users Score":0,"Answer":"You can try EVT_LIST_ITEM_RIGHT_CLICK. That should work. Otherwise you'd want to use a flag and check said flag every time the selection event fires to see if it needs to query the database or not. There's also the UltimateListCtrl, a pure python widget, that you can probably hack to do this too.","Q_Score":3,"Tags":"python,wxpython,listctrl","A_Id":3442559,"CreationDate":"2010-08-09T16:12:00.000","Title":"Respond to Listctrl change exactly once","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a GUI with Tkinter, now how do I make it so when a key command will execute a command even if the Tkinter window is not in focus? Basically I want it so everything is bound to that key command. \nExample: \nSay I was browsing the internet and the focus was on my browser, I then type Ctrl + U. An event would then run on my program.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":515,"Q_Id":3445867,"Users Score":2,"Answer":"Tkinter, on its own, cannot grab keystrokes that (from the OS's\/WM's viewpoint) were directed to other, unrelated windows -- you'll need to instruct your window manager, desktop manager, or \"operating system\", to direct certain keystrokes differently than it usually does.  So, what platform do you need to support for this functionality?  Each platform has different ways to perform this kind of functionality, of course.","Q_Score":1,"Tags":"python,binding,tkinter","A_Id":3445919,"CreationDate":"2010-08-10T03:43:00.000","Title":"Key commands in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"OK, I'm trying to explain what I want to achieve in another way. Here's an example:\nSay if it's an anti virus program, and user can choose between two ways to run the program, choice one, automatically start to scan disks for virus when the program starts up, choice two, hit the start button to make the program scan disks for virus after the program starts up any time the user wants. So, as a wxpython beginner, I know how to bind wx.EVT_BUTTON to let scanning start after the user hit the start button, but I don't know how to make the scanning start once the program starts up. I wonder if there's a program_start event I can bind? Hope you guys can help me out. Thanks!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":372,"Q_Id":3450525,"Users Score":0,"Answer":"In your init or OnInit method, do some kind of check to see if the program should run the startup process on startup (i.e. check a config file or some such). If yes, call the \"scan\" method using wx.CallAfter or wx.CallLater or call it after you Show() the frame.","Q_Score":0,"Tags":"python,event-handling,wxpython","A_Id":3451727,"CreationDate":"2010-08-10T15:19:00.000","Title":"Is there a wxpython event like program_start?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"OK, I'm trying to explain what I want to achieve in another way. Here's an example:\nSay if it's an anti virus program, and user can choose between two ways to run the program, choice one, automatically start to scan disks for virus when the program starts up, choice two, hit the start button to make the program scan disks for virus after the program starts up any time the user wants. So, as a wxpython beginner, I know how to bind wx.EVT_BUTTON to let scanning start after the user hit the start button, but I don't know how to make the scanning start once the program starts up. I wonder if there's a program_start event I can bind? Hope you guys can help me out. Thanks!","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":372,"Q_Id":3450525,"Users Score":1,"Answer":"Why don't you run it just in module code? This way it will be run only once, because code in module is run only once per program instance.","Q_Score":0,"Tags":"python,event-handling,wxpython","A_Id":3450557,"CreationDate":"2010-08-10T15:19:00.000","Title":"Is there a wxpython event like program_start?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to customize ProgressDialog in wxPython?\nFor instance, I would like to make the progressbar slimmer, and the window size wider.\nSetSize() method doesn't appear to have any effect.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":352,"Q_Id":3452986,"Users Score":1,"Answer":"The wx.ProgressDialog isn't customizable its just a wrapper around the native ProgressDialog, the the easiest solution would be to roll your own by extending the wx.Dialog class and using a wx.Gauge","Q_Score":0,"Tags":"python,wxpython,progress-bar","A_Id":3453038,"CreationDate":"2010-08-10T20:09:00.000","Title":"How to customize wx.ProgressDialog?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"suppose a C++ class has several constructors which are overloaded according the number and type and sequences of their respective parameters, for example, constructor(int x, int y) and constructor(float x, float y, float z), I think these two are overloaded methods, which one to use depends on the parameters, right? So then in python, how could I create a constructor that can work like this? I notice that python has the def method(self, *args, **kwargs):, so can I use it like: def __init__(self, *args), then I check the length of *args, like if len(args) == 2:, then construct according to the 2-parameters constructor, if len(args) == 3, then use the 3-parameters constructor, etc. So, does that work? Or is there any better way to do it with python? Or should I think in other ways that could take the advantage of python feature itself? thanks~","AnswerCount":4,"Available Count":1,"Score":0.1488850336,"is_accepted":false,"ViewCount":251,"Q_Id":3476387,"Users Score":3,"Answer":"Usually, you're fine with any combination of\n\nslightly altered design\ndefault arguments (def __init__(self, x = 0.0, y = 0.0, z = 0.0))\nuse of polymorphism (in a duck-typed language, you don't need an overload for SomeThing vs SomeSlightlyDifferentThing if neither inherits from the other one, as long as their interfaces are similar enough).\n\nIf that doesn't seem feasible, try harder ;) If it still doesn't seem feasible, look at David's link.","Q_Score":1,"Tags":"c++,python,constructor,overloading","A_Id":3476486,"CreationDate":"2010-08-13T11:35:00.000","Title":"C++ methods overload in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want the text of the ListBox to be centered, is that possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":434,"Q_Id":3483179,"Users Score":1,"Answer":"No, the default ListBox won't work for that. Try the VListBox instead.","Q_Score":0,"Tags":"python,listbox,wxpython,center,alignment","A_Id":3506756,"CreationDate":"2010-08-14T12:03:00.000","Title":"How to align the text in a wx.ListBox using wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to use PyQt from IronPython? \nFrom what I've read IronPython should work with CPython compatible libraries but out of the box it doesn't seem to work.\nIf it is possible, will code completion work?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":2411,"Q_Id":3483492,"Users Score":2,"Answer":"Hope someone else who spent more time messing around with this comes by and gives you qualified, ambiguous answer, but here is some questionable insight from my personal experience:\nPyQt relates to cPython in a way that is very different than .Net relates to IronPython.\nWhile IronPython is built on TOP of .Net, PyQt is a BINARY, semi-automatically generated set of bindings specific to a version of cPython against which it was compiled.\nFor a variety of reasons, i have problems running \"standard\" BINARY python modules against IronPython. Only the pure-Python modules that can be interpreted by IronPython as \"Python\" would ever work for me.\nI am not saying \"it can't be done,\" but I do expect you to have very bad experience with the set up if you manage to compile and install PyQt into IronPython.","Q_Score":2,"Tags":"ironpython,pyqt","A_Id":3490601,"CreationDate":"2010-08-14T13:25:00.000","Title":"Using PyQt from IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a GUI program in which I already bind a start button with one event, and when I click the start button, the event runs as I like. My question is, if I want my program to start the event immediately after the GUI program starts, which means the start button is immediately being \"clicked\" once the program starts, how do I do it?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":205,"Q_Id":3483675,"Users Score":0,"Answer":"In the __init__( )\u00a0for your main frame put this:\n\nwx.CallAfter( func_name )","Q_Score":0,"Tags":"python,event-handling,wxpython","A_Id":41389878,"CreationDate":"2010-08-14T14:11:00.000","Title":"How to make a event run immediately after a GUI program starts in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a GUI program in which I already bind a start button with one event, and when I click the start button, the event runs as I like. My question is, if I want my program to start the event immediately after the GUI program starts, which means the start button is immediately being \"clicked\" once the program starts, how do I do it?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":205,"Q_Id":3483675,"Users Score":1,"Answer":"In the main frame constructor set a one-shot timer with interval 0 that fires the event.","Q_Score":0,"Tags":"python,event-handling,wxpython","A_Id":3483688,"CreationDate":"2010-08-14T14:11:00.000","Title":"How to make a event run immediately after a GUI program starts in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I get a widget's \"name\"?\nWhen I define a GUI using Glade, I can \"name\" the widgets of the window but how do I recover that property when I have a widget object instance?\nI've tried get_property(), get_name() and $widget.name to no avail.\nUpdate: I am using GtkBuilder file format (i.e. XML format).\nResolution: a fix I have used: use the set_property(\"name\", name) method on the widget just after getting it from GtkBuilder.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4906,"Q_Id":3489520,"Users Score":0,"Answer":"Given the widget w, what does w.get_name() return?  If None, that means the widget has no name property.  Maybe you want gtk.glade.get_widget_name(w) instead?  (I'm not sure if the name property of the widget and the name for it in the Glade XML from which it was created are the same thing...).","Q_Score":10,"Tags":"python,gtk","A_Id":3489566,"CreationDate":"2010-08-15T22:25:00.000","Title":"Python GTK+ widget name","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the format of the parameter activate_time in Python GTK+ when using Gtk.Menu.popup() method?\nI have tried using int(time.time()) but I get a traceback saying an integer is required...","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":132,"Q_Id":3494587,"Users Score":1,"Answer":"I found out I can use gtk.get_current_event_time() to get a reasonable timestamp matching what Gtk looks like it expects.","Q_Score":0,"Tags":"python,gtk","A_Id":3495112,"CreationDate":"2010-08-16T15:22:00.000","Title":"Format of activate_time in Gtk.Menu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I render a huge SVG file with a lot of elements with Cairo, OpenGL and rsvg. I draw svg on cairo surface via rsvg and create an OpenGL texture to draw it. Everything is fine. And now I have to interact with elements from SVG. For example, I want to guess an element by coordinates. And I want to change the background of some path in SVG. In the case of changing background I think, I can change SVG DOM and somehow re-render a part of SVG. But in the case of hit testing elements I'm totally embarrassed.\nSo, is there some python library to interact with SVG? Is it possible to stay with cairo and rsvg and how can I implement it myself? Or is there a better way to render SVG in OpenGL and interact with it in python? All I want is load SVG, manipulate its DOM and render it","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3978,"Q_Id":3501215,"Users Score":0,"Answer":"I had to do the same (changing element color for instance), and had to modify rsvg library because all those nice features exist but they are hidden. You have to make a new interface to link to the nice features.","Q_Score":3,"Tags":"python,opengl,svg,cairo,rsvg","A_Id":37703846,"CreationDate":"2010-08-17T09:51:00.000","Title":"SVG interaction in python with cairo, opengl and rsvg","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing an e-book reader in Python + wxPython, and I'd like to find out how many lines of text can be displayed in a given RichTextCtrl with the current formatting without scrolling. \nI thought of using and dividing the control's height by RichTextCtrl.GetFont().GetPixelSize(), but it appears that the pixel size parameter of wx.Font is only specified on Windows and GTK. In addition, this won't cover any additional vertical spacing between lines\/paragraphs. \nI could of course get the font size in points, attempt to get the display's resolution in ppi, and do it that way, but 1) the line spacing problem still remains and 2) this is far too low a level of abstraction for something like this. \nIs there a sane way of doing this?\nEDIT: The objective is, to divide the ebook up into pages, so the scrolling unit is a whole page, as opposed to a line.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":445,"Q_Id":3504383,"Users Score":0,"Answer":"Did you try calling the GetNumberOfLines() method? According to Robin Dunn, that should work, although it doesn't take wrapped lines into account.","Q_Score":2,"Tags":"python,wxpython,resolution-independence","A_Id":3526358,"CreationDate":"2010-08-17T15:52:00.000","Title":"Finding out how many lines can be displayed in wx.richtext.RichTextCtrl without scrolling","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know how i can select a pixel with a mouse click in an image (QImge) and get pixel position and value.\nThanks","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":19296,"Q_Id":3504522,"Users Score":2,"Answer":"First you have to draw the image. You can do this my making a QLabel widget and call setPixmap. You need to convert your QImage to QPixmap before doing this (you can use QPixmap.fromImage(img)).\nYou can get mouse clicks by subclassing the QImage and intercepting mousePressEvent. Look up the pixel value with QImage.pixel().","Q_Score":9,"Tags":"python,image,pyqt,selection,pixel","A_Id":3543483,"CreationDate":"2010-08-17T16:05:00.000","Title":"Pyqt get pixel position and value when mouse click on the image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Here is what I would like to do, and I want to know how some people with experience in this field do this:\nWith three POST requests I get from the http server:\n\nwidgets and layout\nand then app logic (minimal)\ndata\n\nOr maybe it's better to combine the first two or all three. I'm thinking of using pyqt. I think I can load .ui files. I can parse json data. I just think it would be rather dangerous to pass code over a network to be executed on the client. If someone can hijack the connection, or can change the apps setting to access a bogus server, that is nasty.\nI want to do it this way because it keeps all the clients up-to-date. It's sort of like a webapp but simpler because of Qt. Essentially the \"thin\" app is just a minimal compiled python file that loads data from a server.\nHow can I do this without introducing security issues on the client? Is https good enough? Is there a way to get pyqt to run in a sandbox of sorts?\nPS. I'm not stuck on Qt or python. I do like the concept though. I don't really want to use Java - server or client side.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1647,"Q_Id":3517841,"Users Score":1,"Answer":"Your desire to send \"app logic\" from the server to the client without sending \"code\" is inherently self-contradictory, though you may not realize that yet -- even if the \"logic\" you're sending is in some simplified ad-hoc \"language\" (which you don't even think of as a language;-), to all intents and purposes your Python code will be interpreting that language and thereby execute that code.  You may \"sandbox\" things to some extent, but in the end, that's what you're doing.\nTo avoid hijackings and other tricks, instead, use HTTPS and validate the server's cert in your client: that will protect you from all the problems you're worrying about (if somebody can edit the app enough to defeat the HTTPS cert validation, they can edit it enough to make it run whatever code they want, without any need to send that code from a server;-).\nOnce you're using https, having the server send Python modules (in source form if you need to support multiple Python versions on the clients, else bytecode is fine) and the client thereby save them to disk and import \/ reload them, will be just fine.  You'll basically be doing a variant of the classic \"plugins architecture\" where the \"plugins\" are in fact being sent from the server (instead of being found on disk in a given location).","Q_Score":0,"Tags":"python,qt,networking,pyqt,thin","A_Id":3517886,"CreationDate":"2010-08-19T00:33:00.000","Title":"how to implement thin client app with pyqt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a frame that asks the user to put in a bunch of information in several text control fields. How can I make it so that when you hit the 'tab' key your cursor moves to the next text control?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":595,"Q_Id":3525005,"Users Score":2,"Answer":"If you put a wx.Panel as the only child of the ScrolledWindow and put the other widgets on the panel, then it should work automatically. You could also use ScrolledPanel instead.","Q_Score":3,"Tags":"python,wxpython","A_Id":3525652,"CreationDate":"2010-08-19T18:29:00.000","Title":"wxPython: switching text control focus on tab press","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm displaying some data as a TreeView. How can I detect a click on a particular tree-view cell, so that I know which column of which row was clicked on?\nThis is what I want to do, so maybe there's a better way: Part of the data is a series of True\/False values indicating a particular set of options. For example, the options might be picking any of the options \"Small, Medium, Large, X-Large\" to be display. If the user selects \"Small\" and \"Large\", then the cell should display \"Small, Large\". I don't want to give each a separate column since there are actually like 20 options, and only 2 or 3 will be selected at any point.\nWhen the user clicks on the cell, I want to display a pop-up with a bunch of checkboxes. The user can then select what s\/he wants and submit the changes, at which point the cell's value should be updated.\nThe easiest way I thought of doing this would be to just detect a click (or a double-click) on the cell. Then I could pop up the window, and have the submit button of the window do what I want.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4742,"Q_Id":3534127,"Users Score":6,"Answer":"The row-activated signal is sent when a GTK TreeView row is double-clicked.","Q_Score":5,"Tags":"python,user-interface,gtk,pygtk","A_Id":3534190,"CreationDate":"2010-08-20T19:17:00.000","Title":"gtk: detect click on a cell in a TreeView","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What Python-related code (PyGTK, Glade, Tkinter, PyQT, wxPython, Cairo, ...) could you easily use to create a GUI to do some or all of the following?\n\nPart of the GUI has an immovable square grid.\nThe user can press a button to create a resizable rectangle.\nThe user can drag the rectangle anywhere on the grid, and it will snap to the grid.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5729,"Q_Id":3538769,"Users Score":0,"Answer":"Those actions are not that difficult. All you really need for that is hit detection, which is not hard (is the cursor over the correct area? Okay, perform the operation then). The harder part is finding an appropriate canvas widget for the toolkit in use.","Q_Score":7,"Tags":"python,user-interface,pygtk,tkinter,glade","A_Id":3538804,"CreationDate":"2010-08-21T20:09:00.000","Title":"How do you draw a grid and rectangles in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently in the process of making my Nintendo Wiimote (Kinda sad actually) to work with my computer as a mouse. I've managed to make the nunchuk's stick control actually move the mouse up and down, left and right on the screen! This was so exciting. Now I'm stuck.\nI want to left\/right click on things via python when I press A, When I went to do a search, All it came up with was tkinter?\nSo my question is, What do I call to make python left\/right click on the desktop, and if it's possible, maybe provide a snippet?\nThank you for your help!\nNOTE: I guess I forgot to mention that this is for Linux.","AnswerCount":8,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":65052,"Q_Id":3545230,"Users Score":2,"Answer":"Open your terminal and goto cd \/usr\/share\/pyshared\/twisted\/protocols\/mice\nmay this __init__.py mouseman.py python script will work for you,check them out.","Q_Score":40,"Tags":"python,linux,mouse,mouse-cursor,wiimote","A_Id":9583583,"CreationDate":"2010-08-23T06:42:00.000","Title":"Simulate Mouse Clicks on Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to add images to wx.Dialog (and then sizer) some like wx.ImageList and display it dynamically. \nBut I don't want to change already displayed image, I want to add next.\nHow can I resolve this problem?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":883,"Q_Id":3555065,"Users Score":2,"Answer":"I don't think a dialog is a good choice for a growing list of images, but if you have a good argument for that...\nAnyway, you should be able to display your images using the wx.StaticBitmap widget. To add another one, use your sizer's Add method, then call the dialog's Layout() method and maybe its Refresh() method. If you plan on displaying many images, then you'll probably want to look at the ScrolledPanel or the ScrolledWindow widgets.","Q_Score":1,"Tags":"python,image,wxpython","A_Id":3557437,"CreationDate":"2010-08-24T09:21:00.000","Title":"How to add images\/bitmaps to wx.Dialog","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Assume i want to create 500 wxWidget like (some panels , color buttons and text ctrl etc), I have to create all this at single time but this will freeze my main thread, so i put this creation part in child thread and show some gif anim in main thread. But i was not able to get all these wxWidget object those created on my frame in child thread.\nCan i get that wxWidgets (created in child thread) back in main thread.\n simply just consider a case where i have to create children of a frame in child thread and main thread show animation. once child thread finish the all child created in child thread should available in main thread.\nAny help is really appreciable.\nI am using python 2.5, wxpython 2.8 on windowsxp.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":649,"Q_Id":3574714,"Users Score":0,"Answer":"You can send them back over a queue, or this all takes place in one instance of a class, assign the widgets to some known place in the instance for the main thread to pick them up. Signal via semaphore.","Q_Score":1,"Tags":"python,wxpython","A_Id":3574976,"CreationDate":"2010-08-26T11:42:00.000","Title":"Get object created in child thread back in main thread","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So, for example I draw some objects on wx.PaintDC, such as lines and rectangles.\nNow I want next: on mouse click I wont know which object was clicked.\nOf course, I can see what object is the closest, but what about more exact answer?\nMaybe even not standart wx.DC, but such things as FloatCanvas or something like this.\nSo, what's the best solution?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":100,"Q_Id":3576071,"Users Score":0,"Answer":"Does calling event.GetEventObject() in your event handler give you the object you need?","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":3579195,"CreationDate":"2010-08-26T14:24:00.000","Title":"What is the best solution to bind objects in wx.DC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to implement a button \"New\" that would work the same as File>New in most applications - that is: resets all the labels, treeviews, etc. to the original state.\nThank you, Tomas","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":263,"Q_Id":3577335,"Users Score":1,"Answer":"The widgets don't remember their original state; you have to set them all back one by one. Give labels their original text, clear the tree views by setting their model to None.\nPerhaps it is better to destroy your window and rebuild it from your Glade file if you have one?","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":3580114,"CreationDate":"2010-08-26T16:39:00.000","Title":"How do I restore default settings of an application in Gtk (set all the widgets to the state as if the application was restarted)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made an application using Glade and Python and I would like to make several localizations.\nI know how to localize strings that are in the Python code, I just encapsule all the strings that are supposed to be localized with _() and than specify the translation of the string in a .po file.\nBut how do I tell a string that is built with Glade that it should be localizable (for example labels, menu items, button labels, ...)?\nI am using gettext for the localization.\nThank you, Tomas","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1203,"Q_Id":3586071,"Users Score":4,"Answer":"You should be able to create a *.pot file from a *.glade file using intltool-extract --type=gettext\/glade foo.glade, and intltool supposedly knows what is translatable.\nAlso, I suggest you look into GtkBuilder if you didn't do that already (you can save GtkBuilder interface files from recent Glade 3 versions, and you won't need the extra libglade anymore).","Q_Score":7,"Tags":"python,user-interface,pygtk,gettext,glade","A_Id":3588790,"CreationDate":"2010-08-27T16:05:00.000","Title":"Localization of GUI built with Glade and Python (Gtk)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a PyQt4 program that supports plugins. Basically I want the user to be able to write QWidget subclasses in PyQt4 and add\/remove them from the main application window via a GUI. How would I do that, especially the plugin mechanism?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":834,"Q_Id":3588915,"Users Score":0,"Answer":"Have a directory for the plugins, define an interface for those plugins, and walk the directory importing them.\nI've never done this in Python, but in C the way I did it was to define a number of functions that the plugin needed to implement.  The basic key elements that are necessary is the name of the things in the plugin (so that you can display them in your UI so that the user can instantiate them) and a factory to actually create the things.  I suppose in Python it'd be pretty trivial to just do those as one dict that you can return from the module.\nE.g. declare that all plugins must author a function called GetPluginInfo() which returns a dictionary of name:class mappings.\nActually now that I think about it you could probably just import the file and look for classes that are subclasses of whatever you care about and not require any explicit API be implemented.  I haven't done a lot of that but basically you'd walk the module's dir() and test to see if each thing is a subclass of QWidget (for example).","Q_Score":2,"Tags":"python,qt,plugins,pyqt4,pluggable","A_Id":3588947,"CreationDate":"2010-08-28T00:28:00.000","Title":"Pluggable Python program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a command similar to \"wm_overrideredirect\" for Ubuntu? I want My program to be displayed without the standard window.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":182,"Q_Id":3589185,"Users Score":3,"Answer":"Ubuntu's desktop manager is Gnome, which should support wm_overrideredirect as well as any other.  What's going wrong for you when you try that?  Can you show (by editing your Q) some as-tiny-as-possible Python\/Tkinter script that does not behave the way you want, and tell us how it does behave and how you'd like to behave?","Q_Score":0,"Tags":"python,ubuntu,window,tkinter","A_Id":3589200,"CreationDate":"2010-08-28T02:26:00.000","Title":"Tkinter removing standard window in Ubuntu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an existing python script and I want to wrap it in a GUI.  Since I already have tkinter installed I would like to use it if possible.  At the moment my script has many places where it asks for user input using raw_input().  I would like to replace these with either a modal pop-up asking for user input or (preferably) an Entry object which responds to the enter key.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1228,"Q_Id":3589817,"Users Score":2,"Answer":"UI toolkits usually have an event-driven model where the main loop is in the toolkit itself. This is probably different from your current synchronous, interactive model (where the program just pauses while waiting for input)\nThe best would be to try to refactor your program and factor-out the view part (look up the model-view-control design pattern). After that, it should be easy to replace your console oriented view with an tkInter based one.\n(that's as specific as I can get without a concrete question)","Q_Score":0,"Tags":"python,user-input,tkinter","A_Id":3589984,"CreationDate":"2010-08-28T07:08:00.000","Title":"Creating a gui around a python script using Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to the world of GUI programming and I am writing a little GUI app using IronPython and WinForms. It reads values from an external device and displays them in a ListView component (name, value). I want to periodically perform the reading and updating of the ListView component at a certain fixed rate.\nI had the following ideas to accomplish this:\n\nA timer, which periodically triggers the read\/screen update directly in the OnTick handler\nA timer, whose OnTick handler triggers a BackgroundWorker to perform the read\/update\n\nSince the first solution will block the GUI until the read\/update loop is done, which, depending on the number of values being read from the device, could take some time, I think the BackgroundWorker might be a better solution. I might want to add some functionality to manipulate the ListView items later (add, remove values etc.) and a blocked GUI does not seem like a good idea.\nIs there a certain design pattern or a better way to accomplish reading\/updating screen data?\nNOTE: Any code examples can be IronPython or C#. The conversion from C# to IronPython is pretty straight forward. Thanks!","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1455,"Q_Id":3595236,"Users Score":3,"Answer":"Personally, I'd have one thread that's responsible for reading values out of the device and storing the data in a data structure, and then a System.Windows.Forms.Timer (there's 3 Timers in .NET, this is the only one that ticks in the thread that's safe to update your controls) to read values out of that data structure and update the UI. You may need to synchronise that data structure, you may not.\nThat way the device can take as long as it likes to return data, or it can push as many millions of rows per second at you, and the UI thread will still poll at your predetermined tick rate (probably every 100 msec?). Since your timer ticks are just reading data out of memory, the UI won't block for IO.","Q_Score":2,"Tags":"c#,winforms,ironpython","A_Id":3595266,"CreationDate":"2010-08-29T15:03:00.000","Title":"Pattern for periodically updating screen data","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if there is a good library for python for decoding QR code. Basically what I would like is to give library image with QR code on it and the library would output contents saved in image.","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3926,"Q_Id":3602645,"Users Score":2,"Answer":"I've looked before with no success. Two problems are that native c code can't be compiled and you can't get access to the file system.\npyqrcode didn't work out and neither did zxing.","Q_Score":4,"Tags":"python,google-app-engine,qr-code","A_Id":3602758,"CreationDate":"2010-08-30T17:15:00.000","Title":"Google app engine QR code decoder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to write a simple GTD-style todo list app with python and gtk to learn python.  I want a container that can select an individual list from a lot of choices.  It would be something like the list of notebooks area in tomboy.  Not a combobox.\nAs you can probably tell I'm a beginner and the terminology is probably off.\nCan you please tell me what it is I'm looking for and an overview of how to implement it?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":256,"Q_Id":3604357,"Users Score":0,"Answer":"You mean a widget to filter a large collection into multiple subsets \/ views? \nI would guess you have to implement this yourself - a list of options on the left and filtered results on the right, I don't know of any existing (gtk) widgets.","Q_Score":1,"Tags":"python,user-interface,gtk","A_Id":3604511,"CreationDate":"2010-08-30T21:28:00.000","Title":"Python PyGTK. What's this component?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I don't get what Clyther is or how to use it.  \nMy stuff:\n  ATI OpenCl SDK (just dl'd)\n  clyther beta (just dl'd)\n  windows 7 pro 64 bit\n  active python 3.1.2\n  Xfxs Ati radeon 5850 video card\nI downloaded the ATI OpenCl SDK and the clyther beta from sourceforge. Then I tooke the sample 'reduce' function from the sourceforge documents and pasted the code into notepad and named it clythersample.py.  When I double-click the file or open it in the interactiveshell, it gives an error message on the first line.\nIs naming the file .py wrong? I guess clyther is its own lqnguage and not really python? Can I write python code and in the middle of the program, write a chunk of clyther code? Will python IDEs (esp. Wing understand and debug it?) Will it work with python 3 or do I need 2.6?  Is 64 bit os ok?   \n(I'm not a programme or technically competent, so things like its a python API for OpenCl or it had C bindings for python don't mean a whole lot).","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":507,"Q_Id":3612410,"Users Score":2,"Answer":"Clyther is a Python package for High-Performance Computing (HPC) using, for example, video cards with multiple Graphics Packaging Units (GPUs) or (less frequently) multi-core processors.  Clyther is for parallel processing of algorithms or data sets that would normally take a lot of time to process serially.  Meaning, if you have a problem that can be split into many smaller problems, then Clyther is a useful package to use.  Additionally, your problem must be something that can use numpy arrays.\nClyther is a nice package to use if you have the problem it is intended to solve.  It makes it fairly easy to write Python code to run on multiple processes.\nIf that's not the problem you need to solve, then Clyther probably won't help you.","Q_Score":2,"Tags":"python,python-3.x,gpu","A_Id":10986086,"CreationDate":"2010-08-31T19:18:00.000","Title":"Clyther-how to get started?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I don't get what Clyther is or how to use it.  \nMy stuff:\n  ATI OpenCl SDK (just dl'd)\n  clyther beta (just dl'd)\n  windows 7 pro 64 bit\n  active python 3.1.2\n  Xfxs Ati radeon 5850 video card\nI downloaded the ATI OpenCl SDK and the clyther beta from sourceforge. Then I tooke the sample 'reduce' function from the sourceforge documents and pasted the code into notepad and named it clythersample.py.  When I double-click the file or open it in the interactiveshell, it gives an error message on the first line.\nIs naming the file .py wrong? I guess clyther is its own lqnguage and not really python? Can I write python code and in the middle of the program, write a chunk of clyther code? Will python IDEs (esp. Wing understand and debug it?) Will it work with python 3 or do I need 2.6?  Is 64 bit os ok?   \n(I'm not a programme or technically competent, so things like its a python API for OpenCl or it had C bindings for python don't mean a whole lot).","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":507,"Q_Id":3612410,"Users Score":1,"Answer":"When you name the file .py (the file extension associated with python.exe) and double-click it, how is windows supposed to know it's supposed to run the file with CLyther?\n\nIs naming the file .py wrong? I guess clyther is its own lqnguage and not really python?\n\nDocumentation compares it with Cython - so I suppose it's an extension to the language, i.e. they take Python and bolt more features on it.\n\nCan I write python code and in the middle of the program, write a chunk of clyther code?\n\nFrom the goals of the project, it should (like Cython) ultimately be able to accept all or most Python code. So, yes - but of course you'd have to run the whole program with CLyther.\n\nWill python IDEs (esp. Wing understand and debug it?)\n\nNot natively, I suppose.\nSide note: The project is in a very early stage of developement (very first beta-release), so don't expect things to run smoothly right now.","Q_Score":2,"Tags":"python,python-3.x,gpu","A_Id":3612526,"CreationDate":"2010-08-31T19:18:00.000","Title":"Clyther-how to get started?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python script bundled into a application (I'm on a mac) and have the application set to be able to open .zip files. But when I say \"open foo.zip with bar.py\" how do I access the file that I have passed to it? \nAdditional info:\nUsing tkinter.\nWhat's a good way to debug this, as there is no terminal to pass info to?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":310,"Q_Id":3614609,"Users Score":0,"Answer":"If I'm not greatly mistaken, it should pass the name of the file as the first argument to the script - sys.argv[1].","Q_Score":0,"Tags":"python,macos,tkinter","A_Id":3614650,"CreationDate":"2010-09-01T02:17:00.000","Title":"Python: open a file *with* script?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a widget that measures elapsed time, then after a certain duration it does a command. However, if the widget is left I want I want it to abort this function call and not do the command. \nHow do I go about this?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":88,"Q_Id":3621111,"Users Score":0,"Answer":"Why not use threads and stop that? I don't think it's possible to intercept a function call in a single threaded program (if not with some kind of signal or interrupt).\nAlso, with your specific issue, you might want to introduce a flag and check that in the command.","Q_Score":1,"Tags":"python,tkinter,abort","A_Id":3621138,"CreationDate":"2010-09-01T18:38:00.000","Title":"Is there a way to write a command so that it aborts a running function call?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a widget that measures elapsed time, then after a certain duration it does a command. However, if the widget is left I want I want it to abort this function call and not do the command. \nHow do I go about this?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":88,"Q_Id":3621111,"Users Score":0,"Answer":"No idea about python threads, but in general the way you interrupt a thread is by having some sort of a threadsafe state object that you can set from the widget, and the logic in thread code to check for the change in state object value and break out of the thread loop.","Q_Score":1,"Tags":"python,tkinter,abort","A_Id":3621195,"CreationDate":"2010-09-01T18:38:00.000","Title":"Is there a way to write a command so that it aborts a running function call?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to bind all widgets to one command, with a single line? It would be nice if I could type in one line as opposed to doing each widget individually.","AnswerCount":4,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":9705,"Q_Id":3630664,"Users Score":-2,"Answer":"If you have a list that contains all your widgets, you could iterate over them and assign the events.","Q_Score":7,"Tags":"python,binding,widget,tkinter,global","A_Id":3630691,"CreationDate":"2010-09-02T19:49:00.000","Title":"Tkinter Global Binding","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to bind all widgets to one command, with a single line? It would be nice if I could type in one line as opposed to doing each widget individually.","AnswerCount":4,"Available Count":2,"Score":-0.1488850336,"is_accepted":false,"ViewCount":9705,"Q_Id":3630664,"Users Score":-3,"Answer":"You could also just define a function that calls on all your widgets, and call that function. Or better yet create a class that call on your widgets in init and import the class...","Q_Score":7,"Tags":"python,binding,widget,tkinter,global","A_Id":3630962,"CreationDate":"2010-09-02T19:49:00.000","Title":"Tkinter Global Binding","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python program that has no windows frame and doesn't show up in the taskbar because of self.overrideredirect(1). This program has an options menu (a top level widget) that allows for the alpha to be adjusted with self.attributes(\"-alpha\", 0.85). However when I close out of the options menu my program shows up in the task bar. Obviously I don't want it to do this. I tried invoking the self.overrideredirect(1) command after the options menu was closed, but to no avail. Does anyone have a solution\/ know of a line that will remove my program from the task bar?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2723,"Q_Id":3644113,"Users Score":0,"Answer":"If you change the override redirect flag you need to withdraw and then deiconify the window to give the window manager a chance to make the change. You might try that.\nAlso, when you say \"close out\" the option menu top-level, what exactly do you mean? Are you sure destroying this second top-level window?","Q_Score":0,"Tags":"python,windows,transparency,tkinter,alpha","A_Id":3644372,"CreationDate":"2010-09-04T21:43:00.000","Title":"Help with Tkinter Alpha","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to retrieve the row data from a treemodel when the row_activated callback is fired.\nWhen row_activated is called, the 'path' variable it passes is a tuple. How do I easily use this tuple to retrieve an iter and ultimately the data itself? The treemodel class has a function to convert a string into an iter, but it seems like there should be an easier way than converting the tuple to a string, then the string to an iter.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":262,"Q_Id":3644777,"Users Score":2,"Answer":"Answering my own question, it makes sense after 45 minutes of googling I solve my own problem 30 seconds after posting on StackOverflow.\nI needed to use the get_iter function, not the get_iter_from_string function.","Q_Score":1,"Tags":"python,pygtk","A_Id":3644788,"CreationDate":"2010-09-05T02:32:00.000","Title":"PyGTK treeview and row_activated callback","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am starting to use python,more. Is there a good way to keep python disk access to a minimum.  \nSeems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.  \nWould creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit.","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":181,"Q_Id":3647368,"Users Score":2,"Answer":"If you run a .py file from the harddisk, the harddisk will be accessed.\nIn your GUI, just import your code and it will be loaded once and you can access it later.","Q_Score":0,"Tags":"python,wxpython","A_Id":3647374,"CreationDate":"2010-09-05T19:08:00.000","Title":"Python Software design","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am starting to use python,more. Is there a good way to keep python disk access to a minimum.  \nSeems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.  \nWould creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit.","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":181,"Q_Id":3647368,"Users Score":2,"Answer":"Modern operating systems cache file access pretty efficiently, as long as there is enough spare RAM available. You most likely won't notice any difference, fi you're not loading thousand of python files at once.\nAnd as always, before trying to optimize one aspect, make sure that this is really the bottleneck. Chances are, your percieved slowness is not due to loading of the .py files.","Q_Score":0,"Tags":"python,wxpython","A_Id":3647570,"CreationDate":"2010-09-05T19:08:00.000","Title":"Python Software design","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am starting to use python,more. Is there a good way to keep python disk access to a minimum.  \nSeems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.  \nWould creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":181,"Q_Id":3647368,"Users Score":0,"Answer":"I think if you took the time to measure how much time it takes to load your python code from disk you would end up with a very, very tiny number unless you are doing something very wrong. And if you are doing something really wrong, solving that problem will be a better use of your time.\nUsing wxpython to create a guy to work around what you perceive to be a problem wouldn't likely make any difference.","Q_Score":0,"Tags":"python,wxpython","A_Id":3647549,"CreationDate":"2010-09-05T19:08:00.000","Title":"Python Software design","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having a right old nightmare with JPype. I have got my dev env on Windows and so tried installing it there with no luck. I then tried on Ubunto also with no luck. I'm getting a bit desperate now. I am using Mingw32 since I tried installing VS2008 but it told me I had to install XP SP2 but I am on Vista. I tried VS2010 but no luck, I got the 'error: Unable to find vcvarsall.bat' error. Anyway, I am now on Mingw32\nUltimately I am trying to use Neo4j and Python hence my need to use JPype. I have found so many references to the problem on the net for MySQL etc but they don't help me with JPype. \nIf I could fix unix or windows I could get going so help on either will be really appreciated. \nHere's the versions..\nWindows: Vista 64\nPython: 2.6\nCompiler Mingw32: latest version\nJpype: 0.5.4.1\nJava info: \njava version \"1.6.0_13\"\nJava(TM) SE Runtime Environment (build 1.6.0_13-b03)\nJava HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)\nI run:\npython setup.py install --compiler=wingw32 \nand get the following output.\nChoosing the Windows profile\nrunning install\nrunning build\nrunning build_py\nrunning build_ext\nbuilding '_jpype' extension\nC:\\MinGW\\bin\\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 \"-IC:\\Program Files (x86)\\Java\\jdk1.6.0_21\/include\" \"-IC:\\Program Files (x86)\\Java\\jdk1.6.0_21\/include\/win32\" -Isrc\/native\/common\/include -Isrc\/native\/python\/include -Ic:\\Python26\\include -Ic:\\Python26\\PC -c src\/native\/common\/jp_array.cpp -o build\\temp.win32-2.6\\Release\\src\\native\\common\\jp_array.o \/EHsc\nsrc\/native\/common\/jp_array.cpp: In member function 'void JPArray::setRange(int, int, std::vector&)':\nsrc\/native\/common\/jp_array.cpp:56:13: warning: comparison between signed and unsigned integer expressions\nsrc\/native\/common\/jp_array.cpp:68:4: warning: deprecated conversion from string constant to 'char*'\nsrc\/native\/common\/jp_array.cpp: In member function 'void JPArray::setItem(int, HostRef*)':\nsrc\/native\/common\/jp_array.cpp:80:3: warning: deprecated conversion from string constant to 'char*'\ngcc: \/EHsc: No such file or directory\nerror: command 'gcc' failed with exit status 1\nSo on unix Ubunto the problem is as follows:\nJava version: 1.6.0_18\nJPype: 0.5.4.1\nPython: 2.6\nJava is in the path and I did apt-get install build-essentials just now so have latest GCC etc. \nI won't paste all the output as it's massive. So many errors it's like I have missed the install of Java or similar but I haven't. typing java takes me into version above. This is the beginning:\nrunning install\nrunning build\nrunning build_py\nrunning build_ext\nbuilding '_jpype' extension\ngcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I\/usr\/lib\/jvm\/java-1.5.0-sun-1.5.0.08\/include -I\/usr\/lib\/jvm\/java-1.5.0-sun-1.5.0.08\/include\/linux -Isrc\/native\/common\/include -Isrc\/native\/python\/include -I\/usr\/include\/python2.6 -c src\/native\/common\/jp_javaenv_autogen.cpp -o build\/temp.linux-i686-2.6\/src\/native\/common\/jp_javaenv_autogen.o\ncc1plus: warning: command line option \"-Wstrict-prototypes\" is valid for Ada\/C\/ObjC but not for C++\nIn file included from src\/native\/common\/jp_javaenv_autogen.cpp:21:\nsrc\/native\/common\/include\/jpype.h:45:17: error: jni.h: No such file or directory\nIn file included from src\/native\/common\/jp_javaenv_autogen.cpp:21:\nsrc\/native\/common\/include\/jpype.h:77: error: ISO C++ forbids declaration of \u2018jchar\u2019 with no type\nsrc\/native\/common\/include\/jpype.h:77: error: expected \u2018,\u2019 or \u2018...\u2019 before \u2018\u2019 token\nsrc\/native\/common\/include\/jpype.h:82: error: ISO C++ forbids declaration of \u2018jchar\u2019 with no type\nsrc\/native\/common\/include\/jpype.h:82: error: expected \u2018;\u2019 before \u2018\u2019 token\nsrc\/native\/common\/include\/jpype.h:86: error: ISO C++ forbids declaration of \u2018jchar\u2019 with no type\nsrc\/native\/common\/include\/jpype.h:86: error: expected \u2018;\u2019 before \u2018&\u2019 token\nsrc\/native\/common\/include\/jpype.h:88: error: expected \u2018;\u2019 before \u2018private\u2019\nsrc\/native\/common\/include\/jpype.h:89: error: ISO C++ forbids declaration of \u2018jchar\u2019 with no type\nsrc\/native\/common\/include\/jpype.h:89: error: expected \u2018;\u2019 before \u2018*\u2019 token\nIn file included from src\/native\/common\/include\/jpype.h:96,\n                 from src\/native\/common\/jp_javaenv_autogen.cpp:21:\nAnd this is the end:\nsrc\/native\/common\/include\/jp_monitor.h:27: error: \u2018jobject\u2019 does not name a type\nsrc\/native\/common\/jp_javaenv_autogen.cpp:30: error: \u2018jbyte\u2019 does not name a type\nsrc\/native\/common\/jp_javaenv_autogen.cpp:38: error: \u2018jbyte\u2019 does not name a type\nsrc\/native\/common\/jp_javaenv_autogen.cpp:45: error: variable or field \u2018SetStaticByteField\u2019 declared void\nsrc\/native\/common\/jp_javaenv_autogen.cpp:45: error: \u2018jclass\u2019 was not declared in this scope\nsrc\/native\/common\/jp_javaenv_autogen.cpp:45: error: \u2018jfieldID\u2019 was not declared in this scope\nsrc\/native\/common\/jp_javaenv_autogen.cpp:45: error: \u2018jbyte\u2019 was not declared in this scope\nerror: command 'gcc' failed with exit status 1","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":3736,"Q_Id":3649577,"Users Score":1,"Answer":"Edit the Setup.py and remove the \/EHsc option.","Q_Score":3,"Tags":"java,python","A_Id":6258169,"CreationDate":"2010-09-06T06:54:00.000","Title":"JPype compile problems","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm working on a wxPython app which has multiple frames and a serial connection. I need to be able to exit the app cleanly, closing the serial connection as the app terminates.\nWhat is the best way to do this? Should this be handled by a subclass of wxApp?\nThanks,\nJosh","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1263,"Q_Id":3673418,"Users Score":0,"Answer":"I usually use my close button's event handler to close connections and what-not before closing the frame. If you want to catch the upper right \"x\" button, then you'll need to bind to EVT_CLOSE. Unfortunately, when you do that, you need to call your frame's Destroy() method rather than its Close() method or you'll end up in an infinite loop.","Q_Score":2,"Tags":"python,wxpython","A_Id":3677070,"CreationDate":"2010-09-09T02:43:00.000","Title":"Terminating a wxPython app cleanly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are a lot of games that can generally be viewed as a bunch of objects spread out through space, and a very common operation is to pick all objects in a sub-area. The typical example would be a game with tons of units across a large map, and an explosion that affects units in a certain radius. This requires picking every unit in the radius in order to apply the effects of the explosion.\nNow, there are several ways to store objects that allows efficiently picking a sub-area. The easiest method is probably to divide the map into a grid; picking units in an area would involve selecting only the parts of the grid that is affected, and do a fine-grained coordinate check grid tiles that aren't 100% inside the area.\nWhat I don't like about this approach is answering \"How large should the grid tiles be?\" Too large, and efficiency may become a real problem. Too small, and the grid takes up tons of memory if the game world is large enough (and can become ridiculous if the game is 3d). There may not even be a suitable golden mean.\nThe obvious solution to the above is to make a large grid with some kind of intelligent subdivision, like a pseudo tree-structure. And it is at this point I know for sure I am far into premature optimization. (Then there are proper dynamic quad\/octrees, but that's even more complex to code and I'm not even confident it will perform any better.)\nSo my question is: Is there a standard solution to the above problem? Something, in the lines of an STL container, that can just store any object with a coordinate, and retreive a list of objects within a certain area? It doesn't have to be different than what I described above, as long as it's something that has been thought out and deemed \"good enough\" for a start.\nBonus points if there is an implementation of the algorithm in Python, but C would also do.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":293,"Q_Id":3691278,"Users Score":1,"Answer":"The first step to writing a practical program is accepting that choices for some constants come from real-world considerations and not transcendent mathematical truths. This especially applies to game design\/world simulation type coding, where you'd never get anywhere if you persisted in trying to optimally model the real world. :-)\nIf your objects will all be of fairly uniform size, I would just choose a grid size proportional to the average object size, and go with that. It's the simplest - and keep in mind simplicity will buy you some speed even if you end up searching over a few more objects than absolutely necessary!\nThings get a big harder if your objects vary greatly in size - for example if you're trying to use the same engine to deal with bullets, mice, humans, giant monsters, vehicles, asteroids, planets, etc. If that's the case, a common accepted (but ugly) approach is to have different 'modes' of play depending on the type of situation you're in. Short of that, one idea might be to use a large grid with a binary-tree subdivision of grid cells after they accumulate too many small objects.\nOne aside: if you're using floating point coordinates, you need to be careful with precision and rounding issues for your grid size, since points close to the origin have a lot more precision than those far away, which could lead to errors where grid cells miss some objects.","Q_Score":2,"Tags":"python,c,containers","A_Id":3691446,"CreationDate":"2010-09-11T14:08:00.000","Title":"A container for accessing contents by 2d\/3d coordinates","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are a lot of games that can generally be viewed as a bunch of objects spread out through space, and a very common operation is to pick all objects in a sub-area. The typical example would be a game with tons of units across a large map, and an explosion that affects units in a certain radius. This requires picking every unit in the radius in order to apply the effects of the explosion.\nNow, there are several ways to store objects that allows efficiently picking a sub-area. The easiest method is probably to divide the map into a grid; picking units in an area would involve selecting only the parts of the grid that is affected, and do a fine-grained coordinate check grid tiles that aren't 100% inside the area.\nWhat I don't like about this approach is answering \"How large should the grid tiles be?\" Too large, and efficiency may become a real problem. Too small, and the grid takes up tons of memory if the game world is large enough (and can become ridiculous if the game is 3d). There may not even be a suitable golden mean.\nThe obvious solution to the above is to make a large grid with some kind of intelligent subdivision, like a pseudo tree-structure. And it is at this point I know for sure I am far into premature optimization. (Then there are proper dynamic quad\/octrees, but that's even more complex to code and I'm not even confident it will perform any better.)\nSo my question is: Is there a standard solution to the above problem? Something, in the lines of an STL container, that can just store any object with a coordinate, and retreive a list of objects within a certain area? It doesn't have to be different than what I described above, as long as it's something that has been thought out and deemed \"good enough\" for a start.\nBonus points if there is an implementation of the algorithm in Python, but C would also do.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":293,"Q_Id":3691278,"Users Score":0,"Answer":"I don't know anything about games programming, but I would imagine (based on intuition and what I've read in the past) that a complete grid will get very inefficient for large spaces; you'll lose out in both storage, and also in time, because you'll melt the cache.\nSTL containers are fundamentally one-dimensional.  Yes, things like set and map allow you to define arbitrary sort relationships, but it's still ordered in only one dimension.  If you want to do better, you'll probably need to use a quad-tree, a kd-tree, or something like that.","Q_Score":2,"Tags":"python,c,containers","A_Id":3691977,"CreationDate":"2010-09-11T14:08:00.000","Title":"A container for accessing contents by 2d\/3d coordinates","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I place an image in a Tkinter GUI using the python standard library?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":543,"Q_Id":3698900,"Users Score":0,"Answer":"You can Built-In the images on the code encoding it on Base64","Q_Score":0,"Tags":"python,tkinter","A_Id":3713622,"CreationDate":"2010-09-13T08:45:00.000","Title":"Putting images in a Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In my application i have text control.\nI want my text ctrl should be read only but when some one right click on this he is able to copy the value from that ctrl and he can paste that value in other text control.\nIf i made my text control read only with wx.TE_READONLY then copy\/paste is not working.\nIs there any requirement to handle other type of wx event or i have to set more type of wx style flags while creating the text control object.\nThanks in advance.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":8427,"Q_Id":3710751,"Users Score":1,"Answer":"We should bind wx.EVT_TEXT_COPY and wx.EVT_TEXT_PASTE with text control.\none can copy and paste data from text ctrl although text ctrl is read only mode.","Q_Score":1,"Tags":"python,wxpython","A_Id":3716517,"CreationDate":"2010-09-14T16:13:00.000","Title":"how to create read only text ctrl but support copy paste event","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How is Python able to call C++ objects when the interpreter is C and has been built w\/ a C compiler?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":1508,"Q_Id":3712125,"Users Score":2,"Answer":"C++ can interoperate with C by extern \"C\" declarations.","Q_Score":8,"Tags":"c++,python,boost-python","A_Id":3712249,"CreationDate":"2010-09-14T19:16:00.000","Title":"How does Boost.Python work?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python\/wxPython program where the GUI is the main thread and I use another thread to load data from a file.  Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.\nAs I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread.  I get the count in the main thread by reading the same variable that is being written to by the loading thread.  \nIs this \"thread safe\"?  Could this somehow cause problems?  I've been doing it for awhile and it has been fine so far.\nPS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to.","AnswerCount":5,"Available Count":5,"Score":0.1194272985,"is_accepted":false,"ViewCount":2094,"Q_Id":3714613,"Users Score":3,"Answer":"In normal python this will be safe as all access to variables are protected by the GIL(Global Interpreter Lock) this means that all access to a variable are syncronised so only one thread can do this at a time. The only issue is as @Eloff noted if you need to read more than one value and need them to be consistent - you will need to design in some control of access in this case.","Q_Score":6,"Tags":"python,thread-safety","A_Id":3716794,"CreationDate":"2010-09-15T04:12:00.000","Title":"Python: safe to read values from an object in a thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python\/wxPython program where the GUI is the main thread and I use another thread to load data from a file.  Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.\nAs I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread.  I get the count in the main thread by reading the same variable that is being written to by the loading thread.  \nIs this \"thread safe\"?  Could this somehow cause problems?  I've been doing it for awhile and it has been fine so far.\nPS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to.","AnswerCount":5,"Available Count":5,"Score":0.0399786803,"is_accepted":false,"ViewCount":2094,"Q_Id":3714613,"Users Score":1,"Answer":"It's quite safe.\nWhen the count increases from n to n+1 the \"n+1 object\" is created and then count is switched from referring to the \"n object\" to the new \"n+1 object\".\nThere is no stage that count is referring to something other than the \"n object\" or the \"n+1 object\"","Q_Score":6,"Tags":"python,thread-safety","A_Id":3714773,"CreationDate":"2010-09-15T04:12:00.000","Title":"Python: safe to read values from an object in a thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python\/wxPython program where the GUI is the main thread and I use another thread to load data from a file.  Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.\nAs I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread.  I get the count in the main thread by reading the same variable that is being written to by the loading thread.  \nIs this \"thread safe\"?  Could this somehow cause problems?  I've been doing it for awhile and it has been fine so far.\nPS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to.","AnswerCount":5,"Available Count":5,"Score":1.2,"is_accepted":true,"ViewCount":2094,"Q_Id":3714613,"Users Score":8,"Answer":"Generally as long as...\n\nYou only have one thread writing to it, and...\nIt's not important that the count be kept precisely in sync with the displayed value...\n\nit's fine.","Q_Score":6,"Tags":"python,thread-safety","A_Id":3714627,"CreationDate":"2010-09-15T04:12:00.000","Title":"Python: safe to read values from an object in a thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python\/wxPython program where the GUI is the main thread and I use another thread to load data from a file.  Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.\nAs I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread.  I get the count in the main thread by reading the same variable that is being written to by the loading thread.  \nIs this \"thread safe\"?  Could this somehow cause problems?  I've been doing it for awhile and it has been fine so far.\nPS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to.","AnswerCount":5,"Available Count":5,"Score":0.0798297691,"is_accepted":false,"ViewCount":2094,"Q_Id":3714613,"Users Score":2,"Answer":"This is fine because you have only one writer thread. Read only operations are always thread-safe. The exception to this arises when you are reading more than one related value and expecting some form of consistency between them. Since writes can happen at any time, reads of multiple values may not be consistent and indeed may not even have any sensible program state at all. In this case, locks are used to make the multiple reads appear to happen as a single atomic operation exclusive to any writes.","Q_Score":6,"Tags":"python,thread-safety","A_Id":3714663,"CreationDate":"2010-09-15T04:12:00.000","Title":"Python: safe to read values from an object in a thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python\/wxPython program where the GUI is the main thread and I use another thread to load data from a file.  Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.\nAs I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread.  I get the count in the main thread by reading the same variable that is being written to by the loading thread.  \nIs this \"thread safe\"?  Could this somehow cause problems?  I've been doing it for awhile and it has been fine so far.\nPS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to.","AnswerCount":5,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":2094,"Q_Id":3714613,"Users Score":0,"Answer":"It's safe only because it's not especially critical.  Weird things like the value not updating when it should won't matter.  It is very hard to get a definitive answer on what happens when you pretend a single int that's being read and written to is \"atomic\", as it depends on the exact architecture and a bunch of other things.  But it won't do anything worse than give the wrong number sometimes, so go ahead... or use a queue. :)","Q_Score":6,"Tags":"python,thread-safety","A_Id":3714667,"CreationDate":"2010-09-15T04:12:00.000","Title":"Python: safe to read values from an object in a thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"A wxPython program that I'm writing uses two sliders as part of the GUI. These sliders represent a three state switch with the states \"On Full\", \"On Medium\" and \"Off\". I'd like to be able to assign these labels to the ticks on the slider. Is there a way of doing this without having to subclass or position separate static text controls?\nThanks,\nSpry","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":326,"Q_Id":3715317,"Users Score":1,"Answer":"Not built in. You'd have to create your own.","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":3716150,"CreationDate":"2010-09-15T06:53:00.000","Title":"wxPython: Assigning text labels to ticks on a slider","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a implementation of conway's game of life. I set up two modes, one is auto and the other is manual, which I mean the way to ouput the result of the game. For the auto mode, I cannot stop the running progran without ctrl + q or ctrl + c (which prints out the error message). So is there any way which can allow me to stop the running program and return to the python >>> prompt by pressing some key defined by myself, say, ctrl + k. Thank you.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":3663,"Q_Id":3737922,"Users Score":1,"Answer":"Are you running it from an iteractive prompt and want to just get back to the prompt. Or, are you running it from a shell and want to get to a python prompt in but with the current state of the programs execution? \nFor the later it you could the keyboard interupt exception in your code and break out to the python debugger (pdb).\n\nimport pdb\ntry:\n    mainProgramLoop()\nexcept (KeyboardInterrupt, SystemExit):\n    pdb.set_trace()","Q_Score":4,"Tags":"python","A_Id":3737996,"CreationDate":"2010-09-17T18:23:00.000","Title":"How to quit the running python program to python prompt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to detect when a window that doesn't belong to my application is being dragged in windows using python\/pywin32? I want to set it up so that when I drag a window whose title matches a pattern near the desktop edge, it snaps to the edge when the mouse is let go. I could write code to snap all windows with that title to the desktop whenever the mouse is released, but I want to only move the particular window that was being dragged.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1517,"Q_Id":3753612,"Users Score":2,"Answer":"So far the only possible solution I see is to use SetWindowsHookEx. Pywin32 doesn't interface this, so I think I'll have to do something like this:\n\nWrite a C extension module. It has a function like setCallback which takes a python function to be called when the drag event happens. \nWrite a C DLL that contains the actual hook into windows. This DLL will somehow have to call the python function that is currently set.\n\nI'm not sure how to do these, or if it's correct, though..","Q_Score":2,"Tags":"python,winapi,pywin32,windows","A_Id":3762323,"CreationDate":"2010-09-20T16:50:00.000","Title":"python+win32: detect window drag","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have wxpython application that run over a list of files on some directory and proccess the files line by line\nI need to build a progress bar that show the status how records already done  with wx.gauge control\nI need to count the number of the records before i use the wx.guage in order to build the progress bar ,\nis this the way to do this and if yes what is the best method to count the number of lines of all the files on some directory with pyhon ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":222,"Q_Id":3758468,"Users Score":1,"Answer":"I think you could do 2 progress bars, one for files, and second for line in just read file. This will be similar to copy progress in TotalCommander.\nIf you want one progress bar you could just count file sizes using os.path.getsize(path) and then show how many bytes have you processed\/bytes total.","Q_Score":0,"Tags":"python,wxpython","A_Id":3758497,"CreationDate":"2010-09-21T08:20:00.000","Title":"counting records of files on directory with python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been looking for how to do this and I've found places where the subject comes up, but none of the suggestions actually work for me, even though they seem to work out okay for the questioner (they don't even list what to import). I ran across self.setWindowFlags(Qt.FramelessWindowHint) but it doesn't seem to work regardless of the import I try (QtGui.FramelessWindowHint, QtCore.FramelessWindowHint, etc.).\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":6028,"Q_Id":3758648,"Users Score":13,"Answer":"u need to import  QtCore\n\n\nso the code will look like this : \n self.setWindowFlags(QtCore.Qt.FramelessWindowHint) \nwhenever you see Qt.something put in mind that they are talking about the Qt class inside QtCore module .\nhope this helps","Q_Score":7,"Tags":"python,pyqt,pyside","A_Id":3761216,"CreationDate":"2010-09-21T08:48:00.000","Title":"Setting window style in PyQT\/PySide?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am interested in programming for Mobile Devices.\nNow I have a phone which runs Symbian S60 3rd, which is one of my motivations for programming for mobile devices.\nNow, my question is, which one is better to go for?\nPython or C++?\nI have a good background in C++ (ANSI), Java and C#.\nThanks.","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":1838,"Q_Id":3763766,"Users Score":1,"Answer":"Python is more easy to use, but you have to know that a mobile is normally a very strict environment, so is possible that C++ be a better alternative.","Q_Score":0,"Tags":"c++,python,symbian","A_Id":3763786,"CreationDate":"2010-09-21T19:31:00.000","Title":"Python or C++? Programming for mobile devices","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am interested in programming for Mobile Devices.\nNow I have a phone which runs Symbian S60 3rd, which is one of my motivations for programming for mobile devices.\nNow, my question is, which one is better to go for?\nPython or C++?\nI have a good background in C++ (ANSI), Java and C#.\nThanks.","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1838,"Q_Id":3763766,"Users Score":2,"Answer":"There's a large learning curve associated with Symbian C++, if you want to do a quick prototype probably do it in Python.\nIt depends on what you want your application to do. I believe the Symbian Python implementation was done in some Symbian developers spare time so it may not give you access to everything on the phone. Symbian C++ will give you access to almost everything.\nAlso, Java and MIDP may be useful to you too.","Q_Score":0,"Tags":"c++,python,symbian","A_Id":3763991,"CreationDate":"2010-09-21T19:31:00.000","Title":"Python or C++? Programming for mobile devices","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"It's my understanding that in wxPython in OSX, \u2318+w support for closing wx.Window objects. In order to add it, I've had to bind to wx.EVT_KEY_DOWN, checking for event.MetaDown() and event.KeyCode == 'W' explicitly.\nIn my app, I need to have all windows and dialogs support this. I'm still in the process of layout out my GUI, but I got to thinking, and I'm wondering what the best way to add this support to an existing class easily is. I tried out Multiple Inheritance, but it didn't seem to be working (my event handler never got called).\nI was thinking maybe a class decorator, but this is functionality that will be added at runtime, due to the dynamic nature of python. So I'm a little stumped.\nPS: I know 'best' is subjective, but I'm honestly looking for anything here that might work that's not an exorbitant amount of code.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":93,"Q_Id":3765496,"Users Score":0,"Answer":"I was thinking maybe a class\n  decorator, but this is functionality\n  that will be added at runtime, due to\n  the dynamic nature of python.\n\nI don't understand why this makes you \"a little stumped\". The class decorator executes just after the end of the class statement -- yes, that's \"at runtime\", but, so is the clqss statement itself, all the def statement in it for its methods, and so forth.  By the time you instantiate any of the classes thus decorated, the decorator will have run and so the class you're instantiating will have been modified accordingly by the decorator's code.  Can you please give a small example of why this isn't working for you?","Q_Score":0,"Tags":"python,macos,user-interface,wxpython","A_Id":3765854,"CreationDate":"2010-09-22T00:37:00.000","Title":"Command+W Support in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an image having dimension 1000*500\nI want to make it of 400*300\nBut My image should not looked distorted.\nhttp:\/\/www.daniweb.com\/forums\/thread295652.html - i used this as  a reference. But My image get distorted.","AnswerCount":1,"Available Count":1,"Score":0.761594156,"is_accepted":false,"ViewCount":1120,"Q_Id":3778043,"Users Score":5,"Answer":"Your target image size has a different aspect ratio to that of the original. The original is 2:1 but the target is 4:3.\nYou can resize preserving the aspect ratio, but depending on which dimension you choose you'll either get an image that's 400 x 200 or 600 x 300.\nIf you need the image to be 400 x 300 then you'll need to resize to 400 x 200 and then add border to each side or 600 x 300 and add the border to the top and bottom.","Q_Score":0,"Tags":"python,image-processing","A_Id":3778086,"CreationDate":"2010-09-23T11:52:00.000","Title":"i want a to resize an image but without distortion","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wx.toolbar with some buttons. One of the buttons makes pan left!\nI want to click on the button and while I keep it pressed, the pan left is made.\nFor now I only saw that the wx.EVT_TOOL only works when mouse left is up.\nIs there a way to do what I intend ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":318,"Q_Id":3793526,"Users Score":1,"Answer":"In the toolbar button's event, you should be able to get the state of the mouse via  wx.GetMouseState.\nAlternatively, you can make your own toolbar with a panel and some wx.Buttons (or other button widgets).","Q_Score":0,"Tags":"python,events,wxpython,mouseevent","A_Id":3806500,"CreationDate":"2010-09-25T11:01:00.000","Title":"How to change my wx.toolbar event?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"IronPython.net documentation says the MSIL in the assembly isn't CLS-compliant, but is there a workaround?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":305,"Q_Id":3795914,"Users Score":0,"Answer":"I'm typing this on my phone so please forgive any silly mistakes. To use the compiled assembly, make sure you compile with clr.CompileModules, NOT pyc.py. Then in your C# call the LoadAssembly method on your Python ScriptEngine object. The module can then be imported by calling the ImportModule method on your ScriptEngine. From there if you can take advantage of the dynamic keyword, do so. Otherwise you'll be stuck with some magic string heavy calls to GetVariable. Also note that you'll have to provide the standard library to your compiled Python Assembly in one form or another.","Q_Score":1,"Tags":"c#,ironpython,.net-assembly,cil,cls-compliant","A_Id":3835553,"CreationDate":"2010-09-25T23:07:00.000","Title":"Is there a way to use IronPython objects and functions (compiled into an assembly) from C# code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have used Lua.NET on .NET platform and I  could call the .NET class\/object from Lua and I could call the Lua from .NET Lua API interface. I did the same with the IronPython. I knew the how the .NET binding works.\nNow I have a C++ project and I want to use the dynamic capabilities. I want to call C++ object which may not be possible from Lua so I may need to call some C API which makes call to C++. Meantime I want to call the Lua from C++.\nWe have configuration data which is best described in table like format in Lua or List & Dict like in Python. We need to enumerate these data structures defined in Lua\/Python in C++. \nWhen considering Lua to Python in C++ for two way calling, is Python have upper hand with Boost Python library? I don't have experience in Python\/C++ binding. I don't have equal experience of using Python in C++ and calling Python from C++.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3491,"Q_Id":3818703,"Users Score":0,"Answer":"If you are planning to just use windows you could use C++\/CLI a managed variant of C++. With C++\/CLI you can easily mix managed and unmanaged code. You could call the managed classes from any .net language and the unmanaged (exported) functions from C.","Q_Score":2,"Tags":"c++,python,boost,lua,embedding","A_Id":3819333,"CreationDate":"2010-09-29T04:22:00.000","Title":"Lua or Python binding with C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"all, I want to draw a rectangular or a container with 20 slots inside. it is like a cd container or archive, with empty slot to insert the cd or book. I choose wxPython. \nfor this 20 horizontal empty slots, i see there is wx.BoxSizer(wx.Horizonal) or other sizers to make the layout.\nmy question is, Is it possible to have \"visible border and grey background\" (to represent the empty slots) for the spaces generated by the wx.BoxSizer? It seems to me that, it is not possible. The sizer seems only to do layout, instead of generating visible subwindow.\nIf it is not possible, I think I need to create a slot window class for this \"border and colorful background\" feature, and create 20 slot window objects and add into the sizer. Then, I have to use create another window class to represent the book or CD, and insert this CD window to the slot window. \nThis sounds a bit awkard. I do not know if slot window is necessary or maybe wx.sizer (or other sizer) could achieve the same effect as the slot window.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":355,"Q_Id":3823429,"Users Score":1,"Answer":"I would create a subclass of wx.Panel for each \"slot\", then manage them with a grid or box sizer.","Q_Score":0,"Tags":"wxpython,window,sizer","A_Id":3823479,"CreationDate":"2010-09-29T15:58:00.000","Title":"use wxPython to draw a grided rectangular container or box","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Toplevel widget I'd like it so that it would never appear within the confines of the main Tk window. Basically so that when the Toplevel appears it doesn't cover up any of the main Tk window.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":348,"Q_Id":3836086,"Users Score":1,"Answer":"You want to use wm_geometry and a tiny bit of math to calculate and set a suitable starting position for the second toplevel.","Q_Score":1,"Tags":"python,tkinter","A_Id":3836182,"CreationDate":"2010-10-01T02:10:00.000","Title":"Toplevel widgets in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a plugin UI for an existing application using PyQt4. The window is created using uic.loadUi() on the press of a button in the main window. The problem is that if I press the button again (while the window is showing) the window is re-created and unsaved changes are lost. I don't want to make the window modal. Which options do I have to cope with this problem? I guess it would be related to checking whether the QWidget is already showing.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1072,"Q_Id":3839426,"Users Score":2,"Answer":"You should initializer a pointer to the QWidget (member variable) to 0.\nWhen the button is pressed, check if the pointer is 0 - if it is, load and show the widget, and assign the pointer variable to point to the new widget. If the pointer is not null when the button is pressed, call widget->raise() and widget->activateWindow().\nDisabled buttons can be frustrating to users, as can buttons which appear to do nothing because e.g. their effect is hidden.","Q_Score":2,"Tags":"python,user-interface,qt4,pyqt4","A_Id":3839514,"CreationDate":"2010-10-01T13:07:00.000","Title":"How to check if a QWidget is already showing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a plugin UI for an existing application using PyQt4. The window is created using uic.loadUi() on the press of a button in the main window. The problem is that if I press the button again (while the window is showing) the window is re-created and unsaved changes are lost. I don't want to make the window modal. Which options do I have to cope with this problem? I guess it would be related to checking whether the QWidget is already showing.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1072,"Q_Id":3839426,"Users Score":0,"Answer":"I would have thought that this would be handled more by your application logic than anything else. The main window should disable the button after it has been clicked and then re-enable it again when the window is closed. Connect up a closing signal on the secondary window to a slot on the main window to notify the main window when the secondary window is being closed.","Q_Score":2,"Tags":"python,user-interface,qt4,pyqt4","A_Id":3839466,"CreationDate":"2010-10-01T13:07:00.000","Title":"How to check if a QWidget is already showing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"It doesn't look like it has that attribute, but it'd be really useful to me.","AnswerCount":13,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":131968,"Q_Id":3842155,"Users Score":0,"Answer":"You could use a Label instead. A Label can be edited programmatically and cannot be edited by the user.","Q_Score":83,"Tags":"python,text,tkinter","A_Id":58942250,"CreationDate":"2010-10-01T18:47:00.000","Title":"Is there a way to make the Tkinter text widget read only?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing an application that uses multiple threads to gather data from a variety of network devices. I'm using PyQT to display the collected data on a GUI. I am using regular python threads (from thread, threading) in my app (instead of QThread).  In order to update the GUI on the different threads, I use a lock (thread.allocate_lock()). So, anytime a GUI update will happen, I call with lock, update GUI. Any concerns about this?","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":7384,"Q_Id":3842558,"Users Score":-1,"Answer":"I use pyqtSignal and Python's threading. You can create threads and when the thread is completed have it send a signal to update your GUI.","Q_Score":1,"Tags":"python,multithreading,pyqt","A_Id":3886587,"CreationDate":"2010-10-01T19:50:00.000","Title":"PyQT and threads","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have input values of x, y, z coordinates in the following format:\n[-11.235865 5.866001 -4.604924]\n[-11.262565 5.414276 -4.842384]\n[-11.291885 5.418229 -4.849229]\n[-11.235865 5.866001 -4.604924]\nI want to draw polygons and succeeded with making a list of wx.point objects. But I need to plot floating point coordinates so I had to change it to point2D objects but DrawPolygon doesn't seem to understand floating points, which returns error message: TypeError: Expected a sequence of length-2 sequences or wxPoints.\nI can't find anywhere in the API that can draw shapes based on point2D coordinates, could anyone tell me a function name will do the job? \nThanks","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1320,"Q_Id":3852146,"Users Score":0,"Answer":"DC's only use integers. Try using Cairo or wx.GraphicsContext.","Q_Score":1,"Tags":"python,wxpython","A_Id":3855400,"CreationDate":"2010-10-04T00:29:00.000","Title":"How to draw polygons with Point2D in wxPython?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.","AnswerCount":11,"Available Count":7,"Score":0.0,"is_accepted":false,"ViewCount":801,"Q_Id":3869435,"Users Score":0,"Answer":"Python scripts are analogous to a man looking at a to-do list written in English (or language he understands). The man has to do all the work, every time that list of things has to be done.\nIf the man, instead of doing the steps on his own each time, creates and programs a robot which can carry out those steps again and again (and probably faster than him), that robot is analogous to the C program.\nThe man in the python case is called the \"interpreter\" and in the C case is called the \"compiler\", and the C robot is called the compiled program\/executable.\nWhen you look at the python program source, you see the to-do list. In case of the robot, you see the gears, motors and batteries, etc, which look very different from the to-do list. If you could get hold of the C \"to-do\" list, it looks somewhat like the python code, just in a different language.","Q_Score":3,"Tags":"python,c,decompiling","A_Id":3869481,"CreationDate":"2010-10-06T04:07:00.000","Title":"Why do C programs require decompilers but python programs dont?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.","AnswerCount":11,"Available Count":7,"Score":0.0906594778,"is_accepted":false,"ViewCount":801,"Q_Id":3869435,"Users Score":5,"Answer":"This is sorta a big topic. You should look into your local friendly Computer Science curriculum, you'll find a lot of great stuff on this subject there.\nThe short answer is the Python is an \"interpreted\" language, which means that it requires a machine language program (the python interpreter) to run the python program, adding a layer of indirection. C or C++ are different. They are compiled directly to machine code, which runs directly on your processor.\nThere is a lot of additional voodoo to be learned here, however. Technically Python is compiled to a bytecode, and modern interpreters do more and more \"Just in Time\" compilation, so the boundaries between compiled and interpreted code are getting fuzzier all the time.","Q_Score":3,"Tags":"python,c,decompiling","A_Id":3869458,"CreationDate":"2010-10-06T04:07:00.000","Title":"Why do C programs require decompilers but python programs dont?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.","AnswerCount":11,"Available Count":7,"Score":0.0181798149,"is_accepted":false,"ViewCount":801,"Q_Id":3869435,"Users Score":1,"Answer":"because C code is complied to object (machine) code and python code is compiled into an intermediate byte code. I am not sure if you are even referring to the byte code of python - you must be referring to the source file itself which is directly executable (hiding the byte code from you!). C needs to be compiled and linked.","Q_Score":3,"Tags":"python,c,decompiling","A_Id":3869445,"CreationDate":"2010-10-06T04:07:00.000","Title":"Why do C programs require decompilers but python programs dont?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.","AnswerCount":11,"Available Count":7,"Score":0.0,"is_accepted":false,"ViewCount":801,"Q_Id":3869435,"Users Score":0,"Answer":"Python scripts are parsed and converted to binary only when they're run - i.e., they're text files and you can read them with an editor.\nC code is compiled and linked to an executable binary file before they can be run. Normally, only this executable binary file is distributed - hence you need a decompiler. You can always view the source code, if you've access to it.","Q_Score":3,"Tags":"python,c,decompiling","A_Id":3869451,"CreationDate":"2010-10-06T04:07:00.000","Title":"Why do C programs require decompilers but python programs dont?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.","AnswerCount":11,"Available Count":7,"Score":0.0,"is_accepted":false,"ViewCount":801,"Q_Id":3869435,"Users Score":0,"Answer":"G-WAN executes ANSI C scripts on the fly -making it just like Python scripts.\nThis can be server-side scripts (using G-WAN as a Web server) or any general-purpose C program and you can link any existing library.\nOh, and G-WAN C scripts are much faster than Python, PHP or Java...","Q_Score":3,"Tags":"python,c,decompiling","A_Id":3874099,"CreationDate":"2010-10-06T04:07:00.000","Title":"Why do C programs require decompilers but python programs dont?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.","AnswerCount":11,"Available Count":7,"Score":1.0,"is_accepted":false,"ViewCount":801,"Q_Id":3869435,"Users Score":10,"Answer":"Python is a script language, runs in a virtual machine through an interpeter.\nC is a compiled language, the code compiled to binary code which the computer can run without all that extra stuff Python needs.","Q_Score":3,"Tags":"python,c,decompiling","A_Id":3869443,"CreationDate":"2010-10-06T04:07:00.000","Title":"Why do C programs require decompilers but python programs dont?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.","AnswerCount":11,"Available Count":7,"Score":0.0363476168,"is_accepted":false,"ViewCount":801,"Q_Id":3869435,"Users Score":2,"Answer":"Yes, you can - it's called disassembling, and allows you to look at the code of Safari perfectly well. The thing is, C, among other languages, compiles to native code, i.e. code that your CPU can \"understand\" and execute. \nMore or less obviously, the level of abstraction present in the instruction set of your CPU is much smaller than that of a high level language like Python. The CPU instructions are not concerned with \"downloading that URI\", but more \"check if that bit is set in a hardware register\".\nSo, in conclusion, the level of complexity present in a native application is much higher when looking at the machine code, so many people simply can't make any sense of what is going on there, it's hard to get the big picture. With experience and time at your hands, it is possible though - people do it all the time, reversing applications and all.","Q_Score":3,"Tags":"python,c,decompiling","A_Id":3869460,"CreationDate":"2010-10-06T04:07:00.000","Title":"Why do C programs require decompilers but python programs dont?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QWebView in my app which renders a html page stored in the app as a Qresource. This page, however requires meaty external Javascript libraries such as MathJax, which I would want to include as a resource due to its size. \nMy problem is that it seems that QtWebkit does not cache these files as a regular browser would do, and every time I refresh the widget it downloads MathJax afresh.\nSo my question is: is there any way to cache these libraries after first time they are downloaded, without having resorting to shipping it with the app as resource?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1071,"Q_Id":3872033,"Users Score":0,"Answer":"Could you post some source code? Once downloaded that data will stay in the \/tmp\/ folder for some time. You could likely use the data in the temp folder, my guess is you are not enforcing that policy.","Q_Score":1,"Tags":"javascript,python,pyqt,qtwebkit","A_Id":3886529,"CreationDate":"2010-10-06T11:41:00.000","Title":"Caching external javascript for a QtWebkit widget in a PyQt app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":1459,"Q_Id":3877971,"Users Score":2,"Answer":"Been using Vizard for various VR and AR development for about 3 yrs now - it's NOT unity - i.e. a web enabled game engine (excellent though it is) - what Vizard provides is a highly optimized OpenGL engine, wrapped in user friendly python scripting environment BUT on top of this you get the ability to seamlessly distribute your simulations over a cluster or a network. Vizard keeps all things completely synched - invisible to the user. Connects to pretty much all known VR tracking equipment and display periphals and standard gaming equipment is also supported (Wiimote & Kinnect). Native support for frame sequential, side-by-side and anaglyph stereo, spatial sound engine and the ability to extend it with C and C++ plugins or GLSL shaders.\nDidn't actually mean to write that much and I don't want to come across as a Vizard evangelist, it is not perfect, BUT comparing it to Panda3D, Unity or other game engines I feel is an unfair comparison - not like-for-like :o)","Q_Score":1,"Tags":"python,pygame,3d-engine,panda3d","A_Id":6589557,"CreationDate":"2010-10-07T00:54:00.000","Title":"How does Worldviz Vizard compares to Panda3D and Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1459,"Q_Id":3877971,"Users Score":0,"Answer":"I only used Vizard, and that for one small project.\nIt was easy to use, well documented, and had a good set of examples.","Q_Score":1,"Tags":"python,pygame,3d-engine,panda3d","A_Id":4122231,"CreationDate":"2010-10-07T00:54:00.000","Title":"How does Worldviz Vizard compares to Panda3D and Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.","AnswerCount":5,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":515,"Q_Id":3878873,"Users Score":0,"Answer":"Opencv has functions named like \"cvHoughLines2\" to detect lines.","Q_Score":0,"Tags":"c#,c++,python,image,lua","A_Id":3895535,"CreationDate":"2010-10-07T05:13:00.000","Title":"transforming an image into an array of lines to draw","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.","AnswerCount":5,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":515,"Q_Id":3878873,"Users Score":1,"Answer":"You are looking for a \"raster to vector\" algorithm.  The term comes from early graphics display systems, that used a CRT (cathode ray tube) for the display itself.  There were 2 approaches to displaying graphics: \"raster\" was the scan of a series of lines left to right, top to bottom, each line made up of on\/off pixels. The controller of the CRT's electron gun simply scanned the same pattern over and over, just varying the intensity of the electron beam.  On a \"vector\" display, the electron gun could draw a straight line between any two points - no aliasing, no pixelation, just a pure straight line.  Vector displays were capable of higher resolution, but were limited by the number of lines they could draw - if a drawing had too many lines, then the display would begin to flicker as the time it would take to redraw the picture (to refresh the phosphors of the CRT) would take longer than the persistence of the CRT's phosphor surface.  Raster displays were simpler to control, had much less flicker, but lower resolution.","Q_Score":0,"Tags":"c#,c++,python,image,lua","A_Id":3880279,"CreationDate":"2010-10-07T05:13:00.000","Title":"transforming an image into an array of lines to draw","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":515,"Q_Id":3878873,"Users Score":1,"Answer":"In general, bitmaps are stored in sequential memory, ideal for 'blitting' to the display; your GUI framework of choice will have a function for drawing bitmaps, and this function will be very carefully optimised.\nOn the other hand, decomposing an image into lines - vectorizing the image - is the domain of specialist programs and ongoing research.  In all cases, its going to be slower to computer and slower to draw than just blitting the bitmap.","Q_Score":0,"Tags":"c#,c++,python,image,lua","A_Id":3879121,"CreationDate":"2010-10-07T05:13:00.000","Title":"transforming an image into an array of lines to draw","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.","AnswerCount":5,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":515,"Q_Id":3878873,"Users Score":0,"Answer":"How can you achieve with lines what you have to do with pixels? You need to draw each pixel individually I'd say.","Q_Score":0,"Tags":"c#,c++,python,image,lua","A_Id":3879102,"CreationDate":"2010-10-07T05:13:00.000","Title":"transforming an image into an array of lines to draw","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Due to refactoring\/reworking on a controller I've had to embed a Python Interpreter inside a C application.  I can now call python functions and pass\/get Objects into Python fine.\nThe python code is a controller for a robot (currently simulated),  this now needs make use of some C code for comparisons I'm making.\nPreviously the Python code created objects, read sensors, ran control code and wrote the outputs to motors.  All of this except the control code now needs to be done in C.  The problem I have is that Objects which are created in an init function (in python) which, when I come to run the control code no longer exist.\nWhat is the best way to solve this?  My idea was to return the controllers from the init function and store references to them in the C, passing the reference to the controller each time it is called.\nThanks for any help.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":102,"Q_Id":3883724,"Users Score":1,"Answer":"This may not be the answer you want, but there are ways of working with C and Python other than embedding an interpreter inside a C application.\nNamely, why don't you do the opposite? Create C libraries for Python? You can control the general flow of your application in Python, which is much more comfortable, and call C code whenever you see fit.\nAgain, I'm not really addressing your actual question, so feel free to ignore me.","Q_Score":0,"Tags":"python,c,embedded-language","A_Id":3884055,"CreationDate":"2010-10-07T16:26:00.000","Title":"Maintaining a Python Object when embedding in C","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a programs that runs several threads (on a while loop until \nCtrl  C  is pressed). The app also has a GUI that I developed in PyQt. However, I am facing the following problem:\nIf I press Ctrl C on the console, and then close the GUI, the program exits fine. However, if I close the GUI first, the other threads won't stop and the program keeps running after Ctrl C. Anyone knows how I could address this problem?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":722,"Q_Id":3886500,"Users Score":0,"Answer":"In Qt you would overload the OnClose method for the widget\/frame or hook the lastwindowsdclosed signal to do whatever you need to shut down the app - don't know if it's diiferent from python","Q_Score":0,"Tags":"python,multithreading,pyqt,copy-paste","A_Id":3886510,"CreationDate":"2010-10-07T22:56:00.000","Title":"PyQT4 and Ctrl C","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for qrcode generator for python window version. Can anyone help me to find out. \nI didn't get anywhere. \nPlease help me.\nThanks,\nmanu","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":8188,"Q_Id":3888125,"Users Score":0,"Answer":"pyqrnative is working pretty well for me. I wish I could find some documentation in English for it. Would like to know the relationship between data content size and the first \"typeNumber\" argument.","Q_Score":5,"Tags":"python,qr-code","A_Id":5047781,"CreationDate":"2010-10-08T06:17:00.000","Title":"qrcode generator using python for windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need a simple interpreter which will do execution (evaluation) of simple expressions\/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later.\nIt should also be strait-forward for other team members to pull my application from Source Repository and to build it, without having to install additional application, libraries, etc.\nSearching reveled options like: Python (via Boost and \/ or Python API), Lua, Guile, TinyScheme.\nI am the closest to Python, but using Boost, building Python library, complicated task of interfacing main application with Python makes this choice an overkill, maybe I am wrong.\nThere should be a simple solution for this request, what are your experiences and suggestions?","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":739,"Q_Id":3896313,"Users Score":1,"Answer":"Guile is easy to embed and extend, and scheme if powerfull programming language.\nYou can compile libguile and add it to the repository in lib directory or add source for guile and compile it when user compile the project.\nBut I don't try to use guile on Windows.","Q_Score":3,"Tags":"c++,python,scripting,lua","A_Id":3897041,"CreationDate":"2010-10-09T16:04:00.000","Title":"Simple interpreter to embed and extend inside an C++ Windows application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I need a simple interpreter which will do execution (evaluation) of simple expressions\/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later.\nIt should also be strait-forward for other team members to pull my application from Source Repository and to build it, without having to install additional application, libraries, etc.\nSearching reveled options like: Python (via Boost and \/ or Python API), Lua, Guile, TinyScheme.\nI am the closest to Python, but using Boost, building Python library, complicated task of interfacing main application with Python makes this choice an overkill, maybe I am wrong.\nThere should be a simple solution for this request, what are your experiences and suggestions?","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":739,"Q_Id":3896313,"Users Score":4,"Answer":"Two great options you've already listed are Python and Lua. Here are some of the tradeoffs for your consideration:\nPython\n\nA much more complete and powerful language (IMHO!) with libraries for anything and tons of support and communities everywhere you look.\nSyntax is not entirely C-like\nAlthough Python wasn't designed specifically for embedding (it's much more often used as a standalone language extended by code in C\/C++), it's tot really hard to embed. The official docs contain some examples, and following Boost's examples shouldn't be much harder.\n\nLua\n\nDesigned from bottom up for embedding, so it should be the simplest one to embed. \nSyntax more C-like than Python's\n\nIf you foresee a definite future need for scripting, building in a scripting engine early is a good idea as it may open some interesting possibilities for you as you go on developing the program. Both options listed above are good ones, you should have no problems embedding any of them without much effort.","Q_Score":3,"Tags":"c++,python,scripting,lua","A_Id":3897270,"CreationDate":"2010-10-09T16:04:00.000","Title":"Simple interpreter to embed and extend inside an C++ Windows application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I need a simple interpreter which will do execution (evaluation) of simple expressions\/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later.\nIt should also be strait-forward for other team members to pull my application from Source Repository and to build it, without having to install additional application, libraries, etc.\nSearching reveled options like: Python (via Boost and \/ or Python API), Lua, Guile, TinyScheme.\nI am the closest to Python, but using Boost, building Python library, complicated task of interfacing main application with Python makes this choice an overkill, maybe I am wrong.\nThere should be a simple solution for this request, what are your experiences and suggestions?","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":739,"Q_Id":3896313,"Users Score":2,"Answer":"No matter which scripting language you choose (and I would probably vote for Python), you might consider using SWIG (www.swig.org) to ease the burden of interfacing to C++. While normally used to build C++ extensions for python (or ruby, lua, guile, any many others), it can be used to aid in embedding too.\nYou had mentioned boost::python, which is certainly a full featured option, and allows for a somewhat closer Python\/C++ integration (especially where virtual functions are involved). However, in my experience, SWIG is a lot easier to integrate, works with scads of scripting languages, and for python, is natively supported by Python's distutils.","Q_Score":3,"Tags":"c++,python,scripting,lua","A_Id":3898118,"CreationDate":"2010-10-09T16:04:00.000","Title":"Simple interpreter to embed and extend inside an C++ Windows application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm writing a small app which has 2 separate frames.\nThe first frame is like a video player controller. It has Play\/Stop\/Pause buttons etc. It's named controller.py.\nThe second frame contains OpenGL rendering and many things inside it, but everything is wrapped inside a Frame() class as the above. It's named model.py.\nI'm up to the final part where I have to \"join\" these two together.\nDoes anyone know how to control a frame (model.py) from another frame (controller.py)?\nI would like to do something like a movie player when you clicks play it pops up a new window and play until the stop button is clicked. \nIf you know how, please let me know. (Just tell me in general no need to specific).","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":669,"Q_Id":3898988,"Users Score":1,"Answer":"I'd definitely use PubSub as it's probably the cleanest way I can think of to do it. You can also do it with wx.PostEvent or use a modal frame.","Q_Score":1,"Tags":"python,wxpython,frame,send","A_Id":3906746,"CreationDate":"2010-10-10T04:11:00.000","Title":"How to control a frame from another frame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am hoping to use PyQt to produce an application that will display an equation entered by the user. I had considered matplotlib, but this seems like overkill as I would only be using it to render the latex.\nI need to use SymPy anyway, so I was hoping there would be a way to use it to do the rendering also, preferably producing an SVG file for PyQt to use.\nI hope this makes sense - many thanks in advance for any help\/advice.\nBest wishes,\nGeddes","AnswerCount":2,"Available Count":1,"Score":0.4621171573,"is_accepted":false,"ViewCount":2067,"Q_Id":3902008,"Users Score":5,"Answer":"If you just need simple rendering using python, how about trying ipython 0.11 with qtconsole using sympy profile(ipython qtconsole --profile=sympy). It did implement matplotlib, but I consider it quite clean considering mathematical expressions can be rendered directly on the qtconsole. Need to install pyzmq module.","Q_Score":5,"Tags":"python,latex,pyqt,sympy","A_Id":6916267,"CreationDate":"2010-10-10T20:17:00.000","Title":"Is it possible for SymPy to render LaTeX for use in a GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a simple Python program with a (dynamic) form interface, but it needs to run on Google App Engine. I understand that IronPython lets one use Visual Studio's drag-and-drop interface builder and classes while programming with Python, but will this be compatible with Google App Engine?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":651,"Q_Id":3908062,"Users Score":3,"Answer":"Google's Google App Engine can only run pure python code, and not even all Python is supported.  No, you can't do things like IronPython.\nIf you want to use Python, I'd learn Django.  If you want something closer to .NET, I'd go with Java.","Q_Score":3,"Tags":"python,user-interface,google-app-engine,ironpython","A_Id":3908074,"CreationDate":"2010-10-11T16:23:00.000","Title":"Can I use IronPython to develop GUIs for Google App Engine?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a pygtk application and would like to provide a text-based fallback mode for it. When mporting gtk without a X display available I see only a GtkWarning on stderr but no exception I could take advantage of and checking for DISPLAY seems like an ugly hack. How can I implement this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":46,"Q_Id":3914370,"Users Score":0,"Answer":"Checking gtk.gdk.screen_get_default() does it, however there seems no way to suppress the GTK warnings.","Q_Score":1,"Tags":"python,pygtk","A_Id":3917071,"CreationDate":"2010-10-12T11:56:00.000","Title":"Implementing a text-based fallback for pygtk applications","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem with my python application, and I think it's related to the python garbage collection, even if I'm not sure...\nThe problem is that my application takes a lot of time to exit and to switch to one function to the next one.\nIn my application I handle very large dictionaries, containing thousands of large objects which are instantiated from wrapped C++ classes.\nI put some timestamp outputs in my program, and I saw that at the end of each function, when objects created inside the function should go out of scope, a lot of time is spent by the interpreter before calling the next function. And I observe the same problem at the end of the application, when the program should exit: a lot of time (~ hours!) is spent between the last timestamp on screen and the appearance of the fresh prompt.\nThe memory usage is stable, so I don't really have memory leaks.\nAny suggestions?\nCan be the garbage collection of thousands of large C++ objects that slow?\nIs there a method to speed up that?\nUPDATE:\nThanks a lot for all your answers, you gave me a lot of hints to debug my code :-)\nI use Python 2.6.5 on Scientific Linux 5, a customized distribution based on Red Hat Enterprise 5.\nAnd actually I'm not using SWIG to get Python bindings for our C++ code, but the Reflex\/PyROOT framework. I know, it's not very known outside particle physics (but still open source and freely available) and I have to use it because it's the default for our main framework.\nAnd in this context the DEL command from the Python side does not work, I had already tried it. DEL only deletes the python variable linked to the C++ object, not the object itself in memory, which is still owned by the C++ side...\n...I know, it's not-standard I guess, and a bit complicated, sorry :-P\nBut following your hints, I'll profile my code and I'll come back to you with more details, as you suggested.\nADDITIONAL UPDATE:\nOk, following your suggestions, I instrumented my code with cProfile, and I discovered that actually the gc.collect() function is the function taking the most of the running time!!\nHere the output from cProfile + pstats  print_stats():\n\n\n    >>> p.sort_stats(\"time\").print_stats(20)\nWed Oct 20 17:46:02 2010    mainProgram.profile\n\n         547303 function calls (542629 primitive calls) in 548.060 CPU seconds\n\n   Ordered by: internal time\n   List reduced from 727 to 20 due to restriction \n\n   ncalls  tottime  percall  cumtime  percall filename:lineno(function)\n        4  345.701   86.425  345.704   86.426 {gc.collect}\n        1  167.115  167.115  200.946  200.946 PlotD3PD_v3.2.py:2041(PlotSamplesBranches)\n       28   12.817    0.458   13.345    0.477 PlotROOTUtils.py:205(SaveItems)\n     9900   10.425    0.001   10.426    0.001 PlotD3PD_v3.2.py:1973(HistoStyle)\n     6622    5.188    0.001    5.278    0.001 PlotROOTUtils.py:403(__init__)\n       57    0.625    0.011    0.625    0.011 {built-in method load}\n      103    0.625    0.006    0.792    0.008 dbutils.py:41(DeadlockWrap)\n       14    0.475    0.034    0.475    0.034 {method 'dump' of 'cPickle.Pickler' objects}\n     6622    0.453    0.000    5.908    0.001 PlotROOTUtils.py:421(CreateCanvas)\n    26455    0.434    0.000    0.508    0.000 \/opt\/root\/lib\/ROOT.py:215(__getattr__)\n[...]\n\n>>> p.sort_stats(\"cumulative\").print_stats(20)\nWed Oct 20 17:46:02 2010    mainProgram.profile\n\n         547303 function calls (542629 primitive calls) in 548.060 CPU seconds\n\n   Ordered by: cumulative time\n   List reduced from 727 to 20 due to restriction \n\n   ncalls  tottime  percall  cumtime  percall filename:lineno(function)\n        1    0.001    0.001  548.068  548.068 PlotD3PD_v3.2.py:2492(main)\n        4    0.000    0.000  346.756   86.689 \/usr\/lib\/\/lib\/python2.5\/site-packages\/guppy\/heapy\/Use.py:171(heap)\n        4    0.005    0.001  346.752   86.688 \/usr\/lib\/\/lib\/python2.5\/site-packages\/guppy\/heapy\/View.py:344(heap)\n        1    0.002    0.002  346.147  346.147 PlotD3PD_v3.2.py:2537(LogAndFinalize)\n        4  345.701   86.425  345.704   86.426 {gc.collect}\n        1  167.115  167.115  200.946  200.946 PlotD3PD_v3.2.py:2041(PlotBranches)\n       28   12.817    0.458   13.345    0.477 PlotROOTUtils.py:205(SaveItems)\n     9900   10.425    0.001   10.426    0.001 PlotD3PD_v3.2.py:1973(HistoStyle)\n    13202    0.336    0.000    6.818    0.001 PlotROOTUtils.py:431(PlottingCanvases)\n     6622    0.453    0.000    5.908    0.001 \/root\/svn_co\/rbianchi\/SoftwareDevelopment\n\n[...]\n\n>>>\n\nSo, in both outputs, sorted by \"time\" and by \"cumulative\" time respectively, gc.collect() is the function consuming the most of the running time of my program! :-P\nAnd this is the output of the memory profiler Heapy, just before returning the main() program.\n\nmemory usage before return:\nPartition of a set of 65901 objects. Total size = 4765572 bytes.\n Index  Count   %     Size   % Cumulative  % Kind (class \/ dict of class)\n     0  25437  39  1452444  30   1452444  30 str\n     1   6622  10   900592  19   2353036  49 dict of PlotROOTUtils.Canvas\n     2    109   0   567016  12   2920052  61 dict of module\n     3   7312  11   280644   6   3200696  67 tuple\n     4   6622  10   238392   5   3439088  72 0xa4ab74c\n     5   6622  10   185416   4   3624504  76 PlotROOTUtils.Canvas\n     6   2024   3   137632   3   3762136  79 types.CodeType\n     7    263   0   129080   3   3891216  82 dict (no owner)\n     8    254   0   119024   2   4010240  84 dict of type\n     9    254   0   109728   2   4119968  86 type\n  Index  Count   %     Size   % Cumulative  % Kind (class \/ dict of class)\n    10   1917   3   107352   2   4264012  88 function\n    11   3647   5   102116   2   4366128  90 ROOT.MethodProxy\n    12    148   0    80800   2   4446928  92 dict of class\n    13   1109   2    39924   1   4486852  93 __builtin__.wrapper_descriptor\n    14    239   0    23136   0   4509988  93 list\n    15     87   0    22968   0   4532956  94 dict of guppy.etc.Glue.Interface\n    16    644   1    20608   0   4553564  94 types.BuiltinFunctionType\n    17    495   1    19800   0   4573364  94 __builtin__.weakref\n    18     23   0    11960   0   4585324  95 dict of guppy.etc.Glue.Share\n    19    367   1    11744   0   4597068  95 __builtin__.method_descriptor\n\n\nAny idea why, or how to optimize the garbage collection?\nIs there any more detailed check I can do?","AnswerCount":3,"Available Count":1,"Score":-1.0,"is_accepted":false,"ViewCount":13216,"Q_Id":3916553,"Users Score":-5,"Answer":"If your problem really is the garbage collection, try explicitly freeing your objects when you're done with them using del().\nIn general, this doesn't sound like a garbage collection problem, unless we're talking about terabytes of memory.\nI agree with S.Lott... profile your app, then bring code snippets and the results of that back and we can be much more helpful.","Q_Score":18,"Tags":"python,garbage-collection,root,performance","A_Id":3919321,"CreationDate":"2010-10-12T15:50:00.000","Title":"Python garbage collection can be that slow?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to the world of PyQt.I am using PyQt designer for designing the UI and coding to provide functionality in it.But unfortunately I am getting confused to link with the UI.By importing the class we generally doing in examples.But when I try my own code its not happening.\nAny hints for how designer and other parts interacts will be super helpful.\nThanks in advance!","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":1463,"Q_Id":3949842,"Users Score":-1,"Answer":"winBase, winForm = uic.loadUiType(\"mainWindow.ui\") # this is the \n                                                     file created whith Qt Designer\nclass Window(winBase, winForm):\n   def __init__(self, parent = None)\n     super(winBase, self).__init__(parent)\n     self.setupUi(self)","Q_Score":0,"Tags":"python,user-interface,pyqt4","A_Id":11305421,"CreationDate":"2010-10-16T17:01:00.000","Title":"PyQt GUI based CRUD application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Python and Tkinter, and I need to know the current dimensions (width, height) of a widget.\nI've tried somewidget[\"width\"], but it returns only a fixed value, and is not updated whenever the widget size changes (e.g. when the window is resized).","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":81835,"Q_Id":3950687,"Users Score":77,"Answer":"Use somewidget.winfo_width() and somewidget.winfo_height() to get the actual widget size, the somewidget['width'] property is only a hint given to the geometry manager.","Q_Score":62,"Tags":"python,tkinter","A_Id":3950766,"CreationDate":"2010-10-16T20:39:00.000","Title":"How to find out the current widget size in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Python and Tkinter, and I need to know the current dimensions (width, height) of a widget.\nI've tried somewidget[\"width\"], but it returns only a fixed value, and is not updated whenever the widget size changes (e.g. when the window is resized).","AnswerCount":3,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":81835,"Q_Id":3950687,"Users Score":82,"Answer":"somewidget.winfo_width() and somewidget.winfo_height() give 1. You need to update Tk (issue tk.update()) before getting these values.","Q_Score":62,"Tags":"python,tkinter","A_Id":49216638,"CreationDate":"2010-10-16T20:39:00.000","Title":"How to find out the current widget size in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Python and Tkinter, and I need to know the current dimensions (width, height) of a widget.\nI've tried somewidget[\"width\"], but it returns only a fixed value, and is not updated whenever the widget size changes (e.g. when the window is resized).","AnswerCount":3,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":81835,"Q_Id":3950687,"Users Score":13,"Answer":"You can use the function somewidget.winfo_reqheight() for height and somewidget.winfo_reqwidth() for width, but first don't forget  to call the update function of the widget you want to know the dimension somewidget.update(). If you do not call the update function you will get the default value 1.","Q_Score":62,"Tags":"python,tkinter","A_Id":60086946,"CreationDate":"2010-10-16T20:39:00.000","Title":"How to find out the current widget size in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python dictionary stored in a file which I need to access from a c++ program. What is the best way of doing this?\nThanks","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":2650,"Q_Id":3966227,"Users Score":2,"Answer":"There are umpteen Python\/C++ bindings (including the one in Boost) but I suggest KISS: not a Python\/C++ binding but the principle \"Keep It Simple, Stupid\".\nUse a Python program to access the dictionary. :-)\nYou can access the Python program(s) from C++ by running them, or you can do more fancy things such as communicating between Python and C++ via sockets or e.g. Windows \"mailslots\" or even some more full-fledged interprocess communication scheme.\nCheers & hth.","Q_Score":0,"Tags":"c++,python,dictionary","A_Id":3966356,"CreationDate":"2010-10-19T07:47:00.000","Title":"Read python dictionary using c++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python dictionary stored in a file which I need to access from a c++ program. What is the best way of doing this?\nThanks","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2650,"Q_Id":3966227,"Users Score":0,"Answer":"I assume your Python dict is using simple data types and no objects (so strings\/numbers\/lists\/nested dicts), since you want to use it in C++.\nI would suggest using json library (http:\/\/docs.python.org\/library\/json.html) to deserialize it and then use a C++ equivalent to serialize it to a C++ object.","Q_Score":0,"Tags":"c++,python,dictionary","A_Id":3967560,"CreationDate":"2010-10-19T07:47:00.000","Title":"Read python dictionary using c++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"how can I set width to a tk.Frame (post-initialization ?)\nIn other words, is there a member function to do it ? Sometheing like frame.setWidth()\nthanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4026,"Q_Id":3968275,"Users Score":3,"Answer":"frame.config(width=100)\nBe aware that if there are children in the frame that are managed by grid or pack, your changes may have no effect. There are solutions to this, but it is rarely needed. Generally speaking you should let widgets be their natural size. If you do need to resize a frame that is a container of other widgets you need to turn \"geometry propagation\" off.","Q_Score":3,"Tags":"python,tkinter","A_Id":3968351,"CreationDate":"2010-10-19T12:26:00.000","Title":"TKinter: how to change Frame width dynamically","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In which kind of application is Tkinter usually used?\nI'm doing a project in Python in which I'm using it for the first time to build a simple user interface.\nI was wondering if this is widely used for specific applications, or mobile applications.. etc","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2320,"Q_Id":3970255,"Users Score":4,"Answer":"As far as I have seen, Tkinter is great for simple applications, teaching, or for when you don't need the features of a more comprehensive package like Qt or wxWidgets. These libraries can run several megabytes, and you may not need that. It's part of the standard library, so it's suited for this purpose. However, if you need more features, then Tkinter may not be the best choice.\nTkinter also used to look really ugly because it drew its own widgets on each platform; however, I think the version included with Python 2.7 uses native widgets now.\nI don't think there are any specific applications; it's a general purpose library.","Q_Score":6,"Tags":"python,tkinter","A_Id":3970297,"CreationDate":"2010-10-19T15:57:00.000","Title":"Is TkKinter widely used to build user interfaces?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In which kind of application is Tkinter usually used?\nI'm doing a project in Python in which I'm using it for the first time to build a simple user interface.\nI was wondering if this is widely used for specific applications, or mobile applications.. etc","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2320,"Q_Id":3970255,"Users Score":0,"Answer":"PyQt is a python binding of the popular Qt GUI toolkit. its very comprehensive.Anyway tkinter is good to start with and later you can move to PyQt or wxWidgets","Q_Score":6,"Tags":"python,tkinter","A_Id":3971297,"CreationDate":"2010-10-19T15:57:00.000","Title":"Is TkKinter widely used to build user interfaces?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Qt 4.7 and PyQt 4.7 to build a multi-threaded GUI program. I've been carefully managing PyQt objects so that they stay in one UI thread to avoid synchronization issues and there is no problem in general.\nBut sometimes, at the moment the python garbage collector is activated from other thread, the destructor of Qt object is called right there and the following assertion fails from inside Qt.\nI can define QT_NO_DEBUG even for the debug version and it should be fine because objects being collected hardly cause a synchronization problem. But still, I don't think that's a good idea to turn off other debug messages. How do I prevent this from happening?\n\n#if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD)\nvoid QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)\n{\n    QThread *currentThread = QThread::currentThread();\n    QThread *thr = receiver->thread();\n    Q_ASSERT_X(currentThread == thr || !thr,\n               \"QCoreApplication::sendEvent\",\n               QString::fromLatin1(\"Cannot send events to objects owned by a different thread. \"\n                                   \"Current thread %1. Receiver '%2' (of type '%3') was created in thread %4\")\n               .arg(QString::number((quintptr) currentThread, 16))\n               .arg(receiver->objectName())\n               .arg(QLatin1String(receiver->metaObject()->className()))\n               .arg(QString::number((quintptr) thr, 16))\n               .toLocal8Bit().data());\n    Q_UNUSED(currentThread);\n    Q_UNUSED(thr);\n}\n#elif defined(Q_OS_SYMBIAN) && defined (QT_NO_DEBUG)","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1981,"Q_Id":3975343,"Users Score":1,"Answer":"I would recommend using pyqtSignal. You can create signals for your threads to send when their task is completed and the receiver becomes the signal's connected function.","Q_Score":5,"Tags":"python,multithreading,qt,garbage-collection,pyqt","A_Id":4130841,"CreationDate":"2010-10-20T06:44:00.000","Title":"How to prevent PyQt objects from garbage collecting from different thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have just made a small little app of a Python wxPython script with py2app. Everything worked as advertised, but the app is pretty big in size. Is there any way to optimize py2app to make the app smaller in size?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2325,"Q_Id":3979658,"Users Score":1,"Answer":"py2app or any other such packager mostly bundles all dependencies and files together so that you could easily distribute them. The size is usually large as it bundles all dependencies , share libraries , packages along with your script file. In most cases, it will be difficult to reduce the size.\nHow ever, you can ensure the following so that there is lesser cruft in the bundled application.\n\nDo not use --no-strip option, this will ensure that debug symbols are stripped.\nUse \"--optimize 2 or -O2\" optimization option \nUse \"--strip (-S)\" option to strip debug and local symbols from output\nUse \"--debug-skip-macholib\", it will not make it truly stand alone but will reduce the size\nI am hoping that you have removed unnecessary files from wxPython like demo, doc etc.","Q_Score":1,"Tags":"python,optimization,wxpython,py2app","A_Id":3980702,"CreationDate":"2010-10-20T15:40:00.000","Title":"Slim down Python wxPython OS X app built with py2app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Well i want to input a python function as an input in run time and execute that part of code 'n' no of times. For example using tkinter i create a textbox where the user writes the  function and submits it , also mentioning how many times it wants to be executed. My program should be able to run that function as many times as mentioned by the user.\nPs: i did think of an alternative method where the user can write the program in a file and then i can simply execute it as python filename as a system cmd inside my python program , but i dont want it that way.","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":6779,"Q_Id":3981357,"Users Score":2,"Answer":"Python provides number of ways to do this using function calls:\n- eval()\n- exec()\nFor your needs you should read about exec.","Q_Score":1,"Tags":"python","A_Id":3981399,"CreationDate":"2010-10-20T19:02:00.000","Title":"how to input python code in run time and execute it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got class A wrapped with method foo implemented using %extend:\nclass A {\n  ...\n  %extend {\n  void foo()\n  {\n    self->foo_impl();\n  }\n  }\nNow I want to increase ref count to an A inside foo_impl, but I only got A* (as self). \nQuestion: how can I write\/wrap function foo, so that I have an access both to A* and underlying PyObject*?\nThank you","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":619,"Q_Id":4005355,"Users Score":1,"Answer":"I think it's not possible.  If you need to increase the refcount, it's because you don't want the C++ object to be destroyed when it goes out of scope because there is a pointer to that object elsewhere.  In that case, look at using the DISOWN typemap to ensure the target language doesn't think it \"owns\" the C++ object, so it won't get destroyed.","Q_Score":1,"Tags":"c++,python,swig","A_Id":4026127,"CreationDate":"2010-10-23T18:02:00.000","Title":"Python Swig wrapper: how access underlying PyObject","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Yes, that's what I need to achieve, don't ask why:)\nSo, since this is mainly OS dependent stuff I will be using Windows or Linux (whatever is simpler)\nEvery second my program will: \n1. do a screenshot, analyze the board and other stuff (this I can do)\n2. then move the mouse to some XY and do a left-click\nthat's all\nMy main concern is: is there any library for capturing screenshots and then left clicking somwhere on the screen?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":784,"Q_Id":4007847,"Users Score":1,"Answer":"You can try to use Selenium RC + python driver for Selenium. There are means of making browser screenshot, and there is ClickAt method which takes coordinates.","Q_Score":2,"Tags":"python,click,screenshot","A_Id":4007877,"CreationDate":"2010-10-24T10:22:00.000","Title":"python program that plays flash games for me","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Yes, that's what I need to achieve, don't ask why:)\nSo, since this is mainly OS dependent stuff I will be using Windows or Linux (whatever is simpler)\nEvery second my program will: \n1. do a screenshot, analyze the board and other stuff (this I can do)\n2. then move the mouse to some XY and do a left-click\nthat's all\nMy main concern is: is there any library for capturing screenshots and then left clicking somwhere on the screen?","AnswerCount":3,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":784,"Q_Id":4007847,"Users Score":3,"Answer":"I've done this very thing before - use PIL to get the screenshots, and pywinauto to generate the mouse clicks.","Q_Score":2,"Tags":"python,click,screenshot","A_Id":4700444,"CreationDate":"2010-10-24T10:22:00.000","Title":"python program that plays flash games for me","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using \"tkFileDialog.askopenfilename\" to get a file name variable. I know that I can set the \"initialdir\" option, but not everyone who uses the program will have the target file on the same drive. For example: the file could be located on the C:, D:, E: etc... I don't see a way to view available drives with the dialog box they have open up. I'd like the user to be able to type something like \"\/h\/cowsandstuff\" and have it navigate to that directory instead of locking them in. I am programming in a Linux environment, BTW. The analogous function in Windows that I would like is the \"My Computer\" option in the drop down menu which would list all available drives...","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1219,"Q_Id":4017129,"Users Score":2,"Answer":"Linux doesn't have those drive letters C:, D:, etc. In linux all filesystems of different drives are mounted on separate folders in the same tree structure, so you only have a single tree.\nMost distros use \/media to mount pendrives etc, but hard drives can be configured to mount on any folder. So there's no such thing as \"drive letter\" in linux, your question doesn't apply.","Q_Score":0,"Tags":"python,linux,tkinter,option","A_Id":4018335,"CreationDate":"2010-10-25T17:19:00.000","Title":"tkFileDialog.askopenfilename How to specify a different drive?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using \"tkFileDialog.askopenfilename\" to get a file name variable. I know that I can set the \"initialdir\" option, but not everyone who uses the program will have the target file on the same drive. For example: the file could be located on the C:, D:, E: etc... I don't see a way to view available drives with the dialog box they have open up. I'd like the user to be able to type something like \"\/h\/cowsandstuff\" and have it navigate to that directory instead of locking them in. I am programming in a Linux environment, BTW. The analogous function in Windows that I would like is the \"My Computer\" option in the drop down menu which would list all available drives...","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1219,"Q_Id":4017129,"Users Score":0,"Answer":"If you simply point to \"\/\" it contains all mounted devices...","Q_Score":0,"Tags":"python,linux,tkinter,option","A_Id":4028422,"CreationDate":"2010-10-25T17:19:00.000","Title":"tkFileDialog.askopenfilename How to specify a different drive?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using \"tkFileDialog.askopenfilename\" to get a file name variable. I know that I can set the \"initialdir\" option, but not everyone who uses the program will have the target file on the same drive. For example: the file could be located on the C:, D:, E: etc... I don't see a way to view available drives with the dialog box they have open up. I'd like the user to be able to type something like \"\/h\/cowsandstuff\" and have it navigate to that directory instead of locking them in. I am programming in a Linux environment, BTW. The analogous function in Windows that I would like is the \"My Computer\" option in the drop down menu which would list all available drives...","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1219,"Q_Id":4017129,"Users Score":1,"Answer":"As nosklo sais, in Linux you don't have drive letters. Everything are paths.\nIf the file can be in any path, I would expect that the user will known the path, but I would consider the next options:\n\nDefault to the user's home path. You\ncan directly use the \u00b4~\u00b4and tk will\nconvert it to the Linux home folder\nor the Windows User\/My Documents path\nRemember the last path so you can use\nit in the future.","Q_Score":0,"Tags":"python,linux,tkinter,option","A_Id":4028563,"CreationDate":"2010-10-25T17:19:00.000","Title":"tkFileDialog.askopenfilename How to specify a different drive?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a camera that is taking pictures one by one (about 10 pictures per second) and sending them to PC. I need to show this incoming sequence of images as a live video in PC.\nIs it enough just to use some Python GUI framework, create a control that will hold a single image and just change the image in the control very fast?\nOr would that be just lame? Should I use some sort of video streaming library? If yes, what do you recommend?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5351,"Q_Id":4019571,"Users Score":2,"Answer":"Or would that be just lame?\n\nNo.  It wouldn't work at all.\nThere's a trick to getting video to work.  Apple's QuickTime implements that trick.  So does a bunch of Microsoft product.  Plus some open source video playback tools.\nThere are several closely-related tricks, all of which are a huge pain in the neck.\n\nCompression.  Full-sized video is Huge.  Do the math 640x480x24-bit color at 30 frames per second.  It adds up quickly.  Without compression, you can't read it in fast enough.\nBuffering and Timing.  Sometimes the data rates and frame rates don't align well.  You need a buffer of ready-to-display frames and you need a deadly accurate clock to get them do display at exactly the right intervals.\n\nMaking a sequence of JPEG images into a movie is what iPhoto and iMovie are for.\nUsually, what we do is create the video file from the image and play the video file through a standard video player.  Making a QuickTime movie or Flash movie from images isn't that hard.  There are a lot of tools to help make movies from images.  Almost any photo management solution can create a slide show and save it as a movie in some standard format.\nIndeed, I think that Graphic Converter can do this.","Q_Score":3,"Tags":"python,video,video-streaming","A_Id":4020278,"CreationDate":"2010-10-25T23:04:00.000","Title":"The simplest video streaming?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using .kml file which points to an overlay image (presumably in UTM projection?). \nThe KML file provides the latitudes and longitudes of the bounding box using the \"LatLonBox\" tag. \nI need to calculate the latitudes and longitudes of each pixel in this image. \nAre there any pre-existing libraries in Python that would do this for me?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":744,"Q_Id":4019611,"Users Score":0,"Answer":"The overlay image referenced by the kml file was in standard geographic projection.\nThis means that the latitudes and longitudes vary linearly within the image. \nCalculating the latitude and longitude of each pixel became a trivial case of interpolation given that we already known the lat\/lon bounds of the image provided by the LatLonBox tag attributes.","Q_Score":0,"Tags":"python,geospatial,kml,latitude-longitude","A_Id":4026507,"CreationDate":"2010-10-25T23:11:00.000","Title":"How can I calculate the latitude and longitude of each pixel of an image in a kml file using Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QTableView which displays data from a QSqlTableModel. I want my model to check for changes when a user hits a \"refresh\" button but I can't find a way to update the data.\nI tried the reset() and update() methods on the model without any result.\nIs it possible to \"re-read\" from the database and update the model? How?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3260,"Q_Id":4022049,"Users Score":5,"Answer":"As you dont state what you canged in your model, ill assume the simplest form of change (changed data).\nFor me model.select() works to update the data in the model and force the View to update itself.","Q_Score":1,"Tags":"python,pyqt,qtableview","A_Id":4022111,"CreationDate":"2010-10-26T08:53:00.000","Title":"Force Update QTableView + QSqlTableModel in PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My needs :\n\nI need to develop an GUI application that is cross platform\nthe chosen solution must be the fastest to implement\nit should be easy to extend\n\nThe application is just a database front-end, mainly for CRUD operations, listing, filtering, exporting, charts and graphs etc.\nAfter reading about some solutions (Python Card, PyGUI, DABO, pygtkhelpers, kiwi, pyjamas, pure-mvc, PyQt\/PySide, Wax, Tk-based frameworks, AVC, Fox etc.), I found myself interrested in two particular solutions, one of them is Camelot.\nBefore jumping into it, I would like to have some opinions about Camelot users vs skeptics. \nThanks for sharing :)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":593,"Q_Id":4026026,"Users Score":0,"Answer":"In my opinion the best option for this would be to make a CGI program to run through a browser so that you do not have to worry about platform issues. Granted it might take a little bit more work, it may be better suited for cross platform deployment. :)","Q_Score":3,"Tags":"python,user-interface,sqlalchemy,cross-platform,python-elixir","A_Id":9863280,"CreationDate":"2010-10-26T17:02:00.000","Title":"Feedback for Camelot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My needs :\n\nI need to develop an GUI application that is cross platform\nthe chosen solution must be the fastest to implement\nit should be easy to extend\n\nThe application is just a database front-end, mainly for CRUD operations, listing, filtering, exporting, charts and graphs etc.\nAfter reading about some solutions (Python Card, PyGUI, DABO, pygtkhelpers, kiwi, pyjamas, pure-mvc, PyQt\/PySide, Wax, Tk-based frameworks, AVC, Fox etc.), I found myself interrested in two particular solutions, one of them is Camelot.\nBefore jumping into it, I would like to have some opinions about Camelot users vs skeptics. \nThanks for sharing :)","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":593,"Q_Id":4026026,"Users Score":1,"Answer":"Disclaimer: I am a Camelot committer.\nIf the question has been raised on the Programmers Stack Exchange, please link to it.\nThis question is kind of old, but for any reference, i'll chime in.\nCamelot was and is developed for exactly the reasons you stated. It has matured a lot since this questions was asked and is about feature complete. Latest efforts have been made to use Declarative instead of Elixir. Stability and speed are strongpoints as well.","Q_Score":3,"Tags":"python,user-interface,sqlalchemy,cross-platform,python-elixir","A_Id":14327581,"CreationDate":"2010-10-26T17:02:00.000","Title":"Feedback for Camelot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Tkinter GUI where there is a Scale object.  I have a callback assigned (by the command constructor parameter) to perform an action when the user changes the scale position.  However, there is also a case where the value represented by the scale is modified externally, and so I set the scale position using Scale.set().  In this case, I want to set the scale, but not trigger the callback, since the rest of the program already knows about the change.  However, I notice that the callback is indeed triggered by set().\nIs it possible to do one of:\n\nSet the scale value without triggering the callback.\nDifferentiate in the callback whether it was triggered by user interaction or by Scale.set() being called.\n\nThanks.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2247,"Q_Id":4038517,"Users Score":2,"Answer":"There is nothing specifically built-in to Tkinter to solve this. It's really a simple problem to solve though: remove the callback, set the value, add the callback. Or, set a global flag and check for that flag in the callback.\nThere are ways to solve the problem -- subclass the widget, for example -- but that doesn't really buy you anything. Just go with the simple solution and move on to more interesting problems.","Q_Score":4,"Tags":"python,tkinter","A_Id":4039444,"CreationDate":"2010-10-27T23:21:00.000","Title":"Tkinter: Set a 'scale' value without triggering callback?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a beginner in PyQt. I was trying to create a simple app to try some of the toolkit's many features. My question is, how can I hide the app icon from the taskbar? \nI don't want the user to be able to see the icon in taskbar and to minimize it using this icon. Is there any window flags that I can use to achieve this?","AnswerCount":6,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":7171,"Q_Id":4044994,"Users Score":0,"Answer":"Just initialise your main window like this self.setWindowFlags(Qt.ToolTip)","Q_Score":12,"Tags":"python,widget,pyqt4","A_Id":67350685,"CreationDate":"2010-10-28T16:24:00.000","Title":"Hide PyQt app from taskbar","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for a terminal UI library providing widgets like buttons, checkboxes and so on, that is compatible with python3.\nI've tried:\n\npycdk (pyrex does not work with python3, and porting it is a mess)\nurwid (does not work with python3, it has a port but not working well with new curses interface).\n\nDoes anyone know such a library?\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":537,"Q_Id":4045189,"Users Score":2,"Answer":"Cython supports Python 3, and I was able to make Cython accept the pyx file by changing all __new__ to __cinit__. \nNote that the examples still needs some porting to Python 3 at that point. I get \"TypeError: expected bytes, str found\" when trying to run the examples. Switching all the strings to bytes worked.\nPossibly it would be better if the API accepted strings under Python 3 too, but that is definitely more work.","Q_Score":2,"Tags":"user-interface,python-3.x,widget,ncurses","A_Id":4993662,"CreationDate":"2010-10-28T16:48:00.000","Title":"Is there a terminal widget library compatible with Python 3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running Python 3.1.2 with IDLE 3.1.2 on Windows 7. When I try to use the Stack Viewer, blue text and a new window briefly appear before all open IDLE windows exit (I don't have time to read the text or new window). This is the first time I have used Stack Viewer.\nIs this normal behavior? How can I get the Stack Viewer to stay open?\nThanks for your help,\nAlex","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":1247,"Q_Id":4046021,"Users Score":2,"Answer":"This IDLE bug (3 series only) was fixed 30Jan11.  The fix is in 3.1.4 and 3.2.","Q_Score":0,"Tags":"python,windows,windows-7,python-3.x,python-idle","A_Id":8859539,"CreationDate":"2010-10-28T18:27:00.000","Title":"(Python, IDLE, Windows) Pressing Stack Viewer exits all IDLE windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running Python 3.1.2 with IDLE 3.1.2 on Windows 7. When I try to use the Stack Viewer, blue text and a new window briefly appear before all open IDLE windows exit (I don't have time to read the text or new window). This is the first time I have used Stack Viewer.\nIs this normal behavior? How can I get the Stack Viewer to stay open?\nThanks for your help,\nAlex","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1247,"Q_Id":4046021,"Users Score":0,"Answer":"I don't have Windows so I can't help you with hands-on experience, but I would do the following:\n\nsee what is the exact command that runs when you click on the menu item for Idle (I think you can right-click and see its properties, or at least you could on earlier versions of Windows)\nopen a command prompt, and run the command that opens Idle\nopen the stack viewer and then note the traceback that (should!) appear in the command prompt window\nreport said traceback here :)\n\nBTW, in my installation (neither Windows nor Python 3.x), an attempt to open the stack viewer without a traceback produces the following message box:\n\nTitle: No stack trace\nMessage: There is no stack trace yet.\n(sys.last_traceback is not defined)","Q_Score":0,"Tags":"python,windows,windows-7,python-3.x,python-idle","A_Id":4047313,"CreationDate":"2010-10-28T18:27:00.000","Title":"(Python, IDLE, Windows) Pressing Stack Viewer exits all IDLE windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"so I've got this little Text widget with a scroll bar and I've got a question. How do I make text in this Text widget a variable ? If I made this text a variable I would be able to open a text file and edit it's text or save the text I've written, etc or maybe it's a wrong way that I'm approaching this, is there a better way to do this ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1548,"Q_Id":4055017,"Users Score":5,"Answer":"There is no option to associate a variable with a text widget. You can achieve the same thing by using variable traces and widget bindings but it's rarely worth the effort.\nThe typical way to interact with the text widget is to read a file into a variable then use the insert method of the widget to put the text into the widget. Then, to save you just do the reverse -- get the text from the widget with the get method, and write the data to a file.\nOne tip: when you do a get, don't get the text from 1.0 to \"end\", use \"end-1c\" instead. If you specify \"end\" as the last character you'll get the implicit newline that tk always adds, meaning your text file will grow by one character each time you do a load\/save cycle.","Q_Score":0,"Tags":"python,user-interface,tkinter","A_Id":4055447,"CreationDate":"2010-10-29T19:01:00.000","Title":"Text in Text Widget as a variable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Any suggestions on how one might create event bindings that would allow a user to mouse drag a window without borders, eg. a window created with overridedirect(1)?\nUse case: We would like to create a floating toolbar\/palette window (without borders) that our users can drag around on their desktop.\nHere's where I'm at in my thinking (pseudo code):\n\nwindow.bind( '<Button-1>', onMouseDown ) to capture the initial position of the mouse.\nwindow.bind( '<Motion-1>', onMouseMove ) to track position of mouse once it starts to move.\nCalculate how much mouse has moved and calculate newX, newY positions.\nUse window.geometry( '+%d+%d' % ( newX, newY ) ) to move window.\n\nDoes Tkinter expose enough functionality to allow me to implement the task at hand? Or are there easier\/higher-level ways to achieve what I want to do?","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":20122,"Q_Id":4055267,"Users Score":1,"Answer":"Try this, and it surely works;\n\nCreate an event function to move window:\ndef movewindow(event):\n        root.geometry('+{0}+{1}'.format(event.x_root, event.y_root))\nBind window:\nroot.bind('', movewindow)\n\nNow you can touch the the window and drag","Q_Score":17,"Tags":"python,windows,user-interface,window,tkinter","A_Id":41426823,"CreationDate":"2010-10-29T19:35:00.000","Title":"Tkinter: Mouse drag a window without borders, eg. overridedirect(1)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are Tkinter StringVar (IntVar, FloatVar, etc) thread safe, eg. can a background thread read or write to these objects? Or must I use a Queue to pass information between my background thread and my main Tkinter GUI thread and have my main Tkinter thread pop the Queue and update the application's StringVar's accordingly?\nI know my application's background threads must not read or write a Tkinter widget directly but I'm unclear on whether StringVar's (or their ilk) are considered widgets or if they are objects far enough removed from widgets that they are thread safe for background threads to read and\/or write.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1582,"Q_Id":4058878,"Users Score":0,"Answer":"Definitely go the Queue route. Nothing in Tkinter is setup for being threadsafe :(","Q_Score":3,"Tags":"python,multithreading,user-interface,tkinter","A_Id":5036358,"CreationDate":"2010-10-30T13:26:00.000","Title":"Python\/Tkinter: Are Tkinter StringVar (IntVar, etc) thread safe?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup.\nI searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET.\nI want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.).","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1297,"Q_Id":4059201,"Users Score":6,"Answer":"IronPython isn't a variant of Python, it is Python. It's an implementation of the Python language based on the .NET framework. So, yes, it is pure Python.\nIronPython is caught up to CPython (the implementation you're probably used to) 2.6, so some of the features\/changes seen in Python 2.7 or 3.x will not be present in IronPython. Also, the standard library is a bit different (but what you lose is replaced by all that .NET has to offer).\nThe primary application of IronPython is to script .NET applications written in C# etc., but it can also be used as a standalone. IronPython can also be used to write web applications using the SilverLight framework.\nIf you need access to .NET features, use IronPython. If you're just trying to make a Windows executable, use py2exe.\nUpdate\nFor writing basic RDBMS apps, just use CPython (original Python), it's more extensible and faster. Then, you can use a number of tools to make it stand alone on a Windows PC. For now, though, just worry about learning Python (those skills will mostly carry over to IronPython if you choose to switch) and writing your application.","Q_Score":4,"Tags":"python,wxpython,ironpython","A_Id":4059227,"CreationDate":"2010-10-30T14:49:00.000","Title":"Is IronPython a 100% pure Python variant?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup.\nI searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET.\nI want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.).","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":1297,"Q_Id":4059201,"Users Score":1,"Answer":"IronPython is an implementation of Python using C#. It's just like the implementation of Python using Java by Jython. You might want to note that IronPython and Jython will always lag behind a little bit in development. However, you do get the benefit of having some libraries that's not available in the standard Python libraries. In IronPython, you will be able to get access to some of the .NET stuff, like System.Drawings and such, though by using these non-standard libraries, it will be harder to port your code to other platforms. For example, you will have to install mono to run apps written in IronPython on Linux (On windows you will need the .NET Framework)","Q_Score":4,"Tags":"python,wxpython,ironpython","A_Id":4059540,"CreationDate":"2010-10-30T14:49:00.000","Title":"Is IronPython a 100% pure Python variant?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup.\nI searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET.\nI want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.).","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":1297,"Q_Id":4059201,"Users Score":1,"Answer":"what does \"Pure Python\" mean?  If you're talking about implemented in Python in the same sense that a module may be pure python, then no, and no Python implementation is.  If you mean \"Compatible with cPython\" then yes, code written to cPython will work in IronPython, with a few caveats.  The one that's likely to matter most is that the libraries are different, for instance code depending on ctypes or Tkinter won't work.  Another difference is that IronPython lags behind cPython by a bit.  the very latest version of this writing is 2.6.1, with an Alpha version supporting a few of the 2.7 language features available too.\nWhat do you really need?  If you want to learn to program with python, and also want to produce code for windows, you can use IronPython for that, but you can also use cPython and py2exe;  both will work equally well for this with only differences in the libraries.","Q_Score":4,"Tags":"python,wxpython,ironpython","A_Id":4059291,"CreationDate":"2010-10-30T14:49:00.000","Title":"Is IronPython a 100% pure Python variant?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm experimenting with PyQT, and I was trying to figure out how to get it to work with Firebird. I built the Firebird driver, but couldn't get it to work, so I was thinking maybe I wasn't putting it in the right place. So I tried experimenting with the SQLite driver, since PyQT came with it already installed, with working examples. I figured if I renamed all the qsqlite4.dll driver files I could find, eventually the example program would stop working when I renamed the one it was actually using. That didn't work. So I tried renaming the \"site-packages\\pyqt4\\plugins\\sqldrivers\" folder to \"site-packages\\pyqt4\\plugins\\sqldrivers-old\", and that did it. The example program stopped working. So I changed the folder name back, and tried renaming all the files in the folder. But the example program started working again. Then I moved the qsqlite4.dll file to a subdirectory, and it stopped working. So I moved it back, and renamed it to blah.blah.blah. And it worked again. Then I opened up blah.blah.blah with notepad++, and deleted some stuff at the top of the file, and that kept the example program from working. So I'm confused. As far as I can tell, either Python, PyQT, QT, or Windows Vista is finding the dll, no matter what I rename it to, as long as it's in the right folder. I even tried renaming it to the name of one of the other dll's, thinking maybe that would confuse it. But it only confused me. Is this normal?\nedit: I'm thinking this has something to do with plugins","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":284,"Q_Id":4068906,"Users Score":0,"Answer":"Yes, Qt plugin infrastructure is a fairly simple and robust one.\nIt attempts to load every file in sqldrivers directory. If it is successful, each dll then runs a function that registers all the features such a plugin supports.\nThen, you application initalizes. If all the features it needs are available, it works properly, otherwise, some form of error or exception handling occurs.","Q_Score":0,"Tags":"python,dll,windows-vista,qt4,pyqt4","A_Id":4453952,"CreationDate":"2010-11-01T12:37:00.000","Title":"Either Python, PyQT, QT, or Windows Vista is finding my dll, no matter what I rename it to. Is this normal?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups.\nWhat I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level.\nBut now, since we use the \"spriteGroup.draw(surface)\" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player\/enemy\/bullet\/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated.\nIs this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects.\nObviously the ideal method (I think) is to use Rects with \"real\" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT.\nAny comments\/insight would be appreciated.\nThanks","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1235,"Q_Id":4073928,"Users Score":0,"Answer":"You can have a 2 variables level_landlevel_d which see where you are in the level, Then check which sprites are in the visible area\nlevel_d+height and level_l+width,\n and draw them on the screen.","Q_Score":2,"Tags":"python,scroll,2d,pygame","A_Id":14293575,"CreationDate":"2010-11-01T23:21:00.000","Title":"Pygame: Updating Rects with scrolling levels","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups.\nWhat I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level.\nBut now, since we use the \"spriteGroup.draw(surface)\" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player\/enemy\/bullet\/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated.\nIs this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects.\nObviously the ideal method (I think) is to use Rects with \"real\" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT.\nAny comments\/insight would be appreciated.\nThanks","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1235,"Q_Id":4073928,"Users Score":0,"Answer":"One method I found is to keep track of a scrollx and a scrolly. Then, just add scrollx and scroll y to the coordinates when you move the rectangles.","Q_Score":2,"Tags":"python,scroll,2d,pygame","A_Id":14189213,"CreationDate":"2010-11-01T23:21:00.000","Title":"Pygame: Updating Rects with scrolling levels","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups.\nWhat I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level.\nBut now, since we use the \"spriteGroup.draw(surface)\" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player\/enemy\/bullet\/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated.\nIs this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects.\nObviously the ideal method (I think) is to use Rects with \"real\" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT.\nAny comments\/insight would be appreciated.\nThanks","AnswerCount":5,"Available Count":3,"Score":0.0399786803,"is_accepted":false,"ViewCount":1235,"Q_Id":4073928,"Users Score":1,"Answer":"You could extend de Sprite.Group so it recives the camera information.\nThen do one of these options:\nA. Override the update method so it updates the on-screen coordinates of every sprite.\nB. Override the draw method so it updates the on-screen coordinates of every sprite and then calls its parent draw method.\nI think A it's easier and cleaner.","Q_Score":2,"Tags":"python,scroll,2d,pygame","A_Id":4077600,"CreationDate":"2010-11-01T23:21:00.000","Title":"Pygame: Updating Rects with scrolling levels","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.)\nHow can I do this? I see that the winsound module is not available on Jython.\n(Note that I want to use the sound card, not the built-in beeper.)","AnswerCount":6,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":2323,"Q_Id":4078734,"Users Score":4,"Answer":"If its Jython, then just use any of the Java classes that play sound. There are tons of them. \n\nfrom java import net\nfrom java.applet.Applet import newAudioClip\nfrom java import io\nurl = io.File(\"fileName\").toURL()\naudio = newAudioClip(url)\naudio.play()\n\n\nimport sun.audio\nimport java.io\ninputStream = java.io.FileInputStream(\"test.wav\")\naudioStream = sun.audio.AudioStream(inputStream)\nsun.audio.AudioPlayer.player.start(audioStream)","Q_Score":7,"Tags":"python,windows,audio,jython,sikuli","A_Id":4079110,"CreationDate":"2010-11-02T14:38:00.000","Title":"Jython: Making a simple beep on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.)\nHow can I do this? I see that the winsound module is not available on Jython.\n(Note that I want to use the sound card, not the built-in beeper.)","AnswerCount":6,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":2323,"Q_Id":4078734,"Users Score":0,"Answer":"Since you are using Sikuli you can to the following.\nAdd any mediafile such as any .mp3 on the desktop of a windows machine, asociate the file to a media player.  Capture the image and include:\nclick(pattern(desktopnoiseicon.png)\nalternatley you could execute the same task with openApp(C:\\noise.mp3)\nSikuli gives the ability to find numerous workarounds\nin SikuluXrc2 you could even point to a URL from your code without the need of setting a bundle path","Q_Score":7,"Tags":"python,windows,audio,jython,sikuli","A_Id":4987576,"CreationDate":"2010-11-02T14:38:00.000","Title":"Jython: Making a simple beep on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.)\nHow can I do this? I see that the winsound module is not available on Jython.\n(Note that I want to use the sound card, not the built-in beeper.)","AnswerCount":6,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":2323,"Q_Id":4078734,"Users Score":2,"Answer":"You may do the fllowing using command  line:\nExecute \"copy con beep.txt\"\ntype [ctrl+G] as input and then [ctrl+Z] followed by [Enter] to exit\nThen run\n\"type beep.txt\"\nand you will hear a beep.\nYou may place \"type beep.txt\" in a batch file or use Ctrl+G directly in batch (which would produce error in command line with sound)","Q_Score":7,"Tags":"python,windows,audio,jython,sikuli","A_Id":5165371,"CreationDate":"2010-11-02T14:38:00.000","Title":"Jython: Making a simple beep on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a good wxpython GUI builder that does not require much coding, like in the case of the form builder in MS visual studio ?","AnswerCount":5,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":46286,"Q_Id":4079866,"Users Score":5,"Answer":"In addition to those, some people really like the XRCed application that's included with wxPython. Basically you create your GUI in XML. There's also the defunct Boa Constructor that I see people still using on the wxPython user's list.","Q_Score":29,"Tags":"python,wxpython,gui-builder","A_Id":4080817,"CreationDate":"2010-11-02T16:33:00.000","Title":"A good wxpython GUI builder?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a good wxpython GUI builder that does not require much coding, like in the case of the form builder in MS visual studio ?","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":46286,"Q_Id":4079866,"Users Score":0,"Answer":"You can use ezWxPython. it is not gui builder, but it helps you make layout easy same way as pySimpleGUI.","Q_Score":29,"Tags":"python,wxpython,gui-builder","A_Id":55686053,"CreationDate":"2010-11-02T16:33:00.000","Title":"A good wxpython GUI builder?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want basically to be able to use a Canvas as a meta container for other widgets. \nI want to divide my GUI into a left, center and middle section. Within each section I would like to be able to place widgets like: Checkbutton, Button, Label, etc. \nHow to place widgets in a Canvas widget?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4505,"Q_Id":4080413,"Users Score":6,"Answer":"Your choices depend on what you're really trying to accomplish. Why is using a canvas preferable to using a frame?\nYou can easily add widgets to a canvas just like you do any other container, using pack or grid or place. when you do this, the items will not scroll when you scroll the canvas because they aren't actually part of the canvas.\nThe other choice is to create window objects on the canvas. You do this with the create_window method of the canvas. The advantage is, this window becomes part of the canvas and will scroll along with any other objects on the canvas. The downside is, your only option is absolute placement and you have to explicitly control the size of the widgets.","Q_Score":4,"Tags":"python,python-3.x,widget,tkinter-canvas","A_Id":4080471,"CreationDate":"2010-11-02T17:30:00.000","Title":"How to place a widget in a Canvas widget in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Problem: I have a gtk.Dialog. Whenever the 'minimize' button on the dialog is clicked, the window is destroyed.\nQuestion: How can I connect to the minimize button of a gtk.Dialog so that I can iconify the window?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":129,"Q_Id":4081020,"Users Score":0,"Answer":"Are you sure it's the minimize button? Because GTK doesn't deal with (or even know about the existence of) minimize buttons at all, they are part of the window manager.","Q_Score":0,"Tags":"python,user-interface,gtk,pygtk","A_Id":4085525,"CreationDate":"2010-11-02T18:40:00.000","Title":"Problems Connecting to Minimized Signal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does Tkinter provide a way to temporarily turn off screen updates (when performing a large amount of screen activity) and then turn on screen updates when the UI updates are complete? Many GUI frameworks have this feature. wxPython provides Freeze and Thaw methods for this functionality. The Windows Win32api supports this as well via LockWindowUpdate( hWnd | 0 ). Googling on \"tkinter freeze thaw\" and \"tkinter lockwindowupdate\" came up emtpy.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":968,"Q_Id":4088996,"Users Score":1,"Answer":"No, Tkinter has no such thing. However, the screen is only updated via the event loop, so if all of your \"large amount of screen activity\" is happening in a single method, none of the activity will show up until your method finishes and the event loop is re-entered (or you explicitly call .update_idletasks())","Q_Score":1,"Tags":"python,user-interface,tkinter,pywin32,win32ole","A_Id":4091168,"CreationDate":"2010-11-03T16:01:00.000","Title":"Python\/Tkinter: Turn on\/off screen updates like wxPython Freeze\/Thaw?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"im using wxpython 2.8 ansi with python 2.6 ,and richtext class seems to not exist as an error message prompts that wx module does not contain richtext attribute, i've searched the web but couldn't find a clear answer,therefore i come to you:)\nany thoughts?\nthanks in advance\nNataly","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":427,"Q_Id":4092333,"Users Score":1,"Answer":"You access the rich text control like this: import wx.richtext\nOr you pass the wx.TextCtrl the wx.TE_RICH or wx.TE_RICH2 flag. I've heard that the richtext widget isn't available on *nix though. Did you try the wxPython Demo? That's usually the best place to look to find out how to use a widget.","Q_Score":0,"Tags":"python,wxpython","A_Id":4101577,"CreationDate":"2010-11-03T22:46:00.000","Title":"Is wx.richtext supported in wxpython 2.8?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"im using wxpython 2.8 ansi with python 2.6 ,and richtext class seems to not exist as an error message prompts that wx module does not contain richtext attribute, i've searched the web but couldn't find a clear answer,therefore i come to you:)\nany thoughts?\nthanks in advance\nNataly","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":427,"Q_Id":4092333,"Users Score":1,"Answer":"I just downloaded and installed version 2.8.11-ansi. RichTextControl is the first demo listed, and works fine.\nIt sounds like there is something messed up with your installation.\nUnless you have to support windows 98\/ME, I don't know any good reason to prefer the ansi version over unicode.\nCan you provide the exact text of the error message, and a listing of your site-packages, and the contents of wx.pth","Q_Score":0,"Tags":"python,wxpython","A_Id":4093711,"CreationDate":"2010-11-03T22:46:00.000","Title":"Is wx.richtext supported in wxpython 2.8?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a file dialog that allows the user to save a file after editing it in my app. I want to add a checkbox to the dialog so the user can make some choices about what format the file is saved in. I think I need to make some new class that inherits from FileDialog and inserts a checkbox into the frame created by the filedialog, but I don't really know how to do that. Can anyone help me out?\n(I also want to create an analogous file dialog for opening a file, but I assume that will just mean replacing the SAVE style with the OPEN style.)","AnswerCount":4,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":2300,"Q_Id":4093819,"Users Score":2,"Answer":"In wxWidgets 2.9 custom controls can be added to file dialogs using wxFileDialog::SetExtraControlCreator(). It's implemented for GTK, MSW and generic dialogs.\nAlternatively, you may use the wxFileCtrl class. It has native implementation only in wxGTK.\nI don't know if these features is available from Python wrappers, though.","Q_Score":2,"Tags":"wxpython,wxwidgets,openfiledialog,savefiledialog,filedialog","A_Id":5943314,"CreationDate":"2010-11-04T04:07:00.000","Title":"How do I add widgets to a file dialog in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a file dialog that allows the user to save a file after editing it in my app. I want to add a checkbox to the dialog so the user can make some choices about what format the file is saved in. I think I need to make some new class that inherits from FileDialog and inserts a checkbox into the frame created by the filedialog, but I don't really know how to do that. Can anyone help me out?\n(I also want to create an analogous file dialog for opening a file, but I assume that will just mean replacing the SAVE style with the OPEN style.)","AnswerCount":4,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":2300,"Q_Id":4093819,"Users Score":2,"Answer":"I have to disagree with the sentiment that you should use standard dialogs only how they were designed.\nI take another view and would rather look at using subclassing the way that subclassing was intended.  And to me, it is to add additional functionality\/specialization to a class.\nSo it is not changing the behavior of the standard dialog.  It is creating a new dialog BASED ON the standard dialog with a little additional functionality.\nIn my case, I want to add two buttons to the wx.MultiChoiceDialog to provide a Select All and\/or Unselect All functions.","Q_Score":2,"Tags":"wxpython,wxwidgets,openfiledialog,savefiledialog,filedialog","A_Id":12428450,"CreationDate":"2010-11-04T04:07:00.000","Title":"How do I add widgets to a file dialog in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"there are some people? \ni have some question about wxpython ,\ncan i use panel without a frame?","AnswerCount":2,"Available Count":1,"Score":0.4621171573,"is_accepted":false,"ViewCount":588,"Q_Id":4096417,"Users Score":5,"Answer":"The simple answer is \"no\". The panel is not a TopLevelWindow. Top level windows are Frames and Windows. Panels typically go in Frames, although you can nest panels in panels or frames. Telling us what to do, as Ryan suggested, would be the best way to get a good answer though.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":4101554,"CreationDate":"2010-11-04T12:02:00.000","Title":"can i use panel without a frame in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am loading an IronPython script from a database and executing it.  This works fine for simple scripts, but imports are a problem.  How can I intercept these import calls and then load the appropriate scripts from the database?\nEDIT:  My main application is written in C# and I'd like to intercept the calls on the C# side without editing the Python scripts.\nEDIT: From the research I've done, it looks like creating your own PlatformAdaptationLayer is the way you're supposed to to implement this, but it doesn't work in this case.  I've created my own PAL and in my testing, my FileExsists method gets called for every import in the script.  But for some reason it never calls any overload of the OpenInputFileStream method.  Digging through the IronPython source, once FileExists returns true, it tries to locate the file itself on the path.  So this looks like a dead end.","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":2738,"Q_Id":4105804,"Users Score":1,"Answer":"You can re-direct all I\/O to the database using the PlatformAdaptationLayer.  To do this you'll need to implement a ScriptHost which provides the PAL.  Then when you create the ScriptRuntime you set the HostType to your host type and it'll be used for the runtime.  On the PAL you then override OpenInputFileStream and return a stream object which has the content from the database (you could just use a MemoryStream here after reading from the DB).  \nIf you want to still provide access to file I\/O you can always fall back to FileStream's for \"files\" you can't find.","Q_Score":9,"Tags":"import,ironpython","A_Id":4111764,"CreationDate":"2010-11-05T12:25:00.000","Title":"Custom IronPython import resolution","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for suggestions on how one might implement a toolbar that provides edit cut, copy, paste commands using the Tkinter framework. I understand how to build a toolbar and bind the toolbar commands, but I'm confused over how the toolbar button bound commands will know which widget to apply the cut, copy, or paste action because the widget with edit activity will lose focus when the toolbar button is clicked. My first thought was to have each widget with potential edit activity set a global variable when the widget gains focus and have other widgets (without edit activity, eg. buttons, sliders, checkbox\/radiobox, etc) clear this global variable. But this sounds complicated to maintain unless I build a framework of widgets that inherit this behavior.\nIs there a simpler way to go about this or am I on the right track?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":1053,"Q_Id":4111049,"Users Score":2,"Answer":"You don't have to maintain a big framework, you can create a single binding on the root widget for <FocusIn> and put all the logic in that binding. Or, use focus_class and bind to the class all. \nBinding on the root will only affect children of the root, binding to all will affect all widgets in the entire app.  That only matters if you have more than one toplevel widget.","Q_Score":0,"Tags":"python,tkinter,clipboard,toolbar","A_Id":4111218,"CreationDate":"2010-11-05T23:48:00.000","Title":"Python\/Tkinter: Building a toolbar that provides edit cut, copy, paste commands","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for suggestions on how one might implement a toolbar that provides edit cut, copy, paste commands using the Tkinter framework. I understand how to build a toolbar and bind the toolbar commands, but I'm confused over how the toolbar button bound commands will know which widget to apply the cut, copy, or paste action because the widget with edit activity will lose focus when the toolbar button is clicked. My first thought was to have each widget with potential edit activity set a global variable when the widget gains focus and have other widgets (without edit activity, eg. buttons, sliders, checkbox\/radiobox, etc) clear this global variable. But this sounds complicated to maintain unless I build a framework of widgets that inherit this behavior.\nIs there a simpler way to go about this or am I on the right track?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1053,"Q_Id":4111049,"Users Score":1,"Answer":"You can tell the toolbar buttons to not take the focus; it's a configuration option and no UI guidelines I've ever seen have had toolbar buttons with focus. (Instead, the functionality is always available through some other keyboard-activatable mechanism, e.g., a hotkey combo.)","Q_Score":0,"Tags":"python,tkinter,clipboard,toolbar","A_Id":4111334,"CreationDate":"2010-11-05T23:48:00.000","Title":"Python\/Tkinter: Building a toolbar that provides edit cut, copy, paste commands","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a complicated algorithm that updates 3 histograms that are stored in arrays.  I want to debug my algorithm, so I was thinking of showing the arrays as histograms in a user interface.  What is the easiest way to do this.  (Rapid application development is more important than optimized code.)\nI have some experience with Qt (in C++) and some experience with matplotlib.\n(I'm going to leave this question open for a day or two because it's hard for me to evaluate the solutions without a lot more experience that I don't have.  Hopefully, the community's votes will help choose the best answer.)","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":37324,"Q_Id":4129697,"Users Score":1,"Answer":"I recommend using matplotlib in interactive mode, if you call .show once then it will pop up in its own window, if you don't then it exists only in memory and can be written to a file when you're done with it.","Q_Score":20,"Tags":"python,matplotlib,pyqt,vispy","A_Id":4129787,"CreationDate":"2010-11-09T01:28:00.000","Title":"How do I display real-time graphs in a simple UI for a python program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm studying the Tkinter Listbox widget and have been unable to find solutions for the following functionality:\n\nHow can I create non-selectable horizontal separator items, eg. separators equivalent to the Tkinter Menu widget's .add_separator()? (Using chars like dashes and underscores looks awful).\n\nHow can I disable a specific item? I tried using .itemconfig( index, state='disabled' ) without success.\n\nHow can I enable keyboard navigation, eg. when a user's keyboard input automatically scrolls one forward to the closest item that begins with the text the user typed? Must I bind(<KeyPress>, ...) and manage this behavior myself?\n\nWould some of the above functionality be easier to implement using a Text widget or the ttk.Treeview widget?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2343,"Q_Id":4140396,"Users Score":5,"Answer":"you cannot. The widget doesn't support that.\nyou can't disable certain items, the widget doesn't support a state attribute. That being said, you can monitor the selection and do the appropriate thing if the user selects something that is disabled, and use the item foreground to denote disabled-ness.\nYou will need to bind to keypress events and manage the behavior yourself. It's not particularly difficult, just a little tedious.\nthe text widget might be your best bet, though you'll have to add bindings to mimic the default bindings of the listbox. \n\nBottom line: Tkinter provides nothing that directly supports what you want to do, but the building blocks are all there. You'll just have to build it yourself.","Q_Score":4,"Tags":"python,user-interface,listbox,tkinter,ttk","A_Id":4141054,"CreationDate":"2010-11-10T01:15:00.000","Title":"Tkinter: Listbox separators, disabled items, keyboard navigation?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have projects in C++, Java and Python. Projects in C++ export SWIG interfaces so they can be used by Java and Python projects.\nMy question is: what building mechanism can I use to manage dependencies and build these projects?\nI have used SCons and GYP. They are fairly easy to use and allow plugins (code-generators, compilers, packers). I'd like to know whether there are alternatives, in particular with native support for C++, Java and Python.\nI develop in Linux platform, but I'd like to be able to build in mac and win platforms as well.","AnswerCount":5,"Available Count":4,"Score":0.1586485043,"is_accepted":false,"ViewCount":2318,"Q_Id":4141511,"Users Score":4,"Answer":"I tried to do a Java \/ C++ \/ C++ To Java swig \/ (+ Protocol buffers) project in CMAKE and it was horrible! In such a case the problem with Cmake is, that the scripting language is extremely limited. I switched to Scons and everything got much easier.","Q_Score":6,"Tags":"java,c++,python,scons,gyp","A_Id":7201456,"CreationDate":"2010-11-10T05:32:00.000","Title":"What are the SCons alternatives?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have projects in C++, Java and Python. Projects in C++ export SWIG interfaces so they can be used by Java and Python projects.\nMy question is: what building mechanism can I use to manage dependencies and build these projects?\nI have used SCons and GYP. They are fairly easy to use and allow plugins (code-generators, compilers, packers). I'd like to know whether there are alternatives, in particular with native support for C++, Java and Python.\nI develop in Linux platform, but I'd like to be able to build in mac and win platforms as well.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":2318,"Q_Id":4141511,"Users Score":1,"Answer":"For Java and C++ projects you can take a look into Maven + Maven-nar-plugin but for Python i really don't know the best. May be other tools like CMake would fit better.","Q_Score":6,"Tags":"java,c++,python,scons,gyp","A_Id":4142509,"CreationDate":"2010-11-10T05:32:00.000","Title":"What are the SCons alternatives?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have projects in C++, Java and Python. Projects in C++ export SWIG interfaces so they can be used by Java and Python projects.\nMy question is: what building mechanism can I use to manage dependencies and build these projects?\nI have used SCons and GYP. They are fairly easy to use and allow plugins (code-generators, compilers, packers). I'd like to know whether there are alternatives, in particular with native support for C++, Java and Python.\nI develop in Linux platform, but I'd like to be able to build in mac and win platforms as well.","AnswerCount":5,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":2318,"Q_Id":4141511,"Users Score":9,"Answer":"CMake\nI use and prefer it for my projects.\nThere's also Rake (comes with Ruby, but can be used for anything), which I regard rather highly.","Q_Score":6,"Tags":"java,c++,python,scons,gyp","A_Id":4141589,"CreationDate":"2010-11-10T05:32:00.000","Title":"What are the SCons alternatives?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have projects in C++, Java and Python. Projects in C++ export SWIG interfaces so they can be used by Java and Python projects.\nMy question is: what building mechanism can I use to manage dependencies and build these projects?\nI have used SCons and GYP. They are fairly easy to use and allow plugins (code-generators, compilers, packers). I'd like to know whether there are alternatives, in particular with native support for C++, Java and Python.\nI develop in Linux platform, but I'd like to be able to build in mac and win platforms as well.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":2318,"Q_Id":4141511,"Users Score":1,"Answer":"In Java world ant is \"lingua franca\" for build systems.\nAnt supports a C++ task via ant-contrib - so you can compile your C++ code.\nWith Ant's exec task you can still run swig on C++ code in order to get the wrappers.\nThen standard tasks as javac\/jar can be used for java application build.","Q_Score":6,"Tags":"java,c++,python,scons,gyp","A_Id":4143403,"CreationDate":"2010-11-10T05:32:00.000","Title":"What are the SCons alternatives?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'd like to develop a small\/medium-size cross-platform application (including GUI).\nMy background: mostly web applications with MVC architectures, both Python (Pylons + SqlAlchemy) and Java (know the language well, but don't like it that much). I also know some C#. So far, I have no GUI programming experience (neither Windows Forms, Swing nor QT).\nI plan to use SQLite for data storage: It seems to be a nice cross-platform solution and has some powerful features (e.g. full text search, which SQL Server Compact lacks).\nI have done some research and these are my favorite options:\n\n\n1) QT, Python (PyQT or PySide), and SQLAlchemy\npros:\n\nPython the language\nopen source is strong in the Python world (lots of libraries and users)\nSQLAlchemy: A fantastic way to interact with a DB and incredibly well documented!\n\ncons:\n\ncompilation, distribution and deployment more difficult?\nno QT experience\nQT Designer not as nice as the Visual Studio Winforms designer\n\n\n\n2) .NET\/Mono, Windows Forms, C#, (Fluent) NHibernate, System.Data.SQLite\npros:\n\nC# (I like it, especially compared to Java and would like to get more experience in it)\nThe Winforms GUI designer in Visual Studio seems really slick\nIntelliSense\nClickOnce Deployment(?)\nWindows Forms look and feel good on Windows\n\ncons:\n\n(Fluent) NHibernate far less documented than SQLAlchemy; also annoying: Fluent docs refer to NHibernate docs which refer to Hibernate (aargh!). But plain NHibernate + XML does not look very comfortable.\nWindows Forms will not look + behave native on Linux\/Mac OS (correct?)\nfewer open source libraries in the .NET world, fewer OSS users, less documentation in general\nno WinForms and NHibernate experience\n\n\n\n3) JVM, Java + Jython, Swing, SQLAlchemy\n(I'm emotionally biased against this one, but listed for completeness sake)\npros:\n\nJVM\/Swing work well as cross-platform basis\nJython\nSQLAlchemy\nlots of open source libraries\n\ncons:\n\nSwing seems ugly and difficult to layout\nlacks a good GUI designer\nGuessing that I won't be able to avoid Java for UI stuff\nNot sure how stable the Jython\/Java integration is\n\n(Options that I have ruled out... just to avoid discussion on these):\n- wxWidgets\/wxPython (now that QT is LGPLed)\n- GTK\/PyGTK\nThe look and feel of the final application is very important to me. The above technology stacks are very different (PyQT, .NET WinForms, JVM Swing) and require some time to get proficient, so:\nWhich alternative would you recommend and why?","AnswerCount":1,"Available Count":1,"Score":0.761594156,"is_accepted":false,"ViewCount":3111,"Q_Id":4145350,"Users Score":5,"Answer":"I'm a Python guy and use PyQt myself, and I can wholly recommend it. Concerning your cons:\n\ncompilation, distribution and deployment more difficult?\n\nNo, not really. For many projects, a full setup.py for e.g. cx_Freeze can be less than 30 lines that rarely need to change (most import dependencies are detected automatically, only need to specify the few modules that are not recognized), and then python setup.py will build a standalone executable. Then you can distribute it just like e.g. a C++ .exe.\n\nno QT experience\n\nI didn't have notable GUI experience either when I started out with Qt (only a bit of fiddling with Tkinter), but I grew to love Qt. Most of the time, all widgets work seamlessly and do what they're supposed to do - and there's a lot of them for many purposes. You name it, there's probably a widget that does it, and doesn't annoy the user by being half-assed. All the nice things we've been spoiled with are there.\nQt is huge, but the PyQt documentation answer most question with reasonable search effort. And if all else fails and you know a bit of C++, you can also look at Qt resources.\n\nQT Designer not as nice as the Visual Studio Winforms designer \n\nI don't know the VS Winforms designer, but I must admit that the Qt Designer is lacking. I ended up making a sketch of the UI in the designer, generating the code, cleaning that up and taking care all remaining details by hand. It works out okay so far, but my projects are rather small.\n\nPS:\n\n(now that QT is LGPLed)\n\nPyQt is still GPL only. PySide is LGPL, yes, but it's not that mature, if that's a concern. The project website states that \"starting development on PySide should be pretty safe now\" though.","Q_Score":11,"Tags":"c#,java,python,user-interface,cross-platform","A_Id":4145581,"CreationDate":"2010-11-10T14:11:00.000","Title":"Python + QT, Windows Forms or Swing for a cross-platform application?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to add undo and redo capabilities in Tkinter Entry widgets or must I use single line Text widgets for this type of functionality? \nIf the latter, are there any tips I should follow when configuring a Text widget to act as an Entry widget? \nSome features that might need tweaking include trapping the Return KeyPress, converting tab keypresses into a request to change focus, and removing newlines from text being pasted from the clipboard.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":4108,"Q_Id":4146971,"Users Score":1,"Answer":"Update on using this method for Undo\/Redo:\nI am creating a GUI with lot of frames and each contains at least ten or more 'entry' widgets. \nI used the History class and created one history object for each entry field that I had. I was able to store all entry widgets values in a list as done here. \nI am using 'trace' method attached to each entry widget which will call 'add' function of History class and store each changes. In this way, I was able to do it without running any thread separately. \nBut the biggest drawback of doing this is, we cannot do multiple undos\/redos with this method.\nIssue: \nWhen I trace each and every change of the entry widget and add that to the list, it also 'traces' the change that happens when we 'undo\/redo' which means we cannot go more one step back. once u do a undo, it is a change that will be traced and hence the 'undo' value will be added to the list at the end. Hence this is not the right method.\nSolution:\nPerfect way to do this is by creating two stacks for each entry widget. One for 'Undo' and one for 'redo'. When ever there is a change in entry, push that value into the undo stack. When user presses undo, pop the last stored value from the undo stack and importantly push this one to the 'redo stack'. hence, when the user presses redo, pop the last value from redo stack.","Q_Score":4,"Tags":"python,user-interface,text,tkinter,tkinter-entry","A_Id":32384249,"CreationDate":"2010-11-10T17:03:00.000","Title":"Undo and Redo in an Tkinter Entry widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project involving puzzles made out of user-supplied images. I have been very hard-pressed to find a library that will serve my purposes. I would like to write the program in either Python or C++. I have been considering using Qt (or PyQt) to do it, so if you know of a library that will work with Qt it would be nice, though at this point anything would be nice.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":174,"Q_Id":4151746,"Users Score":2,"Answer":"You can't expect to find a library for any specific task. In this case, you need image-processing library, which is able to:\n\ndraw image region with transparent background. You have piece configuration, use it as a mask to cut out edges.\nsave drawn image to some format.\n\nQt graphics is totally able to do all that.","Q_Score":1,"Tags":"c++,python,qt,image-processing,pyqt","A_Id":4154281,"CreationDate":"2010-11-11T05:57:00.000","Title":"Anyone know of a C++ or Python library that will divide an image into pieces of arbitrary shape?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am wondering, is it possible to display images in python?","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":12412,"Q_Id":4160082,"Users Score":0,"Answer":"The easiest way is to use a web server I reckon. You can script a nice, simple server with bottle and turn out a UI with images.\nIt depends what you want to do. Python can do it all, but needs something to work with. There's pygame and stuff like that if you're just starting out.","Q_Score":3,"Tags":"python,image","A_Id":14884366,"CreationDate":"2010-11-11T22:54:00.000","Title":"How do you show a picture in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am wondering, is it possible to display images in python?","AnswerCount":6,"Available Count":4,"Score":0.0333209931,"is_accepted":false,"ViewCount":12412,"Q_Id":4160082,"Users Score":1,"Answer":"The question needs more clearing up. \nDo you want to put the picture on a system display?\nOr on a window in a desktop app?\nOr render it to a http response?\nPython can do all these things in different manners, but for people to explain it - you need to specify your question a bit more.","Q_Score":3,"Tags":"python,image","A_Id":4160323,"CreationDate":"2010-11-11T22:54:00.000","Title":"How do you show a picture in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am wondering, is it possible to display images in python?","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":12412,"Q_Id":4160082,"Users Score":0,"Answer":"The various OpenCV bindings for Python also provide ways to display images (and videos). Might be a bit heavy if you just want to display an image.","Q_Score":3,"Tags":"python,image","A_Id":4160130,"CreationDate":"2010-11-11T22:54:00.000","Title":"How do you show a picture in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am wondering, is it possible to display images in python?","AnswerCount":6,"Available Count":4,"Score":0.1651404129,"is_accepted":false,"ViewCount":12412,"Q_Id":4160082,"Users Score":5,"Answer":"Almost all GUI toolkits (wxWindows, pyQt, pyGTK, Tkinter) have Canvas or other-type widgets that allow you to draw an image.\nThe standard library way to draw an image is to use Tkinter's Canvas widget.","Q_Score":3,"Tags":"python,image","A_Id":4160121,"CreationDate":"2010-11-11T22:54:00.000","Title":"How do you show a picture in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does Tkinter or underlying Tk framework support the ability to apply the equivalent of the attributes() method to Frames vs. Windows?\nSpecifically: I have forms with a message area that I would like to fade away in jquery-like manner, eg. display a non-modal status message that fades away. I know I can fade a Tkinter window via window.attributes(\"-alpha\", alpha), but I don't see an equivalent way to achieve this effect with a Frame. (I know I could place a top-level message window over my dialog, but coordinating the position and size of this window to match the layout of my dialog sounds complicated).","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":502,"Q_Id":4164962,"Users Score":0,"Answer":"No, there is no way to do what you want. Tkinter only supports transparency on top-level windows.","Q_Score":0,"Tags":"python,user-interface,tkinter","A_Id":7360992,"CreationDate":"2010-11-12T13:13:00.000","Title":"Python\/Tkinter: Apply .attributes() method to Frame vs. Window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I get a handle to the active gtk.Window in python? (not a window I created, but the currently focused window).","AnswerCount":2,"Available Count":1,"Score":0.4621171573,"is_accepted":false,"ViewCount":5129,"Q_Id":4166169,"Users Score":5,"Answer":"The answer is actually not OS-specific -- you can do it within GTK. You can get a list of all the toplevel windows from the application using gtk.window_list_toplevels(), then iterate through it until you find one where window.is_active() returns True.\nIf you want to consider other windows than the ones from your application, then you could try gtk.gdk.screen_get_default().get_toplevel_windows() but this will only get you GDK windows and not GTK windows, because you have no way of knowing whether those GDK windows are actually associated with GTK windows.","Q_Score":3,"Tags":"python,gtk","A_Id":4169956,"CreationDate":"2010-11-12T15:31:00.000","Title":"Get active gtk window in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i want to create application in windows. i need to use databases which would be preferable best for pyqt application\nlike\nsqlalchemy\nmysql\netc.","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":535,"Q_Id":4168020,"Users Score":0,"Answer":"i guess its totally upto you ..but as far as i am concerned i personlly use sqlite, becoz it is easy to use and amazingly simple syntax whereas for MYSQL u can use it for complex apps and has  options for performance tuning. but in end its totally upto u and wt your app requires","Q_Score":0,"Tags":"python,database,pyqt","A_Id":4208750,"CreationDate":"2010-11-12T18:49:00.000","Title":"which databases can be used better for pyqt application","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i want to create application in windows. i need to use databases which would be preferable best for pyqt application\nlike\nsqlalchemy\nmysql\netc.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":535,"Q_Id":4168020,"Users Score":1,"Answer":"SQlite is fine for a single user. \nIf you are going over a network to talk to a central database, then you need a database woith a decent Python lirary. \nTake a serious look at MySQL if you need\/want SQL. \nOtherwise, there is CouchDB in the Not SQL camp, which is great if you are storing documents, and can express searches as Map\/reduce functions. Poor for adhoc queries.","Q_Score":0,"Tags":"python,database,pyqt","A_Id":4294636,"CreationDate":"2010-11-12T18:49:00.000","Title":"which databases can be used better for pyqt application","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i want to create application in windows. i need to use databases which would be preferable best for pyqt application\nlike\nsqlalchemy\nmysql\netc.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":535,"Q_Id":4168020,"Users Score":1,"Answer":"If you want a relational database I'd recommend you to use SQLAlchemy, as you then get a choice as well as an ORM. Bu default go with SQLite, as per other recommendations here.\nIf you don't need a relational database, take a look at ZODB. It's an awesome Python-only object-oriented database.","Q_Score":0,"Tags":"python,database,pyqt","A_Id":4512428,"CreationDate":"2010-11-12T18:49:00.000","Title":"which databases can be used better for pyqt application","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've done a few searches but I couldn't find anything about this topic. Perhaps because it is common programmer knowledge (I'm not a programmer, I've learned from necessity), or because I'm going about it the wrong way. \nI would like ideas\/suggestions on how to manage button states for a GUI. For example, if I have a program which allows the user to import and process data, then certain functions should be inaccessible until the data has been imported successfully, or if they want to graph certain data, they need to select which data to graph before hitting the 'graph' or 'export' button. Even in the simple programs I've built these relationships seems to get complicated quickly. It seems simple to say \"User shouldn't be able to hit button 'A' until 'B' and 'C' have been completed, then 'A' should be disabled if button 'D' or the 'Cancel' button. But that's a lot to track for one button. Thus far, I've tried two things:\n\nChanging\/Checking button states in the callback functions for the button. So in the above example, I would have code in buttons B's and C's callback to check if A should be enabled. And in buttons D's and Cancel's callbacks I would have code to disable button A. This gets complicated quickly and is difficult to maintain as code changes.\nSetting boolean variables in every buttons callback (or just checking the states later using cget()) and checking the variables in a polling function to determine which buttons should be enabled or disabled.\n\nI'm just not sure about this. I would like to make code as short and easy to understand as possible (and easy to edit later), but I don't like the idea of polling all the button states every few hundred milliseconds just for button 'management'. You can extend the same idea to check boxes, menu items, etc... but I'd like to here what others have done and why they do it the way they do.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":851,"Q_Id":4172426,"Users Score":1,"Answer":"You are only changing button states based on events, right? There is no reason to 'poll' to see if a button state has changed.  What you can do is build a function which does all of the calling for you, then call it with something like disable_buttons([okButton, graphButton, printButton]). When an event takes place that modifies the appropriate user interface options (such as importing data), have another function that turns them on: enable_buttons([graphButton]).  You could do this with each object's methods, of course, but making a wrapper allows you to be consistent throughout your application.","Q_Score":0,"Tags":"python,button,tkinter,state","A_Id":4187733,"CreationDate":"2010-11-13T12:11:00.000","Title":"How to handle button states efficiently in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How practical would it be to use Cython as the primary programming language for a game?\nI am a experienced Python programmer and I absolutely love it, but I'm admittedly a novice when it comes to game programming specifically. I know that typically Python is considered too slow to do any serious game programming, which is why Cython is interesting to me. With Cython I can use a Python-like language with the speed of C.\nI understand that I'll probably need to learn a bit of C\/C++ anyway, but it seems like Cython would speed up development time quite a bit in comparison.\nSo, is it practical? And would I still be able to use C\/C++ libraries like OpenGL, OpenAL, and Bullet Physics?","AnswerCount":6,"Available Count":4,"Score":0.1651404129,"is_accepted":false,"ViewCount":9169,"Q_Id":4180836,"Users Score":5,"Answer":"I've found that a lot of the time, especially for larger libraries, you wind up spending a tremendous amount of time just configuring the Cython project to build, knowing which structures to import, bridging the C code into Python in either direction etc. While Cython is a nice stopgap (and significantly more pleasant than pure C\/C++ development), the amount of C++ you'd have to learn to effectively use it basically means you're going to have to bite the bullet and learn C++ anyway.\nHow about PyGame?","Q_Score":19,"Tags":"python,c,cython","A_Id":4180878,"CreationDate":"2010-11-15T01:46:00.000","Title":"Using Cython for game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How practical would it be to use Cython as the primary programming language for a game?\nI am a experienced Python programmer and I absolutely love it, but I'm admittedly a novice when it comes to game programming specifically. I know that typically Python is considered too slow to do any serious game programming, which is why Cython is interesting to me. With Cython I can use a Python-like language with the speed of C.\nI understand that I'll probably need to learn a bit of C\/C++ anyway, but it seems like Cython would speed up development time quite a bit in comparison.\nSo, is it practical? And would I still be able to use C\/C++ libraries like OpenGL, OpenAL, and Bullet Physics?","AnswerCount":6,"Available Count":4,"Score":-0.0333209931,"is_accepted":false,"ViewCount":9169,"Q_Id":4180836,"Users Score":-1,"Answer":"Threads!!! A good modern game must use threads. Cython practically forbids their use, holding to GIL (global interpreter lock) the entire time, making your code run in sequence.\nIf you are not writing a huge game, than Python\/Cython is okay. But Cython is no good as a modern language without good thread support.","Q_Score":19,"Tags":"python,c,cython","A_Id":4445486,"CreationDate":"2010-11-15T01:46:00.000","Title":"Using Cython for game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How practical would it be to use Cython as the primary programming language for a game?\nI am a experienced Python programmer and I absolutely love it, but I'm admittedly a novice when it comes to game programming specifically. I know that typically Python is considered too slow to do any serious game programming, which is why Cython is interesting to me. With Cython I can use a Python-like language with the speed of C.\nI understand that I'll probably need to learn a bit of C\/C++ anyway, but it seems like Cython would speed up development time quite a bit in comparison.\nSo, is it practical? And would I still be able to use C\/C++ libraries like OpenGL, OpenAL, and Bullet Physics?","AnswerCount":6,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":9169,"Q_Id":4180836,"Users Score":7,"Answer":"at this date (12th of April 2011) unixmab83 is wrong.\nCython doesn't forbid the use of threads, you just needs to use the no_gil special statements.\nBeside the bindins of c++ is now functional in cython. \nWe do use it for something which is close to gamedev. So while I cannot be final on this, cython is a valid candidate.","Q_Score":19,"Tags":"python,c,cython","A_Id":5638409,"CreationDate":"2010-11-15T01:46:00.000","Title":"Using Cython for game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How practical would it be to use Cython as the primary programming language for a game?\nI am a experienced Python programmer and I absolutely love it, but I'm admittedly a novice when it comes to game programming specifically. I know that typically Python is considered too slow to do any serious game programming, which is why Cython is interesting to me. With Cython I can use a Python-like language with the speed of C.\nI understand that I'll probably need to learn a bit of C\/C++ anyway, but it seems like Cython would speed up development time quite a bit in comparison.\nSo, is it practical? And would I still be able to use C\/C++ libraries like OpenGL, OpenAL, and Bullet Physics?","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":9169,"Q_Id":4180836,"Users Score":0,"Answer":"I know Cython and you do not have to know C\/C++.\nYou will use static typing but very easy.\nThe hardest part is to get the compiling working, I think on Windows this is done over visual studio thing.\nThere is something like a standard library including math for example. The speed gain is not too big but this depends on your scope.\nctypes was much faster (pure C) but the connection to Python was very slow so that i decided to look for Cython which can still be dynamic.\nFor speed gain in a game Cython will be the right choice but i would name this performance also limited.","Q_Score":19,"Tags":"python,c,cython","A_Id":17047294,"CreationDate":"2010-11-15T01:46:00.000","Title":"Using Cython for game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can I program for Android using Python? I seem to have stumbled upon many links while searching... however neither of them is concrete.\nAny suggestions? I want to write apps for Android but really don't want to get into Java for all this.\nPS: My question is whether I can write proper, full fledged apps for Android.","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":84928,"Q_Id":4185061,"Users Score":1,"Answer":"No, not currently. ASE (Android Scripting Environment) allows you to do simple script apps, but you can only write proper Android apps in Java.","Q_Score":112,"Tags":"python,android","A_Id":4185138,"CreationDate":"2010-11-15T14:03:00.000","Title":"Android Python Programming","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got an option menu that's about 60 items long and, needless to say, I can't see it all on the screen at once. Is there a way that I can make the OptionMenu widget in tkinter scrollable?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1975,"Q_Id":4186981,"Users Score":2,"Answer":"Short answer is no, but you could try a ComboBox mega-widget (quick search will throw some suitable examples up there) which could be a 'good enough' alternative (in fact with it being a combined entry field and scrolled list you could make it 'smart' by including auto-search \/ auto-complete - 60 items in a drop down is a lot :)","Q_Score":1,"Tags":"python,tkinter","A_Id":4194418,"CreationDate":"2010-11-15T17:13:00.000","Title":"Make OptionMenu Widget Scrollable?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I get an integer type from the Tkinter Entry widget?\nIf I try to get the value using variable_name.get(), it says it is a str. If I try to change the type using int(variable_name.get()), it says int can only accept a string or number.\nAny help would be welcome!","AnswerCount":6,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":34695,"Q_Id":4199278,"Users Score":4,"Answer":"In the end I just initialized the variable as tk.IntVar() instead of tk.StringVar()\nThat way you don't have to cast it as an int, it will always be one, and the default value from the Entry element will now be 0 instead of ''\nThat's how I approached it anyway, seems the simplest way and avoid the need for a lot of the validation you'd need to do otherwise...","Q_Score":5,"Tags":"python,tkinter","A_Id":22458776,"CreationDate":"2010-11-16T21:41:00.000","Title":"Get an Integer from Entry","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Like the subject says: Does the latest stable pygame release work with python2.7?\nI've got both versions installed on my OSX Snow Leopard, but import pygame only works on python2.6 - That's the official distro which is 2.6.6, not the pre-installed one which is 2.6.1).\nAnd if it does work, how can I make it work on my machine? What am I doing wrong?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":324,"Q_Id":4200644,"Users Score":0,"Answer":"My guess is that you installed it for 2.6 and so it is residing in 2.6's library directory. Install it in 2.7's library directory and you should be good to go. I don't know OSX so I can't help with the details but a little bit of googling shouldn't be too hard. The problem is that the two python installations have distinct import paths.","Q_Score":0,"Tags":"python,macos,pygame","A_Id":4200863,"CreationDate":"2010-11-17T01:10:00.000","Title":"Does the latest stable pygame release work with python2.7?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a Python GUI library that I can rewrite the rendering \/ drawing.\nIt has to support basic widgets (buttons, combo boxes, list boxes, text editors, scrolls,), layout management, event handling\nThe thing that I am looking for is to use my custom Direct3D and OpenGL renderer for all of the GUI's drawing \/ rendering.\nedit suggested by S.Lott: I need to use this GUI for a 3D editor, since I have to drag and drop a lot of things from the GUI elements to the 3d render area, I wanted to use a GUI system that renders with Direct3D (preffered) or OpenGL. It also has to have a nice look. It is difficult to achieve this with GUI's like WPF, since WPF does not have a handle. Also it needs to be absolutly free for commercial use.\nedit: I would also like to use the rendering context I initialized for the 3d part in my application","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":2152,"Q_Id":4203614,"Users Score":1,"Answer":"You can use Qt Scene Framework with OpenGL rendering. There are many examples on Nokia site.","Q_Score":8,"Tags":"python,user-interface,opengl,directx","A_Id":4250496,"CreationDate":"2010-11-17T10:51:00.000","Title":"Python GUI with custom render\/drawing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to embed some python code in a c++ application i am developing with ms visual studio c++ 2010. But when i run the program, it exits with code 0x01 when i call Py_initialize().\nI dont know how to find out what went wrong. the help file says, Py_Initialize can't return an error value, it only fails fataly.\nBut, why did it fail?\nI am using a self-compiled python27_d.dll, which i created with the msvs project files in the source downloads from python.org.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1264,"Q_Id":4216988,"Users Score":0,"Answer":"Well, i finally found out what went wrong.\nI did compile my python27_d.dll with the same VC10 as my program itself.\nBut my program is normally compiled as 64 bit executable. I just forgot to compile the dll for x64, too. I didnt think this would lead to such annoying behavoiur, as i believed i would get a linkr error then.","Q_Score":1,"Tags":"c++,python,visual-studio-2010,python-c-api,python-embedding","A_Id":4277222,"CreationDate":"2010-11-18T16:16:00.000","Title":"Tried to embed python in a visual studio 2010 c++ file, exits with code 1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to embed some python code in a c++ application i am developing with ms visual studio c++ 2010. But when i run the program, it exits with code 0x01 when i call Py_initialize().\nI dont know how to find out what went wrong. the help file says, Py_Initialize can't return an error value, it only fails fataly.\nBut, why did it fail?\nI am using a self-compiled python27_d.dll, which i created with the msvs project files in the source downloads from python.org.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1264,"Q_Id":4216988,"Users Score":0,"Answer":"Is there  simple 'hello world' type example of the Py_Initilize code in the python sdk you can start with?\nThat will at least tell you if you have the compiler environment setup correctly, or if the error is in your usage.","Q_Score":1,"Tags":"c++,python,visual-studio-2010,python-c-api,python-embedding","A_Id":4217625,"CreationDate":"2010-11-18T16:16:00.000","Title":"Tried to embed python in a visual studio 2010 c++ file, exits with code 1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I get the width and height of a Tkinter window?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":22438,"Q_Id":4220295,"Users Score":32,"Answer":"You use the winfo_width method of the widget to get the actual width. You can use winfo_reqwidth to get the size that the widget is requesting, which may be different.\nNote that if you call this before the window appears on the screen, you won't get the answer you expect. Tkinter needs to have actually drawn the window before it can know the size. A simple fix if you're trying to get the window size before your program starts is to call the update method on the window before trying to get the size.","Q_Score":22,"Tags":"python,tkinter","A_Id":4221002,"CreationDate":"2010-11-18T22:31:00.000","Title":"Get Tkinter Window Size","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I get the width and height of a Tkinter window?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":22438,"Q_Id":4220295,"Users Score":1,"Answer":"to create an exact window size you can simple do:\nwindow.geometry(\"400x400\") as an example but you have to make sure it is like a string otherwise it wont work like I have experience","Q_Score":22,"Tags":"python,tkinter","A_Id":71922330,"CreationDate":"2010-11-18T22:31:00.000","Title":"Get Tkinter Window Size","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Wondering if there's a menu event I can bind to that's related to the currently selected menu item? By menu item I mean the items that show up in a popup menu like New, Open, Save, etc.\nUse case: I would like to update a statusbar area of our application with a description of the currently selected menu item.\nAny ideas appreciated.\nThank you,\nMalcolm","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1525,"Q_Id":4220441,"Users Score":2,"Answer":"You need to bind to the <<MenuSelect>> event.","Q_Score":0,"Tags":"python,menu,tkinter","A_Id":4220839,"CreationDate":"2010-11-18T22:49:00.000","Title":"Python\/Tkinter: bind to event related to currently selected menu item","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The widgets in my application are the old style mac widgets.  How do I make them become the new style ones.  I am using pyqt 4.6.3-1 with python 2.7 on os x 10.6.  Everything was installed using fink and I installed both qt4-mac and qt4-x11.  Not sure which is being used or how to select one or the other.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":475,"Q_Id":4232228,"Users Score":1,"Answer":"I switched from Fink to Macports, and I got the nice widgets.","Q_Score":0,"Tags":"python,cocoa,qt4,pyqt","A_Id":4365030,"CreationDate":"2010-11-20T10:16:00.000","Title":"getting pyqt to use cocoa widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a little gui application with Tkinter, which requires me to have a path to icon files. I am planning on embedding the file into the exe that I make with py2exe, and then retrieving it from there. The only problem is that I need to know where that file is. Does anyone know a way of getting the currently running exe file\/path? Thanks for the help in advance!","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1490,"Q_Id":4234697,"Users Score":0,"Answer":"Oops! I found out the answer! sys.executable should do the trick. It returns the path and filename of the currently running exe, although I must test to see that it works with py2exe.","Q_Score":0,"Tags":"python,py2exe","A_Id":4234727,"CreationDate":"2010-11-20T19:56:00.000","Title":"Get path to exe file on py2exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a series of buttons(Or windows) etc on RUN time.\nNow how do i identify when user clicks on these buttons?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":77,"Q_Id":4239896,"Users Score":1,"Answer":"HI,\nI did an R&D on wx.Event(GetEventObject) and found out that i can get object details. \nSO i solved my problem using this.","Q_Score":0,"Tags":"python,wxpython","A_Id":4240158,"CreationDate":"2010-11-21T19:36:00.000","Title":"How to Identify Dynamically created window\/buttons in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"(Or, \"Can PyPy\/RPython be used to compile\/translate Python to C\/C++ without requiring the Python runtime?\")\nI have tried to comprehend PyPy with its RPython and its Python, its running and its compiling and its translating, and have somewhat failed.\nI have a hypothetical Python project (for Windows); I would like to keep its size down, in the order of a hundred kilobytes (O.N.O.) rather than the several megabytes that using py2exe entails (after UPX). Can I use PyPy1 in any way to produce a standalone executable which does not depend on Python26.dll? If I can, does it need to follow the RPython restrictions like for only working on builtin types, or is it full Python syntax?\nI do realise that if this can be done I almost certainly couldn't use C modules from Python directly.\n\n1 (Since the time of asking, the situation has become clearer, and this part of the toolchain is more clearly branded as RPython rather than PyPy; it wasn't so in 2010.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":6144,"Q_Id":4251964,"Users Score":18,"Answer":"Yes, PyPy can produce standalone executables from RPython code. That means, you need to follow all the awkward RPython rules when it comes to writing code. Your Python code is completely unlikely to function out of the box and porting existing Python code is usually not fun. It won't make executables as small as C, but for example rpystone target (from pypy\/translator\/goal) using boehm GC is 80k on 64bit after stripping.","Q_Score":27,"Tags":"python,compiler-construction,translate,pypy,rpython","A_Id":4253643,"CreationDate":"2010-11-23T01:41:00.000","Title":"Can PyPy\/RPython be used to produce a small standalone executable?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a gtkMenu using gtk.Menu(), appended a couple of items and now I want to remove some menu items. How can I do that?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3084,"Q_Id":4258771,"Users Score":0,"Answer":"Maybe using destroy() could save some RAM:\nmenu.foreach(lambda child: child.destroy())","Q_Score":8,"Tags":"python,pygtk","A_Id":65870271,"CreationDate":"2010-11-23T17:10:00.000","Title":"How to remove an item from a gtkMenu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using pygame to create a small scene.  Right now, I'm working with lines.\nI have an array of lines which are drawn to the screen and when a line is deleted from the array, I would like the line to disappear from the screen.\nThe problem I've found is that the line is drawn on the screen and remains static.  I can't find a way to reset the screen (I'm using a JPEG as the background).\nIs there a way to remove a drawn line from the screen?\nThanks","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4502,"Q_Id":4276342,"Users Score":1,"Answer":"If you use screen.fill([0,0,0])  it will fill in the background (or whatever you have set to be your background).\nThis will erase any lines drawn on the image, essentially removing anything drawn on the background.","Q_Score":0,"Tags":"python,line,pygame","A_Id":4276397,"CreationDate":"2010-11-25T11:10:00.000","Title":"Python (pygame): How can I delete a line?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to display PyGame surfaces with controllable alpha? I would like to take a surface with its own per pixel alpha and display it with variable level of translucency without affecting the surface data and keep the transparency intact i.e. the objects on the surface would keep their shapes but their \"contents\" becoming more or less translucent.\nIn other words I want to combine per-pixel alpha from the source image with per-surface alpha calculated at the runtime.","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":7315,"Q_Id":4276850,"Users Score":4,"Answer":"After checking both PyGame and SDL documentations I came to conclusion that what I asked wasn't doable in PyGame using standard functions.\nSDL docs state that per-pixel alpha and per-surface alpha cannot be combined with the former always taking the precedence. The only way to achieve the effect I want is by writing a code which updates per-pixel alpha values of the source surface before the blit.","Q_Score":13,"Tags":"python,pygame,transparent","A_Id":4535566,"CreationDate":"2010-11-25T12:05:00.000","Title":"PyGame: translucent sprites with per pixel alpha","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to expose a file-like object from a C library that i'm wrapping with a Cython module. I want to reuse python's generic io code for stuff like buffering, readline(), etc.\nThe new IO module seems to be just what i need, but actually using it from Cython seems to be non-trivial, I've tried several aproaches:\n\nMy code in a cdef class that inherits from IO.RawIOBase - This fails because cdef classes can inherit only from other cython cdef classes, while IO is \"raw\" C.\nMy code in a cdef class, another (non-cdef) class that inherits both my cdef class and RawIOBase - Fails with \"TypeError: multiple bases have instance lay-out conflict\"\nMy code in a (non-cdef) class that inherits from RawIOBase - This works, but i loose the ability to store my c-level (that i need to talk to the underlying library) stuff inside the class, so i need a make a cdef wrapper around it and store that as a member... this looks like a mess.\nMy code in cdef class that doesn't inherit (Raw)IOBase rather reimplements it's functionality, Python code gets my object wrapped in BufferedReader\/BufferedWriter - This one seems to work and less messy than the previous option.\n\nMy questions(s): \n1) Am I missing something and reinventing the wheel here?\n2) What is the exact stuff from IOBase that I need to implement to keep BufferedReader\/Writer happy with my object in current and future versions of python? Is this documented anywhere?\n3) How will that work in python 2.6 where IO is pure python? I guess that performance will suffer but it will work, right?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1145,"Q_Id":4278444,"Users Score":1,"Answer":"Would it be too inefficient to call os.fdopen() on the file descriptor number returned by the underlying library, and then to dispatch normal Python method calls to the resulting file object in order to do your input and output? With most I\/O, I would be surprised if you could see a difference with whether you called a C routine directly or let the Python method dispatch logic call it for you \u2014 but, of course, you might be in an unusual situation and I could be wrong!","Q_Score":20,"Tags":"python,file-io,cython","A_Id":8262264,"CreationDate":"2010-11-25T15:08:00.000","Title":"Exposing a file-like object from Cython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was thinking that for a learning project for myself, I would try to make a GUI for ffdshow on linux, using tkinter. Wanted to make sure this project would be feasible first, before I get halfway through and run into something that cant be done in python.\nBasic idea is to have a single GUI window with a bunch of drop down boxes that have the various presets (like format or bitrate), as well as a text box where a custom number can be entered if applicable. Then when all the options are selected, the user hits the Start button on the GUI and it shows a progress little bar with a percentage. All the options selected would just send the relevant selections as cli arguments for ffdshow, and begin the conversion progress (essentially turning all the user's input into a single perfect cli command).\nIs all this doable with python and tkinter? and is it something that a relative newb with only very basic tkinter experience could pull off with books and other python resources?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":446,"Q_Id":4278461,"Users Score":1,"Answer":"That is precisely the type of thing that python and Tkinter excel at. And yes, a relative newbie can easily do a task like that.","Q_Score":1,"Tags":"python,user-interface,tkinter,ffdshow","A_Id":4278800,"CreationDate":"2010-11-25T15:10:00.000","Title":"making a python gui for ffdshow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is a bit of a vague question but bear with me. I am in the process of writing a game using Python\/Pyglet and openGL. I currently have it structured so that there is an object called 'world', in this are other objects with other objects inside them etc. I did it this way because for instance one part of the game is a platform with other objects on it, and when I tilt the platform I want the objects on it to tilt with it. So I do platform.draw() which calls glRotate, glTranslate, then draw each of the objects saving the modelview matrix inbetween, this way all the objects on the platform move together.\nThe first question is, is this a sensible way to organise things or should I be using some other method?\nI don't have a camera class, currently I am just translating the whole world or parts of it to give the illusion of movement. However, in the future I want to be able to switch viewpoints between objects, so for instance switch from looking down onto the world from above to a 1st person view from one of the objects in the world. So the second question is what is the best way to structure my program so that this will be achievable in the future?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":382,"Q_Id":4291566,"Users Score":0,"Answer":"You could put the logic into a seperate module \/ into seperate classes\/functions.\nIn my 2D-Game I have a GameLogic class which simplifies registering it's methods for certain events or scheduling them (and unregistering+unscheduling them), and I created a @state_wrapper decorator which injects a simple new-style object as state-storage for that method. If you do it like that you don't have to pass the pointer to all your world objects, only the event-methods have to get access to your objects.\nBut I wouldn't claim that this is the best solution ;)","Q_Score":2,"Tags":"python,architecture,3d,pyglet","A_Id":4368817,"CreationDate":"2010-11-27T12:10:00.000","Title":"How to organise the structure of a 3D game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Tkinter app written in python, and I want to make \"native\" (easy to run) mac and windows executables of it. I've successfully built a windows .exe using py2exe, but the equivalent process with py2app isn't working.\nHere's my setup.py:\nfrom setuptools import setup\nimport sys\nMAIN_SCRIPT  = \"myapp.py\"\nWINDOWS_ICON = \"myicon.ico\"\nMAC_ICON     = \"myicon.icns\"\nif sys.platform in (\"win32\", \"win64\"): # does win64 exist?\n    import py2exe\n    setup( windows=[{ \"script\":MAIN_SCRIPT,\n                      \"icon_resources\":[(0x0004, WINDOWS_ICON)]\n                   }],\n         )\nelif sys.platform == \"darwin\":\n    import py2app\n    setup( app=[MAIN_SCRIPT], # doesn't include the icon yet\n           setup_requires=[\"py2app\"],\n         )\n\nI just cd to my app directory and run python setup.py py2app. The .app appears without errors, but it crashes on launch with \"myapp has encountered a fatal error, and will now terminate.\"\nI'm running Snow Leopard, and I've tried this with both the standard Apple Python 2.6 and python25 from MacPorts. I read somewhere that it's better to use a different Python because py2app won't bundle the system version in your app.\nEDIT: Here's what the mac console has to say about it:\n11\/27\/10 1:54:44 PM  [0x0-0x80080].org.pythonmac.unspecified.myapp[77495]    dlsym(0x10b120, Py_SetProgramName): symbol not found\n11\/27\/10 1:54:46 PM [0x0-0x80080].org.pythonmac.unspecified.myapp[77495]    0x99274242\n11\/27\/10 1:54:46 PM com.apple.launchd.peruser.501[185]  ([0x0-0x80080].org.pythonmac.unspecified.myapp[77495]) Exited with exit code: 255","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1470,"Q_Id":4294060,"Users Score":0,"Answer":"Turns out it was a problem with using Snow Leopard. I tried it on a Leopard machine at school and it builds fine.","Q_Score":2,"Tags":"python,tkinter,py2app","A_Id":4300560,"CreationDate":"2010-11-27T21:41:00.000","Title":"Help building a mac application from python using py2app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to remove focus from a widget manually.","AnswerCount":6,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":16266,"Q_Id":4299432,"Users Score":2,"Answer":"My solution is root.focus() it will remove widget focus.","Q_Score":11,"Tags":"python,tkinter","A_Id":64151502,"CreationDate":"2010-11-28T22:15:00.000","Title":"In Tkinter how do i remove focus from a widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to remove focus from a widget manually.","AnswerCount":6,"Available Count":2,"Score":0.1651404129,"is_accepted":false,"ViewCount":16266,"Q_Id":4299432,"Users Score":5,"Answer":"Set focus to another widget to remove focus from the target widget is a good idea. There are two methods for this: w.focus_set() and w.focus_force(). However, method w.focus_force() is impolite. It's better to wait for the window manager to give you the focus. Setting focus to parent widget or to the root window removes focus from the target widget.\nSome widgets have takefocus option. Set takefocus to 0 to take your widget out of focus traversal (when user hits <Tab> key).","Q_Score":11,"Tags":"python,tkinter","A_Id":47823400,"CreationDate":"2010-11-28T22:15:00.000","Title":"In Tkinter how do i remove focus from a widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So we want to program a 3d game for school, we can probably use blender for the 3d models, however we are totally clueless as to how to use them in a game\/application.\nAre there any recommended guides\/documents we should read on general 3d game programming and perhaps python specific stuff.\nWe are also possibly considering programming it in C++ but for now I think it's easier to use Python as we can fully focus on the 3d mechanics that way.","AnswerCount":8,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":56291,"Q_Id":4303851,"Users Score":0,"Answer":"I would implement the time-critical stuff as 3D and its object handling + rendering in raw C\/C++ and let an embedded Python with external modules handle the game logic (object movement, object properties, scripting and so on).","Q_Score":15,"Tags":"c++,python,3d","A_Id":4303972,"CreationDate":"2010-11-29T12:49:00.000","Title":"3d game with Python, starting from nothing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So we want to program a 3d game for school, we can probably use blender for the 3d models, however we are totally clueless as to how to use them in a game\/application.\nAre there any recommended guides\/documents we should read on general 3d game programming and perhaps python specific stuff.\nWe are also possibly considering programming it in C++ but for now I think it's easier to use Python as we can fully focus on the 3d mechanics that way.","AnswerCount":8,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":56291,"Q_Id":4303851,"Users Score":2,"Answer":"If you want to write a 3D game you might want to start by understanding the basics of programming and computer science. Starting with the top and learning a language, then find yourself a good graphics library for example Panda, Pygame are all good choices, then there are other parts to consider like networking with twisted for example or a physics engine. It might also be a good choice to consider using a working engine like the unreal engine as often game designers get too wrapped up in game mechanics and not the game itself","Q_Score":15,"Tags":"c++,python,3d","A_Id":4303913,"CreationDate":"2010-11-29T12:49:00.000","Title":"3d game with Python, starting from nothing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So we want to program a 3d game for school, we can probably use blender for the 3d models, however we are totally clueless as to how to use them in a game\/application.\nAre there any recommended guides\/documents we should read on general 3d game programming and perhaps python specific stuff.\nWe are also possibly considering programming it in C++ but for now I think it's easier to use Python as we can fully focus on the 3d mechanics that way.","AnswerCount":8,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":56291,"Q_Id":4303851,"Users Score":2,"Answer":"You should be aware that 3D game consists of\n\nanimated 3D models\n3D environment (including NPCs and objects)\nsimulation of interaction between the environment and the models (game logic and game mechanics)\nuser interface (starting, saving and game settings)\n\nThe game logic and mechanics is going to usually the biggest and most complicated part and you should try to wrap your head against that first.\nModeling 3D objects and environment should be much easier after that.","Q_Score":15,"Tags":"c++,python,3d","A_Id":4304000,"CreationDate":"2010-11-29T12:49:00.000","Title":"3d game with Python, starting from nothing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using Python 2.6, Twisted 10.1, and GTK+ 2.22, with latest pygtk installed, I'm having problems on shutdown. When I close my application and shut down the reactor (using the gtk2reactor of course), the application simply freezes. \nI've poked around the twisted source and added debug messages. What ends up happening is, the 'shutdown' event fires, PortableGtkReactor.crash is called, which calls gtk.main_quit. The event gets processed at the end of ReactorBase.runUntilCurrent. When the function returns, control goes to ReactorBase.iterate, which returns control to PortableGtkReactor.simulate, which goes back to... the gtk.main() call. It looks like gtk just doesn't quit.\nUnfortunately, when I put together a very simple example with twisted and the gtk \"Hello World\" sample, everything shut down correctly. It must be something my application is doing. Until I can figure it out further, though...\nWhat might be causing this? Like what could an app do that causes gtk to not quit? The app worked fine on Gtk 2.12, with Python 2.5 and Twisted 8.1, if that helps at all.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":426,"Q_Id":4308346,"Users Score":0,"Answer":"Threads, perhaps?  The Twisted reactor joins all threads on shutdown, and if you're doing something in a callInThread that hangs, your loop may be unable to stop.  (I'm not sure what the behavior would be if you're starting your own threads, either.)","Q_Score":1,"Tags":"python,pygtk,twisted,gtk","A_Id":4310711,"CreationDate":"2010-11-29T21:36:00.000","Title":"Twisted + Gtk - shutdown not working properly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have implemented an informational popup in a python app using a Tkinter Menu widget.  I have a Text widget on a canvas in the root window. I created a Menu widget that has root as its parent.  When I detect a mouse hover over the text widget I post the popup menu with menuWidget.post(). When I get a leave event from the text widget my intention was to have the popup disappear by calling menuWidget.unpost(), only the popup menu does not disappear until I click elsewhere outside the text widget.\nFirst, is this a sane method for implementing an informational popup? And can anyone tell me why the popup menu won't disappear?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":2151,"Q_Id":4328603,"Users Score":3,"Answer":"This is not the right way to do an informational popup. On the Mac and on windows machines menus are native controls. Because of this the unpost command doesn't work because tk cedes control to the system event loop in order to get platform-specific behavior. \nWhat you want is to use instead is a toplevel window with the overrideredirect flag set. This lets you display a borderless window anywhere you want. The upside to this is that you aren't limited to simple text -- you can put anything you want in that toplevel -- another text widget, a canvas, buttons, etc.","Q_Score":1,"Tags":"python,tkinter","A_Id":4328747,"CreationDate":"2010-12-01T20:09:00.000","Title":"'hover over' popup with Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"hey all,\nim looking for a way of catching a button held down event in wxpython i cant seem to find anything. theres just wx.EVT_BUTTON which isnt quite what i want. i want my event to continue processing as long as the button is down. any help would be appreciated\nthanks james","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1279,"Q_Id":4329377,"Users Score":2,"Answer":"I think I would catch the EVT_LEFT_DOWN and the EVT_LEFT_UP. Then start a wx.Timer to run your process on EVT_LEFT_DOWN until the EVT_LEFT_UP is fired. Alternatively, you could use a ToggleButton.","Q_Score":1,"Tags":"button,wxpython","A_Id":4329486,"CreationDate":"2010-12-01T21:32:00.000","Title":"wxpython button held down event","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to customize the horizontal padding between an image and text in a Label widget when compound=left or right?\nThe 2 ways I can think of are:\n\nUse PIL to dynamically add columns of pixels to an image\nInsert or append spaces to the text= option of the label to force the separation of image and text\n\nWhat I'm looking for is a way to specify the horizontal padding (between image and text) in pixels.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":912,"Q_Id":4333359,"Users Score":0,"Answer":"There is no built-in way to do what you want. Your own suggestions are good. Another option is to create a frame, and place separate image and label widgets in the frame. You then have complete control of the placement of the widgets","Q_Score":0,"Tags":"python,image,label,tkinter","A_Id":4334872,"CreationDate":"2010-12-02T09:16:00.000","Title":"Python\/Tkinter: Customize horizontal padding between image and text in Label widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to integrate IronPython in my Silverlight application but am unable to do so. After downloading the binaries, every time I try to add the dlls as references in my VS2010 solution all I get is an error about them not being compiled for Silverlight. I have even tried downloading the source distribution, but cannot set the various projects making up the solution to build against Silverlight (the only choices I have are different versions of the .net framework).\nAs the IronPython website explicitly states Silverlight compatibility, why is it not working? Is there any easier way of getting scripting capabilities in my Silverlight app?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":127,"Q_Id":4336935,"Users Score":2,"Answer":"You have to use binaries from IronPython-2.6.1\\Silverlight\\bin folder in Silverlight.","Q_Score":3,"Tags":"silverlight,silverlight-4.0,ironpython","A_Id":4358122,"CreationDate":"2010-12-02T15:56:00.000","Title":"Ironpython 2.6.1 on Silverlight 4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm trying to disable warning C0321 (\"more than one statement on a single line\" -- I often put if statements with short single-line results on the same line), in Pylint 0.21.1 (if it matters: astng 0.20.1, common 0.50.3, and Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)).\nI've tried adding disable=C0321 in the Pylint configuration file, but Pylint insists on reporting it anyway. Variations on that line (like disable=0321 or disable=C321) are flagged as errors, so Pylint does recognize the option properly. It's just ignoring it.\nIs this a Pylint bug, or am I doing something wrong? Is there a way around this?\nI'd really like to get rid of some of this noise.","AnswerCount":13,"Available Count":1,"Score":0.0153834017,"is_accepted":false,"ViewCount":404539,"Q_Id":4341746,"Users Score":1,"Answer":"Python syntax does permit more than one statement on a line, separated by semicolon (;). However, limiting each line to one statement makes it easier for a human to follow a program's logic when reading through it.\nSo, another way of solving this issue, is to understand why the lint message is there and not put more than one statement on a line.\nYes, you may find it easier to write multiple statements per line, however, Pylint is for every other reader of your code not just you.","Q_Score":346,"Tags":"python,pylint","A_Id":48765416,"CreationDate":"2010-12-03T01:41:00.000","Title":"How do I disable a Pylint warning?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"hey.. i have a panel (lets call it mainpanel) with a couple of panels in it and other widgets. i need to know what to bind the wx.EVT_LEFT_DOWN to in order for it to fire an event for clicks anywhere in mainpanel and its children. e.g. if i click on a textctrl in mainpanel i want it to pick that up aswell. binding to mainpanel doesnt work. please help i really need to find a solution to this its making me mad!\np.s. binding everychild to the wx.EVT_LEFT_DOWN is not an option i have hundreds of children i really dont want to go that route","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":242,"Q_Id":4368885,"Users Score":0,"Answer":"Text controls eat mouse clicks so you may just want to catch the focus event for them. I think the rest should work though.","Q_Score":1,"Tags":"wxpython","A_Id":4370204,"CreationDate":"2010-12-06T16:55:00.000","Title":"wxpython, what to bind an application wide mouse event to","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Recently I installed wxPython to do some works under Windows. Most of the time I work in Linux so I have a little experience here. \nwith python.exe interpreter, I just do 2 line of codeimport wxtmp=wx.App(False)\nThen the interpreter crashed with Windows error reporting.\nI tried both python 2.7.1 and 2.6.6  with wxPython 2.8.11, all come from their main website, still no luck.\nIs there something I must do after install Python in Windows ? I can see that python install just fine and can do some basic job, wxPython library can be load, but can't call wx.App","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1983,"Q_Id":4369102,"Users Score":1,"Answer":"If you are running that in IDLE, then that is your problem. IDLE and wx don't get along very well because you basically end up with two mainloops fighting each other. Try putting it in a file and then run the file from the command line:\nc:\\python27\\python.exe myPyFile.py\nThat should work just fine. Otherwise, download the correct wxPython for your Python and OS (32\/64 bit), uninstall the current one and install the new one. I've been using wxPython on Windows XP, Vista and 7 with no problems like this.","Q_Score":1,"Tags":"python,wxpython","A_Id":4369662,"CreationDate":"2010-12-06T17:19:00.000","Title":"wx.App (wxPython) crash when calling","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Recently I installed wxPython to do some works under Windows. Most of the time I work in Linux so I have a little experience here. \nwith python.exe interpreter, I just do 2 line of codeimport wxtmp=wx.App(False)\nThen the interpreter crashed with Windows error reporting.\nI tried both python 2.7.1 and 2.6.6  with wxPython 2.8.11, all come from their main website, still no luck.\nIs there something I must do after install Python in Windows ? I can see that python install just fine and can do some basic job, wxPython library can be load, but can't call wx.App","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1983,"Q_Id":4369102,"Users Score":0,"Answer":"I searched for a while and found that this is the problem with wxPython and Python >2.5. Tried many fix with manyfest file but no luck, so I think switch to PyQt is the only solution now.","Q_Score":1,"Tags":"python,wxpython","A_Id":4496450,"CreationDate":"2010-12-06T17:19:00.000","Title":"wx.App (wxPython) crash when calling","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Recently I installed wxPython to do some works under Windows. Most of the time I work in Linux so I have a little experience here. \nwith python.exe interpreter, I just do 2 line of codeimport wxtmp=wx.App(False)\nThen the interpreter crashed with Windows error reporting.\nI tried both python 2.7.1 and 2.6.6  with wxPython 2.8.11, all come from their main website, still no luck.\nIs there something I must do after install Python in Windows ? I can see that python install just fine and can do some basic job, wxPython library can be load, but can't call wx.App","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1983,"Q_Id":4369102,"Users Score":1,"Answer":"In case like me somebody will stumble into this question like I did. Recently installed wxpython on two machines, windows 7 and XP. Testing the sample code in simple.py (provided with the wxpython docs-demos installer), running from a python console, I had the following problem on both machines: First import ok, but when I did a reload of the module, python crash.\nI added this line in the end of the simple.py file: del app\nand that fixed the problem on windows 7 and tomorrow I try it on the XP machine.\nSame solution fitted for the XP machine. So, reloading an un-edited module with a reference to a wx.App with a closed gui seem not to be feasable. Killing the reference with a del statement was enough to solve the problem.","Q_Score":1,"Tags":"python,wxpython","A_Id":16407973,"CreationDate":"2010-12-06T17:19:00.000","Title":"wx.App (wxPython) crash when calling","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm using the Android 2.2 SDK emulator to test out the Scripting Layer for Android and have one annoyance. \nWhen you launch a Python interpreter and start to type code it appears that the parentheses key isn't mapped properly. When I hit the key on the PC keyboard I get ^[[20~ instead. What am I missing?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":669,"Q_Id":4369261,"Users Score":0,"Answer":"Looks like the Control-K button actually toggles the left-ALT key on the PC to mimic the virtual keyboard left-ALT.","Q_Score":0,"Tags":"python,android,sl4a","A_Id":4531739,"CreationDate":"2010-12-06T17:41:00.000","Title":"Android Emulator Keyboard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I get my filechooser to be able to select both files and folders when the open button on the filechooser dialog is hit ? I want to squeeze the ability to open files and filders in just one filechooser. I am using GTK+ and Python.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1339,"Q_Id":4376500,"Users Score":2,"Answer":"I was thinking about this, and although in your comments you've decided to go another route, I do have a suggestion: Write your own file chooser subclass of the GTK+ one and provide two \"Open\" buttons, one to \"Open File\" and another to \"Open Directory\". That would eliminate the ambiguity discussed above.","Q_Score":7,"Tags":"python,pygtk,gtk,filechooser","A_Id":4831626,"CreationDate":"2010-12-07T12:21:00.000","Title":"GTK+ Filechooser to open both files and folders","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a Python 2.7.1 \/ Tkinter 8.4 app on Windows XP that checks several lines of input from a RS-232 port. However, if no input arrives it will sit in a loop for ever. \nI am trying to implement an \u2018Abandon Test\u2019 button on the GUI but because the main thread  is busy waiting for input it doesn\u2019t appear to every check if a button has been pressed.\nI have tried update_idletasks() and time.sleep(1) with no success. \nAny suggestions?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":987,"Q_Id":4376870,"Users Score":5,"Answer":"Tk is single-threaded, so if the main thread is busy the GUI will freeze. One solution is to use a separate thread to do the reading, so when the read blocks your main thread can continue. When you get a line of input you can push it on a queue which is monitored by the main thread. \nThe other way is to figure out how to do a non-blocking read on your serial port. If there is data, read it. If not, return to the main event loop. You then need to configure the event loop to poll your port every few hundred milliseconds or so, depending on your performance needs.","Q_Score":2,"Tags":"python,tkinter","A_Id":4377125,"CreationDate":"2010-12-07T13:04:00.000","Title":"How can I monitor Tkinter buttons when Python is busy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Currently I'm drawing some things in a subclass of DrawingArea, where I get a cairo context inside an expose-event and call a draw method from there. (according to some PyGTK tutorial I found)\nI'm used to doing a repaint() with java, but how can I get the same effect here?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3673,"Q_Id":4383614,"Users Score":0,"Answer":"I found a solution that uses the queue_draw() method (callable from the Gtk.DrawingArea but seems like a method every gtk widget must have), but there are probably alternatives since this one implies it might get delayed, even though in my tests it didn't happen.","Q_Score":2,"Tags":"python,gtk,drawing,pygtk","A_Id":4383675,"CreationDate":"2010-12-08T02:15:00.000","Title":"(Py)GTK: How can I force my window to be repainted \/ call expose-event?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running a .NET 3.5 C# project in Visual Studio 2008. In the project I am hosting an IronPython script that imports modules that I have compiled to .NET dlls with pyc. The version of IronPython is 2.6.1. I have used ObjectOperations.GetInstance and GetMember to wire up the python methods to the C# code.\nWhen I am debugging the C# code and try to step into the pyc generated IronPython dll, VS won't allow me to do that. Is there any way for me to be able to step into that code?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":242,"Q_Id":4396727,"Users Score":1,"Answer":"There is no way to do this out of the box.  You'd need to modify IronPython\/DLR so that the calls from ClrModule.CompileToMethod down would pass an option to emit symbols and then ultimately call LambdaExpression.CompileToMethod to emit symbols.","Q_Score":1,"Tags":".net,visual-studio,dll,ironpython","A_Id":4414812,"CreationDate":"2010-12-09T09:38:00.000","Title":"Is it possible to step into an IronPython dll compiled with pyc?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a pack equivalent of the grid_remove() method where a widget's original pack() settings are restored on a re-pack()?\nUse case: When I show a packed widget that has been hidden via pack_forget(), I would like to have the widget re-packed with its original pack settings when I issue the widget.pack() show request.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2749,"Q_Id":4399237,"Users Score":4,"Answer":"No, there is no equivalent. There is only pack_forget which doesn't remember where the widget was when you restore it. If I need this sort of feature I just use the grid geometry manager.","Q_Score":3,"Tags":"python,tkinter,ttk","A_Id":4399322,"CreationDate":"2010-12-09T14:23:00.000","Title":"Python\/Tkinter: pack equivalent of grid_remove(), eg. pack_remove()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any best practice tips regarding when one should use pack vs. grid for their layouts?\nFrom what I've been reading via google, the concencus seems to be that grid can handle any pack scenario but not vice-versa.\nTo start the conversation, it appears that one use case that favors grid vs. pack is when one wants to show\/hide widgets.","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":33054,"Q_Id":4401202,"Users Score":18,"Answer":"Neither is intrinsically better than the other. Each have strengths and weaknesses. Learn what those are and the choice of which to use becomes obvious.\ngrid is considerably easier to use if you need to lay things out in a grid. pack is generally easier to use if all you need to do is put some widgets in a single row or single column. There's a whole lot of gray area in-between where neither is necessarily better than the other.\nThe other thing to consider is what you said in your question: if you want to show and hide widgets at run-time, grid is probably the best choice because of the grid_remove method which remembers the values of all of the configured attributes in case you want to re-add the widget. \nPersonally, my first choice is always to use pack because I first learned Tk back when there was no grid command. If I can't do it easily in pack, or if I'm very clearly laying things out in a grid, I'll use grid.","Q_Score":31,"Tags":"python,user-interface,layout,tkinter,ttk","A_Id":4402589,"CreationDate":"2010-12-09T17:23:00.000","Title":"When to use pack or grid layouts in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any best practice tips regarding when one should use pack vs. grid for their layouts?\nFrom what I've been reading via google, the concencus seems to be that grid can handle any pack scenario but not vice-versa.\nTo start the conversation, it appears that one use case that favors grid vs. pack is when one wants to show\/hide widgets.","AnswerCount":3,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":33054,"Q_Id":4401202,"Users Score":10,"Answer":"I always recommend grid over pack for polished applications.  There are only a few edge cases where pack is easier and fits the bill (everything in one row or col).  grid has better \"composability\" (e.g. megawidgets or gridding elements of gridded elements).  The reasons to prefer grid are the extra fine-tuning options that it provides.  The use of weight (which effects growing and shrinking btw), minsize and maxsize, as well as convenience features like enforcing uniform rows\/columns.\nA fully gridded app of any size will use (significantly) fewer frames than an equivalent packed app, and have better shrink\/expand control over inner elements.\nBTW, both pack and grid can show\/hide sub-elements, though the syntax differs slightly between the two.  Grid is just slightly better because 'remove' (rather than 'forget') will remember the grid options on the slave widget.","Q_Score":31,"Tags":"python,user-interface,layout,tkinter,ttk","A_Id":4411675,"CreationDate":"2010-12-09T17:23:00.000","Title":"When to use pack or grid layouts in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any best practice tips regarding when one should use pack vs. grid for their layouts?\nFrom what I've been reading via google, the concencus seems to be that grid can handle any pack scenario but not vice-versa.\nTo start the conversation, it appears that one use case that favors grid vs. pack is when one wants to show\/hide widgets.","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":33054,"Q_Id":4401202,"Users Score":2,"Answer":"I personally just think grid is a lot easier to work with, so I would use that. Of course, you've probably read the one thing you should never do is try to use both at the same time in the same container. Thank you Bryan Oakley for making that distinction.","Q_Score":31,"Tags":"python,user-interface,layout,tkinter,ttk","A_Id":4401215,"CreationDate":"2010-12-09T17:23:00.000","Title":"When to use pack or grid layouts in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"one topic that has always been of highest interest to me is 3D Programming. I've made several attempts at programming small games and never really successed. After experiences with DirectX and C++, XNA and C#, as well as Unity3d and C#, I would like to try OpenGL. Just being curious. When using C++ the way to go is rather clear. However Java (and Scala that I'm currently learning), Python ... are way more comfortable. After about 2 years of struggling with C++ without any remarkable success, I turned away from it. Now for Java\/Scala\/... there are many OpenGL bindings and I would like to choose the right one. On the contrary there are few books on them. Java 3d and\/or JOGL books are available but when looking at Scala or Python things aren't that good.\nWhat layer\/wrapper\/binding would you recommend (Java or Scala). Is there a kind of standard ?\nIs it possible to learn this binding by reading for eyample \"OpenGL Superbible\" ? \nIf not, can you recommend a book ?\nAny advice is welcome. If there's a good IDE (plugin), tool, website, tutorial, ... please let me know it.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1677,"Q_Id":4403150,"Users Score":3,"Answer":"I have used JOGL in many of my 3D projects. Learning how to use a binding is not as important as learning the actual api. Using opengl in c and java are pretty much the same. The only thing that differs is the way you set up your rendering windows and buffers. I use netbeans ide with the opengl for netbeans plugin because it sets everything up for you and all you have to worry about is the opengl part. To learn opengl any book is fine. If you have a good background in programming then you should catch on quite easily.","Q_Score":3,"Tags":"java,python,scala,opengl,jogl","A_Id":4435696,"CreationDate":"2010-12-09T21:10:00.000","Title":"Key to OpenGL. Java \/ Scala \/ Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a gtk SpinButton, but for inputting dates.\n\nIs there an easier way to input dates into GTK?\nIf not, how can I create a SpinButton look-alike, but whose output is text representing dates instead of integers? Ideally I'd re-use the arrows, the clicks, the integration with the adjustment, etc. I really just need the output to look different, as I can even represent dates as integers.","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":847,"Q_Id":4404825,"Users Score":3,"Answer":"The calendar is a bit large, but you can find code putting it in a popup. Personally I use a regular text entry and parse the date.\nAs for SpinButton, it is based on a text entry, so you might be able to modify its display only by fiddling with inherited signals and returning False. See also the update-policy and numeric properties.","Q_Score":1,"Tags":"python,user-interface,gtk,pygtk","A_Id":4450091,"CreationDate":"2010-12-10T01:22:00.000","Title":"gtk custom spin button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have done coding for mathematical simulation of Theory of Computation concepts in Python such as grammar checking and other stuff. My Problem is that I have to build a decent looking GUI for it .\nI have looked at PyQt4 and the lack of documentation is really a big deterrent. I have looked at other graphical libraries in Python and they are not helping me so is there a way that I can write the GUI stuff in some other language and integrate python in it.\nThe problem is that I want mathematical stuff like circles, epsilon on runtime which have drag and drop events available on them. So simply creating an image is not an option.\nI am sorry for being a little non specific here but the problem is that I am looking for things that can help here. I have asked a question before too for GUI and unfortunately I could'nt find the right answers for it.\nIs there a way I can get around this problem.\nThanks a lot....","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":4413692,"Users Score":0,"Answer":"Most python guis I recommend tkinter but drag 'n drop isn't built into tkinter yet and I'm not a huge fan of the other libraries.\nHave you thought about IronPython in .Net and WPF? You'll need to learn the xaml syntax but it's not much harder than html (technically, it's stricter and simpler but you need to learn some library controls it will instantiate). There are free versions of visual studio for all of this.\nAnother simple way would be to expose a command line or webservice interface to your python routines.","Q_Score":1,"Tags":"python","A_Id":4413768,"CreationDate":"2010-12-10T22:02:00.000","Title":"Interlinking GUI in some other language and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have done coding for mathematical simulation of Theory of Computation concepts in Python such as grammar checking and other stuff. My Problem is that I have to build a decent looking GUI for it .\nI have looked at PyQt4 and the lack of documentation is really a big deterrent. I have looked at other graphical libraries in Python and they are not helping me so is there a way that I can write the GUI stuff in some other language and integrate python in it.\nThe problem is that I want mathematical stuff like circles, epsilon on runtime which have drag and drop events available on them. So simply creating an image is not an option.\nI am sorry for being a little non specific here but the problem is that I am looking for things that can help here. I have asked a question before too for GUI and unfortunately I could'nt find the right answers for it.\nIs there a way I can get around this problem.\nThanks a lot....","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":77,"Q_Id":4413692,"Users Score":1,"Answer":"I'd look again at PyQT4 if you want something decent looking.  PyQt has an an example directory in the source code. KDE uses QT and they have a lot examples too. You have to understand that it is a binding against QT4. When I use it with python I usually just have the QT docs open. Its pretty easy to translate.\nYou could look at PyGTK also, but again, it is a binding against GTK.","Q_Score":1,"Tags":"python","A_Id":4413875,"CreationDate":"2010-12-10T22:02:00.000","Title":"Interlinking GUI in some other language and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there anyway I could register button pushes on a joystick without using any function from pygame?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":916,"Q_Id":4415649,"Users Score":1,"Answer":"If you're looking for a way to do it with just the standard Python library, the answer is probably \"no\" - or at the very least, \"not in any straightforward manner\". There are many things in the standard library, but gaming hardware support is not one of them.","Q_Score":1,"Tags":"python","A_Id":4415722,"CreationDate":"2010-12-11T07:05:00.000","Title":"Detecting an arbittrary button press on a USB joystick WITHOUT pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Every time I need to load a local file using webkit in python I need to start with \"file:\/\/\" which I need to include in all files I am working with. How can I eliminate the need to do that? I want to load files like webview.load_uri('file.html') instead of webview.load_uri('file:\/\/file.html')?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2182,"Q_Id":4416570,"Users Score":3,"Answer":"You can't. webview.load_uri() takes a string containing a URI. 'file.html' isn't a URI, 'file:\/\/file.html' is.","Q_Score":2,"Tags":"python,webkit,gtk","A_Id":4421093,"CreationDate":"2010-12-11T11:50:00.000","Title":"Problem loading local files with webkit in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Every time I need to load a local file using webkit in python I need to start with \"file:\/\/\" which I need to include in all files I am working with. How can I eliminate the need to do that? I want to load files like webview.load_uri('file.html') instead of webview.load_uri('file:\/\/file.html')?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":2182,"Q_Id":4416570,"Users Score":1,"Answer":"webview.load_string() takes the text of an html file. you can load the file into a file object without the file:\/\/ and read it into the load_string function.","Q_Score":2,"Tags":"python,webkit,gtk","A_Id":7470386,"CreationDate":"2010-12-11T11:50:00.000","Title":"Problem loading local files with webkit in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Has anyone figured out a way to change the brace matching colours in WingIDE?  I have managed to manually port my favourite colour scheme across from my text editor and the default green just doesn't do it for me.  I've been unable to find instructions on how to do this in the UI, user manual and mailing lists.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":135,"Q_Id":4418839,"Users Score":1,"Answer":"I've contacted Wingware support and they have confirmed that there is no way to set the brace matching colour.","Q_Score":3,"Tags":"python,wing-ide","A_Id":4431943,"CreationDate":"2010-12-11T20:40:00.000","Title":"WingIDE brace matching colours","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using a wxPython listbox on Windows to get a choice from the user, and I would like them to be able to select an item using the ENTER key, as if they had double-clicked. I know how to do this in C or C++ using the Windows API directly, but can't seem to find how to do it using wxPython. Anyone know how? It seems like an obvious thing to want to do.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":721,"Q_Id":4451166,"Users Score":1,"Answer":"The simple answer is that the wx.ListBox doesn't support that. Try using a one column wx.ListCtrl (in Report mode) instead.","Q_Score":2,"Tags":"python,windows,wxpython","A_Id":4465221,"CreationDate":"2010-12-15T14:50:00.000","Title":"Keyboard interface to wxPython listbox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using a wxPython listbox on Windows to get a choice from the user, and I would like them to be able to select an item using the ENTER key, as if they had double-clicked. I know how to do this in C or C++ using the Windows API directly, but can't seem to find how to do it using wxPython. Anyone know how? It seems like an obvious thing to want to do.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":721,"Q_Id":4451166,"Users Score":1,"Answer":"Maybe I'm missing some nuance, there wasn't much info to go on, but it sounds like you could accomplish this by catching the keydown event, matching for enter and then calling your on_doubleclick function. Unless there's an implicit double-click handling you should be good to go.","Q_Score":2,"Tags":"python,windows,wxpython","A_Id":4451586,"CreationDate":"2010-12-15T14:50:00.000","Title":"Keyboard interface to wxPython listbox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to decide if it is better to use a pre-rendered large image for a scrolling map game or to render the tiles individual on screen each frame.  I have tried to program the game both ways and don't see any obvious difference in speed, but that might be due to my lack of experiences. \nBesides for memory, is there a speed reasons to not use a pre-rendered map?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":2637,"Q_Id":4451464,"Users Score":0,"Answer":"Depends on the size of the map you want to make, however, with the actual technologies it's very hard to see a tile-map \"rendered\" to take longer than expected, tiled based games are almost extinguished, however is always a good practice and a starting point to the world of game programming","Q_Score":5,"Tags":"python,pygame","A_Id":4474154,"CreationDate":"2010-12-15T15:12:00.000","Title":"Pygame: Tiled Map or Large Image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to decide if it is better to use a pre-rendered large image for a scrolling map game or to render the tiles individual on screen each frame.  I have tried to program the game both ways and don't see any obvious difference in speed, but that might be due to my lack of experiences. \nBesides for memory, is there a speed reasons to not use a pre-rendered map?","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":2637,"Q_Id":4451464,"Users Score":1,"Answer":"Memory and speed are closely related.  If your tile set fits in video memory, but the pre-rendered map doesn't, speed will suffer.","Q_Score":5,"Tags":"python,pygame","A_Id":4451504,"CreationDate":"2010-12-15T15:12:00.000","Title":"Pygame: Tiled Map or Large Image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to decide if it is better to use a pre-rendered large image for a scrolling map game or to render the tiles individual on screen each frame.  I have tried to program the game both ways and don't see any obvious difference in speed, but that might be due to my lack of experiences. \nBesides for memory, is there a speed reasons to not use a pre-rendered map?","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":2637,"Q_Id":4451464,"Users Score":5,"Answer":"The only reason I can think of for picking one over the other on modern hardware (anything as fast and with as much ram as, say, an iPhone), would be technical ones that make the game code itself easier to follow.  There's not much performance wise to distinguish them.\nOne exception I can think of, is if you are using a truly massive background, and doing tile rendering in a GPU, tiles can be textures and you'll get a modest speed bump since you don't need to push much data between cpu and gpu per frame, and it'll use very little video ram.","Q_Score":5,"Tags":"python,pygame","A_Id":4451490,"CreationDate":"2010-12-15T15:12:00.000","Title":"Pygame: Tiled Map or Large Image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a small Python app ready that I'd like to distribute around to my friends in the company. \nI have used wxWidgets for the GUI, with SQLite for the database.\nI'm planning on using py2exe for packaging the entire thing.\nI'd like to know if bundling the Python interpreter is required ? Does py2exe does it by default ? My friends wont have Python installed on their systems.\nAre there any extra libraries that I should bundle for the GUI ?\nI want this to run only on Windows, nothing else.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":725,"Q_Id":4463097,"Users Score":0,"Answer":"py2exe must bundle the Python interpreter--how else would your friends without Python use your program without it?  But it does, of course.\npy2exe mostly includes what needs to be included based on what is imported into your app, so if you have import sqlite3 in there, it will be included.  I'd try using GUI2Exe, it makes using py2exe so much more intuitive and easier.","Q_Score":0,"Tags":"python,installation,wxwidgets,executable,py2exe","A_Id":4467946,"CreationDate":"2010-12-16T16:37:00.000","Title":"Do I need to bundle the Python interpreter (in py2exe) when I am distributing my app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i want to change my progrssbar color to Black which is green. i think by default it is green\nI am trying with \nself.progress_bar.color \nbut doesnot reflect any change i think there will be any inbuilt method but i am unable to find it.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1414,"Q_Id":4468326,"Users Score":1,"Answer":"I'm guessing here, but because wxPython wraps native widgets whenever possible, those widgets may or may not support the changing of certain colors. I know that's true with StaticText on some OSes. So you may want to try with the generic progress bar, PyProgress, since it's written in pure Python and can be hacked easily.","Q_Score":1,"Tags":"wxpython","A_Id":4471136,"CreationDate":"2010-12-17T06:42:00.000","Title":"Want to change progress bar color to Black in wx python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently in the process of discovering OpenCL via the Python binding Clyther. So\nfar I am messing with a very simple script to get the sin or cos of a buffer of 65536. \nApparently 65536 is the limit for buffers on my card but say I'd have 16 million numbers in my buffer how would I go about it without constantly bringing the CPU into it to retrieve\/send data?\nWhat I have do so far is, fill buffer, run kernel, retrieve buffer, in a loop but that also\nhits the CPU badly.\nI looked a bit at OpenCL docs but I just failed to understand how that is achieved. \nThank you","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":156,"Q_Id":4470246,"Users Score":2,"Answer":"This awfully looks like you are using __constant memory. The solution is to use __global memory instead, but you have to be careful about how you access it for best performance.\n__constant memory is a special address space for often used constant values, but is restricted in size on current GPUs.","Q_Score":0,"Tags":"python,opencl","A_Id":4478655,"CreationDate":"2010-12-17T12:02:00.000","Title":"Processing buffers bigger than 65536 in Clyther\/OpenCL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I checked some other question and websites, and I've come to the conclusion that Python does allow (correct me if I'm wrong) you to make GUI programs using different cross-platform toolkits like Qt, wxWidgets and some others.\nBut what if I don't want cross-platform portability. Primary, I want to develop native application using native libraries like Cocoa for Mac, native libraries of Windows for window, GTK for GNOME and Qt for KDE apps different with different code. Different code is not an issue here. Can I do this? I just don't need cross-platform portability but I need to make native apps?\nAny insights from pro programmers ?","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":1951,"Q_Id":4471056,"Users Score":8,"Answer":"Don't waste your time. Use wxPython, which will use the native toolkit for you.","Q_Score":1,"Tags":"python,windows,qt,macos,wxwidgets","A_Id":4471107,"CreationDate":"2010-12-17T13:52:00.000","Title":"Python and native GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I were to write several classes in c++ then use swig to do the conversion so I could later use them in python, would they run faster or slower than if I completely rewrote them in python? Or is there no noticable speed difference?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3456,"Q_Id":4476663,"Users Score":6,"Answer":"The quality and speed of wrappers generated by SWIG is very good, and they will probably perform just as good as handcrafted wrappers. \nFrom my experience, the wrappers themselves are very thin and add very little overhead to the native functions they wrap, making it a perfectly valid choice to use wrapped libraries in python or any other supported language, and is a good way to reuse code.\nhowever, to be if you are interested in performance in addition to code reuse, wrapping native code will probably only pay off if you have some computationally intensive native functions, like multiplying matrices, computing MD5 or CRC, folding proteins etc.\non the other hand, sometimes you can just rewrite everything in an easy language like python or C# and enjoy better code and better tools, with comparable performance.","Q_Score":9,"Tags":"c++,python,performance,swig","A_Id":4484174,"CreationDate":"2010-12-18T04:38:00.000","Title":"Speed of swig wrappers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a configuration file for a C# app in IronPython.  Is there any way I can have that python file just return a value, or do I have to go through variables\/functions to access the results of the script?\ni.e., right now I've got Config.py that looks like\nx = \"test\"\nand C# code that goes\n\n                dynamic pyfile = Python.CreateRuntime().ExecuteFile(\"Config.py\");\n                Console.WriteLine(pyfile.x);\n\nIs there any way to remove the x?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":618,"Q_Id":4479679,"Users Score":3,"Answer":"You can create a ScriptSource with SourceCodeKind.AutoDetect and it will return the last expression in the file.","Q_Score":2,"Tags":"c#,dynamic,interop,ironpython","A_Id":4480156,"CreationDate":"2010-12-18T19:21:00.000","Title":"How to create an IronPython file that simply returns a single value to C#?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a messagebox class where I can just display a simple message box without a huge GUI library or any library upon program success or failure. (My script only does 1 thing). \nAlso, I only need it to run on Windows.","AnswerCount":6,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":53872,"Q_Id":4485610,"Users Score":2,"Answer":"You can also use the messagebox class from tkinter:\n    from tkinter import messagebox\nunless tkinter is that huge GUI you want to avoid.\nUsage is simple, ie:\n    messagebox.FunctionName(title, message [, options])\nwith FuntionName in (showinfo, showwarning, showerror, askquestion, askokcancel, askyesno, askretrycancel).","Q_Score":43,"Tags":"python,windows,user-interface,windows-7","A_Id":40915752,"CreationDate":"2010-12-19T22:58:00.000","Title":"Python Message Box Without huge library dependency","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am C\/C  \/Java programmer, but lately I have started learn Python. \nMoreover I have 3D Graphics on my studies. I have to create 3D model of my apartment, with dynamic camera. I am wondering if this is a good idea to merge this two issues, by writing this 3D model in python. \nHowever as I said, I am a python beginner, so I don't know possibilities, which python can give me in this area. Which libraries\/engine will be the best for a start?","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":425,"Q_Id":4490991,"Users Score":2,"Answer":"If you're solely trying to learn how to do a 3d model go for the language you're the most familiar with. I'd recommend C++ or C# in that case (whichever of the 2 you meant with the second C).\nIf you also want to learn more about the language Python is the better choice.\nBut pure language wise I wouldn't say that C++\/c#\/python beats the other.","Q_Score":5,"Tags":"python,3d","A_Id":4491082,"CreationDate":"2010-12-20T15:19:00.000","Title":"Is python is a good choice as language used to implementing my first 3D model?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have built PyQt4 from source and everything went smoothly until I tried to use some of the classes and attributes located in QtCore. For some reason QtCore is missing a lot of functionality and data that should be there. For example from PyQt4.QtCore import QT_VERSION_STR is an import error. There were no errors or warnings given when building the packages and I have also tried with the PyQt packages from yum but I have the same problem.\nHas anyone else encountered this problem before?\nThanks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":856,"Q_Id":4499204,"Users Score":0,"Answer":"If it's really an ImportError, that suggests that it's failing to import the library altogether. Check that it's definitely somewhere that's in your sys.path, and that from PyQt4 import QtCore works.\nIf the library exists, and QT_VERSION_STR doesn't exist, it will give you a NameError rather than an ImportError.","Q_Score":0,"Tags":"python,linux,qt4,pyqt","A_Id":4499868,"CreationDate":"2010-12-21T12:25:00.000","Title":"PyQt4.QtCore doesn't contain many of its classes and attributes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have built PyQt4 from source and everything went smoothly until I tried to use some of the classes and attributes located in QtCore. For some reason QtCore is missing a lot of functionality and data that should be there. For example from PyQt4.QtCore import QT_VERSION_STR is an import error. There were no errors or warnings given when building the packages and I have also tried with the PyQt packages from yum but I have the same problem.\nHas anyone else encountered this problem before?\nThanks.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":856,"Q_Id":4499204,"Users Score":0,"Answer":"The reason for this problem was a conflict in my python path. I had two modules named sip.py in different locations on my python path, the python path was using the first one but I wanted it to use the second one. I removed the first entry from the python path as it wasn't necessary.","Q_Score":0,"Tags":"python,linux,qt4,pyqt","A_Id":4592960,"CreationDate":"2010-12-21T12:25:00.000","Title":"PyQt4.QtCore doesn't contain many of its classes and attributes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"With wxPython, how does one trigger an event whenever the whole window goes into\/out of focus?  \nTo elaborate, I'm building a serial terminal GUI and would like to close down the connection whenever the user doesn't have my application selected, and re-open the connection whenever the user brings my app back into the foreground.  My application is just a single window derived from wx.Frame.","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":2304,"Q_Id":4505097,"Users Score":2,"Answer":"In addition to what these fellows are saying, you might also want to try EVT_ENTER_WINDOW and EVT_LEAVE_WINDOW. I think these are fired when you move the mouse into and out of the frame widget, although I don't think the frame has to be in focus for those events to fire.\n@ Hugh - thanks for the readership!","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":4510733,"CreationDate":"2010-12-22T00:01:00.000","Title":"wxPython Whole Window Focus Event","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"With wxPython, how does one trigger an event whenever the whole window goes into\/out of focus?  \nTo elaborate, I'm building a serial terminal GUI and would like to close down the connection whenever the user doesn't have my application selected, and re-open the connection whenever the user brings my app back into the foreground.  My application is just a single window derived from wx.Frame.","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":2304,"Q_Id":4505097,"Users Score":2,"Answer":"as WxPerl programmer i know there is \nEVT_SET_FOCUS(\nEVT_KILL_FOCUS(\nif you initialize this event by listening to the frame as first parameter it should work as in Perl since the API is almost the same","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":4505382,"CreationDate":"2010-12-22T00:01:00.000","Title":"wxPython Whole Window Focus Event","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"With wxPython, how does one trigger an event whenever the whole window goes into\/out of focus?  \nTo elaborate, I'm building a serial terminal GUI and would like to close down the connection whenever the user doesn't have my application selected, and re-open the connection whenever the user brings my app back into the foreground.  My application is just a single window derived from wx.Frame.","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":2304,"Q_Id":4505097,"Users Score":5,"Answer":"The correct answer for this case is to use an EVT_ACTIVATE handler bound to the frame.  There will be an event whenever the frame is activated (brought into the foreground relative to other windows currently open) or deactivated.  You can use the event object's GetActive method to tell which just happened.","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":4521758,"CreationDate":"2010-12-22T00:01:00.000","Title":"wxPython Whole Window Focus Event","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hi I'm a techie with no programing experience. I know html and css, but I'd like to someday be able to make an app for my phone (I have an android) and possibly mobile websites. \nI made learning a programing language and creating a mobile app a goal for my job, and now my boss would like me to pick a programing language to learn. I found a free open course from MIT (http:\/\/ocw.mit.edu\/courses\/electrical-engineering-and-computer-science\/6-00-introduction-to-computer-science-and-programming-fall-2008\/) called introduction to computer science. In the course they teach python, but more importantly it seems they teach how to think like a programmer. \nWhen I told my boss about the free online course she didn't think that Python was an appropriate language for me to learn. She'd like me to learn a language that is more similar to one used to make Phone apps. Does anyone out there know a better language for me to pick up that would be similar to Android or iPhone's App language. \nThank you","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":352,"Q_Id":4514389,"Users Score":0,"Answer":"Python is a good beginning language, but you need to ensure that you do more than just course work.\nWhy not just run through tutorials on Android development right off the bat? If you are worried about wasting time by not using Java immediately, then why not just start there?","Q_Score":1,"Tags":"iphone,python,android","A_Id":4514409,"CreationDate":"2010-12-22T22:41:00.000","Title":"Beginner's Language app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Hi I'm a techie with no programing experience. I know html and css, but I'd like to someday be able to make an app for my phone (I have an android) and possibly mobile websites. \nI made learning a programing language and creating a mobile app a goal for my job, and now my boss would like me to pick a programing language to learn. I found a free open course from MIT (http:\/\/ocw.mit.edu\/courses\/electrical-engineering-and-computer-science\/6-00-introduction-to-computer-science-and-programming-fall-2008\/) called introduction to computer science. In the course they teach python, but more importantly it seems they teach how to think like a programmer. \nWhen I told my boss about the free online course she didn't think that Python was an appropriate language for me to learn. She'd like me to learn a language that is more similar to one used to make Phone apps. Does anyone out there know a better language for me to pick up that would be similar to Android or iPhone's App language. \nThank you","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":352,"Q_Id":4514389,"Users Score":1,"Answer":"Learn to program first before learning how to develop for the iPhone.  That will give you a much better chance at success.  Python a perfectly good language for learning to program, especially in the context of an Intro to CS course environment.  But any intro programming language environment will do (even one designed for kids).\nOnce you're comfortable writing non-trivial programs in Python (or whatever first computer language you choose), learning Objective C and the iOS APIs (or Java and the Android APIs) will become much much easier, compared with starting from scratch and zero programming background.","Q_Score":1,"Tags":"iphone,python,android","A_Id":4514481,"CreationDate":"2010-12-22T22:41:00.000","Title":"Beginner's Language app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a wx.FileDialog (with the wx.FD_OPEN flag) & I would like to know if I can (& how) I could change the button in the bottom right of the FileDialog from \"Open\" to \"Create\" or \"Delete\", etc.\nWhat I am doing is I have a button with the text \"Delete Portfolio\", when pressed it opens a FileDialog & allows the user to select a portfolio file(.db) to delete. So instead of the File Dialog's bottom right confirm button displaying \"Open\" I would like to be able to change the text to \"Confirm\" or \"Delete\" or whatever.\nIs this possible, its a rather superficial thing to do, but if the button says open when the user wants to select a file to delete, it can be a little confusing even if the title of the dialog says \"please select a file to delete\"","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":691,"Q_Id":4529991,"Users Score":0,"Answer":"If you are using the native controls, which wx tends to use, then you probably can't.","Q_Score":2,"Tags":"python,wxpython","A_Id":4530426,"CreationDate":"2010-12-25T10:17:00.000","Title":"wxPython: Change a buttons text in a wx.FileDialog","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wx.FileDialog (with the wx.FD_OPEN flag) & I would like to know if I can (& how) I could change the button in the bottom right of the FileDialog from \"Open\" to \"Create\" or \"Delete\", etc.\nWhat I am doing is I have a button with the text \"Delete Portfolio\", when pressed it opens a FileDialog & allows the user to select a portfolio file(.db) to delete. So instead of the File Dialog's bottom right confirm button displaying \"Open\" I would like to be able to change the text to \"Confirm\" or \"Delete\" or whatever.\nIs this possible, its a rather superficial thing to do, but if the button says open when the user wants to select a file to delete, it can be a little confusing even if the title of the dialog says \"please select a file to delete\"","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":691,"Q_Id":4529991,"Users Score":1,"Answer":"Yeah, I agree with Arafangion. wxPython uses the native widgets and can only manipulate them in whatever way that native widgets allow. You would need to create a custom dialog to do this.","Q_Score":2,"Tags":"python,wxpython","A_Id":4539977,"CreationDate":"2010-12-25T10:17:00.000","Title":"wxPython: Change a buttons text in a wx.FileDialog","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"my question is quite simple, but I can't move on until I solve it. I want to develop a card game, something like Magic the Gathering. I suppose there will be just a little of animation, but much work with images, image transformation and special rendering - some kind of things, that every unit has now attack plus 2 so cards on table will adapt.\nI thought Python will be best for it, because it easy to develop with it and I know it pretty well. Also I have a little of experience with PyQt and Pygame. But I can't decide which one is better for that purpose. What do you think will be easier to use: PyQt, Pygame or something else?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2261,"Q_Id":4530901,"Users Score":3,"Answer":"if you want just a simple animation and want to finish your game fast. use the pyqt's scene view. refer to (Rapid GUI programming using python and pyqt) book if you want to learn more about scene view.","Q_Score":1,"Tags":"python,pyqt,pygame","A_Id":4562183,"CreationDate":"2010-12-25T17:02:00.000","Title":"what framework to use for python card game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"my question is quite simple, but I can't move on until I solve it. I want to develop a card game, something like Magic the Gathering. I suppose there will be just a little of animation, but much work with images, image transformation and special rendering - some kind of things, that every unit has now attack plus 2 so cards on table will adapt.\nI thought Python will be best for it, because it easy to develop with it and I know it pretty well. Also I have a little of experience with PyQt and Pygame. But I can't decide which one is better for that purpose. What do you think will be easier to use: PyQt, Pygame or something else?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2261,"Q_Id":4530901,"Users Score":0,"Answer":"Both pygame and pyqt will work for what you want to do, but I'd recommend pyqt: you'll be able to use standard widgets (like listboxes, textboxes, menus, buttons, ...).\nI've never worked with pyqt myself, but I image that drag 'n drop is something built-in, which will be really useful for a card game.\nWith pygame on the other hand you'll have to make everything yourself. This will give it more of a game feel as you can draw everything exactly like you want it to look like, but it'll take more work as you have to implement basic stuff yourself.","Q_Score":1,"Tags":"python,pyqt,pygame","A_Id":4562270,"CreationDate":"2010-12-25T17:02:00.000","Title":"what framework to use for python card game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to pyglet. I'd like to change a pixel from black to white at each on_draw iteration. So after 1000 iterations, there should be exactly 1000 white pixels in the window. However, I'd like to avoid calling 1000 draw operations in on_draw for that. So I'd like to create an image, do an RGB putpixel on the image, and blit the image to the screen. How can I do that? The pyglet documentation, the examples and the source code aren't too helpful on this.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1298,"Q_Id":4532008,"Users Score":0,"Answer":"It seems there is no easy way to do this in pyglet. So I've given up on using pyglet.","Q_Score":1,"Tags":"python,image,pyglet","A_Id":5832879,"CreationDate":"2010-12-25T22:51:00.000","Title":"putpixel with pyglet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a PyQt application that reads and writes data files. I am including a 'version number' in each file written.  This is a simple number similar to: 1.2  or something (major and minor versions).\nI am doing this so that I can change the format of these data files in future versions and then still correctly parse them simply by checking to see what the version is inside the file.\nMy question is what is the best practice for keeping this number stored inside the app itself.  I.e. do I just hard-code the app version number into the class that is responsible for reading and writing files?  Or should I have some sort of object\/variable stored at the top-level of the app and somehow access it from the class responsible for reading and writing these files.  If the latter, how do I store it and how do I access it?\nThanks.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3932,"Q_Id":4535895,"Users Score":0,"Answer":"Personally, I wouldn't do it manually this way.  I'd save my code in Subversion and let it maintain the revision numbers for me.","Q_Score":5,"Tags":"python,version,global-variables","A_Id":4535921,"CreationDate":"2010-12-26T23:43:00.000","Title":"Python: Best practice for including a version number in an app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've incorporated IronPython into my XNA game on Windows, but, of course, that won't work on the compact framework since the DLR stuff isn't available.\nAre there any scripting object implementations available that will work with the compact framework? It's really convenient to be able to tweak the system real-time without having to recompile.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":446,"Q_Id":4556096,"Users Score":1,"Answer":"Most things in IronRuby will work on the compact framework (it runs on Windows Phone today).  You may need to deploy the DLR yourself but because it's just an additional library it is possible to run it.  IronPython could be made to work but it'll require some work to avoid doing code generation where it does today which is not possible on the compact framework.","Q_Score":1,"Tags":"ironpython,xbox360,xna-4.0","A_Id":4566611,"CreationDate":"2010-12-29T17:05:00.000","Title":"XNA - scripting on XBOX?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to check if part or an entire window is over\/under another window in python?\nI have two windows and I'd like to make them not appear over each other. This is in Windows, using Tkinter.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":79,"Q_Id":4566330,"Users Score":1,"Answer":"You can use the methods winfo_rootx and winfo_rooty to get the x\/y in the upper left corner.  You can use winfo_width and winfo_height to get the width and height of the window. From that it's just a little math to figure out if two windows overlap. You can then use the geometry method to position the windows anywhere on the screen.","Q_Score":1,"Tags":"python,tkinter","A_Id":4570554,"CreationDate":"2010-12-30T21:15:00.000","Title":"Making windows not appear over each other","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a somehow complex application:\nIt is a game level editor. You can put in tiles and other objects for a level. Then \"compress\" the level data into a file.\nWith another application, it will read the file's data and play the game.\nThe application is for Windows mainly. Other platforms are yet to be considered.\nSo I need help deciding:\nIf you were to do something like what I described, which programming language would you choose?\nI want to decide between Ruby or Python.\nI want you to help me choose depending on my following needs:\n\nEasy GUI platform for making the editor.\nCan show sprites, move, transform them etc.\nCan play audio.\nCan compress data, graphics and audio. The compressed file can only be read by another application I make.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":955,"Q_Id":4577156,"Users Score":1,"Answer":"I've never used Ruby but I'm sure there is virtually no difference between the 2 when it comes to libraries.  I know what you want can be done with Python using wxPython or pygame (or the combination of two).  But I'm sure there are similar libs for Ruby.  So just look at both languages and use the one you like better.","Q_Score":0,"Tags":"python,ruby,user-interface","A_Id":4577169,"CreationDate":"2011-01-02T04:38:00.000","Title":"Making a somehow complex application: Ruby vs Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I want to create a somehow complex application:\nIt is a game level editor. You can put in tiles and other objects for a level. Then \"compress\" the level data into a file.\nWith another application, it will read the file's data and play the game.\nThe application is for Windows mainly. Other platforms are yet to be considered.\nSo I need help deciding:\nIf you were to do something like what I described, which programming language would you choose?\nI want to decide between Ruby or Python.\nI want you to help me choose depending on my following needs:\n\nEasy GUI platform for making the editor.\nCan show sprites, move, transform them etc.\nCan play audio.\nCan compress data, graphics and audio. The compressed file can only be read by another application I make.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":955,"Q_Id":4577156,"Users Score":4,"Answer":"Python + PyGame. Hands down. You will benefit from:\n\nGood docs for both the language and PyGame\nGUI, sprites, and audio all in one, again with PyGame\nBetter Windows support than Ruby (you can install both Python and PyGame from .exes)\n\nDesktop applications (esp. for Windows) aren't really Ruby's sweet spot. PyGame will serve your purposes perfectly, though.\nThat's not to say you couldn't do it with Ruby; you could write this in any language. But for ease of use, Python is the way to go.","Q_Score":0,"Tags":"python,ruby,user-interface","A_Id":4577168,"CreationDate":"2011-01-02T04:38:00.000","Title":"Making a somehow complex application: Ruby vs Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'd like to try my hand at some PC game development.  I keep hearing that python is slow compared to C++.  Is this something I should be worried about?  \nI am more familiar with python than C++.  If I'm looking to make some games, should I take the time to learn C++ or just stick with Python?","AnswerCount":5,"Available Count":4,"Score":0.1586485043,"is_accepted":false,"ViewCount":13393,"Q_Id":4578307,"Users Score":4,"Answer":"The kind of game matters immensely. High performance games like the big name PC or console games are almost exclusively the domain of C++.\nCasual games can be written in almost any language, including slower languages like Python.\nIf you're a garage type developer who gets his hands wet with some simple game development for this first time, Python would be more than enough. If you however have the ambition to work for a game developer studio, I would definitely recommend learning C++.","Q_Score":8,"Tags":"python,performance","A_Id":4578373,"CreationDate":"2011-01-02T12:15:00.000","Title":"How \"slow\" is python for game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to try my hand at some PC game development.  I keep hearing that python is slow compared to C++.  Is this something I should be worried about?  \nI am more familiar with python than C++.  If I'm looking to make some games, should I take the time to learn C++ or just stick with Python?","AnswerCount":5,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":13393,"Q_Id":4578307,"Users Score":6,"Answer":"Elebenty-seven.\nNo, really, it's fast enough for most things, and can drop to C when you really need speed. Profile twice, optimize once.","Q_Score":8,"Tags":"python,performance","A_Id":4578311,"CreationDate":"2011-01-02T12:15:00.000","Title":"How \"slow\" is python for game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to try my hand at some PC game development.  I keep hearing that python is slow compared to C++.  Is this something I should be worried about?  \nI am more familiar with python than C++.  If I'm looking to make some games, should I take the time to learn C++ or just stick with Python?","AnswerCount":5,"Available Count":4,"Score":-0.1194272985,"is_accepted":false,"ViewCount":13393,"Q_Id":4578307,"Users Score":-3,"Answer":"C++ is much more easier for object orientation.  When you're doing things, it's easier to keep track of everything, because most IDEs for C++ are more based on projects, were as IDLE is more based on single files.  \nThe bottom line is for game development, use what you're comfortable with using.  I mean, game development is about what you want to do, not what would be better, because better == what you want.","Q_Score":8,"Tags":"python,performance","A_Id":15419304,"CreationDate":"2011-01-02T12:15:00.000","Title":"How \"slow\" is python for game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to try my hand at some PC game development.  I keep hearing that python is slow compared to C++.  Is this something I should be worried about?  \nI am more familiar with python than C++.  If I'm looking to make some games, should I take the time to learn C++ or just stick with Python?","AnswerCount":5,"Available Count":4,"Score":0.0798297691,"is_accepted":false,"ViewCount":13393,"Q_Id":4578307,"Users Score":2,"Answer":"Many if not most top-end commercial games these days include some kind of scripting engine for game logic. Game logic decisions, for the most part, aren't particularly performance-sensitive in the way that e.g. the rendering engine is.\nBTW - I'm not claiming any insider knowledge of game development - this is fairly well known outside the industry. Some games publishers have even allowed users access to the scripting stuff and other tools for games modding - for years.\nIf you find a game engine that is wrapped to be used in Python, you'll be dealing with the same basic principles. Write the game logic in Python, and you'll probably be fine.\nPyGame is basically SDL wrapped for Python, supporting basic 2D games for the most part (though OpenGL can be used for 3D in SDL - not sure for PyGame).\nIt's a good starting point. You may hit a performance issue with managing your game objects and running your blit loop, since only very basic graphics stuff is handled by SDL, but you should find that it's just fine for most things.\nAs Ignacio implies - worry about performance problems when you know you have performance problems, not before. Some performance problems are predictable in advance, but if you're not writing the actual game engine in Python, you should be OK - don't fall into the premature optimisation trap, IOW.","Q_Score":8,"Tags":"python,performance","A_Id":4578381,"CreationDate":"2011-01-02T12:15:00.000","Title":"How \"slow\" is python for game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a PyQt3 (Or 4) Windows binary installer for Python 2.3? I've googled around for an hour now but to no avail. Why am I using version 2.3? With my project file size is paramount. Without the interface, un-needed modules and compressing using UPX the resulting .exe size is a mear 750KB's. Just need to add the interface which will beaf the size up considerably I know but it will still be a good size.\nSo anyone know how I can install PyQt3 or 4 with Python2.3?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":209,"Q_Id":4588045,"Users Score":3,"Answer":"Python 2.3 is extremely old. You really shouldn't be using it at all. I seriously doubt there's any qt bindings for it that would even compile. Why do you think using python 2.3 will save you so much file size?\nAdding pyqt will probably increase your file size by 10s of megabytes at least. Just use python at least 2.6. This is definitely a case of premature optimization. And optimizing something stupid like file size.","Q_Score":0,"Tags":"python,pyqt,python-2.3","A_Id":4588075,"CreationDate":"2011-01-03T20:24:00.000","Title":"PyQt & Python2.3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am building a window application written in C++. I'd like to utilize several python libraries. \nI don't need any fancy Python interop here. My method is like this:\n\nOpen a thread to run Python interpreter. \nSend commands from C++ to the Python interpreter. The C++ may need to write some intermediate files for the interop. \n\nThis method is dirty, but it will work for a lot of interpreter-like environments, e.g. gnuplot, lua.\nMy question is that what kind of API are there for me to use for this task. Maybe I need some Win32 API?\nEDIT: I don't need any Python specific. I really want the general method. So that my application could also work with gnuplot, etc..","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1517,"Q_Id":4596013,"Users Score":2,"Answer":"ActivePython (http:\/\/www.activestate.com\/activepython\/downloads) installs itself as an ActiveScript engine.The ProgID is Python.AXScript.2 . So you can use it with COM via the Windows standard IActiveScript interface. Read up on it.\nDistribution is another matter. Either you require that customers have it, or you could try and extract the juicy bits from the ActiveState's package, or maybe there's an official way to do unattended setup...","Q_Score":4,"Tags":"c++,python,winapi,api","A_Id":4596102,"CreationDate":"2011-01-04T16:38:00.000","Title":"Embed a Python interpreter in a (Windows) C++ application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am trying to display a simple graph using pydot.\nMy question is that is there any way to display the graph without writing it to a file as currently I use write function to first draw and then have to use the Image module to show the files. \nHowever is there any way that the graph directly gets printed on the screen without being saved ??\n\nAlso as an update I would like to ask in this same question that I observe that while the image gets saved very quickly when I use the show command of the Image module it takes noticeable time for the image to be seen .... Also sometimes I get the error that the image could'nt be opened because it was either deleted or saved in unavailable location which is not correct as I am saving it at my Desktop..... Does anyone know what's happening and is there a faster way to get the image loaded.....\nThanks a lot....","AnswerCount":7,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":27874,"Q_Id":4596962,"Users Score":0,"Answer":"I'm afraid pydot uses graphviz to render the graphs. I.e., it runs the executable and loads the resulting image.\nBottom line - no, you cannot avoid creating the file.","Q_Score":28,"Tags":"python,pydot","A_Id":4597838,"CreationDate":"2011-01-04T18:19:00.000","Title":"Display graph without saving using pydot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've created a little screensaver-type program with Python, and I'd like to get it working properly under gnome-screensaver. The documentation is all written for C, and there don't appear to be libraries for Python. Is there any way to get this working?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":567,"Q_Id":4597080,"Users Score":2,"Answer":"gnome-screensaver doesn't integrate with the screensavers any more than with a small config file that sets the name, some other properties, and a command to execute to start the screensaver. This is documented in the gnome-screensaver FAQ.\nThe program that gets started needs to get the Window ID from the environment (XSCREENSAVER_WINDOW), and start displaying on that window. This is the tricky part, as it's not always obvious how to do that. Most toolkits should have methods to get a handle on an already existing window by giving the ID, so search your GUI-toolkit documentation for something like that.","Q_Score":2,"Tags":"python,gnome,screensaver","A_Id":4597542,"CreationDate":"2011-01-04T18:34:00.000","Title":"Gnome-Screensaver with Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to get what lines are currently visible in a Tkinter text widget? I'm trying to make a scrollbar. \nCurrently I'm trying to coordinate my scroll bar with the other methods of scrolling (ie, the arrow keys and scroll wheel). So that when I scroll with the arrow keys or mouse, my bar scrolls too.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1674,"Q_Id":4610074,"Users Score":4,"Answer":"You can get the character (and thus, the line number) at a pixel position using an index of @x,y (eg: @0,0 for the top-left-most visible character). Since you know the width and height of the widget (using the winfo_width and winfo height methods) you can calculate what lines are at the bottom of the widget too.\nYou can also use the yview method to get the relative portion of the text that is in view (eg: a value of .5 means you are half way through the document)","Q_Score":1,"Tags":"python,tkinter","A_Id":4611229,"CreationDate":"2011-01-05T22:59:00.000","Title":"Visible lines in Tkinter text widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i am trying below code still it is giving me horizontal line..i am missing something?\nself.ln = wx.StaticLine(self,-1,wx.Point(620,0), wx.Size(687,7),wx.LI_VERTICAL)\nself.ln.SetForegroundColour(wx.Colour(255,0,255))","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":6448,"Q_Id":4623031,"Users Score":0,"Answer":"thanks for ur reply\ngot it now..i was missing style keyword ..earliar it has not given error thats why \ndidnot found it\nself.ln = wx.StaticLine(self, -1, size=(4,479),style=wx.LI_VERTICAL)","Q_Score":4,"Tags":"wxpython","A_Id":4623890,"CreationDate":"2011-01-07T06:24:00.000","Title":"How to draw vertical line using wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Simply, I'm developing a wireless ECG (electrocardiogram, or EKG from the German Elektrokardiogramm) and I need to choose the best language for a desktop application that allows the following:\n\nwireless transmission of data over WiFi\nreal-time graphing of ECG data signal\na good DSP library\n\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":883,"Q_Id":4623047,"Users Score":1,"Answer":"From the viewpoint of a normal program (i.e., not a device driver) a Wi-Fi connection is just a network connection -- not noticeably different from (for example) a wired Ethernet connection.\nReal-time graphing and digital signal processing libraries are probably a little less common, but not much. \"Real time\" is one of those slippery phrases that it's hard to pin down exactly what it means (different people use it differently). At a guess, you just mean you want to update the graph as data arrives. In that case, the important question is what bandwidth you're dealing with -- i.e., how many updates of how much information, how fast?\nBottom line -- none of what you've told us gives much in the way of real criteria for picking a language to use. The obvious open question would be performance -- how much data you need to process, and how much processing you need to do on it. That might at least hint at one being better than another.","Q_Score":1,"Tags":"c#,java,c++,python,c","A_Id":4623129,"CreationDate":"2011-01-07T06:26:00.000","Title":"ECG\/EKG software language advice","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i' have downloaded boost 1.45.0, installed Python 3.1.3 on my mac.\nI have the build Boost with Python succesfully.\nFor this i had to edit my \"project-config.jam\" and add \"using python : 3.1 : \/Library\/Frameworks\/Python.framework\/Versions\/3.1;\" into it.\nAt this point all seems to be allright.\nNow when i try to use this lib in an xcode project, i have link errors:\n\nUndefined symbols:\n    \"boost::python::objects::make_nurse_and_patient(_object*, _object*)\", referenced from:\n        _object* boost::python::with_custodian_and_ward_postcall<0ul, 1ul, boost::python::default_call_policies>::postcall<_object*>(_object* const&, _object*)in libFluxCore.a(Python.o)\n    \"boost::python::objects::enum_base::enum_base(char const*, _object* ()(void const), void* (*)(_object*), void (*)(_object*, boost::python::converter::rvalue_from_python_stage1_data*), boost::python::type_info, char const*)\", referenced from:\n        sandbox::BindComponentState()      in libFluxCore.a(Python.o)\n        sandbox::BindCallOptions()      in libFluxCore.a(Python.o)\n        sandbox::BindFrameRate()      in libFluxCore.a(Python.o)\n\nAnd lot of more...\nPaths and lib are well set in my project.\nDoes someone have an idea of what can happen ?\nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":380,"Q_Id":4623930,"Users Score":0,"Answer":"I'v finally found this error. buid boost python with \n.\/bjam toolset=darwin-4.2 architecture=x86 address-model=32 link=static threading=multi runtime-link=static\ndid the job, as i am on i86 arch.","Q_Score":0,"Tags":"xcode,boost-python","A_Id":4627509,"CreationDate":"2011-01-07T09:01:00.000","Title":"Linker issue with boost python on Xcode","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to draw to ttkinter.Canvas like javascript or .NET canvas?\nI.E drawline() without storing an object for that line which can be manipulated later.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":248,"Q_Id":4625108,"Users Score":1,"Answer":"I'm not sure what you mean by \"storing an object\". The canvas gives each thing you draw an id, but you don't have to store it. You can't prevent the canvas from assigning an id to the object but are free to completely ignore it.\nWhat problem are you trying to solve where you perceive this to be an issue?\n[edit] To clarify: yes, the interpreter keeps some sort of data for each thing that is drawn. It's not an object in the sense of a Python object though. It's more like a location in memory that describes the thing that was drawn.","Q_Score":1,"Tags":"python,python-3.x,tkinter","A_Id":4625172,"CreationDate":"2011-01-07T11:38:00.000","Title":"Using tkinter.Canvas stateless-ly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i want to implement 1024x1024 monochromatic grid , i need read data from any cell and insert rectangles with various dimensions, i have tried to make list in list ( and use it like 2d array ), what i have found is that list of booleans is slower than list of integers.... i have tried 1d list, and it was slower than 2d one, numpy is slower about 10 times that standard python list, fastest way that i have found is PIL and monochromatic bitmap used with \"load\" method, but i want it to run a lot faster, so i have tried to compile it with shedskin, but unfortunately there is no pil support there, do you know any way of implementing such grid faster without rewriting it to c or c++ ?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":651,"Q_Id":4637190,"Users Score":0,"Answer":"One thing I might suggest is using Python's built-in array class (http:\/\/docs.python.org\/library\/array.html), with a type of 'B'. Coding will be simplest if you use one byte per pixel, but if you want to save memory, you can pack 8 to a byte, and access using your own bit manipulation.","Q_Score":3,"Tags":"python,bitmap,performance","A_Id":4637207,"CreationDate":"2011-01-09T01:31:00.000","Title":"Python Fast monochromatic bitmap","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i want to implement 1024x1024 monochromatic grid , i need read data from any cell and insert rectangles with various dimensions, i have tried to make list in list ( and use it like 2d array ), what i have found is that list of booleans is slower than list of integers.... i have tried 1d list, and it was slower than 2d one, numpy is slower about 10 times that standard python list, fastest way that i have found is PIL and monochromatic bitmap used with \"load\" method, but i want it to run a lot faster, so i have tried to compile it with shedskin, but unfortunately there is no pil support there, do you know any way of implementing such grid faster without rewriting it to c or c++ ?","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":651,"Q_Id":4637190,"Users Score":2,"Answer":"Raph's suggestin of using array is good, but it won't help on CPython, in fact I'd expect it to be 10-15% slower, however if you use it on PyPy (http:\/\/pypy.org\/) I'd expect excellent results.","Q_Score":3,"Tags":"python,bitmap,performance","A_Id":4637284,"CreationDate":"2011-01-09T01:31:00.000","Title":"Python Fast monochromatic bitmap","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having problem with drawing in pydot. \nThe problem lies in defining the layout of the nodes created. Currently everything is drawn vertically and is not spread. This gives me the problem of going down to see the nodes created.\nIs there any way I can define the nodes to be created horizontally whenever they are very large in number??\nAlso I want to display mathematical symbols in the labels. But I have not been able to find how to do that. \nIf anyone knows please do tell how I can write epsilon and lambda in the labels from one node to another....\nThanks a lot...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":419,"Q_Id":4638806,"Users Score":0,"Answer":"I found out that writing the string in unicode representation shows mathematical symbols as edges...\nFor example you can write node = pydot.Node(\"&#949;\",shape = \"ellipse\", style=\"filled\", fillcolor=\"turquoise\")\nUsing this we get epsilon as label of the node....\nSimilarly we can get rest of the mathematical symbols....","Q_Score":1,"Tags":"python,pydot","A_Id":4844143,"CreationDate":"2011-01-09T11:07:00.000","Title":"changing layout and inserting mathematical symbols with pydot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPython application that is almost done & I would like to place it in my portfolio. I have to consider when someone attempts to run my app that they may not have Python, or wxPython, so if they just click the main script\/python file its not going to run, right?\nHow should I distribute my app (how do you distribute ur apps) so that it can be run & also so that it could be run on the 3 major OS's (Unix, Windows, MacOSX)?\nI know of py2exe for releasing under windows, but what can I use for Unix & MacOSX to compile the program? Whats the easiest way?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1685,"Q_Id":4643247,"Users Score":1,"Answer":"I suggest both, script for all platforms and frozen binary for lazy windows users.\nTo answer your latest question, you don't compile python. Python is an interpreted language, it gets compiled on the fly when run. A python frozen binary is actually the python interpreter with your script hardcoded in it. And frozen binaries are windows-only, AFAIK. Besides, Unix and MacOS (usually) come with python pre-installed.","Q_Score":3,"Tags":"python,wxpython","A_Id":4643279,"CreationDate":"2011-01-10T02:33:00.000","Title":"Releasing a wxPython App: Give out scripts or compile in Exe, etc?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"My cocoa app runs background tasks, which I would like to stop when the user becomes idle (no keyboard\/mouse input) and then resume when the user becomes active again. Is there a way to register for idle-state notifications?","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":3011,"Q_Id":4643579,"Users Score":1,"Answer":"I used a different approach. \nSubclassing UIApplication I override the sendEvent method filtering touches (actually you can filter any kind of event, acceleration, touches, etc.).\nUsing a shared variable and a background timer I managed the \"idle\".\nEvery time the user touch the screen the variable is set with current timeInterval (current time). \nThe timer fire method checks for the elapsed time since last touch, if greater than the threshold (in my case was around 90seconds) you can POST your own notification. \nI used this simple approach to create a custom set of apps that after some idle time automatically call the \"screensaver\" app. \nNothing clever, it just do the job.\nHope that helps.","Q_Score":7,"Tags":"objective-c,time,python-idle","A_Id":9402960,"CreationDate":"2011-01-10T03:59:00.000","Title":"Objective C: Get notifications about a user's idle state","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"is it possible to convert a Python program to C\/C++?\nI need to implement a couple of algorithms, and I'm not sure if the performance gap is big enough to justify all the pain I'd go through when doing it in C\/C++ (which I'm not good at). I thought about writing one simple algorithm and benchmark it against such a converted solution. If that alone is significantly faster than the Python version, then I'll have no other choice than doing it in C\/C++.","AnswerCount":8,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":475467,"Q_Id":4650243,"Users Score":163,"Answer":"If the C variant needs x hours less, then I'd invest that time in letting the algorithms run longer\/again\n\n\"invest\" isn't the right word here.\n\nBuild a working implementation in Python.  You'll finish this long before you'd finish a C version.\nMeasure performance with the Python profiler.  Fix any problems you find.  Change data structures and algorithms as necessary to really do this properly.  You'll finish this long before you finish the first version in C. \nIf it's still too slow, manually translate the well-designed and carefully constructed Python into C.\nBecause of the way hindsight works, doing the second version from existing Python (with existing unit tests, and with existing profiling data) will still be faster than trying to do the C code from scratch.\n\nThis quote is important.\n\nThompson's Rule for First-Time Telescope Makers\n  It is faster to make a four-inch mirror and then a six-inch mirror than to make a six-inch mirror.\nBill McKeenan\n  Wang Institute","Q_Score":202,"Tags":"c++,python,c,code-generation","A_Id":4650953,"CreationDate":"2011-01-10T18:46:00.000","Title":"Convert Python program to C\/C++ code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"is it possible to convert a Python program to C\/C++?\nI need to implement a couple of algorithms, and I'm not sure if the performance gap is big enough to justify all the pain I'd go through when doing it in C\/C++ (which I'm not good at). I thought about writing one simple algorithm and benchmark it against such a converted solution. If that alone is significantly faster than the Python version, then I'll have no other choice than doing it in C\/C++.","AnswerCount":8,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":475467,"Q_Id":4650243,"Users Score":12,"Answer":"I know this is an older thread but I wanted to give what I think to be helpful information.\nI personally use PyPy which is really easy to install using pip. I interchangeably use Python\/PyPy interpreter, you don't need to change your code at all and I've found it to be roughly 40x faster than the standard python interpreter (Either Python 2x or 3x). I use pyCharm Community Edition to manage my code and I love it. \nI like writing code in python as I think it lets you focus more on the task than the language, which is a huge plus for me. And if you need it to be even faster, you can always compile to a binary for Windows, Linux, or Mac (not straight forward but possible with other tools). From my experience, I get about 3.5x speedup over PyPy when compiling, meaning 140x faster than python. PyPy is available for Python 3x and 2x code and again if you use an IDE like PyCharm you can interchange between say PyPy, Cython, and Python very easily (takes a little of initial learning and setup though). \nSome people may argue with me on this one, but I find PyPy to be faster than Cython. But they're both great choices though.\nEdit: I'd like to make another quick note about compiling: when you compile, the resulting binary is much bigger than your python script as it builds all dependencies into it, etc. But then you get a few distinct benefits: speed!, now the app will work on any machine (depending on which OS you compiled for, if not all. lol) without Python or libraries, it also obfuscates your code and is technically 'production' ready (to a degree). Some compilers also generate C code, which I haven't really looked at or seen if it's useful or just gibberish. Good luck.\nHope that helps.","Q_Score":202,"Tags":"c++,python,c,code-generation","A_Id":37192125,"CreationDate":"2011-01-10T18:46:00.000","Title":"Convert Python program to C\/C++ code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a project that is based on Urdu language in Ubuntu platform. I'm using Python language and have almost achieved my task.\nThe problem is that, the Urdu text is rendered in reverse order.\nFor example, consider the word \u06a9\u0627\u0645 (which means work)\nconsisting of the three letters: \n\u06a9 ,\n\u0627 , and\n\u0645\nThe output is rendered in reverse order as  \u0645\u0627\u06a9\nconsisting of the three letters:\n\u0645, \n\u0627, and\n\u06a9\nWhen copying this text to Open Office or opening the generated XML file in Firefox,\nthe generated result is absolutely desired.\nI Am using Python 2.6 IDLE, its working perfect with Windows platform, which clearly shows its not the problem of IDLE. Am working on TKINTER GUI library.\nHow can this problem be solved?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":824,"Q_Id":4668985,"Users Score":-1,"Answer":"Use a toolkit that isn't terrible, such as PyQt, PyGTK, or wxPython.","Q_Score":2,"Tags":"python,linux,fonts,tkinter,right-to-left","A_Id":4669402,"CreationDate":"2011-01-12T12:50:00.000","Title":"Reverse rendering of Urdu fonts","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm trying to use clr.AddReference to add sqlite3 functionality to a simple IronPython program I'm writing; but everytime I try to reference System.Data.SQLite I get this error:\n\nTraceback (most recent call last):\n    File \"\", line 1, in \n  IOError: System.IO.IOException: Could not add reference to assembly System.Data.SQLite\n     at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean&shouldOptimize)\n     at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller2.Call1(CallSite site, CodeContext context, TFuncType func, T0 arg0)\n     at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\n     at CallSite.Target(Closure , CallSite , CodeContext , Object , Object )\n     at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame)\n     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)\n     at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)\n     at IronPython.Runtime.FunctionCode.Call(CodeContext context)\n     at IronPython.Runtime.Operations.PythonOps.QualifiedExec(CodeContext context, Object code, PythonDictionary globals, Object locals)\n     at Microsoft.Scripting.Interpreter.ActionCallInstruction4.Run(InterpretedFrame frame)\n     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)\n\nI've been testing out the imports and references in the interpreter mainly, and these are the lines I test:\n\nimport sys\n  import clr\n  sys.path.append(\"C:\/Program Files (x86)\/SQLite.NET\/bin\")\n  clr.AddReference(\"System.Data.SQLite\")  \n\nThe error happens after the clr.AddReference line is entered. How would I add System.Data.SQLite properly?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1695,"Q_Id":4682960,"Users Score":1,"Answer":"My first guess is that you're trying to load the x86 (32-bit) System.Data.SQLite.dll in a x64 (64-bit) process, or vice versa. System.Data.SQLite.dll contains the native sqlite3 library, which must be compiled for x86 or x64, so there is a version of System.Data.SQLite.dll for each CPU.\nIf you're using the console, ipy.exe is always 32-bit (even on 64-bit platforms) while ipy64.exe is AnyCPU, so it matches the current platform. If you're hosting IronPython, and the host app is AnyCPU, you need to load the right copy of System.Data.SQLite.dll for the machine you're running on (or just force the host app x86).","Q_Score":1,"Tags":"ado.net,ironpython,system.data.sqlite","A_Id":4696478,"CreationDate":"2011-01-13T17:11:00.000","Title":"Adding System.Data.SQLite reference in IronPython","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having a database (sqlite) of members of an organisation (less then 200 people). Now I'm trying to write an wx app that will search the database and return some contact information in a wx.grid. The app will have 2 TextCtrls, one for the first name and one for the last name.  What I want to do here is make it possible to only write one or a few letters in the textctrls and that will start to return result. So, if I search \"John Smith\" I write \"Jo\" in the first TextCtrl and that will return every single John (or any one else having a name starting with those letters). It will not have an \"search\"-button, instead it will start searching whenever I press a key.\nOne way to solve this would be to search the database with like \" SELECT * FROM contactlistview WHERE forname LIKE 'Jo%' \" But that seems like a bad idea (very database heavy to do that for every keystroke?).  Instead i thought of use fetchall() on a query like this \" SELECT * FROM contactlistview \" and then, for every keystroke, search the list of tuples that the query have returned. And that is my problem: Searching a list is not that difficult but how can I search a list of tuples with wildcards?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":697,"Q_Id":4698933,"Users Score":0,"Answer":"If you are searching for a string matching the start using LIKE, eg 'abc%' (rather than anywhere in the string - '%abc%'), the search should be quite fast if you have an index on the field, as the db can use the index to help find the matches.","Q_Score":0,"Tags":"python,sqlite,tuples","A_Id":4699909,"CreationDate":"2011-01-15T09:49:00.000","Title":"Searching a list of tuples in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having a database (sqlite) of members of an organisation (less then 200 people). Now I'm trying to write an wx app that will search the database and return some contact information in a wx.grid. The app will have 2 TextCtrls, one for the first name and one for the last name.  What I want to do here is make it possible to only write one or a few letters in the textctrls and that will start to return result. So, if I search \"John Smith\" I write \"Jo\" in the first TextCtrl and that will return every single John (or any one else having a name starting with those letters). It will not have an \"search\"-button, instead it will start searching whenever I press a key.\nOne way to solve this would be to search the database with like \" SELECT * FROM contactlistview WHERE forname LIKE 'Jo%' \" But that seems like a bad idea (very database heavy to do that for every keystroke?).  Instead i thought of use fetchall() on a query like this \" SELECT * FROM contactlistview \" and then, for every keystroke, search the list of tuples that the query have returned. And that is my problem: Searching a list is not that difficult but how can I search a list of tuples with wildcards?","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":697,"Q_Id":4698933,"Users Score":2,"Answer":"I think that generally, you shouldn't be afraid of giving tasks to a database. It's quite possible that the LIKE clause will be very fast. Sqlite is implemented in fairly robust C code, and will happily deal with queries like this.\nIf you're worried about sending too many requests, why not send a query once a user has entered a threshold of characters, such as three?\nA list comprehension is probably the best way to return the result if you want to do added filtering.","Q_Score":0,"Tags":"python,sqlite,tuples","A_Id":4698981,"CreationDate":"2011-01-15T09:49:00.000","Title":"Searching a list of tuples in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I have a Python package that depends on some C libraries (like say the Gnu Scientific Library (GSL) for numerical computations), is it a good idea to bundle the library with my code?\nI'd like to make my package as easy to install as possible for users and I don't want them to have to download C libraries by hand and supply include-paths. Also I could always ensure that the version of the library that I ship is compatible with my code.\nHowever, is it possible that there are clashes if the user has the library installed already, or ar there any other reasons why I shouldn't do this?\nI know that I can make it easier for users by just providing a binary distribution, but I'd like to avoid having to maintain binary distributions for all possible OSs. So, I'd like to stick to a source distribution, but for the user (who proudly owns a C compiler) installation should be as easy as python setup.py install.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":629,"Q_Id":4700178,"Users Score":0,"Answer":"You could have two separate branches of the src, one containing the libraries and another that doesn't. That way you can explicitly warn your users in case they have installed the libraries. Another solution could be (if the licences of the libraries allow you) is to wrap 'em up in a single file.\nI think there's no unique solution, but this are the ideas I could think so far.\nGood luck","Q_Score":7,"Tags":"python,c,distutils","A_Id":4700264,"CreationDate":"2011-01-15T14:47:00.000","Title":"Should I bundle C libraries with my Python application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills.\nBut I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF)\nor try Python \/ python framework.\nI you are on my place which possibility you choose?\nI am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven\u2019t any experience.\nWhat would be your choice and why?","AnswerCount":6,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":438,"Q_Id":4708482,"Users Score":0,"Answer":"Personally I prefer Python, but profesionally, that is if you want a good job C++ is a better choice.","Q_Score":3,"Tags":"c++,python,frameworks","A_Id":4708502,"CreationDate":"2011-01-16T22:20:00.000","Title":"Start with some C++ framework or python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills.\nBut I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF)\nor try Python \/ python framework.\nI you are on my place which possibility you choose?\nI am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven\u2019t any experience.\nWhat would be your choice and why?","AnswerCount":6,"Available Count":4,"Score":0.0333209931,"is_accepted":false,"ViewCount":438,"Q_Id":4708482,"Users Score":1,"Answer":"I recommend you to keep learning C++. Before you started looking for framework learn some popular search algorithm and try implement them. After that try implement some structures, like queues, list, stack, binary trees and some operation on them. Meanwhile play with I\/O (for example, try write your stack to file and read it back to stack - in plain text and binary). \nIt was my university tour on programming class. C++ is good choice because it is hard and multiparadigmats language so in future u will find much in common with other languages and you will be familiar with memory management system.","Q_Score":3,"Tags":"c++,python,frameworks","A_Id":4708519,"CreationDate":"2011-01-16T22:20:00.000","Title":"Start with some C++ framework or python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills.\nBut I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF)\nor try Python \/ python framework.\nI you are on my place which possibility you choose?\nI am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven\u2019t any experience.\nWhat would be your choice and why?","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":438,"Q_Id":4708482,"Users Score":0,"Answer":"Well. Learning Python basics will take a week, and you will save the time spent in a year since it is such a good language for small hacks and scripts. So I suggest you learn it first.\nLearning C++ well will take you five to ten years, so there is not the same immediate benefit :)","Q_Score":3,"Tags":"c++,python,frameworks","A_Id":4708899,"CreationDate":"2011-01-16T22:20:00.000","Title":"Start with some C++ framework or python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills.\nBut I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF)\nor try Python \/ python framework.\nI you are on my place which possibility you choose?\nI am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven\u2019t any experience.\nWhat would be your choice and why?","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":438,"Q_Id":4708482,"Users Score":0,"Answer":"I'd pick C++ for the sole reason that it's nothing like the languages you already know, even though it shares some syntax.","Q_Score":3,"Tags":"c++,python,frameworks","A_Id":4708606,"CreationDate":"2011-01-16T22:20:00.000","Title":"Start with some C++ framework or python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a main window and I want that when I maximize it the widgets inside it should automatically be resized ....\nIs there any way I can do that ????","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1134,"Q_Id":4712705,"Users Score":2,"Answer":"Yes. Use layout objects (such as QHBoxLayout or QGridLayout) to organize your widgets inside, and set the widgets' resize modes accordingly. Note that standard Qt-supplied widgets support resizing by default.","Q_Score":1,"Tags":"python,pyqt4","A_Id":4712851,"CreationDate":"2011-01-17T11:39:00.000","Title":"PyQt4 - Maximize window along with inside widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a main window and I want that when I maximize it the widgets inside it should automatically be resized ....\nIs there any way I can do that ????","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1134,"Q_Id":4712705,"Users Score":1,"Answer":"If you want to save you a lot of work, don't hand-code the ui. Use Qt Creator to create a ui file and then load this file dynamically using PyQt4.uic module. There is also a \"static\" approach that generates python code from Qt Creator ui files.","Q_Score":1,"Tags":"python,pyqt4","A_Id":4713335,"CreationDate":"2011-01-17T11:39:00.000","Title":"PyQt4 - Maximize window along with inside widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a menu bar in wxPython 2.8.11.0 and Python 2.7 where most of the menus are left aligned (as normal) but one is - ideally - right aligned, or at least separated in some way from the rest.\nIs this possible?\nEDIT: This needs to be a cross-platform solution.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":608,"Q_Id":4730785,"Users Score":1,"Answer":"If the native menubar doesn't support it, then wxPython probably won't either. There is a pure Python implementation of the menubar though. It's called FlatMenu. I would try that. If it doesn't work, at least you can hack it or submit a patch in Python code rather than trying to figure out the C++ for fixing wxWidgets.","Q_Score":2,"Tags":"python,menu,cross-platform,wxpython,menubar","A_Id":4763966,"CreationDate":"2011-01-19T01:08:00.000","Title":"Is it possible to align a menu to the right of the menu bar using wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on Qtdesigner for generating a GUI for my python app.\nThe problem is that I had manually made the widgets and then compiled it to py. But then I found out that the components did not resize when maximised.\nSo I opened the .ui file in designer and selected the group box for my widgets and chose layout in grid by right clicking on it.\nEven now the widgets do not resize on maximising....\nDo I have to do something else ???\nThanks a lot...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":316,"Q_Id":4737324,"Users Score":0,"Answer":"To have the widgets resized with the window, you must apply a layout to your top-level object (usually QMainWindow), and then place your new widgets where you want in the layout (and maybe other layouts for a more complicated window).\nNOTE: the menu items allowing to apply a layout on the main window will be available only once you have placed your first widget in it.","Q_Score":0,"Tags":"python,qt,pyqt4,qt-designer","A_Id":4741509,"CreationDate":"2011-01-19T15:47:00.000","Title":"Help in designing layout with qtdesigner for python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"HI, guys,\nI am using wxpython to develop a GUI for software configuration, launching and interaction. I want something like a CLI shell window (like pycrust) embedded inside the GUI to interact with a long-term running background process. I could give the input via this shell window and print the output on this window. My current code works very well. But there is problem of editing style, because wx.TextCtrl is simply an editable text window. e.g., I could overwrite or remove any previous text characters or type new input at any location. This is not desirable. \nHow can I make the wx.TextCtrl like a shell window, i.e. make the output readonly, while keep input editable? e.g.,\n1) when input new command, the position only starts after prompt. \n2) The user cannot change or replace any previous output text.\nI want to force certain restriction, for interaction purpose. \nIs there a way to fix the curse prompt? If so, then my problem will be solved, because the user will have no chance to move the curse. \nOr is there a way to set certain part of the text (the output and the prompt) readonly?\nOr another solution, thanks to 9000's answer, is that I make a grid of windows (a StaticTextCtrl or readonly TextCtrl for output in the upper window; prompt \">>>\" on the bottom left area; invisible-border editable window or entry dialog on the bottom right area for input). \nany suggestions? Is there any better choice?\nThanks a lot!","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1237,"Q_Id":4747944,"Users Score":1,"Answer":"In our product we have a console made up of two edit windows, separated by a thin line. The upper window is the output window, it is read-only. The lower window is editable. Once you have written a command in it and submitted it, the command is removed from the lower window and goes to the upper window, along with command's output.\nYou can click the upper window, select something from it, scroll it up, etc, all without removing the command you're currently editing from sight. Then you click on the lower window or press any key, and the control returns to the lower window, where you continue to craft your next command.","Q_Score":1,"Tags":"shell,formatting,input,wxpython,wxwidgets","A_Id":4748126,"CreationDate":"2011-01-20T13:53:00.000","Title":"output readonly, input editable with wx.textctrl?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"HI, guys,\nI am using wxpython to develop a GUI for software configuration, launching and interaction. I want something like a CLI shell window (like pycrust) embedded inside the GUI to interact with a long-term running background process. I could give the input via this shell window and print the output on this window. My current code works very well. But there is problem of editing style, because wx.TextCtrl is simply an editable text window. e.g., I could overwrite or remove any previous text characters or type new input at any location. This is not desirable. \nHow can I make the wx.TextCtrl like a shell window, i.e. make the output readonly, while keep input editable? e.g.,\n1) when input new command, the position only starts after prompt. \n2) The user cannot change or replace any previous output text.\nI want to force certain restriction, for interaction purpose. \nIs there a way to fix the curse prompt? If so, then my problem will be solved, because the user will have no chance to move the curse. \nOr is there a way to set certain part of the text (the output and the prompt) readonly?\nOr another solution, thanks to 9000's answer, is that I make a grid of windows (a StaticTextCtrl or readonly TextCtrl for output in the upper window; prompt \">>>\" on the bottom left area; invisible-border editable window or entry dialog on the bottom right area for input). \nany suggestions? Is there any better choice?\nThanks a lot!","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1237,"Q_Id":4747944,"Users Score":1,"Answer":"Just keep track of the location of the prompt each time you display it. Intercept all keypresses and releases, and if anything causes text before the prompt to change, veto that event. It's not that hard, it just takes a little attention to detail and some diligence to capture all text-modification events.","Q_Score":1,"Tags":"shell,formatting,input,wxpython,wxwidgets","A_Id":4764075,"CreationDate":"2011-01-20T13:53:00.000","Title":"output readonly, input editable with wx.textctrl?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We are building an app where in there will be a need to display the updates\/notification (ex : like status updates\/wall posts on FB). These needs to be displyed at the lower right corner of the window(like any other notifications). So was trying on some alternatives to best display the updates. Some option explored are PopupWindow (which was not that great for status update) and dialog (seems ok). Are there any other good options for this and is there any pre-defined end corners position constants? Plz suggest.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2743,"Q_Id":4755963,"Users Score":0,"Answer":"I second the ToasterBox suggestion. You can also create your own Dialog though and position it by grabbing the screen resolution and the size of the dialog and setting its position. I've done the latter for a custom popup. On Macs, you can access Growl through a Python API that's mentioned on their website.","Q_Score":4,"Tags":"python,user-interface,wxpython","A_Id":4763861,"CreationDate":"2011-01-21T06:16:00.000","Title":"wxPython PopUp notifications","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Considering the following requirementes:\n\nMust be supported on Windows.  Preferably works also on other platforms.\nMust support multi threading.  By that I mean that the engine can work in parallel in multiple threads.\nReadability is important.\nLicense must be compatible with closed-source projects.\n\nI like Python for its readablity.  I am also have more experience with Python than other scripting languages.  However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++\/CLI or C#).","AnswerCount":12,"Available Count":5,"Score":0.0166651236,"is_accepted":false,"ViewCount":4208,"Q_Id":4756544,"Users Score":1,"Answer":"Im pretty sure Stackless Python is going to be the only one supporting multithreading out the box. Stackless Python was chosen by CCP for their MMO: Eve-Online specifically because the stackless nature of the code allowed them to schedule the continuations on any OS thread they needed once they'd built the necessary primitives in to make the whole thing thread safe.\nLua can be used in a multi threaded environment, but each concurrent thread would need a separate lua_State object so you'd need to build your own interthread message passing system for lua code, executing in the context of separate lua states, to communicate.","Q_Score":17,"Tags":"javascript,python,ruby,windows,lua","A_Id":4774036,"CreationDate":"2011-01-21T07:51:00.000","Title":"Which scripting language is better for embedding in multi-threaded C\/C++ application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Considering the following requirementes:\n\nMust be supported on Windows.  Preferably works also on other platforms.\nMust support multi threading.  By that I mean that the engine can work in parallel in multiple threads.\nReadability is important.\nLicense must be compatible with closed-source projects.\n\nI like Python for its readablity.  I am also have more experience with Python than other scripting languages.  However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++\/CLI or C#).","AnswerCount":12,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":4208,"Q_Id":4756544,"Users Score":0,"Answer":"Entirely preference-based.  Most languages have a way to embed in C with options for exports into the scripting environment.\nIf it were me, I'd go with V8 Javascript.","Q_Score":17,"Tags":"javascript,python,ruby,windows,lua","A_Id":4855161,"CreationDate":"2011-01-21T07:51:00.000","Title":"Which scripting language is better for embedding in multi-threaded C\/C++ application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Considering the following requirementes:\n\nMust be supported on Windows.  Preferably works also on other platforms.\nMust support multi threading.  By that I mean that the engine can work in parallel in multiple threads.\nReadability is important.\nLicense must be compatible with closed-source projects.\n\nI like Python for its readablity.  I am also have more experience with Python than other scripting languages.  However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++\/CLI or C#).","AnswerCount":12,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":4208,"Q_Id":4756544,"Users Score":0,"Answer":"By \"multithreaded\" I'm assuming you mean \"can effectively exploit multiple cores\"? If your system only has a single CPU, then you're only going to be done one thing at a time regardless of the scripting language you choose.\nIf you do decide to go the CPython route, then there the main thing to remember is that it is only the scripting engine itself that is protected by the global interpreter lock. If the script being executed spends a lot of time calling out to non-Python code (including I\/O and other system level operations) then it can exploit multiple threads quite happily.\nAnother factor to consider is that Python's introspection capabilities make it inherently difficult to secure properly (Google have done it for AppEngine, but they had to disallow quite a few things in the process).\nGiven the prevalence of Javascript engines in browsers and Lua engines in PC games, one of those is likely to be an easier way forward.","Q_Score":17,"Tags":"javascript,python,ruby,windows,lua","A_Id":4859076,"CreationDate":"2011-01-21T07:51:00.000","Title":"Which scripting language is better for embedding in multi-threaded C\/C++ application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Considering the following requirementes:\n\nMust be supported on Windows.  Preferably works also on other platforms.\nMust support multi threading.  By that I mean that the engine can work in parallel in multiple threads.\nReadability is important.\nLicense must be compatible with closed-source projects.\n\nI like Python for its readablity.  I am also have more experience with Python than other scripting languages.  However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++\/CLI or C#).","AnswerCount":12,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":4208,"Q_Id":4756544,"Users Score":11,"Answer":"I've been in the same dilemma an choose Lua over Python and JScript. \nThe thing which Lua does best is the great interop with C\/C++ code using libraries like luabridge and luabind. That is, you can call lua from C++ and have the script call back into C++ without a problem, access c++ data from the script and vice versa.\nThe problem with languages like Python and Lua is that the language is not really multi-threaded in the regular sense of the word: if one C++ thread it using the language scripting engine to run a script, you cannot use the same engine to run another script. Both languages has an engine-wide lock which can be used in those cases to make sure the engine integrity is maintained. However, both languages are multi-threaded in the sense that you can run function in the background and interact with any synchronization object you want (just like from C++). So I choose to have all threads created from C++ and scripting code only run in a dedicated threads (thread per engine) and interact with other threads in the application in the regular ways.\nIf you need to pass data and control from C++ to a script and vice versa, Lua is much better than Python. Beside that, I would not host the CLR in a C++ project. It's too messy.","Q_Score":17,"Tags":"javascript,python,ruby,windows,lua","A_Id":4769506,"CreationDate":"2011-01-21T07:51:00.000","Title":"Which scripting language is better for embedding in multi-threaded C\/C++ application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Considering the following requirementes:\n\nMust be supported on Windows.  Preferably works also on other platforms.\nMust support multi threading.  By that I mean that the engine can work in parallel in multiple threads.\nReadability is important.\nLicense must be compatible with closed-source projects.\n\nI like Python for its readablity.  I am also have more experience with Python than other scripting languages.  However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++\/CLI or C#).","AnswerCount":12,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":4208,"Q_Id":4756544,"Users Score":12,"Answer":"Lua is the best choice. Python, Ruby and JavaScript are big languages and they are not designed for to embed. But Lua is different, designed to embed.\nYou should consider the \"restriction\" more than any other things for your script language. Embed scripts can use for hack (bad meaning) easily.\nFor example, by default Lua can not print to console. As I know, Blizzard uses the Lua because of that.","Q_Score":17,"Tags":"javascript,python,ruby,windows,lua","A_Id":4808596,"CreationDate":"2011-01-21T07:51:00.000","Title":"Which scripting language is better for embedding in multi-threaded C\/C++ application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to draw a Grid World (similar to a table), where cells may contain robots or obstacles. A dot\/arrow would do to represent the robot and colouring the cells in black for examples could represent the obstacles. \nI am not looking for anything complicated, just a simple python library that would help me do this. Any suggestions?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3612,"Q_Id":4783462,"Users Score":1,"Answer":"tkinter has a canvas widget that is pretty easy to work with. It has primitives for lines and filled polygons and circles and so on. And with the event loop its pretty easy to do simple animations.","Q_Score":3,"Tags":"python,grid,draw","A_Id":4784164,"CreationDate":"2011-01-24T14:59:00.000","Title":"How to draw Grid World using Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made an application using Python and recently i found that i can use py2exe to make executables for windows.\nThe problem is that a library i am using (xmpppy) produces this error\n\nDeprecationWarning: the md5 module is deprecated; use hashlib instead\n\nand when i try to run the executable a dialog appears saying this\n\nSee the logfile 'C:\\Python26\\P2E\\MyApp\\dist\\MyApp.exe.log' for details\n\nany ideas how to fix that?","AnswerCount":2,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":974,"Q_Id":4793250,"Users Score":-2,"Answer":"when a python script .py has any error it shows in console but when you run python .exe file it genrates .exe.log file when error accured.so go to your folder and see that there is a .exe.log file is there showing errors.","Q_Score":0,"Tags":"python,pyqt4,xmpppy","A_Id":50261727,"CreationDate":"2011-01-25T12:03:00.000","Title":"PyQt4 - \"See the log file for details\" error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to build my first wx application\nI have a browse button in my panel, the user adds his file. i do some processing on the file.\nNow i want to show the information in a TextCtrl so that the user may modify it. Then i need to write it in a file.\nBut I dont know how many TextCtrl box is needed before processing the file. \nUsing the browse button event i have got the file, extracted the information also. But i dont know how to show the information back to the user. \nany suggestion is appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":439,"Q_Id":4802134,"Users Score":0,"Answer":"If all you're doing is showing one file, then all you need is one TextCtrl. I would give the widget the wx.TE_MULTILINE style and add it to a sizer with an EXPAND flag:\nsizer.Add(myTxtCtrl, 0, wx.EXPAND)\nThen the user can see the file and you can save the data with a Save button or menu item. The handler for that would basically just grab the text control's contents using it's GetValue() method.","Q_Score":0,"Tags":"wxpython,textctrl","A_Id":4807514,"CreationDate":"2011-01-26T07:10:00.000","Title":"wxPython: TextCtrl problem","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using python 3 \/ tkinter if that matters.\nIn looking at code samples I noticed that the main loop is typically in the GUI part of the code, and the rest of the code provides callbacks for GUI to call when needed.\nBut my simulation runs independently of the user interaction; the UI is there to provide a view, from time to time, into what's going on in the simulation, but it doesn't control what goes on in the simulation. So I would like the main loop to be concerned with the simulation rather than UI. How would I do that?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":816,"Q_Id":4812323,"Users Score":1,"Answer":"Write your own main loop that calls the functions that check for and process GUI events.","Q_Score":2,"Tags":"python,design-patterns,user-interface,tkinter","A_Id":4812333,"CreationDate":"2011-01-27T03:02:00.000","Title":"Can the main loop of a program be moved out of GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using python 3 \/ tkinter if that matters.\nIn looking at code samples I noticed that the main loop is typically in the GUI part of the code, and the rest of the code provides callbacks for GUI to call when needed.\nBut my simulation runs independently of the user interaction; the UI is there to provide a view, from time to time, into what's going on in the simulation, but it doesn't control what goes on in the simulation. So I would like the main loop to be concerned with the simulation rather than UI. How would I do that?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":816,"Q_Id":4812323,"Users Score":2,"Answer":"Why not seperate your logic and presentation. Write your sim backend to respond to a single text based protcol to receive cmds and send back results, and then just talk to it from your gui program over e.g. unix sockets.","Q_Score":2,"Tags":"python,design-patterns,user-interface,tkinter","A_Id":4812403,"CreationDate":"2011-01-27T03:02:00.000","Title":"Can the main loop of a program be moved out of GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using the pyBluez module on Python 2.6 on WindowsXP. I'd like to get the RSSI of other bluetooth devices around.\nI foudn some code but it makes use of _bluetooth, which I cannto find anywhere for Windows.\nIs it available \/ is there another way to circumvent the problem, getting the RSSI without using _bluetooth?\nThank you all!","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1917,"Q_Id":4815088,"Users Score":0,"Answer":"The _bluetooth module is a part of PyBluez. If you have installed a Windows release of PyBluez, it should work.\nI don't know enough about Bluetooth to even know what \"getting the RSSI without using it\" means or why it should be a problem, so can't help you there. :)","Q_Score":1,"Tags":"python,windows,bluetooth,rssi","A_Id":4815494,"CreationDate":"2011-01-27T10:17:00.000","Title":"RSSI with pyBluez on WindowsXP","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently taking a course on Compilers. I don't like the idea of blindly memorising facts without any sort of place to apply them to. I want to learn by hands-on doing. \nSo, I would like to have the complete code of 3-4 compilers, possibly for languages with different syntax rules (python,c, c++, java) while working through the Dragon book.\nIf complete compilers are too much of an ask, examples of parsers(well-written LL, LR, LALR parsers) and intermediate-code generators for these languages would also do. \nThere is a LOT of code out there on the Internet regarding this, but I want something that is considered to be high-quality and standard. I would be grateful for any resources that you can refer me to in this matter. Thanks.","AnswerCount":6,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1318,"Q_Id":4818779,"Users Score":2,"Answer":"You can grab code for the Lua compiler from lua.org, they distribute full source, and you could also get GCC's source code, which is both C and C++ compiling.","Q_Score":1,"Tags":"java,c++,python,parsing,compiler-construction","A_Id":4818927,"CreationDate":"2011-01-27T16:11:00.000","Title":"Good source code for compiler components","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently taking a course on Compilers. I don't like the idea of blindly memorising facts without any sort of place to apply them to. I want to learn by hands-on doing. \nSo, I would like to have the complete code of 3-4 compilers, possibly for languages with different syntax rules (python,c, c++, java) while working through the Dragon book.\nIf complete compilers are too much of an ask, examples of parsers(well-written LL, LR, LALR parsers) and intermediate-code generators for these languages would also do. \nThere is a LOT of code out there on the Internet regarding this, but I want something that is considered to be high-quality and standard. I would be grateful for any resources that you can refer me to in this matter. Thanks.","AnswerCount":6,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1318,"Q_Id":4818779,"Users Score":0,"Answer":"Your course on compilers should be giving you the pieces that will eventually lead to a full blown compiler.  \nFor example, the section on lexical analysis can lead to a component called the Lexer.  If you keep an eye open to generics and re-usability, you can turn this into a component that can be used later in your compiler.\nI highly suggest you take the approach of having at least two components in every homework project:  main and the library component.  In the example of lexical analysis, the main component would handle input and testing.  The library component would be the lexer.  This technique will help greatly after you graduate and develop huge applications in the real world.","Q_Score":1,"Tags":"java,c++,python,parsing,compiler-construction","A_Id":4820418,"CreationDate":"2011-01-27T16:11:00.000","Title":"Good source code for compiler components","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to create a small application for Symbian mobile phones using Python. Being a beginner i am having some trouble in setting up the environment for development. I installed Symbian3 SDK,PyS60 Application Manager ( for creating the .sis files to be installed on phones) and python 2.5.2 . I created a small hello world program and created its equivalent .sis file. But when i try to install it in Symbian 3 SDK, it gives me a 'Python Run time Error' ; i suppose it is because there isnt any python installed on the SDK. But when i tried to install the PythonForS60.sis file, it gives me a certificate error. I tried downloading the file through SDK, again it gives me a certificate error. I tried certifying the application through SymbianSigned.com, then it gives this error \n\"The .sis file contains capabilities that are not permitted for Open Signed (Online)\nFAILURE: Submitted .sis file uses a UID that is not allocated to the account holder matching this email address (0x20022ee8 )\nFAILURE: Submitted .sis file uses a UID that is in protected range and is not allocated to the account holder matching this email address (0x20022ee8)\" . Can somebody help me to solve this..??","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":900,"Q_Id":4825055,"Users Score":1,"Answer":"Open Application Manager on your Symbian phone, go to settings and select Software installation. Change it from Signed to All. This will allow you to install applications which don't have a certificate, such as the SIS file you just packaged. \nAlso note that PythonForS60 2.0 works only with Python 2.5.","Q_Score":1,"Tags":"python,symbian,pys60","A_Id":4825096,"CreationDate":"2011-01-28T05:11:00.000","Title":"Certificate Error on installing PythonForS60","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to optimize the interaction between two scripts I have.\nTwo things I thought of are the c++ program not terminating unless you manually kill it, or generating all info in python before feeding it to c++.\nExplanation of the problem:\nWhat the scripts do:\nC++ program (not made by me, and I can't program in c++ very well): takes a 7 number array and returns a single number, simple. \nPython script (mine, and I can program a bit in python): generates those 7 number arrays, feeds them to the c++ program, waits for an answer and adds it to a list. It then makes the next array. \nIn theory, this works. However, as it is right now, it opens and closes the c++ program for each call. For one array that is no problem, but I'm trying to upscale to 25k arrays, and in the future to 6+ million arrays. Obviously it is then no longer feasible to open\/close it each time, especially since the c++ program first has to load a 130mb VCD file to function.\nTwo options I thought of myself were to generate all arrays first in python, then feed them to the c++ program and then analyze all results. However, I wouldn't know how to do this with 6M arrays. It is not important however that the results I get back are in the same order as the arrays I feed in.\nSecond option I thought of was to make the c++ program not quit after each call. I can't program in c++ though so I don't know if this is possible, keeping it 'alive' so you can just feed arrays into it at times and get an answer.\n(Note: I cannot program in anything else than python, and want to do this project in python. The c++ program cannot be translated to python for speed reasons.)\nThanks in advance, Max.","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":2200,"Q_Id":4826896,"Users Score":1,"Answer":"Firstly, just to be pedantic, there are no C++ scripts in normal use. C++ compiles, ultimately, to machine code, and the C++ program is properly referred to as a \"program\" and not a \"script\".\nBut to answer your question, you could indeed set up the C++ program to stay in memory, where it listens for connections and sends responses to your Python script. You'd want to study Unix IPC, particularly sockets.\nAnother way to approach it would be to incorporate what the C++ program does into your Python script, and forget about C++ altogether.","Q_Score":1,"Tags":"c++,python,optimization,interaction","A_Id":4827083,"CreationDate":"2011-01-28T09:59:00.000","Title":"Python and C++ script interaction","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need a QCombox which Items are filtered based on the text input. If I set the QCombobox editable, the user can insert text and the QCompleter is automatically created. But the items are not filtered and I don\u2019t want the user to add new Items.\nIs there any possibility to add this functionality to the QCombobox?","AnswerCount":5,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":15195,"Q_Id":4827207,"Users Score":5,"Answer":"Both answers posted are correct, however they have a small bug wherein filtering the options in the combobox by typing then clicking a selection doesn't cause an activation signal to fire. You can fix this by placing self.activated[str].emit(self.itemText(index)) in on_completer_activated, on the line after self.setCurrentIndex(index).\nThis fires an activated signal when you select an item from the completer, which contains the name of the item that was clicked.","Q_Score":13,"Tags":"python,qt,pyqt,qcombobox","A_Id":8198846,"CreationDate":"2011-01-28T10:32:00.000","Title":"How do I Filter the PyQt QCombobox Items based on the text input?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to draw arrows (that change size dynamically) within a Label or any other widget. I have these arranged as a grid. How can I do this? Would I need a Canvas? (not used yet ... currently just a grid of labels).\nI am using Python & Tkinter Gui library.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1937,"Q_Id":4830180,"Users Score":0,"Answer":"Tkinter does not support drawing on top of widgets. Your only choice for drawing arrows is to use a canvas.  Your only other option is to draw directly on a image that is used by a label or button, but there's no support for that other than to set the value of individual pixels.\nYour only practical choice is to use a canvas.","Q_Score":0,"Tags":"python,tkinter","A_Id":4840199,"CreationDate":"2011-01-28T15:51:00.000","Title":"Python Tkinter: Draw arrows within Label","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am quite confused about the stdin and the key_events of GUI widget.\nUsually in my mind, I thought stdin is the ordinary way to get the keyboard input for a process. E.g., If I have a process, then I could use stdin to have the keyboard inputs. And this is usually used to make I\/O direction for the subprocess to get keyboard inputs. E.g., I could make subprocess.Popen(stdin=PIPE)\nOn the other hand for GUI, I am using wx.TexCtrl or py.Shell.shell, to catch the key events, like inputs. \nSo I am quite confused here, if I have a GUI or pyShell running, when I am typing via the keyboard, is it via the stdin or via the GUI key event catching system? If via the GUI key events system, how can I get the keyboard stdin? Can I still simply redirect the keyboard inputs to my child process (inside the GUI) as the ordinary non-GUI programming?\nThanks a lot for any comments.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":405,"Q_Id":4854486,"Users Score":2,"Answer":"When you type, the input comes from the GUI event mechanism, not from stdin. You asked how to get the \"keyboard stdin\", and the answer to that is the same as for any other type of program: you read it (but it will almost certainly be empty). It's important to realize that the GUI probably doesn't have a stdin if it was started by double-clicking on an icon on the desktop.\nAnd no, you can't \"redirect keyboard inputs to [your] child process\", if I understand your question. Stdin really has absolutely nothing to do with GUIs at all. How keyboard input is read via a GUI is completely disconnected from stdin.","Q_Score":0,"Tags":"user-interface,redirect,event-handling,wxpython,stdin","A_Id":4854744,"CreationDate":"2011-01-31T18:18:00.000","Title":"key_events of GUI widget and stdin","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.","AnswerCount":14,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":40558,"Q_Id":4865636,"Users Score":16,"Answer":"Well, if you can do 2d you can always do 3d.  All 3d really is is skewed 2 dimensional surfaces giving the impression you're looking at something with depth.  The real question is can it do it well, and would you even want to.  After browsing the pyGame documentation for a while, it looks like it's just an SDL wrapper.  SDL is not intended for 3d programming, so the answer to the real question is, No, and I wouldn't even try.","Q_Score":34,"Tags":"python,3d,pygame","A_Id":4865764,"CreationDate":"2011-02-01T17:08:00.000","Title":"Does PyGame do 3d?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.","AnswerCount":14,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":40558,"Q_Id":4865636,"Users Score":0,"Answer":"If you want to stick with a python-esque language when making games, Godot is a good alternative with both 2D and 3D support, a large community, and lots of tutorials. Its custom scripting language(gdscript) has some minor differences, but overall its mostly the same. It also has support for c# and c++, and has much more features when it comes to game development.","Q_Score":34,"Tags":"python,3d,pygame","A_Id":66323924,"CreationDate":"2011-02-01T17:08:00.000","Title":"Does PyGame do 3d?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.","AnswerCount":14,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":40558,"Q_Id":4865636,"Users Score":0,"Answer":"Pygame is just a library for changing the color of pixels (and some other useful stuff for programming games). You can do this by blitting images to the screen or directly setting the colors of pixels.\nBecause of this, it is easy to write 2D games with pygame, as the above is all you really need. But a 3D game is just some 3D objects 'squashed' (rendered) into 2D so that it can be displayed on the screen. So, to make a 3D game using only pygame, you would have handle this rendering by yourself, including all the complex matrix maths necessary.\nNot only would this run slowly because of the immense processing power involved in this, but it would require you to write a massive 3D rendering\/rasterisation engine. And because of python being interpreted it would be even slower. The correct approach would be to have this process run on the GPU using (Py)opengl.\nSo, yes it is technically possible to do 3D using only pygame, but definitely not recommended. I would suggest you learn Panda3D or some similar 3D engine.","Q_Score":34,"Tags":"python,3d,pygame","A_Id":51124080,"CreationDate":"2011-02-01T17:08:00.000","Title":"Does PyGame do 3d?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.","AnswerCount":14,"Available Count":5,"Score":0.0428309231,"is_accepted":false,"ViewCount":40558,"Q_Id":4865636,"Users Score":3,"Answer":"Python Soya can render 3d graphics on pygame surfaces.","Q_Score":34,"Tags":"python,3d,pygame","A_Id":8702727,"CreationDate":"2011-02-01T17:08:00.000","Title":"Does PyGame do 3d?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.","AnswerCount":14,"Available Count":5,"Score":0.0142847425,"is_accepted":false,"ViewCount":40558,"Q_Id":4865636,"Users Score":1,"Answer":"It is easy to make 3D driver for PyGame. PyGame has some assets for 3D game development.\nI am developing Py3D driver using PyGame now. When I finish, I'll show you link to download Py3D. I tried to make 3D game with PyGame, and I needed just small addon for PyGame. It is wrong you think you must use SDL, PyOpenGL, OpenGL, PyQt5, Tkinter. All of them are wrong for making 3D games. OpenGL and PyOpenGL or Panda3D are very hard to learn. All my games made on those drivers were awful. PyQt5 and Tkinter aren't drivers for making games, but they've got addons for it. Don't try to make any game on those drivers. All drivers where we need to use the math module are hard. You can easily make small addon for them, I think everybody can make driver for PyGame in 1-2 weeks.","Q_Score":34,"Tags":"python,3d,pygame","A_Id":50873427,"CreationDate":"2011-02-01T17:08:00.000","Title":"Does PyGame do 3d?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a little web server that loads, using webkit, an URL to extract some data from the web page (eg: title, images sizes...).\nI'm using PyQt4 to access from python to webkit. For each request, I'm creating a QThread that:\n- creates an QWebPage object,\n- run an event loop\n- when the loading of the webpage has finished (loadFinished signal), some code extracts data from the mainFrame of the QWebPage and kills the QThread\nThis works very well the first time, the web page is loaded, included all its resources (CSS, images).\nThe second time I ask the server to load an url, the web page is loaded, but none of its resources (no css, no images). So when I try to retrieve image sizes, all size are set to 0,0.\nHere is some code snipset:\n\n# The QThread responsible of loading the WebPage\nclass WebKitThread(QThread):\n    def __init__(self, url):\n        QThread.__init__(self)\n        self.url = url\n        self.start()\n    def run(self):\n        self.webkitParser = WebKitParser(self.url)\n        self.exec_()\n\nclass WebKitParser(QWebPage):\n    def __init__(self, url, parent=None):\n        QWebPage.__init__(self, parent )\n        self.loadFinished.connect(self._loadFinished)\n        self.mainFrame().load(QUrl(url))\n\n    def _loadFinished(self, result):\n        self.computePageProperties()\n        QThread.currentThread().exit()\n\n    def computePageProperties(self):\n        # Some custom code that reads title, image size...\n        self.computedTitle=XXXXXXXX\n\nThe calling code (that respond to the HTTP request) is executing: \n\nt = WebKitThread(url)\nt.wait()\n# do some stuff with properties of WebKitParser\nprint t.webkitParser.computedTitle","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":628,"Q_Id":4876649,"Users Score":2,"Answer":"I've managed to fix the issue: creating the QWebPage in the GUI thread (the thread of QApplication event loop) fixes the issue.\nIt seems the second time a QWebPage is used, it tries to access to the browser cache (even if it has been disabled by configuration). But if the first QWebPage was not created in the main GUI thread, the cache is somewhat misconfigured and not usable.\nTo create the QWebPage in the main GUI thread I'm using a custom QEvent (QEvent of type User) that triggers QWebPage initialization and result fetching.","Q_Score":2,"Tags":"python,qt,qt4,pyqt4,qtwebkit","A_Id":4885477,"CreationDate":"2011-02-02T15:54:00.000","Title":"Unable to use in the same application a QWebPage twice","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to use PyQt4. I have downloaded its LINUX version and trying to install it with Cygwin(because I have windows on my PC and I want to use linux, therefore I am using Cygwin). I don't know how to install it ? please guide me . There is no such file like setup.py, install....what should I do??","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":526,"Q_Id":4877959,"Users Score":2,"Answer":"PyQt4 and Qt are cross-platform. If you write cross-platform code, you don't need to develop on any specific OS. Testing on different platforms from time to time is a good idea, but good cross-platform code will usually just work.\nDon't use any Windows-specific features, Windows-specific code. In particular, don't use subprocess unless calling shell commands is part of your app, use os.path instead of writing paths yourself, don't hardcode any paths, verify that each library that you're using is cross-platform, and you'd be fine.\nAnd when you're testing on Linux, test on actual Linux. Cygwin is another, different platform. You can try using a virtual machine with VirtualBox.\nP.S. You might also look at Nokia's new PySide which has more liberal license than PyQt4 and supports most of what PyQt4 supports with nearly the same interface. It's a bit young, but by the time you complete your application, it would probably be more common.","Q_Score":1,"Tags":"python,linux,pyqt4","A_Id":4878854,"CreationDate":"2011-02-02T17:53:00.000","Title":"pyqt4 on Linux environment","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know if it is possible to minimise my python program to the system tray.\nBasically what it does is at every hour it takes a screenshot but I don't want it to stay on the task bar taking space. Could I make it go to the system tray area next to the clock but keep it running?\nI am not using tkinter or anything like that.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2796,"Q_Id":4878093,"Users Score":0,"Answer":"As opposed to having the program running continuously, why don't you use your system's scheduler? (Cron under *nix, Task Scheduler under windows). There might be a bit more overhead since it has to spin up Python each time, but it would be easier than hooking up a notification icon.\nSince you refer to it as the task bar, I assume Windows. To have a notification icon, you would have to have a hidden window, with a running message pump, so Windows has somewhere to send messages to for the icon.\nSo, in short, much simpler just running a scheduled job.","Q_Score":2,"Tags":"python","A_Id":4878220,"CreationDate":"2011-02-02T18:05:00.000","Title":"Minimize python to system tray in Windows (Vista)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know if it is possible to minimise my python program to the system tray.\nBasically what it does is at every hour it takes a screenshot but I don't want it to stay on the task bar taking space. Could I make it go to the system tray area next to the clock but keep it running?\nI am not using tkinter or anything like that.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2796,"Q_Id":4878093,"Users Score":2,"Answer":"Since you are running on Windows, you may simply want to rename your script to have a .pyw extension, so there is no console window. If you try to make a system tray application, you will need to pick a GUI toolkit like you've suggested, and your simple script will become a LOT bigger and far more complicated.","Q_Score":2,"Tags":"python","A_Id":4878236,"CreationDate":"2011-02-02T18:05:00.000","Title":"Minimize python to system tray in Windows (Vista)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there an equivalent to Tkinter's place geometry manager in wxPython?\nFor those those that don't know, place allows the positioning of widgets based on x y or relative x y coordinates. \nI'm a fan of this geometry manager simply because it offers a lot of control over widget positioning.","AnswerCount":2,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":231,"Q_Id":4885296,"Users Score":-1,"Answer":"The GridBagSizer or FlexGridSizer are kind of like Tkinter's place. Of course, wx also supports absolute positions, although I do not recommend that.","Q_Score":1,"Tags":"python,geometry,wxpython","A_Id":4888025,"CreationDate":"2011-02-03T11:00:00.000","Title":"Equivalent to Tkinter's place geometry manager in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there an equivalent to Tkinter's place geometry manager in wxPython?\nFor those those that don't know, place allows the positioning of widgets based on x y or relative x y coordinates. \nI'm a fan of this geometry manager simply because it offers a lot of control over widget positioning.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":231,"Q_Id":4885296,"Users Score":1,"Answer":"I think the best answer is \"no, there is no equivalent\". You can use absolute positioning with the \"pos\" keyword argument in the constructor, but that doesn't come close to the power of place.","Q_Score":1,"Tags":"python,geometry,wxpython","A_Id":4888233,"CreationDate":"2011-02-03T11:00:00.000","Title":"Equivalent to Tkinter's place geometry manager in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a gtk window in init\nand then I process a new function\nand i append the values from new function to the gtk window\ntill the second function completes, the window gets unresponsive and can become responsive when second function completes.\ncan anyone tell me whet should i do for the same?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":142,"Q_Id":4886652,"Users Score":2,"Answer":"Windows become unresponsive in gtk (and in windowing systems in general) when you call a function within the Event Loop, which is the thread in charge of keeping the window responsive (this thread repaints the window, handles mouse clicks, etc.). If the function you call returns immediately, you won't notice the unresponsiveness, but if the function makes some heavy work, you'll have the situation you have described in your question.\nYou should execute your second function in a thread of its own (a working thread). If you need to refresh your window after this function returns, make sure you make this update in the Event Loop (for example, invoking glib.idle_add) and not from the working thread! Otherwise, strange crashes may occur.","Q_Score":1,"Tags":"python,gtk","A_Id":4886782,"CreationDate":"2011-02-03T13:17:00.000","Title":"python gtk problem","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The idea is that I would have two or three different windows and I would like to open and close them automatically by calling a function (separate functions to open and close each window). The program itself would be running in the background but when a certain event happens it would call the window opening function. On another event the window would close, or window #2 would open etc.\nThat's the general idea anyway. Right now I would settle for one window I could open by calling a function. So in a nutshell a function that opens a window but lets the program run in the background waiting for a command to destroy the window. \nIs it even possible to do that? \nI've searched for tkinter solutions, none have worked so far. The reason for tkinter is because wxpython won't close a window unless you move the mouse over it.\nAdditionally, in the end I would be making borderless windows that are always on top of everything else. I have a somewhat suitable code for that already but it's nothing definitive.\nPS. Yes I know it's a poorly composed question. That's why I'm asking...","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":149,"Q_Id":4890257,"Users Score":1,"Answer":"In wxWindows you just call the .destroy() method on the dialog\/window to delete it. You don't have to move the mouse over it. That would make wxWindows apps very annoying.\nI suspect your problem is more related to trying to do something outside the wx event framework. Most GUIs are event driven, so if you've got other things going on you either run them in another thread and have them signal the GUI framework to do stuff or run your code in an event handler callback that lets the event handler manage the .destroy() method you called in your code.","Q_Score":0,"Tags":"python","A_Id":4890390,"CreationDate":"2011-02-03T18:39:00.000","Title":"Opening and closing windows by calling a function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm about to undertake a .NET project: We need to create a create a program that utilize some existing C# code, and I'm hoping to use IronPython. (I'm an experienced Python programmer, but a bit of a .NET newbie). \nMy question is: Is IronPython a good fit for using mostly C# code, or would it be better just to use C#? If IronPython is a good fit, are there any pitfalls to look out for?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":801,"Q_Id":4890407,"Users Score":1,"Answer":"If you are in a Windows environment for reasons beyond your control, there are a lot of advantages in using IronPython.\n\nIts just like Python, only .NET.  Once you learn the idosyncratic elements of how to reference an assembly, how to instantiate objects, browse objects, etc.  it is really nice.\nYou don't need Visual Studio to develop. Notepad++ or any decent text editor is all you need.  If you really must have an IDE you can go with SharpDevelop.  Now if you have VS2010, the new plugin for Ironpython is nice and should get better with future releases.\nWith the introduction of Ironpython 2.7 and .NET 4.0, the startup time issues of previous versions have been mostly negated.\nI find the WPF and XAML approach much much easier than wx for creating GUI applications.\nIronpython scripts can be compiled into exe's for easy distribution\n\nThat said, there are downsides.\n\nMost packages do not install directly into Ironpython, forcing you to install into CPython, then copying over the relevant modules.\nPython extension that utilize pyd shared libraries don't work unless you use Ironclad, and even then you can have issues.\nYou give up being cross platform, unless your users are running Mono and even then you lose some of the cool features like WPF.\nYou are a bit behind the development curve.  Ironpython is currently at 2.7 Beta 1 and has been since October, when Microsoft released the code into the wild.  Prior to that no one outside of MS could submit patches.  The community leadership is on track for a 2.7 RTM release in February and then starting the 3.x development.","Q_Score":3,"Tags":"c#,.net,python,ironpython","A_Id":4892791,"CreationDate":"2011-02-03T18:54:00.000","Title":"Using C# code in IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm about to undertake a .NET project: We need to create a create a program that utilize some existing C# code, and I'm hoping to use IronPython. (I'm an experienced Python programmer, but a bit of a .NET newbie). \nMy question is: Is IronPython a good fit for using mostly C# code, or would it be better just to use C#? If IronPython is a good fit, are there any pitfalls to look out for?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":801,"Q_Id":4890407,"Users Score":5,"Answer":"You'll need to compile the C# code into an assembly (DLL) you can use within IronPython.  Once you do this, IronPython can use this just like any other .NET assembly.\nThis is a common usage scenario for IronPython.","Q_Score":3,"Tags":"c#,.net,python,ironpython","A_Id":4890442,"CreationDate":"2011-02-03T18:54:00.000","Title":"Using C# code in IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to develop a C-based application which embeds one or more Python interpreters. I'm using gtk-things in the C-parts, and logically calling gtk_main() within that.\nThe Python interpreters are created in separate pthreads using Py_NewInterpreter(), and basically running forever (a 'while True' loop is added to the end in case the script terminates).\nNow I'd like to use pyGTK in those scripts, which seems to work until there's a callback (signal emitted). You can register signal handlers to point to parts in the Python scripts ok, but it seems that the gtk main loop can't direct them correctly when they happen, causing segfaults like the log below.\nI'm guessing it might have something to do with the python thread state not being initialized correctly, but not sure. Would anyone have insight on what I'm doing wrong or what to check?\n\n#0  0xb7ecfc9a in PyFrame_New () from \/usr\/lib\/libpython2.5.so.1.0\n#1  0xb7f376ed in PyEval_EvalCodeEx () from \/usr\/lib\/libpython2.5.so.1.0\n#2  0xb7ed09b6 in ?? () from \/usr\/lib\/libpython2.5.so.1.0\n#3  0xb7eae327 in PyObject_Call () from \/usr\/lib\/libpython2.5.so.1.0\n#4  0xb7f30f7c in PyEval_CallObjectWithKeywords () from \/usr\/lib\/libpython2.5.so.1.0\n#5  0xb7eaeb5c in PyObject_CallObject () from \/usr\/lib\/libpython2.5.so.1.0\n#6  0xb424face in ?? () from \/usr\/lib\/pymodules\/python2.5\/gtk-2.0\/gobject\/_gobject.so\n#7  0xb76e113a in g_closure_invoke () from \/usr\/lib\/libgobject-2.0.so.0\n#8  0xb76f761d in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#9  0xb76f8bfc in g_signal_emit_valist () from \/usr\/lib\/libgobject-2.0.so.0\n#10 0xb76f9076 in g_signal_emit () from \/usr\/lib\/libgobject-2.0.so.0\n#11 0xb7ab3a8a in gtk_button_clicked () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#12 0xb7ab5048 in ?? () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#13 0xb76eecac in g_cclosure_marshal_VOID__VOID () from \/usr\/lib\/libgobject-2.0.so.0\n#14 0xb76df7a9 in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#15 0xb76e113a in g_closure_invoke () from \/usr\/lib\/libgobject-2.0.so.0\n#16 0xb76f6eba in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#17 0xb76f8bfc in g_signal_emit_valist () from \/usr\/lib\/libgobject-2.0.so.0\n#18 0xb76f9076 in g_signal_emit () from \/usr\/lib\/libgobject-2.0.so.0\n#19 0xb7ab3b2a in gtk_button_released () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#20 0xb7ab3b73 in ?? () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#21 0xb7b70e74 in ?? () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#22 0xb76df7a9 in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#23 0xb76e113a in g_closure_invoke () from \/usr\/lib\/libgobject-2.0.so.0\n#24 0xb76f7266 in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#25 0xb76f8a7b in g_signal_emit_valist () from \/usr\/lib\/libgobject-2.0.so.0\n#26 0xb76f9076 in g_signal_emit () from \/usr\/lib\/libgobject-2.0.so.0\n#27 0xb7c9d156 in ?? () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#28 0xb7b694cd in gtk_propagate_event () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#29 0xb7b6a857 in gtk_main_do_event () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#30 0xb79f3dda in ?? () from \/usr\/lib\/libgdk-x11-2.0.so.0\n#31 0xb7636305 in g_main_context_dispatch () from \/lib\/libglib-2.0.so.0\n#32 0xb7639fe8 in ?? () from \/lib\/libglib-2.0.so.0\n#33 0xb763a527 in g_main_loop_run () from \/lib\/libglib-2.0.so.0\n#34 0xb7b6ae19 in gtk_main () from \/usr\/lib\/libgtk-x11-2.0.so.0","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":285,"Q_Id":4896434,"Users Score":0,"Answer":"This is a situation where you are better off making one more Python interpreter and doing all your GTK work by sending Python snippets to that special GTK helper interpreter. That way your C code never uses GTK directly and you only need to worry about coordinating between the Python threads.","Q_Score":2,"Tags":"python,c,multithreading,gtk,pygtk","A_Id":4911145,"CreationDate":"2011-02-04T09:30:00.000","Title":"pygtk and native gtk_main(); mixing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to develop a C-based application which embeds one or more Python interpreters. I'm using gtk-things in the C-parts, and logically calling gtk_main() within that.\nThe Python interpreters are created in separate pthreads using Py_NewInterpreter(), and basically running forever (a 'while True' loop is added to the end in case the script terminates).\nNow I'd like to use pyGTK in those scripts, which seems to work until there's a callback (signal emitted). You can register signal handlers to point to parts in the Python scripts ok, but it seems that the gtk main loop can't direct them correctly when they happen, causing segfaults like the log below.\nI'm guessing it might have something to do with the python thread state not being initialized correctly, but not sure. Would anyone have insight on what I'm doing wrong or what to check?\n\n#0  0xb7ecfc9a in PyFrame_New () from \/usr\/lib\/libpython2.5.so.1.0\n#1  0xb7f376ed in PyEval_EvalCodeEx () from \/usr\/lib\/libpython2.5.so.1.0\n#2  0xb7ed09b6 in ?? () from \/usr\/lib\/libpython2.5.so.1.0\n#3  0xb7eae327 in PyObject_Call () from \/usr\/lib\/libpython2.5.so.1.0\n#4  0xb7f30f7c in PyEval_CallObjectWithKeywords () from \/usr\/lib\/libpython2.5.so.1.0\n#5  0xb7eaeb5c in PyObject_CallObject () from \/usr\/lib\/libpython2.5.so.1.0\n#6  0xb424face in ?? () from \/usr\/lib\/pymodules\/python2.5\/gtk-2.0\/gobject\/_gobject.so\n#7  0xb76e113a in g_closure_invoke () from \/usr\/lib\/libgobject-2.0.so.0\n#8  0xb76f761d in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#9  0xb76f8bfc in g_signal_emit_valist () from \/usr\/lib\/libgobject-2.0.so.0\n#10 0xb76f9076 in g_signal_emit () from \/usr\/lib\/libgobject-2.0.so.0\n#11 0xb7ab3a8a in gtk_button_clicked () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#12 0xb7ab5048 in ?? () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#13 0xb76eecac in g_cclosure_marshal_VOID__VOID () from \/usr\/lib\/libgobject-2.0.so.0\n#14 0xb76df7a9 in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#15 0xb76e113a in g_closure_invoke () from \/usr\/lib\/libgobject-2.0.so.0\n#16 0xb76f6eba in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#17 0xb76f8bfc in g_signal_emit_valist () from \/usr\/lib\/libgobject-2.0.so.0\n#18 0xb76f9076 in g_signal_emit () from \/usr\/lib\/libgobject-2.0.so.0\n#19 0xb7ab3b2a in gtk_button_released () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#20 0xb7ab3b73 in ?? () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#21 0xb7b70e74 in ?? () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#22 0xb76df7a9 in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#23 0xb76e113a in g_closure_invoke () from \/usr\/lib\/libgobject-2.0.so.0\n#24 0xb76f7266 in ?? () from \/usr\/lib\/libgobject-2.0.so.0\n#25 0xb76f8a7b in g_signal_emit_valist () from \/usr\/lib\/libgobject-2.0.so.0\n#26 0xb76f9076 in g_signal_emit () from \/usr\/lib\/libgobject-2.0.so.0\n#27 0xb7c9d156 in ?? () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#28 0xb7b694cd in gtk_propagate_event () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#29 0xb7b6a857 in gtk_main_do_event () from \/usr\/lib\/libgtk-x11-2.0.so.0\n#30 0xb79f3dda in ?? () from \/usr\/lib\/libgdk-x11-2.0.so.0\n#31 0xb7636305 in g_main_context_dispatch () from \/lib\/libglib-2.0.so.0\n#32 0xb7639fe8 in ?? () from \/lib\/libglib-2.0.so.0\n#33 0xb763a527 in g_main_loop_run () from \/lib\/libglib-2.0.so.0\n#34 0xb7b6ae19 in gtk_main () from \/usr\/lib\/libgtk-x11-2.0.so.0","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":285,"Q_Id":4896434,"Users Score":0,"Answer":"This looks like a pretty long stack, and some of the functions called look the same.  (For example, g_signal_emit is called repeatedly from itself via g_closure_invoke.)\nIt looks to me like you may be causing a stack overflow, possibly by emitting a signal inside your callback that handles the signal, thus infinitely recursing until you run out of stack space and crash.  This is just a guess and I don't know much about the GTK+\/GLIB internals, but that is what it smells like to me.  I'd put money on it.  :-)\nIf not that, then maybe the GLIB closures are being chained too much (one callback calls another callback which calls another etc. etc. until you run out of space.)  Maybe adjusting your stack size would help.  (I don't remember offhand if there is an easy way to do this for main(), but if you're creating a new thread pthread_attr_setstacksize() might help.)","Q_Score":2,"Tags":"python,c,multithreading,gtk,pygtk","A_Id":4911173,"CreationDate":"2011-02-04T09:30:00.000","Title":"pygtk and native gtk_main(); mixing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a 2nd year university student, and I thought it would be a good idea to expand my abilities. I will be using python later this year to complete a gui for a  C program (using Tkinter), but I want to make a side project as well, and python seems like a great language to do it with. \nI want a project which has multiple levels for me to code, so it's definitely going to have a gui and command-line version, and then maybe some database stuff (since I would like to know more about SQL and other database tech). \nI thought I could make a music player. Start by just making a command line program which plays a music file, then expand it from there, probably using pygtk for the gui.\nConsidering I have no python experience, but I do have a strong background in C and Java, are there going to be any difficulties which will unexpectedly stop me? I have never made a music application before, and I am not sure whats involved in keeping a music library, for example.\nAre there any other projects you might recommend, that can be completed in about an hour a night, for 3 months? (Or get a significant working program out of it, even if its not complete).\nThanks!","AnswerCount":6,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":9115,"Q_Id":4898747,"Users Score":2,"Answer":"Writing a program will help you learn the language, but IMHO joining the development team of an open-source python project would help you learn even more, as reading high-quality code written by other developers will disclose to you features of the language that you would never discover alone.\nSo, my suggestion is to hunt for a smallish and high-quality python open source project, read its code, understand what it does and then start contributing. It might help to choose a project that you use or that you like.","Q_Score":2,"Tags":"python,project,pygtk","A_Id":4898798,"CreationDate":"2011-02-04T13:57:00.000","Title":"A good side-project for learning python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a 2nd year university student, and I thought it would be a good idea to expand my abilities. I will be using python later this year to complete a gui for a  C program (using Tkinter), but I want to make a side project as well, and python seems like a great language to do it with. \nI want a project which has multiple levels for me to code, so it's definitely going to have a gui and command-line version, and then maybe some database stuff (since I would like to know more about SQL and other database tech). \nI thought I could make a music player. Start by just making a command line program which plays a music file, then expand it from there, probably using pygtk for the gui.\nConsidering I have no python experience, but I do have a strong background in C and Java, are there going to be any difficulties which will unexpectedly stop me? I have never made a music application before, and I am not sure whats involved in keeping a music library, for example.\nAre there any other projects you might recommend, that can be completed in about an hour a night, for 3 months? (Or get a significant working program out of it, even if its not complete).\nThanks!","AnswerCount":6,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":9115,"Q_Id":4898747,"Users Score":10,"Answer":"Considering I have no python experience, but I do have a strong background in C and Java, are there going to be any difficulties which will unexpectedly stop me? \n\nYes. \n\nI have never made a music application before, and I am not sure whats involved in keeping a music library, for example.\n\nThat will stop you.\nWant advice?  \nStep 1.  Avoid asking yes\/no questions.  \nStep 2.  Start smaller.  [see below]\nStep 3.  Start with a tutorial on Python.\nStep 4.  Find related projects, download their code, and read it.\n\nOn Starting Smaller.\n\"about an hour a night, for 3 months\".  90 hours.  \nAllocate 40 hours to do enough Python tutorials to understand the language.  Ordinarily, I'd suggest 80 hours for this, but your budget is tight.\nAllocate another 40 hours to working out how the sound playback API's work on your platform.  This may be too much time, but there are always odd mysteries.  OS API and Device Driver issues are often difficult problems to solve.\nAllocate another 40 hours to make enough mistakes to get a PyGTK application that runs respectably well.  Ordinarily, I'd allocate at least 120 hours to this, since GUI design includes lots of new concepts, not covered in the language tutorials.   Again, your budget is tight.\nLearning SQL and Database design and an ORM API.  Perhaps 40 hours.  There are a lot of mistakes you can make here, and you'll need time to make those mistakes.  \nAllocate another 40 hours to creating some kind of \"music library\" built on existing file system API's.  This involves defining some use cases for add, change and delete and figuring out how to implement those use cases.\nThat's my rationale for suggesting that you may want to \"start smaller\".","Q_Score":2,"Tags":"python,project,pygtk","A_Id":4898770,"CreationDate":"2011-02-04T13:57:00.000","Title":"A good side-project for learning python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i've built a com component which utilizes libxml2 python bindings , the build is successfull but when i try to register the component i get \"specified module could not be found , unable to load python dll\" this is the error i get when the component is built using the bundle files option set as 1\nif i build the component with bundle files set as 3 ,then i get a different error saying that the component was loaded but the call to DllRegisterServer Failed with error code 80040201\nif the libxml2 import is removed all works fine.\nany help wold be simply great.\nthanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":240,"Q_Id":4899158,"Users Score":1,"Answer":"Most likely, regsvr32.exe which registers you COM component couldn't find a DLL that your COM component needs.\nI'm not familiar with Python COM components but is there some way you can run depends.exe on it?  This is the usual way to track down binary dependency problems.","Q_Score":0,"Tags":"python,com","A_Id":4899486,"CreationDate":"2011-02-04T14:33:00.000","Title":"python com component does not register when using libxml2 on win7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In order to indicate activity, some applications (e.g. Pidgin) highlight their entry in GNOME's Window List panel widget (e.g. via bold font or flashing color). This indication is reset automatically when the window is activated.\nI have a terminal application for which I would like to achieve the same thing (preferably via Perl, but Python would work too) - but I have no idea where to start. I imagine I'd first have to find the terminal window (based on window title) and then trigger some kind of GTK action.\nAny help would be greatly appreciated!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":495,"Q_Id":4906424,"Users Score":1,"Answer":"I'm not really into GTK programming, but as far as i know you want to set an \"URGENT\"-Flag for the Window which should be highlighted. Maybe this will get you any further. :)","Q_Score":1,"Tags":"python,perl,gtk","A_Id":4906739,"CreationDate":"2011-02-05T10:51:00.000","Title":"highlighting a window in GNOME's window list","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"How can i set up icon for my existing program.exe and icon.ico ( in the same folder ) using some sort of hidden (settings) file ?\nEdit: i am aware of py2exe CustomIcon option, also about WinRar Sfx ...\nQuestion is: it is possible in this specific way i described ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1915,"Q_Id":4915202,"Users Score":0,"Answer":"do it like this:\nIf you dont have winrar then install it!\nThen right click on your program.exe and select \"Add to archive...\", under \"Archiving options\" select \"Create SFX Archive\". Now go to tab \"Advanced\" and click on \"SFX Options\" on \"General tab\" setup all you need and add \"Run after extraction\" (yourprogram.exe) under \"Modes\" tab select \"Hide All\" under silent groupbox, go to \"Update\" tab and select \"Update Mode\" (Extract and replace files) and \"Overwrite mode\" (Overwrite all files) now go to \"TextAndIcon\" tab and put to title yourprogram.exe name and under \"Load SFX icon from the file\" add an icon you want! Click OK, and click OK again. Now wait to compile and you have your program with icon! \nJust have to watch where you want it to be installed, or if it doesnt have any install direction then you use \"Unpack to temporary folder\" under the \"Modes\" tab in \"SFX Options\"!\nThink this will help you! :)","Q_Score":0,"Tags":"python,icons,exe,ico","A_Id":4915328,"CreationDate":"2011-02-06T18:22:00.000","Title":"How to set up icon for a program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a program in Python.  The first thing that happens is a window is displayed (I'm using wxPython) that has some buttons and text.  When the user performs some actions, a plot is displayed in its own window.  This plot is made with R, using rpy2.  The problem is that the plot usually pops up on top of the main window, so the user has to move the plot to see the main window again.  This is a big problem for the user, because he's lazy and good-for-nothing.  He wants the plot to simply appear somewhere else, so he can see the main window and the plot at the same time, without having to lift a finger.\nTwo potential solutions to my problem are:\n(1) display the plot within a wxPython frame (which I think I could control the location of), or\n(2) be able to specify where on the screen the plot window appears.\nI can't figure out how to do either.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":757,"Q_Id":4938556,"Users Score":5,"Answer":"Plot to a graphics file using jpeg(), png() or another device, then display that file on your wxWidget.","Q_Score":3,"Tags":"python,r,plot,rpy2","A_Id":4938599,"CreationDate":"2011-02-08T21:17:00.000","Title":"How do I control where an R plot is displayed, using python and rpy2?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an image wiht gtk.gdk. I want to make it look grayed out, so I wanna do something like draw a gray rectangle over it with 50% alpha value. How would I do this? The docs are so confusing.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":246,"Q_Id":4947341,"Users Score":0,"Answer":"i just thought of a way\ntaking half of the color's highest values and taking half of the number directly between them and putting that on the lowest number (Eg: 0,255,255 to 127,255,255 or 0,127,255 to 96,127,255) \nor taking the second highest number and the highest number, finding the 50%, putting that as the second highest number, then doing that again for the absolute lowest number (Eg: 0,128,255 > 112,192,255)\nhope this works for me and for you, right now im recommending to myself and you, the second option, however if you're lazy, the first option is less work","Q_Score":0,"Tags":"python,pygtk,gtk,gdk","A_Id":22739002,"CreationDate":"2011-02-09T16:03:00.000","Title":"gtk.gdk: make image 50% grayer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to read data from a text field. The name of the text field is not defined of found in the other class with methods of reading the text field. The textfield is defined in the Design class. now how do I access this field from another class, so I can read data from it. Thanks!!\nEdit:\nI have 2 Classes: FeatureImportCommonWidget(QtGui.QWidget) and MetaDataBrowser. FeatureImportCommonWidget contains a Text Field called placesGroupBox. I want to access this text field in the MetaDataBrowser Class.\nI tried it using \"filename = get_metadata.placesGroupBox.text()\", but it gives an error about placesGroupBox not being defined in the MetaDataBrowser class.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":179,"Q_Id":4967179,"Users Score":0,"Answer":"If the field's an ordinary attribute called text and your Design instance is called design, you can access (read\/write) it from anywhere as design.text.","Q_Score":0,"Tags":"python,pyqt","A_Id":4968555,"CreationDate":"2011-02-11T09:01:00.000","Title":"Python Referencing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to read data from a text field. The name of the text field is not defined of found in the other class with methods of reading the text field. The textfield is defined in the Design class. now how do I access this field from another class, so I can read data from it. Thanks!!\nEdit:\nI have 2 Classes: FeatureImportCommonWidget(QtGui.QWidget) and MetaDataBrowser. FeatureImportCommonWidget contains a Text Field called placesGroupBox. I want to access this text field in the MetaDataBrowser Class.\nI tried it using \"filename = get_metadata.placesGroupBox.text()\", but it gives an error about placesGroupBox not being defined in the MetaDataBrowser class.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":179,"Q_Id":4967179,"Users Score":0,"Answer":"1.  if object of FeatureImportCommonWidget class is created inside of MetaDataBrowser class, you can access your text field anywhere inside MetaDataBrowser class like this: FeatureImportCommonWidgetObjectName.placesGroupBox.text()\n2   if object of FeatureImportCommonWidget class is created before MetaDataBrowser class, you can pass that object as parameter to MetaDataBrowser class and then access your text field anywhere inside MetaDataBrowser class like in step 1","Q_Score":0,"Tags":"python,pyqt","A_Id":17676533,"CreationDate":"2011-02-11T09:01:00.000","Title":"Python Referencing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Just wondering whether there is any provision\/method to bind clicks on images\/(or include a button) to result into some events. Also is there any kind of way to draw a StaticLine kind of thing in a RichTextCtrl in wxPython.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":239,"Q_Id":4967307,"Users Score":0,"Answer":"You can bind to a button if you like, you could use a bitmapbutton instead, or bind mouse events to your static bitmap. The wxPython demo has examples for all of these methods.\nWith regards to the \"StaticLine kinda thing\", are you trying to resize the richtextctrl on demand? You might want to look at the ExpandoTextCtrl instead, which is also demonstrated in the demo. If not, I would need some more detail than \"kinda thing\".. ;)","Q_Score":1,"Tags":"python,user-interface,wxpython,wxtextctrl,wx.textctrl","A_Id":5696978,"CreationDate":"2011-02-11T09:15:00.000","Title":"wxpython RichtextCtrl event bindings on buttons\/images","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a fast python way to save all data in all widgets to file before app is close?\nAnd of course read it and restore after app is re-run?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2185,"Q_Id":4972429,"Users Score":4,"Answer":"QWidget.saveGeometry saves the geometry of an widget.\nQMainWindow.saveState saves the window's toolbars and dockwidgets.\nTo save other things you can use pickle.","Q_Score":3,"Tags":"python,pyqt","A_Id":4974374,"CreationDate":"2011-02-11T18:01:00.000","Title":"PyQt 4 - save all data in window to file on app close","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to create a PyThreadState since there doesn't appear to be one for the current thread.\nHow do I get the current PyInterpreterState to pass to PyThreadState_New(...), or is that something that I should only do if I'm embedding an interpreter (and thus have created it), rather than calling into a library from python?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1482,"Q_Id":4987579,"Users Score":1,"Answer":"It turns out that not having a PyThreadState in the main thread is a fatal error. It was caused for me by two different python versions both being linked at the same time, so this question is somewhat moot.","Q_Score":2,"Tags":"python,c,multithreading,python-c-api","A_Id":5002035,"CreationDate":"2011-02-13T23:16:00.000","Title":"How do I get the current PyInterpreterState?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"As a hobbyists who has a little experience making 2D games using PyGame, and has ventured into using C++ with the SDL library (in Visual Studio), I'm curious. Is the library used professionally?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":769,"Q_Id":4993101,"Users Score":3,"Answer":"SDL is used professionally and some great games were made with it. Many times it is used as a cross-platform window creation system to initialize openGL (as I assume it is used for Doom3, UT, etc...). It is also used for as \"raw\" 2d graphics API (for example in Battle For Wesnoth).","Q_Score":4,"Tags":"c++,python,sdl,pygame","A_Id":4993955,"CreationDate":"2011-02-14T14:08:00.000","Title":"Is C++ SDL and (Python PyGame) used by people other than hobbyists?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a small cross-platform wxPython app, however on every platform I need to use some platform-specific API. On Mac OS it can be done using PyObjC. \nI'm searching for tutorial on how to use PyObjC. However, all I found so far were tutorials with Xcode. I want my app to be able to run on mac\/win\/lin, without changes, and I don't want to develop it in Xcode. Is there a way?\nUPD. To be more specific I need to access some pen-tablet events from Mac OS X and I wanted to use PyObjC for that (I don't see any other ways).","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3791,"Q_Id":4994058,"Users Score":0,"Answer":"What do you need Xcode for? If you need it for the windows\/gui (*.nib, *.xib files), then you should perhaps search for 'creating *.nib, *xib without Xcode'.\nThat's only a search hint and no satisfying answer.","Q_Score":6,"Tags":"python,macos,wxpython,pyobjc","A_Id":5071853,"CreationDate":"2011-02-14T15:39:00.000","Title":"PyObjC tutorial without Xcode","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a small game that supports Python scripting. I've no problems with using the Python C-API, but I don't know how to ensure that the game will run on a computer with no Python installed.\nI know I need pythonXY.dll -- what else is there? When I try to run the program it tells me it cannot find encodings.utf_8. I tried copying the encodings\/utf_8.py file in the same directory as my program, but the error still pops up.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":258,"Q_Id":4995336,"Users Score":0,"Answer":"You need the encodings\/__init__.py file, otherwise encodings is a folder and not a python package.\nChances are that you'll need a lot of stuff from within the python standard library. To make everything just work you'll need to include the entire standard library along with your program.\nYou can make this a bit better by putting the library in a zip file and adding that to sys.path. Also, you can include only pyc not the original py files.","Q_Score":2,"Tags":"python,embed,python-c-api","A_Id":4995435,"CreationDate":"2011-02-14T17:40:00.000","Title":"C++ Python embedding: Run on machine with no Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to write a python script to convert PNG's into 2-page pdfs (i.e. 2 PNGs per PDF). The software needs to run on both a Mac and Windows 7.\nMy current solution is using ReportLab, but that doesn't install easily on a Mac. According to its website, it only has a compiled version for Windows. It has a cross-platform version that requires a C compiler to install.\nIs there a better way to do this (so that I don't have to install a C compiler on the Mac)? Should I use a different library, or a different language entirely? As long as I can call the program from a python script, I could use any language for the pdf creation. Or, is there a very straightforward (i.e a non-programmer could install it) C compiler that I could install on a Mac?\nWhat do you recommend?","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":8947,"Q_Id":4999660,"Users Score":1,"Answer":"PyCairo could be a good alternative. You'll have full control and less dependencies, but reportlab is a lot simplier.","Q_Score":6,"Tags":"python,pdf-generation,reportlab","A_Id":7099416,"CreationDate":"2011-02-15T03:36:00.000","Title":"Using python to convert PNG's into PDF's","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Have downloaded VLC.py, and placed it in my VLC install directory, where libvlc.dll is also present\nOn typing import vlc\nI get the following error\n\nTraceback (most recent call last):\n  File \"C:\\Program Files\n  (x86)\\VideoLAN\\VLC\\vlc.py\", line 88,\n  in \n      dll = ctypes.CDLL('libvlc.dll')   File\n  \"C:\\Python27\\lib\\ctypes__init__.py\",\n  line 353, in init\n      self._handle = _dlopen(self._name, mode) WindowsError: [Error 193] %1 is\n  not a valid Win32 application\n\nAny ideas why?\nIf needed, my config is:\nWin7 pro 64 bit\n4GB RAM","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2520,"Q_Id":5007455,"Users Score":3,"Answer":"Reposting my comment as an answer, since it fixed the problem:\n\nI'm going to guess that the problem is trying to load a 32-bit DLL from a 64-bit process. You may be able to fix it by using a 32-bit Python build.","Q_Score":0,"Tags":"python,vlc","A_Id":5033072,"CreationDate":"2011-02-15T17:55:00.000","Title":"VLC Python Bindings -- Error 193","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What's the best way to draw rotated text rendered with fonts with pygame? I can just draw the font then rotozoom it, but it seems better result would be gotten if it were possible to draw the glyphs directly rotated, especially taking AA into account?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2142,"Q_Id":5007478,"Users Score":0,"Answer":"You can use a pyOpenGL surface in pygame, if that simplifies it for you.\nPyglet also uses OpenGL. \n(for pygame surfaces) You can cache the rendered text, using that to rotate. Or pre-cache all 32 directions. [ see other answer ]","Q_Score":0,"Tags":"python,fonts,rotation,render,pygame","A_Id":5691673,"CreationDate":"2011-02-15T17:57:00.000","Title":"draw rotated font with pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPython app with one frame and one panel.  On that panel are a number of static boxes, each of which has buttons and textboxes.\nI have just begun reading about sizers, but they seem like they might be more than what I need, or it could that they are exactly what I need but I don't know how to use them correctly!\nThe frame currently opens at 1920 x 1080.  If the user drags the bottom right corner to resize the app, I just want everything to get smaller or larger as needed to keep the same size ratio.\nIs this possible?\nThank you!\nedit: additional info: I used wxPython 2.8 and Boa to construct the GUI.  I am contemplating trying another gui ide.\nSo after reading some more about sizers, I am thinking about doing the following:\nadd a gridsizer and basically divide my window's elements into rows and columns, then set each row and column's size as necessary until I achieve the original layout.  Then I guess set the rows and columns to resize correctly?  Is this a decent idea?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":301,"Q_Id":5012257,"Users Score":1,"Answer":"For complex layouts, I sketch it out on a piece of paper. Then I draw boxes around the widgets in different ways to decide what sizers to use. You can nest pretty much any sizer inside another one. If the controls naturally fit in a grid, then using a grid sizer of some sort is probably alright. If not, then use BoxSizers. I tend to use those the most.","Q_Score":1,"Tags":"python,wxpython,boxsizer","A_Id":5018264,"CreationDate":"2011-02-16T03:31:00.000","Title":"Simple wxPython Frame Contents Resizing - Ratio?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im currently working on a project with pygame and am in need of being able to view part of a surface, moving around, zooming in and out ect\nCan anyone recommend a way of achieving this efficently, i have it working in a convoluted method at the moment but it is too slow and reduces the game to about 1fps when zoomed out to view the whole area. (my version of only scrolling and no zooming works fine with no lagging)\nLooking though the docs pygame.transform.scroll looks promising but i am unsure how i would correctly implement it with pygame.transform.scale for zooming in and out\nAny help welcome\nupdate:\nI fiddled around for a bit and got it working scaleing objects and their positions before bliting them. I have now hit the problem that the scaling looks unatural because of the low resolution of the pygame scroll wheel events so I am now trying to impliment some kind of smoothing.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":7328,"Q_Id":5014993,"Users Score":0,"Answer":"For a game that I have never finished I used trigonometry to get the new drawing positions with a freely zoomed and turned camera (bit complicated). It didn't really take to much time to calculate but I think it is more efficient to use other libraries. But if you want some examples just ask.","Q_Score":5,"Tags":"python,scroll,zooming,transform,pygame","A_Id":13349846,"CreationDate":"2011-02-16T10:02:00.000","Title":"Pygame zooming\/scrolling window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im currently working on a project with pygame and am in need of being able to view part of a surface, moving around, zooming in and out ect\nCan anyone recommend a way of achieving this efficently, i have it working in a convoluted method at the moment but it is too slow and reduces the game to about 1fps when zoomed out to view the whole area. (my version of only scrolling and no zooming works fine with no lagging)\nLooking though the docs pygame.transform.scroll looks promising but i am unsure how i would correctly implement it with pygame.transform.scale for zooming in and out\nAny help welcome\nupdate:\nI fiddled around for a bit and got it working scaleing objects and their positions before bliting them. I have now hit the problem that the scaling looks unatural because of the low resolution of the pygame scroll wheel events so I am now trying to impliment some kind of smoothing.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":7328,"Q_Id":5014993,"Users Score":0,"Answer":"You can use pygame with OpenGL, since you are already familiar with pygame. Otherwise pyglet is a similar opengl library.","Q_Score":5,"Tags":"python,scroll,zooming,transform,pygame","A_Id":7509780,"CreationDate":"2011-02-16T10:02:00.000","Title":"Pygame zooming\/scrolling window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying automatically generate buttons to a menu using PIL in python.\nThe button should be small rectangular and have a little gradient from one color to another, and a little text in it.\nIs PIL the best way to do this, or is Cairo a better alternative? Any suggestion to how I can accomplish this without having a image to start with..?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":413,"Q_Id":5022891,"Users Score":1,"Answer":"You can do this entirely with PIL if you start with a single pre-made white-to-black gradient image (that you've made in some other program) and then use the ImageChops module to manipulate this together with your primary image to get what you want.\nFor example to if you want to fade from red to blue: multiply red by the gradient, flip the gradient and multiply blue by this, and add these together.\nIf your images vary in size, you can scale the gradient image appropriately in PIL.","Q_Score":1,"Tags":"python,python-imaging-library,cairo","A_Id":5024687,"CreationDate":"2011-02-16T22:25:00.000","Title":"Generating a shaded button using PIL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For a computer architecture assignment, I am trying to replace a C++ library called \"Sim\" with something in Python.\nI am already using MyHDL for the simulator, but the C++ program has a nice interactive feature that lets students see the components connected together (gates, inputs, outputs, flip flops, etc.) and toggle any signal.\nI am attempting to create that interactive aspect and I just need to pick the library to use.  I was wondering if wxPython would be a good choice in this case.  The GUI mainly needs to draw gates or devices like flip flops and counters, use lines to connect them, and have some representation of signals (0 and 1 for instance or black and white).\nIs wxPython a good idea, or are there better libraries for this application?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":441,"Q_Id":5038022,"Users Score":0,"Answer":"wxPython and PyQt both are good option. I find Qt easy as compare to wxPython.","Q_Score":3,"Tags":"python,wxpython,computer-architecture","A_Id":5039125,"CreationDate":"2011-02-18T05:40:00.000","Title":"Is wxPython good for a Hardware Simulator?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For a computer architecture assignment, I am trying to replace a C++ library called \"Sim\" with something in Python.\nI am already using MyHDL for the simulator, but the C++ program has a nice interactive feature that lets students see the components connected together (gates, inputs, outputs, flip flops, etc.) and toggle any signal.\nI am attempting to create that interactive aspect and I just need to pick the library to use.  I was wondering if wxPython would be a good choice in this case.  The GUI mainly needs to draw gates or devices like flip flops and counters, use lines to connect them, and have some representation of signals (0 and 1 for instance or black and white).\nIs wxPython a good idea, or are there better libraries for this application?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":441,"Q_Id":5038022,"Users Score":1,"Answer":"wxPython or pyside  (Qt python bindings) are both ideal for this.\nwx is a little better if you have any MFC experience, Qt is perhaps a more modern design.","Q_Score":3,"Tags":"python,wxpython,computer-architecture","A_Id":5038058,"CreationDate":"2011-02-18T05:40:00.000","Title":"Is wxPython good for a Hardware Simulator?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to listen for certain keypresses in a python terminal program without pausing execution with raw_input. I've seen people use a few windows specific ways of listening for keystrokes and I've seen people use large modules like tkinter and pygame which I want to avoid.\nIs there a lightweight module out there that does this cross platform (at least ubuntu, windows, mac)? or is there a way to use just the event system from tkinter, pygame, etc...?\nIf not, how should I approach tackling this? My first thought is to redirect stdin to another process and keep checking to see if it contains one of my event keys.\n\nedit\nThank you @unutbu for taking the time to mark this question that is 3 years old and successfully answered as a duplicate of another question whose answers do not apply to this question because I specifically asked about a non-blocking solution.","AnswerCount":4,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":20515,"Q_Id":5044073,"Users Score":6,"Answer":"Short answer: no\nKeypresses are system-dependent.  They are interrupt-driven.  They one of the basic things built into most modern OSes.  They have different philosophies that can't be unified in a generic way without losing functionality.  \nyou might try-\ntermios = unix, posix-style file-descriptor driven\ncurses = portal terminal-style handling (which is a specific console-based paradigm not generic)\nPython wraps certain classes of input that might come from the keyboard: e.g., sys.stdin for console inupt. \nBut trying to get universal keyboard input is a very general problem that's inherently platform-dependent.","Q_Score":21,"Tags":"python,keyboard-events","A_Id":5047120,"CreationDate":"2011-02-18T16:48:00.000","Title":"Python cross-platform listening for keypresses?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a game and now I want to make script system for it.\nNow I have abstract class Object which is inherited by all game objects. I have to write a lot of technical code, add new object type into enum, register parser function for each object (that function parses object's params from file).\nI don't want to make such work. So the idea is to get some script system (boost.python for example, because I'm using boost in my project). Each object will be a simple python-script, at c++ side I just load and run all that scripts.\nPython isn't hard -typed so I can register functions, build types dynamically without storing enum, etc. The only bad part is writing a lot of binding-code but It makes only once.\nAre my ideas right?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":203,"Q_Id":5050372,"Users Score":0,"Answer":"Can you give us a rough idea of how large the game is going to be?\nIf you're not careful, you could give yourself a lot of extra work without much benefit, but with some planning it sounds like it might help. The important questions are \"What parts of the program do I want to simplify?\", \"Do I need a scripting language to simplify them? and \"Can the scripting language simplify them?\". \nYou mentioned that you don't want to have to manually parse files. Python's pickle module could handle serialization for you, but so could .NET. If you're using Visual Studio, then you may find it easier to write the code in C# than in Python. \nYou should also look for ways to simplify your code without adding a new language. For example, you might be able to create a simple binary file format and store your data structures without much parsing. There are probably other things you can do, but that would require more detailed knowledge of the program.","Q_Score":1,"Tags":"c++,python,boost,system","A_Id":5055236,"CreationDate":"2011-02-19T10:57:00.000","Title":"Script system in application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having a problem with a simple Notepad application I'm writing to teach myself basic Python\/PyQt.\nSpecifically, I want to know how to change the multi-touch pan gesture sensitivity on a QListWidget. \nAs it is now, when I drag up and down with 2 fingers, it seems like the list is moving up\/down one step for each pixel I move with my fingers. This is nothing I've implemented myself, it seems to work out of the box for list widgets\nI want the movement to mimic the speed of my fingers i.e one move up\/down of the widget items for every x*height_of_item_in_pixels. Is this doable without major hacking into the gesture system?\nHow would I go about this?\nI'm using PyQt 4.8.3 with Python 2.6","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1586,"Q_Id":5050817,"Users Score":0,"Answer":"More than likely this functionality exists because the multitouch event is being interpreted by your operating system as a scroll of some type and QT is recieving the scroll action, rather than the multitouch action directly.","Q_Score":3,"Tags":"python,qt4,pyqt,pyqt4,qlistwidget","A_Id":18070801,"CreationDate":"2011-02-19T12:40:00.000","Title":"Customize PyQt multi-touch pan gestures on QListWidget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can i make a smooth circular orbit at a constant speed using pygame?\nHow would i calculate x, y on a circle?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":907,"Q_Id":5058591,"Users Score":1,"Answer":"Try using polar coordinates. It's natural :)\nIf you don't calculate enough frames to make your orbit look smooth, calculate 3-4 intermediate points of orbit to draw shorter line segments, without calculating the game state at these points. Make this radius-dependent. This helps proper collision detection, too.","Q_Score":1,"Tags":"python,math,pygame","A_Id":5058696,"CreationDate":"2011-02-20T17:16:00.000","Title":"Making smooth orbits in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a little programming experience and I did get to work with Swing (Java) and wxPython. \nSome years ago, I ended up having to port an app I did to OS X and all the problems I've had with wxPython just multiplied. I've started looking at alternatives and I could not find anything better than wxPython. QT was the only one that came even close. GTK was hell on Windows (last time I checked). \nI don't think my predicament is unique, some other people might have reached the same position over the years.\nSo, why isn't there a GUI toolkit to have the following characteristics:\n\nSimple. Basic windows\/dialogs (native open and save) + a basic set of widgets with SOLID Layout management. Additional (composite widgets) implemented as additional libraries. \nActively maintained on OS X, Linux and Windows\nActively maintained bindings to at least 3 high level languages. \nActively maintained documentation for best practices GUI devel with examples using the toolkit. MVC\/MVP properly explained. GUI HIG (Apple style) simply explained, complete with semantics, paradigms, best practices, alignment, proper spacing and TONS of best of their kind examples from successful pieces of software.  \nA simple way of building a distributable executable for the 3 targeted platforms in each of the languages. \nImplemented as close to the metal using readily available libs like Clutter, cairo, etc. \n\nAre these requirements too much to ask? If yes, why?\nHelp me understand why isn't there such a tiny lib available?","AnswerCount":6,"Available Count":3,"Score":0.1651404129,"is_accepted":false,"ViewCount":653,"Q_Id":5067578,"Users Score":5,"Answer":"Have you tried Qt? It is a cross platform C++ GUI toolkit for higher level language (PyQt). And it seemed very simple to me.","Q_Score":2,"Tags":"python,user-interface","A_Id":5067597,"CreationDate":"2011-02-21T15:08:00.000","Title":"Why are there no simple, cross-platform, C\/C++ GUI tookits for higher level languages?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a little programming experience and I did get to work with Swing (Java) and wxPython. \nSome years ago, I ended up having to port an app I did to OS X and all the problems I've had with wxPython just multiplied. I've started looking at alternatives and I could not find anything better than wxPython. QT was the only one that came even close. GTK was hell on Windows (last time I checked). \nI don't think my predicament is unique, some other people might have reached the same position over the years.\nSo, why isn't there a GUI toolkit to have the following characteristics:\n\nSimple. Basic windows\/dialogs (native open and save) + a basic set of widgets with SOLID Layout management. Additional (composite widgets) implemented as additional libraries. \nActively maintained on OS X, Linux and Windows\nActively maintained bindings to at least 3 high level languages. \nActively maintained documentation for best practices GUI devel with examples using the toolkit. MVC\/MVP properly explained. GUI HIG (Apple style) simply explained, complete with semantics, paradigms, best practices, alignment, proper spacing and TONS of best of their kind examples from successful pieces of software.  \nA simple way of building a distributable executable for the 3 targeted platforms in each of the languages. \nImplemented as close to the metal using readily available libs like Clutter, cairo, etc. \n\nAre these requirements too much to ask? If yes, why?\nHelp me understand why isn't there such a tiny lib available?","AnswerCount":6,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":653,"Q_Id":5067578,"Users Score":0,"Answer":"My guess is that windows developers couldn't be bothered as they have wpf etc and linux developers couldn't be bothered as they are used to it. So only people who are sick of win developement and moving to linux would embrace it. Maybe its time for you to start an open source project :) I was thinking something like wpf but based on opengl would be a good start.","Q_Score":2,"Tags":"python,user-interface","A_Id":5067655,"CreationDate":"2011-02-21T15:08:00.000","Title":"Why are there no simple, cross-platform, C\/C++ GUI tookits for higher level languages?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a little programming experience and I did get to work with Swing (Java) and wxPython. \nSome years ago, I ended up having to port an app I did to OS X and all the problems I've had with wxPython just multiplied. I've started looking at alternatives and I could not find anything better than wxPython. QT was the only one that came even close. GTK was hell on Windows (last time I checked). \nI don't think my predicament is unique, some other people might have reached the same position over the years.\nSo, why isn't there a GUI toolkit to have the following characteristics:\n\nSimple. Basic windows\/dialogs (native open and save) + a basic set of widgets with SOLID Layout management. Additional (composite widgets) implemented as additional libraries. \nActively maintained on OS X, Linux and Windows\nActively maintained bindings to at least 3 high level languages. \nActively maintained documentation for best practices GUI devel with examples using the toolkit. MVC\/MVP properly explained. GUI HIG (Apple style) simply explained, complete with semantics, paradigms, best practices, alignment, proper spacing and TONS of best of their kind examples from successful pieces of software.  \nA simple way of building a distributable executable for the 3 targeted platforms in each of the languages. \nImplemented as close to the metal using readily available libs like Clutter, cairo, etc. \n\nAre these requirements too much to ask? If yes, why?\nHelp me understand why isn't there such a tiny lib available?","AnswerCount":6,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":653,"Q_Id":5067578,"Users Score":2,"Answer":"What you ask is a simple lib with enormous flexibility. Be able to build 3 * 3 executables, having good documentation and using other libraries all with a different background. And all of that on different OS platforms. It is quite a challenge it think QT would com the closest but it does not meet all your criteria.","Q_Score":2,"Tags":"python,user-interface","A_Id":5067669,"CreationDate":"2011-02-21T15:08:00.000","Title":"Why are there no simple, cross-platform, C\/C++ GUI tookits for higher level languages?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I make a newly created window in wxPython not take focus? I'd like to be able to create a new window, without focus jumping to it.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":527,"Q_Id":5073054,"Users Score":1,"Answer":"That seems a little counter-intuitive. However, you can also simulate this by creating and showing the second frame and then calling Raise() on the original frame.","Q_Score":2,"Tags":"python,wxpython,focus","A_Id":5082357,"CreationDate":"2011-02-22T01:06:00.000","Title":"Preventing New Windows from Capturing Focus wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to convert a QTabBar inside the QTabWidget into a QComboBox?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":161,"Q_Id":5075232,"Users Score":1,"Answer":"That might somehow be possible by overwriting QTabWidget, but I think the much cleaner, faster and easier solution would be to combine QComboBox and QStackedWidget to a new widget.","Q_Score":1,"Tags":"python,qt,pyqt,pyqt4","A_Id":5077111,"CreationDate":"2011-02-22T07:23:00.000","Title":"Is it possible to convert a QTabBar inside the QTabWidget into a QComboBox?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've installed ActivePython 3.1 and ran IDLE with -n parameter as required by the turtle module in documentation. However when I try to use it with call such as turtle.postion(), new windows is opened (with Tk icon), which freezes and shows nothing.\nWhat could be wrong?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":906,"Q_Id":5081499,"Users Score":2,"Answer":"The immediate cause of the freeze is that the Tk event loop is not being serviced. Without that, Tk windows do not display or update correctly (all GUI toolkits are event based, but Tk is particularly so). Unfortunately, I don't know Python's Tk binding or IDLE nearly well enough to be able to say what that is caused by.","Q_Score":2,"Tags":"python,windows,tk,turtle-graphics,activepython","A_Id":5137220,"CreationDate":"2011-02-22T17:19:00.000","Title":"Why ActivePython freezes after I use the turtle module?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've installed ActivePython 3.1 and ran IDLE with -n parameter as required by the turtle module in documentation. However when I try to use it with call such as turtle.postion(), new windows is opened (with Tk icon), which freezes and shows nothing.\nWhat could be wrong?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":906,"Q_Id":5081499,"Users Score":0,"Answer":"Partially resolved by not running it in IDLE, I execute it as a python script and wait for input to see what is drawn.","Q_Score":2,"Tags":"python,windows,tk,turtle-graphics,activepython","A_Id":5092475,"CreationDate":"2011-02-22T17:19:00.000","Title":"Why ActivePython freezes after I use the turtle module?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Python Tkinter and I want to place a variable number of text box widgets in a frame or canvas. The text boxes are packed vertically down the frame, so the first one is on top, the second one is found below, etc.. I can have all the button, listbox, etc widgets in a \"left section\" of the GUI, while a \"right section\" will only contain the text box widgets. I want the text box widgets to horizontally expand when the master window is maximized, but because there's a variable number of these widgets, the \"right section\" containing the text boxes also needs to be able to vertically scroll to view them all.\nCurrently, I'm using Canvas.create_window to add my variable number of text boxes to the canvas, and while I can scroll the canvas to view all the text boxes, they do not horizontally expand when I resize the window. I have an alternate GUI that uses a frame for the \"right section\", which allows the widgets to horizontally expand, but if too many are packed, I cannot scroll the frame to see the additional text boxes because I can't have a scroll bar tied to a frame.\nIs there any way around this trade-off?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1473,"Q_Id":5082642,"Users Score":0,"Answer":"The solution is pretty simple: bind to the <Configure> event of the canvas -- this will cause your callback to be called whenever the canvas widget is resized. You then simply need to get the width of the canvas and use that to iteratively resize all the embedded windows.","Q_Score":1,"Tags":"python,canvas,widget,scroll,tkinter","A_Id":5082704,"CreationDate":"2011-02-22T19:03:00.000","Title":"Python Tkinter - Scrollable canvas containing expandable widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wondering how to go about implementing a macro recorder for a python gui (probably PyQt, but ideally agnostic). Something much like in Excel but instead of getting VB macros, it would create python code. Previously I made something for Tkinter where all callbacks pass through a single class that logged actions.  Unfortunately my class doing the logging was a bit ugly and I'm looking for a nicer one. While this did make a nice separation of the gui from the rest of the code, it seems to be unusual in terms of the usual signals\/slots wiring. Is there a better way?\nThe intention is that a user can work their way through a data analysis procedure in a graphical interface, seeing the effect of their decisions. Later the recorded procedure could be applied to other data with minor modification and without needing the start up the gui.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1816,"Q_Id":5093153,"Users Score":1,"Answer":"Thinking in high level, this is what I'd do:\nDevelop a decorator function, with which I'd decorate every event-handling functions.\nThis decorator functions would take note of thee function called, and its parameters  (and possibly returning values) in a unified data-structure - taking care, on this data structure, to mark Widget and Control instances as a special type of object. That is because in other runs these widgets won't be the same instances - ah, you can't even serialize a toolkit widget instances, be it Qt or otherwise.\nWhen the time comes to play a macro, you fill-in the gaps replacing the widget-representating object with the instances of the actually running objects, and simply call the original functions with the remaining parameters.\nIn toolkits that have an specialized \"event\" parameter that is passed down to event-handling functions, you will have to take care of serializing and de-serializing this event as well.\nI hope this can help. I could come up with some proof of concept code for that (although I am in a mood to use tkinter today - would have to read a lot to come up with a Qt4 example).","Q_Score":2,"Tags":"python,user-interface,macros,recorder","A_Id":5093338,"CreationDate":"2011-02-23T15:41:00.000","Title":"Implementing a macro recorder for a python gui?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wondering how to go about implementing a macro recorder for a python gui (probably PyQt, but ideally agnostic). Something much like in Excel but instead of getting VB macros, it would create python code. Previously I made something for Tkinter where all callbacks pass through a single class that logged actions.  Unfortunately my class doing the logging was a bit ugly and I'm looking for a nicer one. While this did make a nice separation of the gui from the rest of the code, it seems to be unusual in terms of the usual signals\/slots wiring. Is there a better way?\nThe intention is that a user can work their way through a data analysis procedure in a graphical interface, seeing the effect of their decisions. Later the recorded procedure could be applied to other data with minor modification and without needing the start up the gui.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1816,"Q_Id":5093153,"Users Score":1,"Answer":"You could apply the command design pattern: when your user executes an action, generate a command that represents the changes required.  You then implement some sort of command pipeline that executes the commands themselves, most likely just calling the methods you already have.  Once the commands are executed, you can serialize them or take note of them the way you want and load the series of commands when you need to re-execute the procedure.","Q_Score":2,"Tags":"python,user-interface,macros,recorder","A_Id":5093408,"CreationDate":"2011-02-23T15:41:00.000","Title":"Implementing a macro recorder for a python gui?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I've got a problem - I'm writing a game prototype in Python, using Pygame, and I want to save my games.  All of the game-related data is in three instances of certain classes, and I want to save these three instances to a file.  However, I've tried pickling these instances, and it doesn't work.  Instead, I get \"TypeError: can't pickle Surface objects\".  This is a problem, because I want to store Surface objects.\nI'm open to any alternatives to pickling that there may be, using any other kind of data type.  The important thing is that these instances get stored, and that their data is then retrievable later on.  So what can I do to overcome this issue?  Please keep in mind, I'm not a very experienced programmer, having learned Python in my spare time a year ago, and I can't write much of any other language, though I'm slowly learning C++.","AnswerCount":2,"Available Count":1,"Score":0.4621171573,"is_accepted":false,"ViewCount":1353,"Q_Id":5145664,"Users Score":5,"Answer":"The basic point of pickling is that you should be able to serialise the object somehow. An SDL surface is an in memory object holding a lot of run time state. Trying to serialise it is not totally sensible. \nWhat you should do is to decouple the state of your game from the rendering components so that you can serialise just those (pickling or whatever). \nIt's like trying to save the state of a video by somehow saving the memory buffers holding the decoded video. This will not work. Instead, how you save it is to serialise the location of the video file and the time offset. Then you can continue playback upon load the next time you restore your application.","Q_Score":3,"Tags":"python,serialization,pygame,pickle","A_Id":5145756,"CreationDate":"2011-02-28T17:58:00.000","Title":"Storing unpicklabe pygame.Surface objects in external files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started using SWIG on a huge C++ library (made of of several inter-dependent static libs) to expose it to python. This library defines many primitive classes that are used throughout as parameters (images of different types for example). There is extensive use of STL, inheritance and templating in the lib as well.\nSo far I have a minimal portion of the lib usable from Python but would like to progressively add the remaining 90+%.\nFor my part, working with SWIG is really no fun: Battling with template instantiations, learning all that SWIG syntax and keywords, etc. I recently played a bit with CTypes and found it so enjoyable that I am now considering writing an extern C interface for the whole library instead of using SWIG.\nI would rather be coding in C\/C++ and\/or Python than learning an obscure set of SWIG commands (that counts for SIP also).\nThere are quite a few questions out there already asking similar advice so I'll add something new and specific:   \nI would like for the library's internal images classes to be visible from python as PIL images transparently, not as SWIG-Wrapped native classes. Will I have to resort to the plain-old Python External API to accomplish that?\nI welcome any and all advice!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":982,"Q_Id":5160308,"Users Score":1,"Answer":"Have you considered looking into using Boost.Python?","Q_Score":3,"Tags":"c++,python,python-imaging-library","A_Id":5161325,"CreationDate":"2011-03-01T21:03:00.000","Title":"Exposing C++ library to Python + PIL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Why doesn't Ctrl+C work to break a Python program that uses PyQt?  I want to debug it and get a stack trace and for some reason, this is harder to do than with C++!","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":10443,"Q_Id":5160577,"Users Score":4,"Answer":"I agree with Neil G, and would add this:\nIf you do not call QApplication.exec_() to start the event loop, and instead execute your program in an interactive python shell (using python -i), then pyqt will automatically process events whenever the interactive prompt is waiting, and Ctrl-C should again behave as expected. This is because the Qt event loop will be sharing time with the python interpreter, rather than running exclusively, allowing the interpreter a chance to catch those interrupts.","Q_Score":23,"Tags":"python,pyqt","A_Id":5186213,"CreationDate":"2011-03-01T21:28:00.000","Title":"Ctrl-C doesn't work with PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a list of instances of objects (wxPython widgets). I'd like to be able to tell if an instance within my list has been destroyed. How would one go about this?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":803,"Q_Id":5162773,"Users Score":4,"Answer":"Assuming wxPython is playing by the rules and by \"destroyed\" you mean \"is no longer referenced\", then the weakref module in the standard library should let you do what you want (specifically, you can register a callback when creating a weak reference that is invoked just before the target of the weak reference is destroyed).\nIf wxPython isn't playing by the rules, or has disabled weak referencing for its objects, you may be out of luck.","Q_Score":1,"Tags":"python,list,wxpython,instance","A_Id":5162963,"CreationDate":"2011-03-02T02:28:00.000","Title":"Telling if an Instance has been Destroyed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a list of instances of objects (wxPython widgets). I'd like to be able to tell if an instance within my list has been destroyed. How would one go about this?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":803,"Q_Id":5162773,"Users Score":0,"Answer":"This is applicable to all wx.Window derived objects. If it has been destroyed or disposed, it won't be None, but it will be False.","Q_Score":1,"Tags":"python,list,wxpython,instance","A_Id":40513866,"CreationDate":"2011-03-02T02:28:00.000","Title":"Telling if an Instance has been Destroyed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I try to import the 'Rect'-struct from System.Windows, IronPython-Interpreter claims that it cannot import.\nSince I am using the IronPython Tools for Visual Studio, i can also see that the IntelliSense-DropDown does not show this struct.\nIs there a need for a special statement for importing this struct?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":273,"Q_Id":5189630,"Users Score":2,"Answer":"You probably need to do:\nimport clr\nclr.AddReference('WindowsBase')\nto load the assembly Rect is declared in before importing it.","Q_Score":1,"Tags":"import,ironpython,rect","A_Id":5190602,"CreationDate":"2011-03-04T04:23:00.000","Title":"IronPython: Cannot import 'Rect'-struct from System.Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there an equivalent to Tkinter's .after() in wxPython? \nFor those that don't know .after() allows the running of functions at some point in the future. This can be used to make loops with functions. \nI'm attempting to make a clock, so this would be handy for making it tick.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1132,"Q_Id":5201876,"Users Score":1,"Answer":"There are several functions in wx.Python to do that.\nYou should check the \"Process and events\" section of the wxPython demos, More especifically those related with wx.Timer\n\nThe wx.Timer class allows you to\n  execute code at specified intervals\n  from within the wxPython event loop.\n  Timers can be one-shot or repeating. \n  This demo shows the principle method\n  of using a timer (with events) as well\n  as the convenient wx.FutureCall class.","Q_Score":1,"Tags":"python,wxpython,tkinter","A_Id":5201931,"CreationDate":"2011-03-05T05:22:00.000","Title":"wxPython Equivalent to Tkinter .after()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i am looking to start learning. people have told me it is juts as capable. though i haven't really seen any good looking games available. some decent ones on pygame, but none really stand out.\ni would like to know if python really is as capable as other languages.\nEDIT: thanks guys, is python good for game development?","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":161,"Q_Id":5217513,"Users Score":2,"Answer":"Short answer: Yes, it is.\nBut this heavily depends on your problem :)","Q_Score":0,"Tags":"python","A_Id":5217530,"CreationDate":"2011-03-07T08:40:00.000","Title":"is python as capable as other languages like c++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im making a PyQt4 app which calls Imagemagick and ffmpeg, but it takes too much to complete the tasks and im wondering if there is a way to implement threads to this, the app is going to run in a multicore machine, and some of the methods I have seen are not efficient enough. Thanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":256,"Q_Id":5224679,"Users Score":0,"Answer":"The answer is yes and no - you can use QThread for threading but you'll still be subject to the GIL, so your threads will run in serial.\nYou could try using multiprocessing to create a worker class in its own process and send work to it (or have it steal work from a queue), however this could introduce its own performance penalties in copying objects and sending objects between processes...\n\nHaving re-read your question, it looks like Imagemagick and ffmpeg are external executables, in which case the GIL is released while you wait for the process to execute. Can I ask how you run these though? I tend to find that it is better to create a work queue and an event loop. Each time round the event loop you check whether your running process(es) have finished and then get their output. For this subprocess.Popen is more useful than os.command.\nIf you use a QTimer you can utilise your QApplication's event loop, which also has the added benefit of allowing your GUI (assuming you have one) to be refreshed between ticks.","Q_Score":0,"Tags":"multithreading,ffmpeg,imagemagick,pyqt4,python-2.6","A_Id":5273687,"CreationDate":"2011-03-07T20:08:00.000","Title":"Threads in PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i hear people say python is just as good as c++ and java but i cant find many good games made in python. a few in pygames but not many\njust trying to choose the right language\nedit: sorry, many games really, i would love to make a roguelike, basically my dream. also an overhead rpg. nothing to complex, i dont want to reinvent the wheel but i would like to make a fun game. i have minor java experience, but like the looks of python. i dont plan on making a 3d game really.","AnswerCount":6,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":90954,"Q_Id":5224759,"Users Score":3,"Answer":"I'd say Python is okay for scripting in a game engine (See: EVE Online, Civ IV), but I wouldn't write a game engine in it. The performance just isn't there for serious real-time games. If you just want to do simple 2d stuff that's fine, but your're not going to write the next Crysis, or even the next Minecraft, in pure Python.","Q_Score":21,"Tags":"python","A_Id":5224812,"CreationDate":"2011-03-07T20:17:00.000","Title":"is python good for making games?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i hear people say python is just as good as c++ and java but i cant find many good games made in python. a few in pygames but not many\njust trying to choose the right language\nedit: sorry, many games really, i would love to make a roguelike, basically my dream. also an overhead rpg. nothing to complex, i dont want to reinvent the wheel but i would like to make a fun game. i have minor java experience, but like the looks of python. i dont plan on making a 3d game really.","AnswerCount":6,"Available Count":2,"Score":0.0333209931,"is_accepted":false,"ViewCount":90954,"Q_Id":5224759,"Users Score":1,"Answer":"For the kind of games you want to make, Python is a perfectly suitable language. The only reason there are few games made in Python is because the professional game development industry nearly exclusively uses C++, which in turn due to a combination of performance concerns and reliance on legacy code. These aren't significant for your situation so don't worry about it.","Q_Score":21,"Tags":"python","A_Id":5261445,"CreationDate":"2011-03-07T20:17:00.000","Title":"is python good for making games?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to manage some Virtual Machines through the vboxapi provided with the SDK.\nSo far I managed to launch the VM and poweroff it, but I'm not able to restore the snapshot.\nLooks like the power off procedure locks the virtual machine until the scripts terminates, as a matter of fact this is the error that I get:\n    progress = self.session.console.restoreSnapshot(self.mach.currentSnapshot)\n  File \"\", line 3, in restoreSnapshot\nxpcom.Exception: 0x80070005 (The object is not ready)\nAnd following is the specific functions I sequentially call to stop vm and restore snapshot.\n\n    def stop(self):\n        if self.mach:\n            # Poweroff the virtual machine.\n            progress = self.session.console.powerDown()\n            # Wait for task to complete with a 60 seconds timeout.\n            progress.waitForCompletion(VIRTUALBOX_TIMEOUT)\n            # Check if poweroff was successful.\n            if progress.resultCode != 0:\n                log(\"[Virtual Machine] [PowerOff] [ERROR] Unable to poweroff virtual machine \\\"%s\\\".\" % self.mach.name)\n                return False\n            else:\n                log(\"[Virtual Machine] [PowerOff] Virtual machine \\\"%s\\\" powered off successfully.\" % self.mach.name)\n        else:\n            log(\"[Virtual Machine] [PowerOff] [ERROR] No virtual machine handle.\")\n            return False\n\n        return True\n\n    def restore_snapshot(self):\n        if self.mach:\n            # Restore virtual machine snapshot.\n            progress = self.session.console.restoreSnapshot(self.mach.currentSnapshot)\n            # Wait for task to complete with a 60 seconds timeout.\n            progress.waitForCompletion(VIRTUALBOX_TIMEOUT)\n            # Check if snapshot restoring was successful.\n            if progress.resultCode != 0:\n                log(\"[Virtual Machine] [Restore Snapshot] [ERROR] Unable to restore virtual machine \\\"%s\\\" snapshot.\" % self.mach.name)\n                return False\n            else:\n                log(\"[Virtual Machine] [Restore Snapshot] Virtual machine \\\"%s\\\" successfully restored to current snashot.\" % self.mach.name)\n        else:\n            log(\"[Virtual Machine] [Restore Snapshot] [ERROR] No virtual machine handle.\")\n            return False\n\n        return True\nI think I'm probably missing something, any clue of what that is?\nThanks,\nC.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2664,"Q_Id":5253832,"Users Score":0,"Answer":"You need to lock the machine first so that the console object get created for you.","Q_Score":3,"Tags":"python,api,virtualbox","A_Id":28183048,"CreationDate":"2011-03-09T23:53:00.000","Title":"VirtualBox Python API restoring snapshot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a Listbox in Tkinter that has columns. \nI'm returning from a DB query records and would like to display each entry in it's own column for each record. \nLooking at Listbox, I feel like there should be this functionality there but can't find it. What widget should I be using to do this? I've been searching around online but documentation has been very sparse.","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":62004,"Q_Id":5286093,"Users Score":9,"Answer":"One simple solution is to use two listboxes side-by-side. There's no real magic, you just have to do a little bit of extra work to get one scrollbar to control both (easily done) and have the selection in the two sync up (also easily done).","Q_Score":20,"Tags":"python,listbox,tkinter","A_Id":5290731,"CreationDate":"2011-03-12T22:52:00.000","Title":"Display Listbox with columns using Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to use both Cython and pure python extensions together? Say I'd like to have a wrapper for a C function, returning GdkPixbuf pointer. The ultimate goal would be to have that function available in python, returning gtk.gdk.Pixbuf object.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":272,"Q_Id":5287207,"Users Score":0,"Answer":"Yes it is possible because most of the things that can be done with python can also be done in cython. However, using python extensions or doing anything with python objects (as opposed to statically declared C datatypes) will incur a performance penalty, so Cython will be less of an advantage.\nLook into cdef classes, they are an efficient way to implement objects in cython.","Q_Score":0,"Tags":"python,gtk,pygtk,cython","A_Id":5467143,"CreationDate":"2011-03-13T03:28:00.000","Title":"Cython interface with other extensions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QTreeWidget with QComboBoxes inside of it.  I would like to be able to hide the combo boxes.\nI am getting the QComboBox out of the tree using the itemWidget function.  I have tried using setVisible(False) and hide() but neither work.  Can anyone explain why this is the case and possibly offer a soultion?  \nI suspect it has something to do with the QTreeWidget or the QTreeWidgetItems controlling the visibility of its widgets.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":220,"Q_Id":5307007,"Users Score":0,"Answer":"Have you tried putting the QComboBoxes inside a layout inside a QWidget, and placing the QWidget in the QTreeWidget?","Q_Score":1,"Tags":"python,qt,user-interface,qt4,pyqt","A_Id":5312332,"CreationDate":"2011-03-15T02:54:00.000","Title":"PyQt Hide QDialogs Inside of QTreeWidget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created three frames separately. I need to call these child frames \nfrom the click events of buttons located in a main frame. And when a \nchild frame is open, I want the main frame to be hidden or disabled \nuntil the child frame is closed. How can I do this? \nThanks in advance.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":149,"Q_Id":5308263,"Users Score":0,"Answer":"Create an event queue for each frame, when a child frame is opened set a variable that is checked on processing events to join the queue, and then unset this on destruction of the child frame. If this variable is set then throw the message away, otherwise add it to the queue for processing.\nDepending on the libraries you are using there may be a nice built-in way of dong most of this.","Q_Score":0,"Tags":"python,wxpython","A_Id":5308640,"CreationDate":"2011-03-15T06:31:00.000","Title":"Control three frames from main menu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to write some python, and I'm used to the lispy way of doing things, a REPL in EMACS and the ability to send arbitrary code snippets to the REPL. I like this way of developing code, and python's built-in IDLE seems to do it pretty well. However I do like EMACS as an editor.\nWhat's the best thing analogous to SLIME for Python?\n\nSo far:\nIt seems that the trick is to open a python file, and then to use 'Start Interpreter' from the Python menu, after which you get an Inferior Python buffer. You can then use C-c C-c to load the whole buffer you're editing into the 'REPL', and use normal copy and paste to put snippets into the REPL.\nThis works as far as it goes. Is there any way to say 'reevaluate the big thing that the cursor is in now and display the answer', or 'reevaluate the thing the cursor is just at the end of and display the answer', like M-C-x and C-x-e in SLIME?\nAnd it all seems to work better if you use the python-mode.el from Bozhidar's answer","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":4224,"Q_Id":5316175,"Users Score":3,"Answer":"python-mode is the default mode for editing Python in emacs. It includes commands for evaluating the buffer and running an inferior interpreter instance.","Q_Score":11,"Tags":"python,emacs,slime","A_Id":5316229,"CreationDate":"2011-03-15T18:18:00.000","Title":"What's the closest thing to SLIME for python ? \/ What's the best way to use python from EMACS?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"It might be the bindings (SIP) or even python, but I have a problem with Qt (pyqt4).\nI have a QTabWidget, and inside it I put widgets one can close.\nI have a widget that allocates about 400mb of memory. I have not set a parent, and I call deleteLater() on close but nothing happens. Even calling the python's gc does not work:\n\nimport gc\ngc.collect()\n\nNow when closing the widgets from the QTabWidget without using deleteLater() more and more memory is allocated. So lets say I open up 4 tabs of the memory-heavy widget, I use around 1.6GB memory. If I close them all, and open a new, I am now up to 2GB of memory usage.\nIf I use the deleteLater(), after closing the 4 tabs, I do not go up to 2GB opening a new one, then I have to open 5 tabs. But, and here is the problem, 1.6GB is still allocated for the process (python) even tho all widgets are closed, and deleteLater has been called.\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1477,"Q_Id":5341954,"Users Score":3,"Answer":"I had this - somewhere you have an reference to your widget, and that reference has been counted... the only way to delete that widget is to make sure that there are no remaining references so python can garbage-collect it.\nAt least you don't end up with a dangling reference like C++, which can lead to some nasty crashes...\n\nThis can actually be useful - if you create a class with a class-level list of its members, you can recycle old objects and never have them garbage-collected","Q_Score":3,"Tags":"python,qt,garbage-collection,pyqt4","A_Id":5341992,"CreationDate":"2011-03-17T16:19:00.000","Title":"Memory not deallocated - PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've managed to package my PyQt4 app as a \"standalone\" application on windows, it works.\nHowever this application can upgrade itself, which is done by replacing the actual code written by me (.py files) with new versions, downloaded via the internet.\nHow can I tell PyInstaller do its job (putting together the DLLs, generating the launcher with the shiny icon, etc), BUT let the .py files untouched?\nI need those files directly on disk, in order for the auto-update to work.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1782,"Q_Id":5366100,"Users Score":0,"Answer":"I think the embedded interpreter in the executable will still search for .py files in the same directory and\/or PYTHONPATH, py2exe uses a zip file for native python components, iirc pyinstaller embeds all of them in the executable, maybe there is an option to keep a zip like in py2exe (or not add them in the spec), then try to run the application without the files and monitor file accesses with procmon.","Q_Score":8,"Tags":"python,installation,pyqt4,pyinstaller","A_Id":6085674,"CreationDate":"2011-03-20T01:12:00.000","Title":"PyInstaller but keeping .py files upgradeable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to run a Qt application in Batch mode, so basically I need to run it without GUI. \nI've already tried using QCoreApplication but my application relies on the existence of X11 window. So I need the GUI to open regularly, but I need to \"hide\" it from the user.\nI know that I have the ability to create a virtual VNC and change the active display to the virtual VNC window.\nI'm looking for a cleaner, simpler solution that will allow to suppress or \"dump\" the GUI output of the application.\nIf this helps for ideas, it will be used in a script written in Bash, Perl or Python.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":454,"Q_Id":5369290,"Users Score":1,"Answer":"As @utdmr suggested, that solved the problem.\nI've thought that show() was also responsible for the signal\/slot mechanism and other Qt and X11 functions. But apparently, the application works normally, just doesn't show the GUI. \nAnd that was exactly what I needed since it is a fully developed application and the effort to convert it to a console application was enormous.\nThanks utdmr :)","Q_Score":2,"Tags":"python,linux,qt,user-interface,x11","A_Id":5420016,"CreationDate":"2011-03-20T15:08:00.000","Title":"How to suppress a Qt GUI application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a gtk.Window. How do I set it to be the active window? I can call is_active() to see whether it already is, but I don't see where to make it active.\nBonus points: given a gtk.Widget, how do I make the window it is a part of the active window?","AnswerCount":4,"Available Count":1,"Score":-0.049958375,"is_accepted":false,"ViewCount":4336,"Q_Id":5393185,"Users Score":-1,"Answer":"You can also use gtk.Dialog.run (if it's a Dialog) aditional to gtk.Window.present","Q_Score":3,"Tags":"python,window,pygtk,gtk","A_Id":5441492,"CreationDate":"2011-03-22T14:58:00.000","Title":"gtk: set active window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Debugging performance problems using a standard debugger is almost hopeless since the level of detail is too high. Other ways are using a profiler, but they seldom give me good information, especially when there is GUI and background threads involved, as I never know whether the user was actually waiting for the computer, or not. A different way is simply using Control + C and see where in the code it stops.\nWhat I really would like is to have Fast Forward, Play, Pause and Rewind functionality combined with some visual repressentation of the code. This means that I could set the code to run on Fast Forward until I navigate the GUI to the critical spot. Then I set the code to be run in slow mode, while I get some visual repressentation of, which lines of are being executed (possibly some kind of zoomed out view of the code). I could for example set the execution speed to something like 0.0001x. I believe that I would get a very good visualization this way of whether the problem is inside a specific module, or maybe in the communication between modules.\nDoes this exist? My specific need is in Python, but I would be interested in seeing such functionality in any language.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":182,"Q_Id":5416987,"Users Score":1,"Answer":"The methods you're describing, and many of the comments, seem to me to be relatively weak probabilistic attempts to understand the performance impact.  Profilers do work perfectly well for GUIs and other idle-thread programs, though it takes a little practice to read them.  I think your best bet is there, though -- learn to use the profiler better, that's what it's for.  \nThe specific use you describe would simply be to attach the profiler but don't record yet.  Navigate the GUI to the point in question.  Hit the profiler record button, do the action, and stop the recording.  View the results.  Fix.  Do it again.","Q_Score":6,"Tags":"java,python,performance,debugging,debuggervisualizer","A_Id":5419956,"CreationDate":"2011-03-24T09:19:00.000","Title":"Debugging visually using >>, >, >|, ||, |<, <, <<","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Debugging performance problems using a standard debugger is almost hopeless since the level of detail is too high. Other ways are using a profiler, but they seldom give me good information, especially when there is GUI and background threads involved, as I never know whether the user was actually waiting for the computer, or not. A different way is simply using Control + C and see where in the code it stops.\nWhat I really would like is to have Fast Forward, Play, Pause and Rewind functionality combined with some visual repressentation of the code. This means that I could set the code to run on Fast Forward until I navigate the GUI to the critical spot. Then I set the code to be run in slow mode, while I get some visual repressentation of, which lines of are being executed (possibly some kind of zoomed out view of the code). I could for example set the execution speed to something like 0.0001x. I believe that I would get a very good visualization this way of whether the problem is inside a specific module, or maybe in the communication between modules.\nDoes this exist? My specific need is in Python, but I would be interested in seeing such functionality in any language.","AnswerCount":3,"Available Count":2,"Score":0.2605204458,"is_accepted":false,"ViewCount":182,"Q_Id":5416987,"Users Score":4,"Answer":"The \"Fast Forward to critical spot\" function already exists in any debugger, it's called a \"breakpoint\". There are indeed debuggers that can slow down execution, but that will not help you debug performance problems, because it doesn't slow down the computer. The processor and disk and memory is still exactly as slow as before, all that happens is that the debugger inserts delays between each line of code. That means that every line of code suddenly take more or less the same time, which means that it hides any trace of where the performance problem is.\nThe only way to find the performance problems is to record every call done in the application and how long it took. This is what a profiler does. Indeed, using a profiler is tricky, but there probably isn't a better option. In theory you could record every call and the timing of every call, and then play that back and forwards with a rewind, but that would use an astonishing amount of memory, and it wouldn't actually tell you anything more than a profiler does (indeed, it would tell you less, as it would miss certain types of performance problems).\nYou should be able to, with the profiler, figure out what is taking a long time. Note that this can be both by certain function calls taking a long time because they do a lot of processing, or it can be system calls that take a long time becomes something (network\/disk) is slow. Or it can be that a very fast call is called loads and loads of times. A profiler will help you figure this out. But it helps if you can turn the profiler on just at the critical section (reduces noise) and if you can run that critical section many times (improves accuracy).","Q_Score":6,"Tags":"java,python,performance,debugging,debuggervisualizer","A_Id":5417219,"CreationDate":"2011-03-24T09:19:00.000","Title":"Debugging visually using >>, >, >|, ||, |<, <, <<","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My stack for web developing includes Django\/Python and Qt\/C++ for non-web developing.\nWhat is most comfortable OS for a developer with such a stack ?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":237,"Q_Id":5423404,"Users Score":1,"Answer":"I would say: nobody cares...if you are fine with Windows, use Windows. If you are commandline guy, go with a Unix system...the distro unlikely matters...","Q_Score":1,"Tags":"python,linux,qt","A_Id":5423456,"CreationDate":"2011-03-24T17:57:00.000","Title":"Which OS recommended for Programmers?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"My stack for web developing includes Django\/Python and Qt\/C++ for non-web developing.\nWhat is most comfortable OS for a developer with such a stack ?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":237,"Q_Id":5423404,"Users Score":1,"Answer":"Once you go linux, you'll never go back (though you might go crazy and move onto bsd).  Ubuntu is probably the easiest OS to start with, if only because of the truckloads of documentation, forum assistance, etc.  Good luck!","Q_Score":1,"Tags":"python,linux,qt","A_Id":5423449,"CreationDate":"2011-03-24T17:57:00.000","Title":"Which OS recommended for Programmers?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"My stack for web developing includes Django\/Python and Qt\/C++ for non-web developing.\nWhat is most comfortable OS for a developer with such a stack ?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":237,"Q_Id":5423404,"Users Score":1,"Answer":"If you don't want to use an language that has special requirements (like .net), the question should be which os does the programmer recommend.\nThat's really a personal decision.","Q_Score":1,"Tags":"python,linux,qt","A_Id":5423454,"CreationDate":"2011-03-24T17:57:00.000","Title":"Which OS recommended for Programmers?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I need to know how to do this on a mac because whenever I try quitting it, I have to force quit it. Is there a proper way when the user clicks the exit button that Tkinter will exit normally?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":888,"Q_Id":5427875,"Users Score":2,"Answer":"I figured out how. I just put a simple exit() command after the main loop.","Q_Score":2,"Tags":"python,macos,tkinter,exit","A_Id":5427950,"CreationDate":"2011-03-25T02:21:00.000","Title":"Python: How can I make my tkinter app exit properly?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a GUI toolkit which also has a good designer (like visual studio) for Python language.\nIt should have\n...Good Documentation\n...Good IDE + Designer\n...Cross Platform Support (if possible)","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1203,"Q_Id":5432871,"Users Score":0,"Answer":"I've used PyQt together with Qt Designer, nice documentation and cross platform support.","Q_Score":3,"Tags":"python,user-interface,toolkit","A_Id":5432925,"CreationDate":"2011-03-25T13:12:00.000","Title":"GUI Toolkit with Good Designer for Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a 3d shooter game that I would like to run on Computers\/Phones\/Tablets and would like some help to choose which engine to use.\n\nI would like to write the application once and port it over to Android\/iOS\/windows\/mac with ease.\nI would like to make the application streamable over the internet. \nThe engine needs some physics(collision detection) as well as 3d rendering capabilities\nI would prefer to use a scripting language such as Javascript or Python to Java or C++(although I would be willing to learn these if it is the best option)\n\n-My desire is to use an engine that is Code-based and not GUI-based, an engine that is more like a library which I can import into my Python files(for instance) than an application which forces me to rely on its GUI to import assets and establish relationships between them.\n\n\n\nThis desire stems from my recent experience with Unity3d and Blender. The way I had designed my code required me to write dozens of disorganized scripts to control various objects. I cannot help but think that if I had written my program in a series of python files that I would be able to do a neater, faster job. \n\n\n\nI'd appreciate any suggestions. The closest thing to what I want is Panda3d, but I had a difficult time working with textures, and I am not convinced that my application can be made easily available to mobile phone\/device users. If there is a similar option that you can think about, I'd appreciate the tip.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1543,"Q_Id":5445166,"Users Score":2,"Answer":"For the requirements that you have Unity3d is probably one of your best bets. As roy said there aren't any other 3D engines out there that will span that wide a range of platforms. Why do you think that going to a completely code based system would save you from creating a variety of classes with various responsibilities ?\nThe coding effort and the amount of code and classes will stay the same. The only thing that does change is the way that you interact with the system that you are producing. With any large scale system you will quickly run into hundreds of files. I am just finishing up a smaller sized unity project 3-4 month coding including learning unity it runs at 10k lines of code plus another 8k from external libraries and over 100 classes. But this amount wasn't driven by how unity works it was driven by the requirements of the project. While coding this I have learned a lot about how unity runs and what kind of patterns it requires and will be able to come up with better solutions for the next project. Look back at what you did and think about how you can organize it better. I think it is a save bet to say that you will need about the same amount of code with any other system to achieve a similar result. \nThe advantages that unity does have are a good multiplattform support and a excellent asset pipeline. Importing and utilising art assets, 2D, 3D and audio is for me one of the most onerous tasks of this kind of development and it is extremely well supported in unity.","Q_Score":0,"Tags":"javascript,python,game-engine","A_Id":5445501,"CreationDate":"2011-03-26T20:41:00.000","Title":"3d game engine suggestions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am developing a 3d shooter game that I would like to run on Computers\/Phones\/Tablets and would like some help to choose which engine to use.\n\nI would like to write the application once and port it over to Android\/iOS\/windows\/mac with ease.\nI would like to make the application streamable over the internet. \nThe engine needs some physics(collision detection) as well as 3d rendering capabilities\nI would prefer to use a scripting language such as Javascript or Python to Java or C++(although I would be willing to learn these if it is the best option)\n\n-My desire is to use an engine that is Code-based and not GUI-based, an engine that is more like a library which I can import into my Python files(for instance) than an application which forces me to rely on its GUI to import assets and establish relationships between them.\n\n\n\nThis desire stems from my recent experience with Unity3d and Blender. The way I had designed my code required me to write dozens of disorganized scripts to control various objects. I cannot help but think that if I had written my program in a series of python files that I would be able to do a neater, faster job. \n\n\n\nI'd appreciate any suggestions. The closest thing to what I want is Panda3d, but I had a difficult time working with textures, and I am not convinced that my application can be made easily available to mobile phone\/device users. If there is a similar option that you can think about, I'd appreciate the tip.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1543,"Q_Id":5445166,"Users Score":0,"Answer":"Well I see you've checked Unity3D already, but I can't think of any other engines work on PC, Telephones and via streaming internet that suport 3D (for 2D check EXEN or any others). \nI'm also pretty sure that you can use Unity code-based, and it supports a couple of different languages, but for Unity to work you can't just import unity.dll (for example) into your code, no you have to use your code into unity so that unity can make it work on all these different platforms.","Q_Score":0,"Tags":"javascript,python,game-engine","A_Id":5445300,"CreationDate":"2011-03-26T20:41:00.000","Title":"3d game engine suggestions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have some .png images and I want to be able to quickly:\n(a) Load a .png from a file.\n(b) Draw some simple lines on top of the .png.\n(c) Get the contents (bytes) of the resulting image to return as the result of an http request.\nIt sounds like PIL is a good candidate for doing this with relatively little code. However, I'm trying to understand how efficient it is, especially when I have, say, thousands of lines to draw in step (b). The alternative is using PyOpenGL, but before getting into that I wanted to understand if PIL was already fast enough.\nI was going to ask if PIL used OpenGL under the covers. But that might be the wrong question, because my understanding is that to get the real speed benefit from PyOpenGL I'd want to submit my line vertexes as NumPy arrays. So presumably even if PIL uses OpenGL, I'm going to lose a lot of that benefit when I make an individual PIL call to draw each of my lines?\nAnybody have concrete data for speed of PIL when drawing lots of primitives?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2486,"Q_Id":5446816,"Users Score":2,"Answer":"\"Draw some simple lines on top of the .png\" is not a computationally intensive task. \nThis doesn't seems to be a good candidate for the GPU since they are better suited for more complex tasks. You've got to realize that the image is initially loaded on the RAM, making it your job to send this data to the GPU memory and then retrieve it back. This operation consumes a few milliseconds, depending on the size of the image, that could be better used for CPU processing.\nYour application would only benefit from the GPU if it had high arithmetic intensity.","Q_Score":0,"Tags":"python,opengl,python-imaging-library,gpu","A_Id":5446952,"CreationDate":"2011-03-27T02:23:00.000","Title":"How fast is Python Image Library's (PIL) ImageDraw Module, for instance as compared to OpenGL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have recently converted a library, I originally wrote in C++ with Boost Python wrapping, to C with SWIG wrapping to support more languages.\nI switched from C++ to C because the library consists only of a set of functions and I also want the library to be callable from C (without having to compile the whole program with a C++ compiler).\nHowever there is one thing that was not easy to port, a very small subset of the functions needs the ability to report errors back.\nIn C++\/Boost Python that was very elegantly accomplished with throw and exception translation.\nWhat would be the most elegant way (on both the C and wrapped language side) to have a subset of functions report errors?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1235,"Q_Id":5448257,"Users Score":0,"Answer":"Take a look at Chapter 4 in C Interfaces and Implementations by Richard R. Hanson.","Q_Score":4,"Tags":"python,c,swig","A_Id":5521222,"CreationDate":"2011-03-27T09:11:00.000","Title":"Most elegant way for SWIG wrapped C library to raise exceptions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to monitor the presence of USB devices and have found modules such as PyUSB that serve this purpose. However, I don't know how to run USB detection services alongside the Tkinter main loop. Is this possible?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":874,"Q_Id":5453256,"Users Score":0,"Answer":"Might I suggest that instead of trying to constantly monitor the presence of a USB device you include a search or refresh button that will check just once.","Q_Score":2,"Tags":"python,tkinter,pyusb","A_Id":5489197,"CreationDate":"2011-03-27T23:36:00.000","Title":"Tkinter and detection of USB devices","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make several different pages where I need to show different texts and buttons.\nWhat I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents\/sizers.\nIt worked well in Linux, but when I tried the same source in the windows, the first page was okay, but in the second page and onward, it seems the sizers were not applied. \nI tried various .Update() and .Refresh(), but nothing seems working. \nIt seems only when I maximize the window the sizers get applied and the layout becomes normal.\n(Again, after panel.Destory() and a new panel generation, the layouts are messed up again.)\nHow do I make two different \"pages\" (where I click on a button and it goes to the second page) with different contents and sizers in Windows?","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":3727,"Q_Id":5457644,"Users Score":2,"Answer":"It seems there are better ways to do this, but panel.Layout() solved the problem for now. :)","Q_Score":2,"Tags":"python,user-interface,wxpython","A_Id":5458130,"CreationDate":"2011-03-28T10:28:00.000","Title":"wxPython panel redraw in windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make several different pages where I need to show different texts and buttons.\nWhat I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents\/sizers.\nIt worked well in Linux, but when I tried the same source in the windows, the first page was okay, but in the second page and onward, it seems the sizers were not applied. \nI tried various .Update() and .Refresh(), but nothing seems working. \nIt seems only when I maximize the window the sizers get applied and the layout becomes normal.\n(Again, after panel.Destory() and a new panel generation, the layouts are messed up again.)\nHow do I make two different \"pages\" (where I click on a button and it goes to the second page) with different contents and sizers in Windows?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":3727,"Q_Id":5457644,"Users Score":3,"Answer":"Calling Layout on the widget's parent is the best way to do this is you are adding or destroying widgets. Sometimes you also need to call Refresh() to make it redraw too, although that might only be required when you're using Freeze\/Thaw.","Q_Score":2,"Tags":"python,user-interface,wxpython","A_Id":5460406,"CreationDate":"2011-03-28T10:28:00.000","Title":"wxPython panel redraw in windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make several different pages where I need to show different texts and buttons.\nWhat I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents\/sizers.\nIt worked well in Linux, but when I tried the same source in the windows, the first page was okay, but in the second page and onward, it seems the sizers were not applied. \nI tried various .Update() and .Refresh(), but nothing seems working. \nIt seems only when I maximize the window the sizers get applied and the layout becomes normal.\n(Again, after panel.Destory() and a new panel generation, the layouts are messed up again.)\nHow do I make two different \"pages\" (where I click on a button and it goes to the second page) with different contents and sizers in Windows?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":3727,"Q_Id":5457644,"Users Score":1,"Answer":"I agree with using Layout(), but might I suggest just hiding the unused panel instead of destroying it? Using the Show()\/Hide() functions of the sizer, you can add both side-by-side and just hide the unused panel instead of destryong it and recreating it each time?","Q_Score":2,"Tags":"python,user-interface,wxpython","A_Id":5461786,"CreationDate":"2011-03-28T10:28:00.000","Title":"wxPython panel redraw in windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to change the mouse pointer using python xlib. I successfully did it using warp_pointer. But when i try to play any games like Secret Maryo Chronicles, the mouse pointer moves to the rightmost corner of the screen and not the specified location. Why is it so? Can anyone help me with this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1321,"Q_Id":5487301,"Users Score":0,"Answer":"I'm not familiar with SMC. It may be that it uses warp_pointer itself. I know a lot of games do to simulate the relative motion support only recently introduced to XInput and I think some of them use it to stash the mouse \"out of the way\". Have you tried it with games that do different things with the mouse?","Q_Score":1,"Tags":"python,mouse,xlib","A_Id":5499581,"CreationDate":"2011-03-30T13:55:00.000","Title":"Python xlib warp_pointer not working properly inside games","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a great python fan. Recently I got an idea to write RTS engine and\/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these:\n\nPerformance. Most games are written in C++. Isn't python too slow for game engine? I am aiming only at 2D, but still it may be too demnading.\nGraphics. Are there any good graphics libraries for python? SDL\/OpenGL bindings or maybe something more suitable for python?\nGame engines. Do you know of any existing RTS engine written in python?\nAny tools\/libraries for python that maybe helpful in developing RTS\n\nThanks in advance!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2553,"Q_Id":5544634,"Users Score":7,"Answer":"Performance may be an issue with heavy graphics\/math processing. If so, see Panda3D, NumPy, Cython, and PyPy.\nUse Pyglet, PyOpenGL with Pyglet, Panda3D (although you are writing in 2D, you can still use a 3D engine), or perhaps some other library.\nThere don't seem to be existing RTS libraries, but there are definitely pre-existing generalized engines.\nTry searching for RTS-related libraries in general: you'll need AI, pathfinding, networking, and so on. Therefore, you may be interested in Twisted, for instance, since it helps with networking.","Q_Score":3,"Tags":"python,performance,graphics,real-time-strategy","A_Id":5544725,"CreationDate":"2011-04-04T21:36:00.000","Title":"2D RTS in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a great python fan. Recently I got an idea to write RTS engine and\/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these:\n\nPerformance. Most games are written in C++. Isn't python too slow for game engine? I am aiming only at 2D, but still it may be too demnading.\nGraphics. Are there any good graphics libraries for python? SDL\/OpenGL bindings or maybe something more suitable for python?\nGame engines. Do you know of any existing RTS engine written in python?\nAny tools\/libraries for python that maybe helpful in developing RTS\n\nThanks in advance!","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":2553,"Q_Id":5544634,"Users Score":3,"Answer":"I can answer your first two.\n\nPython isn't too slow for games.  That all games must be written in C++ is a myth.  Sure C++ (or C) might give you the best performance, but it doesn't mean you're unable to write a game in another language.\nTry PyGame: SDL bindings for Python.","Q_Score":3,"Tags":"python,performance,graphics,real-time-strategy","A_Id":5544672,"CreationDate":"2011-04-04T21:36:00.000","Title":"2D RTS in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing an application which has to be able to print a couple of pages with Python. Now I am searching for a method to create these pages and print them. It should work on Linux and Windows. The pages contain tables, images and text.\nI developed the GUI with PyGtk, but I think it's convenient to create an image or PDF and print it. I have no idea how to do this. Anyone knows a good way for this?\nNote: The problem isn't the generation. It is the printing of that file.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":2696,"Q_Id":5572489,"Users Score":1,"Answer":"Have you considered generating HTML?","Q_Score":2,"Tags":"python,pdf,printing,pygtk","A_Id":5572506,"CreationDate":"2011-04-06T20:22:00.000","Title":"OS independent printing with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Can anybody recommend how to switch between scenes in pyglet. \nI.e. \n\nmenu > game\ngame > menu\nmenu > help\nect\n\nThe only way that i can think to do it off the top of my head is by using different windows, which i am quite sure would be the complete wrong way to do it. Or by overloading all of the window's event functions.\nSorry if i haven't made myself clear but any help would be appreciated","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":3236,"Q_Id":5581447,"Users Score":2,"Answer":"The cocos2d.org framework is built on pyglet and includes scene management.","Q_Score":3,"Tags":"python,pyglet","A_Id":5590220,"CreationDate":"2011-04-07T12:58:00.000","Title":"Switching scenes with pyglet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a gtk.Table to which I've attached a number of gtk.Buttons, some of which overlap others.  I can't figure out how to bring a specific button to the front, however.  How do I do it?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":200,"Q_Id":5584398,"Users Score":1,"Answer":"I've struggled with an issue similar to this, and came to the conclusion that it wasn't possible in an officially documented manner... gtk.Table doesn't seem to have been designed to deal with the idea that things might overlap. Widgets seemed to be rendered in an order related to (but not exactly) the order they were added into the table.\nWhat I ended up doing was determining which widgets were overlapping, and wrote code to toggle their visibility, depending on which one was appropriate for the current state. That was only possible because of the particular nature of my app, it might not work for you.\nOne avenue which I didn't research to far, but might be viable: intercepting the expose event on the gtk table, and propagating it to the children in a specific order (this got complicated quickly, but might work). My understanding of the gtk.Widget events is incomplete, there may be other events that need intercepting as well.","Q_Score":1,"Tags":"python,pygtk","A_Id":5585600,"CreationDate":"2011-04-07T16:29:00.000","Title":"How do I bring a PyGTK Button to the front?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anyone know of any articles or code samples to get me started customising the WxPython rich text control?\nI am trying to extend the rich text control to allow me to insert controls (buttons, text boxes etc) into the editing area e.g. instead of just inserting images or formatted text I would like to be able to insert a control such as a button (similar to the output provided by the HTML controls but I need to provide an editable interface).\nLooking through the documentation for wxpython and wxWidgets it seems there is the infrastructure built into the controls to support this but I cannot find any help or examples to get me started.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":328,"Q_Id":5637677,"Users Score":1,"Answer":"Download the wxpython demo from their site, it should provide you with an in-depth example of a wxRichTextCtrl. Without providing any information about your specific customizations, there is not much else I can help with.","Q_Score":0,"Tags":"python,wxpython,richtext","A_Id":5696733,"CreationDate":"2011-04-12T15:25:00.000","Title":"Where do I start if I want to customise the WxPython rich text control?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"hi i am working on a VR engine \"vizard\" it has (like any other game engine) its mainloop, i want to integrate it with a multi-touch framework \"kivy\" which has its own mainloop , is it possible to do so?\nand if you can help me finding references about this topic\nthank you in advance :D","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":368,"Q_Id":5646943,"Users Score":0,"Answer":"It is technically possible, but you should not do it.\nSimply open up the source, get the code for the two main loops and stitch it together.  \nThe results will probably be broken, though.","Q_Score":2,"Tags":"python,multi-touch,kivy","A_Id":5647086,"CreationDate":"2011-04-13T09:17:00.000","Title":"how to integrate two apps (mainloop) together in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a relative newbie with Python and was trying to install wxPython 2.9 using Python 2.6. I did a build from source and then installed the package both being done in a non-standard (local) path. When I try and import wx (having provided the path to the installation folder in my environment variable), I get the following error message:  \n\n\"ImportError:\n  libwx_gtk2u_xrc-2.9.so.1: cannot open\n  shared object file: No such file or\n  directory\".  \n\nCan someone please tell me if I need to build gtk separately? And if yes, how do I go about doing it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":380,"Q_Id":5660354,"Users Score":0,"Answer":"Add the directory containing the library given in the error to your ld search paths. See the ldconfig(8) man page for details.","Q_Score":0,"Tags":"python,gtk,wxpython","A_Id":5660469,"CreationDate":"2011-04-14T08:14:00.000","Title":"Error while installing wxPython package in a non-standard path","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Which is the most efficient method to display a grid of about 1000 clickable images in wxPython ?\nCurrently i am using a GridSizer filled with StaticBitmap objects. But its quite slow for 500+ images. \nOne more thing is that, i have a listbox of categories on the left. That is to filter the images. Categories will be like \"All\", \"Cat 1\", \"Cat 2\" etc. When i click \"All\", all the image have to be displayed.\nHow i am doing this currently :\n\nA VERTICAL BoxSizer will contain n\nGridSizer objects, one for each\ncategory. I add the StaticBitmap\nobjects to multiple GridSizers\ndepending on the categories it\nbelongs to. \nThen i display only that    GridSizer\ndepending on which category    is\nselected\n\nThis method is also terribly slow for anything over 300 images. So, how do i achieve the same effect efficiently ?\n.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":796,"Q_Id":5680487,"Users Score":0,"Answer":"I would think a ListCtrl in ICON style would be the best way to do this.\nIf you look at the wxPython Demos, the UltimateListCtrl sample in the wx.LC_ICON style is a good example of what you could create.","Q_Score":1,"Tags":"python,image,performance,wxpython","A_Id":5681008,"CreationDate":"2011-04-15T17:50:00.000","Title":"Efficient method for a grid of clickable images in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I really like D(2) language and would like to use it for multi-platform GUI application, but I see that its ecosystem is not quite developed. After moving from Linux to (Free)PC-BSD, I see there is even no 64bit compiler ready in the ports and one is not sure if any of GUI libs (QtD, gtkD, wxD) are ready for serious project and we would like to start with the project as soon as possible.\nOtoh, I was previously recommended to try with Python which is mature, with many tools, GUI libs etc. but there was question about speed - we have to use one C lib for calculating Ephemeris and write several libraries which would use that C-lib. \nHowever, this might be good (perfect) job for Cython, so my question is what do you think about writing GUI-part in Python (Qt,EFL) and use Cython for performance-critical stuff (binding external C lib and writing our own libraries) instead of (waiting for) D to become ready for serious projects?","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":1579,"Q_Id":5685078,"Users Score":1,"Answer":"Well, its a typical usecase to just write your number crunching code in C\/C++ or any language that can be linked into a C module and just add the non performance critical stuff with a scripting language easily. The Python C interface is okay to work with and using SWIG or even writing the binding code manually isn't too hard (unless you talk about threads and need to handle CPythons idiotic GIL...).","Q_Score":4,"Tags":"python,user-interface,d,cython,cpython","A_Id":5687119,"CreationDate":"2011-04-16T07:14:00.000","Title":"multi-platform gui app in C(P)ython or D","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I really like D(2) language and would like to use it for multi-platform GUI application, but I see that its ecosystem is not quite developed. After moving from Linux to (Free)PC-BSD, I see there is even no 64bit compiler ready in the ports and one is not sure if any of GUI libs (QtD, gtkD, wxD) are ready for serious project and we would like to start with the project as soon as possible.\nOtoh, I was previously recommended to try with Python which is mature, with many tools, GUI libs etc. but there was question about speed - we have to use one C lib for calculating Ephemeris and write several libraries which would use that C-lib. \nHowever, this might be good (perfect) job for Cython, so my question is what do you think about writing GUI-part in Python (Qt,EFL) and use Cython for performance-critical stuff (binding external C lib and writing our own libraries) instead of (waiting for) D to become ready for serious projects?","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":1579,"Q_Id":5685078,"Users Score":2,"Answer":"Writing the GUI in a dynamic language and writing performance-sensitive code in another language is a great way to write an application. This can be done in Python, it can also be done really easily in Tcl\/Tk and several other scripting languages.","Q_Score":4,"Tags":"python,user-interface,d,cython,cpython","A_Id":5687640,"CreationDate":"2011-04-16T07:14:00.000","Title":"multi-platform gui app in C(P)ython or D","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I really like D(2) language and would like to use it for multi-platform GUI application, but I see that its ecosystem is not quite developed. After moving from Linux to (Free)PC-BSD, I see there is even no 64bit compiler ready in the ports and one is not sure if any of GUI libs (QtD, gtkD, wxD) are ready for serious project and we would like to start with the project as soon as possible.\nOtoh, I was previously recommended to try with Python which is mature, with many tools, GUI libs etc. but there was question about speed - we have to use one C lib for calculating Ephemeris and write several libraries which would use that C-lib. \nHowever, this might be good (perfect) job for Cython, so my question is what do you think about writing GUI-part in Python (Qt,EFL) and use Cython for performance-critical stuff (binding external C lib and writing our own libraries) instead of (waiting for) D to become ready for serious projects?","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1579,"Q_Id":5685078,"Users Score":7,"Answer":"I'm obviously biased as a Cython core developer, but I can certainly recommend it. The combination of CPython and Cython provides an otherwise hard to reach level of developing speed, platform stability, portability, low-level coding and FFI capabilities, and execution performance, including a very easy optimisation path from quick and simple to highly tuned code at C speed.\nI can also warmly recommend Qt as a GUI toolkit. It works very nicely with Python.","Q_Score":4,"Tags":"python,user-interface,d,cython,cpython","A_Id":5686614,"CreationDate":"2011-04-16T07:14:00.000","Title":"multi-platform gui app in C(P)ython or D","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When chatting in IRC yesterday about the possibility to use P(C)ython instead of D for multi-platform GUI application, someone suggested me Enlightenment Foundation Libraries (EFL).\nWe have researched a bit about it and considering we would like to target some mobile-platform in the future as well, EFL looks as nice alternative to Qt.\nSo, what do you think how does EFL (used via Python bindings) compare with Qt (pyqt or pyside, depending on py3k readiness) for multi-platform desktop GUI application?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1308,"Q_Id":5685176,"Users Score":2,"Answer":"EFL looks good and promising, especially its widget toolkit which can do very smart things when resizing windows, but there are problems with it: first, it comes in a very-beta quality. Second, the widgets will look quite unfamiliar for the users. Qt is mature and stable, and it adapts to the platform look and feel (but still may be easily customized). I give PyQt a go.","Q_Score":2,"Tags":"python,qt,pyqt,pyside","A_Id":5688829,"CreationDate":"2011-04-16T07:38:00.000","Title":"Qt or EFL for multi-platform Python application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are a number of Tkinter builders out there but none (that I've found) that work for Python 3. I don't have the time to learn Tkinter and don't use it much which is why I'm looking for a builder.","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":12993,"Q_Id":5691674,"Users Score":0,"Answer":"Wow, pity I didn't get any useful responses. Fortunately I have discovered a solution. PyQt4 may not be Tkinter but it works just the same ... and works in python 3.x and comes with a GUI designer that is very neat. Takes a bit of research to know how to use it but well worth it","Q_Score":3,"Tags":"python-3.x,tkinter,builder","A_Id":5743059,"CreationDate":"2011-04-17T05:25:00.000","Title":"Tkinter GUI Builder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using PyQt4 and Python 3 do you know how I can change the color of a QLcdNumber during the runtime ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1466,"Q_Id":5692968,"Users Score":1,"Answer":"Didn't use this for some thime, but I think you had to change paletteForegroundColor and change segmentStyle to QLCDNumber::Filled or QLCDNumber::Flat","Q_Score":0,"Tags":"python,qt,python-3.x,pyqt4","A_Id":5693049,"CreationDate":"2011-04-17T10:22:00.000","Title":"Change the color of the text of QLcdNumber","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python code whose output is a .png file. What should I do to get the output in an OpenGL window?\nI searched a few places and the closest I got to converting an Image was StringIO() but that didn't seem very helpful.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":224,"Q_Id":5699508,"Users Score":0,"Answer":"If you want something to handle the more complex details you could setup your OpenGL using pygame then use\nsurface = pygame.image.load(fileobj)\nWhere fileobj is any object with a 'file-like' interface. You would need to modify the PNG generator to write to this object rather than a real file.","Q_Score":0,"Tags":"python,image","A_Id":5699658,"CreationDate":"2011-04-18T06:59:00.000","Title":"How to change a .png output from Python to an OpenGL window output?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I basically want to make a clone of the classic game Pacman using Python. I would like to keep all the original graphics, sounds, etc. Perhaps being able to have the game in windowed mode would be useful.\nWith Java I would just use Swing and be done with it. But I'd really like to use Python and make it possible for the game to work on all major platforms with minimal effort from the users.\nI've used pygame previously but felt that it was a bit 'hacky' and not all that intuitive to use.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":310,"Q_Id":5743946,"Users Score":1,"Answer":"You could do this with Tkinter about as easily (or easier) than most other toolkits. Since pac-man graphics set the bar pretty low you could code this all by using the canvas widget. This is arguably the most portable solution since Tkinter is the official, bundled GUI toolkit so you won't require people to download any extra libraries.\nThe canvas widget gives you a nice vector-based drawing surface, with nice tagging abilities that let you easily move drawn objects. It supports all the basic drawing primitives -- lines, circles, etc. as well as being able to embed bitmap graphics and even other widgets.","Q_Score":1,"Tags":"python,pygame,pacman","A_Id":5763788,"CreationDate":"2011-04-21T12:15:00.000","Title":"What would be a good python library to use to write a portable version of pacman with nice graphics?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use qt with python. \n\"import qt\" return me :\"ImportError: No module named qt\". I already instaled pyqt.\nwhat I hve to install in order to activate \"import qt\"\nThank You","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":22987,"Q_Id":5766539,"Users Score":3,"Answer":"import PyQt4 works for me fine.","Q_Score":10,"Tags":"python","A_Id":5766552,"CreationDate":"2011-04-23T19:56:00.000","Title":"problem with import qt in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to expose some kind of graph explorer widget in Python using PyQt and some library.  Does such a library exist?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5195,"Q_Id":5768566,"Users Score":0,"Answer":"Try the nodebox-gl fork version of nodebox that support unix, but I can't find the fork version graph in nodebox :(\nThanks","Q_Score":2,"Tags":"python,graph,pyqt,graphviz","A_Id":5926728,"CreationDate":"2011-04-24T04:05:00.000","Title":"Python graph visualization and editing with PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for a Python 2D graphics library that can basically do the following and not necessarily anything more:\n\nCreate a window of specified width and height\nSet the RGB of pixel X, Y on the back buffer.\nSwap buffers\n\n...and that's it basically. I can't find anything that doesn't come with a massive amount of complex baggage.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4847,"Q_Id":5770944,"Users Score":4,"Answer":"I recommend PyQt for this - it's a GUI library\/framework but it has very good drawing capabilities. If you look at the examples coming with PyQt, focusing on the graphics & drawing samples, it's quite amazing what you can do with very few lines of code.\nOh, and it does the double-buffering you mention automatically so you don't have to worry about it.\n\nAlternatively, you can use PyGame - a library wrapping SDL, used for game development. Naturally it has very strong 2D graphics capabilities.","Q_Score":2,"Tags":"python,graphics,2d","A_Id":5770967,"CreationDate":"2011-04-24T14:04:00.000","Title":"Basic Python 2D graphics?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project that basically follows a pre-defined structure, like a state machine or a wizard. I stumbled upon QWizard, its nextId() function seemed to be a good way to make my wizard dyamically load further pages. Now, it would be very nice to go back to earlier, already visited pages of the wizard. But even with overloaded nextId() I can't go back to that already visited pages.\nIs is possible to clear the visited pages history? Or is there a better way to do this?\nI use Qt by PyQt4 in Python, but that should make that much of a difference. Another way to do what I ask would be to add a similar page to the wizard and share the previous data with this page, but coming from mostly C++ I don't like the way to create dummy objects that mimic originals.\nEdit:\nWhat I'm trying to do is to replicate a state machine with QWizard (because it almost is a state machine). For example, on page 1 data is loaded, then on page 2 additional computations happen that potentially extend page 1 data. By using the back button I can go back to page 1, but I can not \"go back\" with the next button because page 1 is already visited at this point. I tried it by overloading the nextId() functions but it doesn't work. This means I can not build a cyclic order of pages, which I would like to do.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":607,"Q_Id":5788526,"Users Score":0,"Answer":"I'm not sure I see the logical connection between the different questions you're asking here. If you want to go back to already visited pages, why do you want to delete the history?\nWith the help of overloading the nextID method of either the QWizard or separate QWizardPages you can easily implement any custom visiting order you desire. Use the hasVisitedPage method to find out whether some page was already visited. visitedPages returns the list of IDs of visited pages, in the order in which the pages were visited.\nWhat else do you need?","Q_Score":2,"Tags":"python,qt,pyqt,qwizard","A_Id":5788678,"CreationDate":"2011-04-26T09:40:00.000","Title":"QWizard: delete history of visited pages","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Qt with Python, and I've got a mainwindow with a status bar at the bottom.  I can display a message in the bar using a QLabel, and set the color of that message using something like \"<font color=\\\"green\\\">In progress<\/font>\" for the QLabel text.\nI would like to also put a temporary message in the status bar, and assign a color to that message as well.  However since it's not a QLabel this time (I'm using QStatusBar::showMessage which just takes a QString) I can't change the color anymore.  The tags above are not recognized and the entire string \"<font color=\\\"green\\\">In progress<\/font>\" is shown in gray.\nDoes anyone have any ideas?","AnswerCount":6,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":10542,"Q_Id":5795214,"Users Score":2,"Answer":"If your showMessages text will be all of the same color, you can define it in the palette of QStatusBar via QtDesigner(window text color) for temporary messages, and then use the QLabel color for normal  and permanent messages of different colors.","Q_Score":5,"Tags":"python,qt,qstatusbar","A_Id":11617883,"CreationDate":"2011-04-26T19:06:00.000","Title":"Qt statusbar color","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a toolbar that has the typical buttons: new, save, save as, etc. Is there a way to gray out\/disable\/make unavailable icons that are not useful?\nFor instance, if nothing has been changed, disable and gray out the save button, then re-enabled it when something has changed that requires a save.\nThanks for the help!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":128,"Q_Id":5808881,"Users Score":0,"Answer":"myButton.set_sensitive(True)    # make button available\nmyButton.set_sensitive(False)    # make button unavailable","Q_Score":1,"Tags":"python,pygtk","A_Id":5810073,"CreationDate":"2011-04-27T18:38:00.000","Title":"Make a pygtk stock icon \"unavailable\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Xcode 3 had templates for building Cocoa subclasses in Python. I've recently upgraded to Xcode 4 but I cannot find out how I can use other languages besides the C family (C, C++, Obj-C) in Xcode 4.\nDoes anyone know?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":7826,"Q_Id":5843508,"Users Score":2,"Answer":"I've successfully built a MacRuby GUI app in XCode 4.2 on Lion today following a MacRuby tutorial on Apple's site. MacRuby also includes a template in XCode 4.2. I'm a Python programmer and really hoped to use it, but at this point I've given up on PyObjC. I use Tk in Python for quick little apps and maybe switch to MacRuby, but will likely just switch to Objective-c. Ruby is a pretty nice language though. Maybe MacRuby will interest you.","Q_Score":13,"Tags":"python,xcode,xcode4,pyobjc","A_Id":7815044,"CreationDate":"2011-04-30T17:39:00.000","Title":"PyObjC on Xcode 4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"For my sins (and for fun the learning experience) I am writing a window manager (I know, I know).\nI'm using python and XCB (python-xpyb).\nSo far I have figured out that I need to use a SubStructureRedirect mask on the root window(s), and I am successfully being passed events related to applications' top-level windows. I'm testing this by launching xterm.\nI get a ConfigureRequestEvent, followed by a pause, followed by another ConfigureRequestEvent, and then a MapRequestEvent.\nWhen I get the MapRequestEvent I call connection.core.MapWindowChecked(e.window), which works, but maps a window that is only a pixel or two wide\/tall.\nMy question, then, is what should I do with the ConfigureRequestEvent to make the window the correct size (assuming thats what I'm missing)?\nMore accurately, what exactly do i call? MapWindowChecked was an obvious choice, but I can't seem to find how to actually configure the width\/height. I'm guessing it is ConfigureWindow, but the arguments that accepts seem obscure to me. Last time I called it I used xcb.xproto.CW.EventMask, but none of the flags in CW seem to be related to width\/height.\nPS The documentation on all of this seems quite elusive to me. I've looked at a couple of python window managers that supposedly use xcb, and they seem to use their own custom versions with extra functionality. Also, Examining\/debugging a running window manager (which is also responsible for mapping your debugger's window) is a PITA, hence my asking here. probably would be better to use two machines or a VM or something.\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":848,"Q_Id":5845717,"Users Score":1,"Answer":"The short answer is configure the window (size, stacking, etc.) by calling ConfigureWindow. The long answer is here you impose policy and honor specs such as XSizeHints. Best to have a look at some existing WMs' source and get a sense of what they do. Exactly what you do depends on your desired UI. \nThe simplest thing to get it working is to just ConfigureWindow exactly as the request asks with no policy or hint overrides. But you'll probably see lots of usability problems quickly and have to add some more smarts.","Q_Score":2,"Tags":"python,x11,window-managers,xcb","A_Id":5851984,"CreationDate":"2011-05-01T01:17:00.000","Title":"What should a Window Manager do with a ConfigureRequestEvent?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm just beginning a very simple pygame code that draws a green line on a white background. However, I have to use pygame.display.flip() in order for it to show up, but it seems that I would have to use this every time I made a change and this seems too impractical for me to be doing it right. Am I missing something?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1583,"Q_Id":5851656,"Users Score":3,"Answer":"There's a good reason for this.  Double buffering is a technique used to prevent \"flickering\".  Basically, you want to draw a frame to memory instead of to the monitor and then push the frame all at once when its drawn.  Otherwise, you can see different elements of the same frame go up at different times.\nWhat you want to do is call pygame.display.flip() only once per frame draw, not after every change.  Usually, this is done by having a \"draw\" function that is called at the end of a frame once the physics manipulations and game rules are done, and flip()ing at the end of draw.","Q_Score":2,"Tags":"python,pygame","A_Id":5853562,"CreationDate":"2011-05-01T21:46:00.000","Title":"Beginner problem with pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running Python2.7.1 and OpenCV 2.2 without problems in my WinXP laptop and wrote a tracking program that is working without a glitch. But for some strange reason I cannot get the same program to run in any other computer where I tried to install OpenCV and Python (using the same binaries or appropriate 64 bit binaries). In those computers OpenCV seems to be correctly installed (although I have only tested and CaptureFromCamera() in the webcam of the laptop), but CaptureFromFile() return 'None' and give \"error: Array should be CvMat or IplImage\" after a QueryFrame, for example.\nThis simple code:\nimport cv   \/\nvideofile = cv.CaptureFromFile('a.avi')   \/\nframe = cv.QueryFrame(videofile)   \/\nprint type(videofile)   \/\nprint type(frame)\nreturns:\ntype 'cv.Capture'  \/\ntype 'NoneType'\n\nOpenCV and Python are in the windows PATH...\nI have moved the OpenCV site-packages content back and forth to the Pyhton27 Lib\\Site-packages folder.\nI tried different avi files (just in case it was some CODEC problem). This AVI uses MJPEG encoding (and GSpot reports that ffdshow Video Decoder is used for reading).\nImages work fine (I think): the simple convert code:\nim = cv.LoadImageM(\"c:\\tests\\colormap3.tif\")\ncv.SaveImage(\"c:\\tests\\colormap3-out.png\", im)\nopens, converts and saves the new image...\nI have tested with AVI files in different folders, using \"c:\\\", \"c:\/\", \"c:\\\" and \"c:\/\/\".\n\nI am lost here... Anyone has any idea of what stupid and noob mistake may be the cause of this? Thanks","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1705,"Q_Id":5858446,"Users Score":0,"Answer":"This must be an issue with the default codecs. OpenCV uses brute force methods to open video files or capture from camera. It goes by trial and error through all sources\/codecs\/apis it can find in some reasonable order. (at least 1.1 did so).\nThat means that on n different systems (or days) you may get n different ways of accessing the same video. The order of multiple webcams for instance, is also non-deterministic and may depend on plugging order or butterflies.\nFind out what your laptop uses, (re)install that on all the systems and retry.\nAlso, in the c version, you can look at the capture's properties\nlook for cvGetCaptureProperty and cvSetCaptureProperty where you might be able to hint to the format.\n[EDIT]\nJust looked i tup in the docs, these functions are also available in Python. Take a look, it should help.","Q_Score":1,"Tags":"opencv,python-2.7,iplimage","A_Id":5859924,"CreationDate":"2011-05-02T14:34:00.000","Title":"IplImage 'None' error on CaptureFromFile() - Python 2.7.1 and OpenCV 2.2 WinXP","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a simple game where the point is to collect as many blocks as you can in a certain amount of time, say 10 seconds. How can I get a timer to begin ticking at the start of the program and when it reaches 10 seconds, do something (in this case, exit a loop)?","AnswerCount":10,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":148808,"Q_Id":5890304,"Users Score":9,"Answer":"Using time.time()\/datetime.datetime.now() will break if the system time is changed (the user changes the time, it is corrected by a timesyncing services such as NTP or switching from\/to dayligt saving time!).\ntime.monotonic() or time.perf_counter() seems to be the correct way to go, however they are only available from python 3.3. Another possibility is using threading.Timer. Whether or not this is more reliable than time.time() and friends depends on the internal implementation. Also note that creating a new thread is not completely free in terms of system resources, so this might be a bad choice in cases where a lot of timers has to be run in parallel.","Q_Score":43,"Tags":"python,time","A_Id":14132794,"CreationDate":"2011-05-04T21:53:00.000","Title":"Timer for Python game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a bug in my python script that is using PyQt4 that causes a segmentation fault.\nI could not find the bug using pdb, so now I wanna try it with gdb.\nThe core file is written and when I open it and type where, I just get memory addresses and only question marks as function names.\nI already installed the python-qt4-dbg package on Ubuntu but that did not help.\nIs there any additional parameter I have to pass to gdb to make the function names appear?\nCheers,\nManuel","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":407,"Q_Id":5902379,"Users Score":0,"Answer":"If I remember correctly, you will also need at least libqt4-dbg and python-dbg, maybe a few others..","Q_Score":0,"Tags":"python,gdb,segmentation-fault,pyqt4","A_Id":5913587,"CreationDate":"2011-05-05T18:20:00.000","Title":"Debugging PyQt4 using a core file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Some details of my machine and installed packages before proceeding further:\nMac OSX version: 10.6.6\nPython version: Activestate Python 2.7.1\nwxpython version: wxpython 2.8 (uses Carbon API hence limited to 32-bit mode arch only)\nI installed wxPython2.8-osx-unicode-py2.7 from wxpython website using their .dmg installer file. This package uses the Carbon API and hence is limited to 32-bit mode only. I have to write my applications using \"arch -i386\" in order to import wx, and due to this limitation I am unable to import certain other packages likes \"MySQLdb\" which are not available in 32-bit mode. So, my best option is to uninstall wxpython 2.8 and install wxpython 2.9 because version 2.9 uses Cocoa API which has both 32-bit and 64-bit support. \nI don't know how to uninstall wxpython2.8 on my Mac OSX. Can anyone please help me?","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":4762,"Q_Id":5920764,"Users Score":8,"Answer":"If you look in the .dmg for wxPython, there is an uninstall_wxPython.py unininstall script. Just drag it to your desktop and run python ~\/Desktop\/uninstall_wxPython.py in a terminal.","Q_Score":5,"Tags":"python,macos,wxpython,uninstallation","A_Id":5922093,"CreationDate":"2011-05-07T11:33:00.000","Title":"How to uninstall wxpython 2.8 on Mac OSX 10.6","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I would like to know where exactly a widget is on the screen.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":469,"Q_Id":5930780,"Users Score":4,"Answer":"You want to use the winfo_rootx and winfo_rooty methods of a widget.","Q_Score":2,"Tags":"python,geometry,screen,tkinter","A_Id":5932003,"CreationDate":"2011-05-08T22:22:00.000","Title":"Is there any way to get a widgets position relative to the entire screen in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to make a wxPython window only re-sizable to a certain ratio? I know you can disable resizing; however, I'd like it so when the window was resized it stuck to a certain width to height ratio.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":7440,"Q_Id":6005960,"Users Score":-1,"Answer":"I'm not too familiar with wxPython, but can't you just reset the window size to your max\/min size that you want once the user pass that? Preferably in the event that detects resizing?","Q_Score":5,"Tags":"python,resize,wxpython","A_Id":6006073,"CreationDate":"2011-05-15T01:41:00.000","Title":"Resizing a wxPython Window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking into using sprox but I can't seem to find any information about styling the generated form. I am sure its got to be something obvious but i didn't see it in the docs or find anything using a google\/google groups search. \nIdeally i would use sprox to generate the form but be able to pass in some css for layout. I could just manually create the forms but with the built in validation and select, drop downs pulling in data it seemed worth a look.\nIn a perfect world I would use sprox and pass it to the template and then let my designer have at it for formatting\/styling the resulting widget leaving me to not have to fuss with it.\nTIA!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":160,"Q_Id":6006773,"Users Score":0,"Answer":"You should be able to pass the form to the template, render it there while adding any custom css rule inside the template itself. For example using <style> tag inside the template head.\nIf you really want to add a custom CSS on python side you can try to add CSSLink\/CSSSource to css key inside form __base_widget_args__ dictionary","Q_Score":1,"Tags":"python,web-applications,sprox","A_Id":6636134,"CreationDate":"2011-05-15T02:34:00.000","Title":"Python \/ TG2 - Sprox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I need to show a slider in one column of a grid. I was able to create a custom CellEditor which displays the slider when I double click into a cell of the appropriate column so it enters the edit mode. But I don't know how to create a custom CellRenderer that displays the slider in all cell that are not in edit mode.\nUnfortunately the wx.RendererNative does not offer such a method like DrawSlider() :-(\nI appreciate any suggestion. \nBelow you can see an example of what is working so far. You can see the one cell with the sl","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":337,"Q_Id":6020070,"Users Score":1,"Answer":"Maybe you could use the editor to set the numeric value of the cell, then on the renderer draw a vertical bar by dividing the value by the maximum possible value and multiplying it by the width of the cell (in px, to get the proportion of the cell that the slider needs to appear at) and drawing a narrow vertical rectangle at this point that would act as the indicator, something like:\n\n+---------------+\n|    |-|        |\n+---------------+\n\nNote that this is untested, but I plan to do something similar on my current project. Just out of curiosity, how did you get the slider to appear in the editor?","Q_Score":1,"Tags":"wxpython,wxwidgets","A_Id":6641179,"CreationDate":"2011-05-16T16:01:00.000","Title":"wx\/wxPython: How to add a slider to a grid cell?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to use PyQt to load the html of a web page which can then be manipulated and fed back to the page for web scraping. I am basically trying to log into a page with Javascript on it, search for documents to download (by selecting a check box next to the correct one's names), and then clicking a download button which pops out another page.\nDoes anyone know the functions I would use? Is there a way to discuss this without going into Classes? (My understanding of Classes is not as good as it could be, I am trying to learn, I'm still something of a beginner).\nSorry if I didn't explain this well. I'm trying to use either PyQt or PySide to do this.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1332,"Q_Id":6032287,"Users Score":0,"Answer":"I think you are confused about where things happen, so it is not clear to me what it is you are attempting to do, but lets make a guess. \nI think you want to automate the use of a web site, where you have to call up a selection page, tick a box, click a button and handle the resulting download.\nIf you only want to do it a few times, for testing the site, then check out watir and Selenium. \nIf you really wish to code it up in Python, then you will have to understand the page sent with the check box well enough that you can find and extract the form, create a POST from the fields in that form, and send the POST to get your download. If the page contains javascript this might add\/remove\/inhibit you from creating a valid post.  \nThen you will have to catch and save the resulting download. \nAnd you will have a panic change to your code, every time the site changes its html pages. \nI don't envy you that job one bit.","Q_Score":3,"Tags":"javascript,python,screen-scraping,pyqt,pyside","A_Id":6036473,"CreationDate":"2011-05-17T14:24:00.000","Title":"Outputting and Responding to Javascript with PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a wx.ScrolledWindow where is drawn on using cairo. I have implemented a zoom-functionality which right now redraws the whole content.\nBut as there will be up to 200 curves to draw I should consider a more performant solution.\nI have thought of these:\n\nBuffering images for the zoom factors -1\/+1 (Memory consuming)\nUsing librsvg and buffer an SVG image (I have read something about this. Does librsvg work under Windows too?)\nStoring the cairo.Context after drawing groups of curves, and on zoom restoring it (just an idea.. is that possible?)\n\nAre there other possibilities, and: what is the best solution?\nThanks a lot","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1049,"Q_Id":6049208,"Users Score":1,"Answer":"If you're double-buffering anyway, why not do a quick bitmap scale as a \"preview\" while waiting for the newly redrawn vector image? I confess I don't know how to do this. But if you can make it work, it should work! :)","Q_Score":6,"Tags":"python,wxpython,cairo","A_Id":6450169,"CreationDate":"2011-05-18T18:15:00.000","Title":"What is the most performant way to implement zoom to a cairo-drawn canvas?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if it is possible (I'm sure it is) to get a reference to a control based on the name of the control.\nSomething like control = findcontrol(\"btnProduct\"+buttonNumber)\nYou probably catch my drift... (and yes, I am a newby in wxPython)\nRegards,\nDennis","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1526,"Q_Id":6049481,"Users Score":3,"Answer":"You can use the frame instance's FindWindowByName() method, assuming you passed a unique name parameter to the widget or you might be able to use the frame instance's FindWindowByLabel() method. You can also find by id, but I don't really recommend that since it's better not to manage the ids yourself.","Q_Score":4,"Tags":"python,wxpython","A_Id":6050833,"CreationDate":"2011-05-18T18:39:00.000","Title":"wxpython, find control based on its name","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently working the final project for my programming class. We're writing it in Python 3.1, and I'm doing the GUI. My team's leader wants to do the whole project in 3.1, but most pyGame addons (like pyConsole) are giving me compatibility issues. \nSo, my question is, can I write my frontend in 2.5 and then hook it up to the engine that's written in 3.1? Thanks for your help!","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":195,"Q_Id":6052379,"Users Score":6,"Answer":"To be honest, that's probably more trouble than it's worth.\nYour best bet is to get together and make a list of the addons you guys want to use and whether or not they're compatible with 3.1.  Then decide if you can live without the incompatible ones.  If you can't, do the project in 2.5, otherwise go with 3.1 and have a \"Plan B\" for the addons you can't use.\nIf you're careful you can make switching from 2 to 3 relatively painless later on when those addons add support for 3.x.\nIf it's a project you plan on working on for a long time (i.e. more than just a class project), I'd probably say go with 3 and try porting some of the addons yourself.  But for a class' final project it's probably not worth it.","Q_Score":7,"Tags":"python,python-3.x,pygame","A_Id":6052506,"CreationDate":"2011-05-18T23:58:00.000","Title":"Using Python 3.1 and 2.5 together","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently working the final project for my programming class. We're writing it in Python 3.1, and I'm doing the GUI. My team's leader wants to do the whole project in 3.1, but most pyGame addons (like pyConsole) are giving me compatibility issues. \nSo, my question is, can I write my frontend in 2.5 and then hook it up to the engine that's written in 3.1? Thanks for your help!","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":195,"Q_Id":6052379,"Users Score":3,"Answer":"Short Answer NO.\nLonger Answer. You can write your frontend with Python 2.5 and the backend with 3.0, but they can't interact at all. You need some sort of abstraction layer between them. Doing something like this you can have any language in the other side. \nThe abstraction Layer would need to pull jobs work on them and push back to some sort of queue. This is just a silly example and can get really complicated as you go by. In the end the abstraction layer may become even more complicated than you application, assuming it's a work for a class.\nI'd listen to Jeremiah and discuss with professor about the goods and bads that you have going with Python 2.5 or 3.0. If you include an explanation of the reasons you choose one over the other in your final papper I'm sure you'll get some extra points and he'll hardly penalyze you for it.","Q_Score":7,"Tags":"python,python-3.x,pygame","A_Id":6052534,"CreationDate":"2011-05-18T23:58:00.000","Title":"Using Python 3.1 and 2.5 together","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need a button that has a bitmap, toggles, and to which I can add a menu (I realize this is asking a lot).  I can't figure out a way to do this in wx python.  Here are the things I've tried and why they don't work:\nplate buttons: don't toggle\ngenbitmaptogglebuttons: for some reason, these buttons kill my tooltips (I posted this problem earlier and never got an answer)\ntoolbar buttons: can't add a drop down menu to a button.  I would make a separate button for the drop down menu, but the toolbar has to be oriented vertically, and I don't know how to get the drop down button to show up beside its corresponding button, rather than beneath it with vertical a toolbar orientation.  \nbitmap buttons: won't toggle\nAm I missing something obvious?  If not I'm just going to resort to faking a toggle by changing the border\/background color, unless someone has a better suggestion.\nThanks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":618,"Q_Id":6064044,"Users Score":0,"Answer":"Per Mark's suggestion, if you have wx 2.8.12 you can use a plate button to get the toggle\/bitmap\/menu functionality.  Since it is not easy for me to update to the newer wx at this point, I'll use a bitmap button and fake the toggle.","Q_Score":0,"Tags":"button,menu,bitmap,wxpython,toggle","A_Id":6073070,"CreationDate":"2011-05-19T19:46:00.000","Title":"wx python bitmap\/toggle\/menu button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need a button that has a bitmap, toggles, and to which I can add a menu (I realize this is asking a lot).  I can't figure out a way to do this in wx python.  Here are the things I've tried and why they don't work:\nplate buttons: don't toggle\ngenbitmaptogglebuttons: for some reason, these buttons kill my tooltips (I posted this problem earlier and never got an answer)\ntoolbar buttons: can't add a drop down menu to a button.  I would make a separate button for the drop down menu, but the toolbar has to be oriented vertically, and I don't know how to get the drop down button to show up beside its corresponding button, rather than beneath it with vertical a toolbar orientation.  \nbitmap buttons: won't toggle\nAm I missing something obvious?  If not I'm just going to resort to faking a toggle by changing the border\/background color, unless someone has a better suggestion.\nThanks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":618,"Q_Id":6064044,"Users Score":0,"Answer":"I don't see a pre-built button with all those features. I would think that you can use the generic toggle button or maybe the ShapedButton for your bitmap toggle functionality and attach a right-click popup menu. I'm not really sure what you mean by a menu, so that may not work. If you're talking about a menu implementation similar to the one that the PlateButton has, then you'll probably have to roll your own button. The guys on the wxPython mailing list can tell you how to do that.","Q_Score":0,"Tags":"button,menu,bitmap,wxpython,toggle","A_Id":6064311,"CreationDate":"2011-05-19T19:46:00.000","Title":"wx python bitmap\/toggle\/menu button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a Canvas which manipulates objects in the mouse event handler. After modifying the objects, I want to trigger the OnPaint() event for the same Canvas to show (rerender) the changes. What is the right way to do this? It doesn't let me call OnPaint() directly. Also, is triggering an event from another event \"wrong\" in some sense, or likely to lead to trouble?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3642,"Q_Id":6076014,"Users Score":4,"Answer":"I would just call self.Refresh() or maybe RefreshRect() and pass the area that needs to be repainted.","Q_Score":4,"Tags":"python,drawing,wxpython","A_Id":6076453,"CreationDate":"2011-05-20T18:11:00.000","Title":"Force repaint in wxPython Canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to provide a listbox where the user can select (multiple) characters (usually close to 15). Quite often some of these will be sequenced, so a listbox is easier than a validated text entry field.\nSince the character combination has a meaning to the user, it is user friendly to orient the listbox horizontally.\nIs there an easy way e.g. a theme, setting or subclass of the Tkinter listbox so I do not have to build my own?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1145,"Q_Id":6082723,"Users Score":2,"Answer":"No, there is no setting, subclass or theme that will let you do that with a listbox.\nWhat you might want to use instead is a set of check buttons with the indicator turned off so they each appear as a button with a single letter. You can then pack them all horizontally in a frame. With the indicator off, the button will appear sunken when selected, or normal otherwise.","Q_Score":0,"Tags":"python,listbox,tkinter","A_Id":6083339,"CreationDate":"2011-05-21T15:33:00.000","Title":"Horizontally oriented listbox using Python and Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Tkinter program and running it like: python myWindow.py starts it all right, but the window is behind the terminal that I use to start it. \nIs there a way to make it grab the focus and be the foreground application? Does it depend on the platform?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":3844,"Q_Id":6091688,"Users Score":2,"Answer":"This might be a feature of your particular window manager. One thing to try is for your app to call focus_force at startup, after all the widgets have been created.","Q_Score":7,"Tags":"python,python-3.x,tkinter,focus","A_Id":6102787,"CreationDate":"2011-05-23T00:10:00.000","Title":"Set focus on Tkinter window (depends on platform?)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm learning wxpython right now and one thing that helps me ALOT is when I'm typing in the text editor I sometimes press the tab key to give me a hint on what I'm looking for...This is great when it works but I notice sometimes it doesn't work and I get lost looking for a syntax I can't remember...\nQuestion is how can I get the suggestion box to pop back up again, Or what am I doing that causes it to stop coming up...\nif it matters I backtracked to 2.7 to learn wx, Windows 7\nEdit: More specifically... when I type: wx.(Here is normally when I would press tab)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":320,"Q_Id":6093313,"Users Score":0,"Answer":"What editor do you use??\nWithout knowing that there's no way we can possibly help you.\nFWIW in vim I use C-x [onp]","Q_Score":0,"Tags":"python","A_Id":6093396,"CreationDate":"2011-05-23T05:51:00.000","Title":"Anyway to bring up suggestion box when typing python code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Have you ever used those cracks and keygens with the really nice interfaces and 8-bit music playing in the bg with special effects when you clicked buttons and stuff? I'd like to create works like such (the GUI part), but I'm wondering which GUI toolkit has that kind of flexibility.\nDo all GUI toolkits have the ability to create such out-of-the-box (literally) designs? I even remember one famous cracker had a dancing panda or some animal at the top of his program that was really trippy. I bet that wasn't easy.\nI was planning on trying to get started with Python and PyGTK, if it's even possible, I guess I'll find out.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":237,"Q_Id":6111171,"Users Score":2,"Answer":"I'd wager most of those cracks are written in C or even assembly language, using the Windows API at a very low level. Very few, if any, are written in Python, and positively none are written using GTK. :) Crackers have different aesthetics than ordinary programmers, and they tend to idealize low-level programs with small executable size. They also usually know Assembly, C and low-level Windows API much better than they're familiar with cross platform toolkits such as GTK and Qt.\nThat being said, most modern toolkits can do at least some of what you describe. Playing sound when a button is clicked, for instance, is quite easy: all you have to do is to hook the to the button events and play a sound using your toolkit's sound API (or an additional library if your toolkit doesn't have sound capabilities). The same goes for music. Drawing graphics on your window's background is also possible with most toolkits I know, and although I have no experience with GTK, I guess it can do that as well.\nSome of the things that might be harder to implement (depending on your toolkit) are non-rectangular windows (e.g. an egg-shaped window), and smooth animations that require at least some sort of double-buffering (if not hardware graphic acceleration support).","Q_Score":0,"Tags":"python,user-interface,interface","A_Id":6112009,"CreationDate":"2011-05-24T13:29:00.000","Title":"Graphical User Interfaces for cracks, keygens, etc","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to create a legend of sorts using ObjectListView in Python. \nI am able to accomplish this, using wx.PaintDC, DrawText, and DrawRectangle in wxPython, but it doesn't look very good because it is all free hand.\nIs it possible to create a square image, say a 10x10 pixel square, using wxPython or another package and then insert that image into a column on ObjectListView while changing the fill of that square for each row.\nFor example:\nCheckBox||State||Population||Legend Color\nYes||Massachusetts||6.5million||Red Filled Square Image\nNo||Illinois||12.9million||Blue Filled Square Image\nThanks in advance.\nChris","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":182,"Q_Id":6118139,"Users Score":0,"Answer":"You should be able to add different images to different rows with the ObjectListView widget, if I understand the question correctly. Alternatively, you might want to take a look at the UltimateListCtrl, which was written in pure Python and can have any widget put into it. I think there's a new list control widget in 2.9 too, but I don't remember what new features it added.","Q_Score":0,"Tags":"python,wxpython,objectlistview","A_Id":6142594,"CreationDate":"2011-05-24T23:49:00.000","Title":"Creating a Legend Using ObjectListView","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've never created a GUI before, just simple text based stuff.  I think I'm ready to move on to building a GUI and I have a project in mind.  Specifically, I'm thinking about creating a simple touch typing tutor game...nothing too fancy.  Which python GUI toolkit and builder would lend itself best to a project like this?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":867,"Q_Id":6119508,"Users Score":1,"Answer":"You can use Pygame modul\nPygame site has a lot of tutorials, you can use those tutorials as a starting point.\nGood Luck!","Q_Score":0,"Tags":"python,user-interface","A_Id":6119548,"CreationDate":"2011-05-25T04:21:00.000","Title":"python GUI to build a simple typing tutor game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've never created a GUI before, just simple text based stuff.  I think I'm ready to move on to building a GUI and I have a project in mind.  Specifically, I'm thinking about creating a simple touch typing tutor game...nothing too fancy.  Which python GUI toolkit and builder would lend itself best to a project like this?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":867,"Q_Id":6119508,"Users Score":0,"Answer":"I wrote several application prototypes using the libglade library and the python bindings.\nI found the toolkit pretty easy to use, it acted just like any other GUI widget framework I've used, but the widgets seemed more ready to grow or shrink to fit the available space easier than many other GUI frameworks.\nSince they were just prototypes, I can't give you feedback on what it is like to maintain the interface for years -- but they sure went together easily.","Q_Score":0,"Tags":"python,user-interface","A_Id":6119529,"CreationDate":"2011-05-25T04:21:00.000","Title":"python GUI to build a simple typing tutor game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a PyGTK GUI that has a gtk.Table.\nPressing one button will generate a PNG file.\nI can show the PNG file in the GUI by adding it somewhere in the table and calling the main window's show_all method again.\nIs there a better way? What if I want to show more than one PNG file at a time?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":173,"Q_Id":6126044,"Users Score":0,"Answer":"You can use a combination of gtk.Image, gtk.HBox (or VBox), and maybe gtk.ScrolledWindow if you plan on showing a lot of images.  Just create a new gtk.Image, set the image using set_from_file, then call pack_end on the box to display it.","Q_Score":1,"Tags":"python,gtk,png,pygtk","A_Id":6127034,"CreationDate":"2011-05-25T14:28:00.000","Title":"In PyGTK, what's a good way of displaying an image in a GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am reading a little bit on Objective-C, and since it comes from Smalltalk, like Ruby does, so I wonder, is it true that if using Ruby, (if Apple change XCode to support it), to develop iPhone or Mac app, it is not suitable really because of the speed?   For example, Angry Birds probably isn't as smooth as it is now if using Ruby, vs if Objective-C, it is compiled and running as machine code.\nBut currently, is there any way of compiling Ruby or Python code into machine code so that it is running in the similar speed zone as Objective-C programs can?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1121,"Q_Id":6129086,"Users Score":1,"Answer":"Python and Ruby themselves are not too fast, but many programs today are written to basically do none of the heavy lifting alone. For instance, if you want to save a PNG file as a JPG, you are certainly going to use the built in system calls to do it. In that case it does not really matter if it takes 0.00001 seconds in Obj-C, or 0.001 seconds in Python to process the mouse click, when the optimized system code to convert the image is the exact same code in both programs, and takes, say 1\/2 a second to run. On the other hand if you are making a low level data munger of your own design, then you might want some C. Basically all languages that you would use on a Mac allow you to write something in C, and call it from that language, so even that does not slow you down. \nPick the language for the task based usually on what everyone else is doing for that problem, intersected with your abilities.","Q_Score":1,"Tags":"python,objective-c,ruby,ios","A_Id":6129509,"CreationDate":"2011-05-25T18:28:00.000","Title":"Is Ruby or Python not suitable for iPhone or Mac app development because of speed, and any compiler that can help boost the speed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My Python backend (Django) has to request to a C++ library to get a result (with help of ctypes module).\nIs it normal to call a C++ method directly? Or may be I need an intermediate thread manager that starts a new thread when python script wants a result?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":339,"Q_Id":6129383,"Users Score":2,"Answer":"Basically you have to decide what kind of operation flow you want. If you prefer synchronous processing you can call you method directly, if you favor asynchronous processing you will need an intermediate solution.\nHowever, you have to be aware, that when you call the C++ routine directly form your Django app the call will end in the execution path that is triggered via the web application. If the processing takes more time than you want to wait, a job management system will be the better choice.\nIn any case I would recommend such a solution if the execution of your C++ routine takes too much time. You could then use polling to wait until the result is ready using e.g. Web Sockets.","Q_Score":2,"Tags":"c++,python,django,ctypes,backend","A_Id":6129485,"CreationDate":"2011-05-25T18:54:00.000","Title":"High Perfomance: Do call C++ methods directly from a python backend?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python script calls an external C++ function (using ctypes). Memory leaks are possible when execution the C++ function.\nWill all allocated memory (in C++ function) be automatically cleaned up after finishing of the Python script?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":169,"Q_Id":6129933,"Users Score":2,"Answer":"Yes, It will all be returned to the OS once the python interpreter exits. This is true for all processes - nothing specific to python or c++.","Q_Score":1,"Tags":"c++,python,ctypes","A_Id":6129979,"CreationDate":"2011-05-25T19:39:00.000","Title":"Call an External C++ function and Memory Leaks: is all allocated memory cleaned up after finishing Python script?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've gone from one book to another, one google search to another and I notice EVERY SINGLE ONE starts the main window in a completely different way.\nI don't want to pick up bad habits so can someone please give me the best of these options and why its the better method. Below are all the ways i've seen it done\nA)\nclass iFrame(wx.Frame):\n    def init(....):\n        wx.Frame._init_(...)\nB)\nclass iFrame(wx.Frame):\n    def init(...):\n        super_init_(...)\nC)\nThen I see some that uses the Panel instead such as\nclass iPanel(wx.Panel)\n    def init(...):\n        wx.Panel.init(...)\nD)\nAnd even more confusing some are using the regular App class of wx\nclass iApp(wx.App):\n    def OnInit(self):\n        wx.Frame.init(...)\nForgive me if some of my structures are wrong but I'm recalling these off the top of my head, Question again...Which one of these, IF ANY is the best way to structure the GUI. It's hard following tutorials and books when they all do things in diff ways\nedit: Sorry if format is not correct, but normally it works...","AnswerCount":4,"Available Count":1,"Score":0.1488850336,"is_accepted":false,"ViewCount":1956,"Q_Id":6133348,"Users Score":3,"Answer":"Don't worry about it. You aren't going to ruin your future programming by making the wrong choice now. \nNone of the options you mention are wrong. They all do things differently because different applications have different requirements. No one way is best.\nJust work on what you want and do what works for you, and once you have greater familiarity then you'll understand why different code does it differently.","Q_Score":3,"Tags":"python,wxpython","A_Id":6133380,"CreationDate":"2011-05-26T03:23:00.000","Title":"Confused on how to structure the GUI (wxpython)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to send a binary file (or a Bitmap object) from Android to a PC, which runs a Python script to receive it. \nHas anybody been in the same situation or has any hints, what could be best practice here? Options are sockets or Webservice (besides from workarounds with samba etc) I guess, but what is the easiest and fastest to implement?\nCheers,\nMarc","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":490,"Q_Id":6151335,"Users Score":1,"Answer":"Just doing a HTTP POST containing data to a web server should do the job. This way you have a myriad of frameworks to choose from, which saves you from doing the dirty work of pushing bits back and forth. Sure, there is some overhead, but unless you have specific reasons to avoid that (which were not mentioned in the question), I think this is the most straightforward approach.\nAdditionally, when the application grows, you can extend this to a full REST style interface later on.","Q_Score":2,"Tags":"java,android,python,networking,binaryfiles","A_Id":6151433,"CreationDate":"2011-05-27T11:03:00.000","Title":"How to best send binary file from Android to Python script on PC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Okay, I'm just starting to get into creating GUIs with python and I'm a bit confused as how how I should go forward:\n\nShould I download PyGTK or the current version of GTK+ if I'm using Python or does it matter?  \nConcerning GUI builders, from what people are saying, it seems like GTKbuilder is better to use than Glade because it's built into GTK+?  Is GTKbuilder also included in PyGTK or would I have to use Glade with PyGTK?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":255,"Q_Id":6158439,"Users Score":1,"Answer":"PyGTK bridges GTK+ to Python, so you need all three.\nGlade is an application to edit XML files. You'll definitely want it. To read those files you can use either libglade (separate, deprecated) or GtkBuilder (built into GTK+, and therefore PyGTK).","Q_Score":0,"Tags":"python,user-interface,pygtk,glade,gtkbuilder","A_Id":6201626,"CreationDate":"2011-05-27T22:58:00.000","Title":"simple questions about PyGTK, GTKbuilder, GTK+","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I noticed the width argument for the Tkinter Text widget is in characters. \nIs it possible to set a maximum width in characters for the text widget?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":8149,"Q_Id":6174390,"Users Score":3,"Answer":"What you want to do isn't directly supported by the widget. You can almost get there by using a couple of tricks. For example, you can set the wrap attribute to wrap at word or character boundaries, then make sure the widget is never wider than 80 characters (this requires using pack\/grid\/place options appropriately). \nThis technique will work fine for fixed-width fonts, but for variable width fonts it won't always wrap at 80 characters. That is because when you set the width to 80 characters it's actually setting it to a specific pixel width based on 80 times the width of an average character (specifically, the 0 (zero) character, last time I checked). \nOf course, you can always force it to wrap at 80 characters by monitoring text insertions and deletions and handling the wrapping yourself, but that's usually more work than is worth the effort.","Q_Score":3,"Tags":"python,text,fonts,width,tkinter","A_Id":6182702,"CreationDate":"2011-05-30T09:18:00.000","Title":"How to set maximum width in characters for the Text widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to get the x y coordinates of the insertion cursor in a Tkinter Text widget? I'm trying to make a popup menu that pops up next to the insertion cursor.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":556,"Q_Id":6180944,"Users Score":3,"Answer":"The bbox method can be used to get the bounding box of an index. You can use that to get the position relative to the window. You can use the winfo method to get the x\/y of the window. \nTypically popups appear next to the mouse rather than the insertion point (though typically, right-clicking first sets the insertion point and then displays a menu).","Q_Score":2,"Tags":"python,text,popup,tkinter","A_Id":6181133,"CreationDate":"2011-05-30T21:35:00.000","Title":"The Tkinter Text Widget Insertion Cursor","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was thinking about adding pythonqt to my application for writing plugins.  My application is in C++ and already uses the Qt framework.  The pythonqt option seems like a natural fit for adding GUI components, but I'm concerned about how well the program will scale if I expose an class with millions of instances.  It will not be uncommon to have something like a million of a certain type of object in memory and I wanted to make sure pythonqt would be able to expose these objects without making them QObjects.  It may be fine, I guess, but before I started, I was wondering if exposing such a large number of classes would be practical using pythonqt and if anyone had any experience with scaling it this much.  \nFrom this link (http:\/\/pythonqt.sourceforge.net\/Developer.html), it seems the decorators actually only load them into python\/Qt on request.  I just don't want an even bigger memory footprint of Qt trying to keep track of these millions of objects for no reason.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":310,"Q_Id":6180947,"Users Score":2,"Answer":"PythonQt only creates Python wrappers for C++ instances that are exposed to Python.\nSo if you do not expose millions of C++ instances to Python at the same time,\nit will scale nicely and create wrappers only for the exposed objects.\nThese wrappers are deleted when they go out of scope in Python, so this should scale as well.\nThe best way to wrap a C++ object is to register a decorator QObject derived class for each C++ class, this allows to register many classes without actually creating\/evaluating the decorators until a class of that type becomes visible to Python.\nHave a look at the Qt wrappers, e.g. PythonQtWrapper_QImage, to see how such a decorator looks like and how it is registered.","Q_Score":1,"Tags":"c++,python,qt","A_Id":10348201,"CreationDate":"2011-05-30T21:35:00.000","Title":"scalability of pythonqt for millions of objects","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was thinking about adding pythonqt to my application for writing plugins.  My application is in C++ and already uses the Qt framework.  The pythonqt option seems like a natural fit for adding GUI components, but I'm concerned about how well the program will scale if I expose an class with millions of instances.  It will not be uncommon to have something like a million of a certain type of object in memory and I wanted to make sure pythonqt would be able to expose these objects without making them QObjects.  It may be fine, I guess, but before I started, I was wondering if exposing such a large number of classes would be practical using pythonqt and if anyone had any experience with scaling it this much.  \nFrom this link (http:\/\/pythonqt.sourceforge.net\/Developer.html), it seems the decorators actually only load them into python\/Qt on request.  I just don't want an even bigger memory footprint of Qt trying to keep track of these millions of objects for no reason.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":310,"Q_Id":6180947,"Users Score":0,"Answer":"I haven't done much with it but it almost sounds like you should at least look at QtQuick\/QML layer. It is hard to tell from your description what is going on but QML is a way to write Qt GUIs without doing any C++ coding. It build on the already exisiting and well working Qt\/JavaScript Implementation and Bridge. \nAs for exposing instances of classes to a scripting language, that would usually depend on the implementation of the bridge. While there is usually some code involved you might not incur that per instance, or it might be lazily instantiated to a point where you will only have much less than the millions of wrapped instances than the originals that you are holding in memory.","Q_Score":1,"Tags":"c++,python,qt","A_Id":6182460,"CreationDate":"2011-05-30T21:35:00.000","Title":"scalability of pythonqt for millions of objects","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyQt to develop an application that in Windows, if set in preferences, should be able to start at boot.\nI'm releasing this software with PyInstaller as a single executable file; i don't have a proper \"installer\".\nWhich is the best way to achieve this? ( = starting at boot)\nA possible solution is to add a link in the startup folder, but i have to do it from the software: it's possible? Other ways?\nThere is an universal path to the Startup folder? Can i have some rights' problem?","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":2695,"Q_Id":6186091,"Users Score":4,"Answer":"You may add registry key under [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run], with any name and value \"path_to_your_exec\". this will require local administrator right, but will work for all users.\nThe same key but starting with [HKEY_CURRENT_USER] will not require administrator privileges, but will work only for current user.\nThat registry path is the same for win2k..win7","Q_Score":5,"Tags":"python,windows,pyqt,startup,pyinstaller","A_Id":6186198,"CreationDate":"2011-05-31T10:17:00.000","Title":"PyQt: best way to do the trick \"start at boot\" for my program in Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have 4 spinctrls in my app. When I click on them, I want all their \ncontent to be selected instantly. And another thing is, I need to make \nthem tab traversal. Can you help me with some sort of code to do this \ntask? \nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":158,"Q_Id":6189047,"Users Score":2,"Answer":"You need to catch EVT_SPIN or EVT_SPINCTRL and in your handler, you can select all the values by calling each of the control's GetValue method. In the wxPython demo, it seems to support tab traversal. I'm not sure what's going on with yours. Did you try the FloatSpin widget as an alternative?","Q_Score":0,"Tags":"python,wxpython","A_Id":6191925,"CreationDate":"2011-05-31T14:24:00.000","Title":"Make Spinctrl selected when activated in WxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The plan is to mainly load the graphics from a disc, or .iso (I already know the sectors the graphics need to be read from) and fill in the rest with game logic and graphics routines, and probably load other things from the disc like the map data.\nI want this to be a multiplatform project, because I use Linux and would like for more people to join in on the project once I have enough done (and it's easy to get more people through platforms like Windows). I'll be making a website to host the project. Also, none of the graphics will be distributed, they'll have to be loaded from your own disc. I'd rather not have to deal with any legal issues.. At least not soon after the project is hosted on my site. \nBut anyway, here's my dilemma- I know quite a bit of Java, and some Python, but I'm worried about performance\/feature issues if I make this engine using one of these two languages. I chose them due to familiarity and platform independence, but I haven't gotten too into graphics programming yet. I'm very much willing to learn, however, and I've done quite a bit of ASM work on the game- looking at graphics routines and whatnot. What would be the best route to take for a project like this? Oh, and keep in mind I'll eventually want to add higher-resolution textures in an .iso restructuring patch or something.\nI'm assuming based on my results on Google that I could go with something like Pygame + OpenGL, JOGL, Pyglet, etc. Any suggestions on an API? Which has plenty of documentation\/support for game or graphics programming? Do they have any serious performance hits?\nThank you for your time.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":213,"Q_Id":6195508,"Users Score":0,"Answer":"I'd recommend going with PySFML, and, of course, Python.\nIf you do your Python programming correctly , and if you really are willing to fiddle with C or ASM Python plugins for faster computations, you shouldn't really have too much performace hits.","Q_Score":1,"Tags":"java,python","A_Id":6195610,"CreationDate":"2011-06-01T02:04:00.000","Title":"Game Engine Remake - Trouble Choosing a Language \/API(Java or Python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The plan is to mainly load the graphics from a disc, or .iso (I already know the sectors the graphics need to be read from) and fill in the rest with game logic and graphics routines, and probably load other things from the disc like the map data.\nI want this to be a multiplatform project, because I use Linux and would like for more people to join in on the project once I have enough done (and it's easy to get more people through platforms like Windows). I'll be making a website to host the project. Also, none of the graphics will be distributed, they'll have to be loaded from your own disc. I'd rather not have to deal with any legal issues.. At least not soon after the project is hosted on my site. \nBut anyway, here's my dilemma- I know quite a bit of Java, and some Python, but I'm worried about performance\/feature issues if I make this engine using one of these two languages. I chose them due to familiarity and platform independence, but I haven't gotten too into graphics programming yet. I'm very much willing to learn, however, and I've done quite a bit of ASM work on the game- looking at graphics routines and whatnot. What would be the best route to take for a project like this? Oh, and keep in mind I'll eventually want to add higher-resolution textures in an .iso restructuring patch or something.\nI'm assuming based on my results on Google that I could go with something like Pygame + OpenGL, JOGL, Pyglet, etc. Any suggestions on an API? Which has plenty of documentation\/support for game or graphics programming? Do they have any serious performance hits?\nThank you for your time.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":213,"Q_Id":6195508,"Users Score":0,"Answer":"At the end of the day if you're passionate about the project and committed to getting the most out of the language you choose, the performance difference between java and python will be minimal if non-existent.\nPersonally speaking, the biggest challenge is finishing the project once it loses novelty and initial momentum.  I suggest you go with whichever language you're more passionate about and are interested in plumbing the depths of, or one that could boost your resume.\nSecondly, as you mention you're hoping to attract contributors, you may want to factor that into your decision.  I can't comment much here, but have a look at similar projects with lots of activity.\nGood luck!","Q_Score":1,"Tags":"java,python","A_Id":6195870,"CreationDate":"2011-06-01T02:04:00.000","Title":"Game Engine Remake - Trouble Choosing a Language \/API(Java or Python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I would like to execute a method which can only be called once my QApplication is displayed, i.e. when it has entered its main event loop exec_(). I'm new to Qt4 (using PyQt4): i was hoping to have a on_start()-like callback, but didn't find one.\nDo i need to create a thread or a timer? Or is there some callback included in the API already?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4716,"Q_Id":6215690,"Users Score":0,"Answer":"I haven't used Qt before, so I might be wrong on this, but I imagine you could bind your on_start() method to the ApplicationActivate event, and set a flag from inside your on_start() method so that the code would only be run that very first time and not any other times the ApplicationActivate event is triggered during execution of your program.\nOn the other hand if the on_start() method would be called by multiple threads, you might want to use thread-specific flags. Haven't done much multithreading myself, so I'm not sure of what the specifics for that would be, or how simple\/complicated it would be.","Q_Score":4,"Tags":"python,multithreading,timer,pyqt4,event-loop","A_Id":6218924,"CreationDate":"2011-06-02T14:11:00.000","Title":"How to execute a method automatically after entering Qt event loop?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to develop an application targeting both android and iphone. I guess they use Java and Objective-C. Can I use single language like Python? Is it the best route? Will I lose performance, features, etc. by using Python. Are there any limitations that I will run into?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1256,"Q_Id":6216890,"Users Score":0,"Answer":"phonegap is one of the way that you can use to target the iphone & android.through the javascript,html.","Q_Score":3,"Tags":"python,android,iphone,beeware","A_Id":6217111,"CreationDate":"2011-06-02T15:47:00.000","Title":"target both android and iphone with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am binding C++ classes to Python and have come to an interesting solution to a previous problem, unfortunately this has lead to another question that there seems to be no easy answer too. \n\nI am wrapping each function into a \"callable\" PyObject, what makes it callable is having the call function define (C side this is the tp_call method in the PyTypeObject). \nThe tp_call seems to take a ternary function which just accepts (PyObject*, PyObject*, PyObject*) as its argument list.\nNow the problem is that I need for this function to just take the place of the PyCFunction, which just takes the arguments (PyObject* self, PyObject* args). Now python side this can be done easily, but C side it seems to need the ternary function when I just want a binary one,\nso is there anyway to make the callable function simple take the PyCFunction pointer or a way to encapsulate it as such?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":390,"Q_Id":6221533,"Users Score":3,"Answer":"The third PyObject* is the kwargs. Write a wrapper that just... doesn't pass them. Raising TypeError if it contains anything is optional.","Q_Score":0,"Tags":"python,callable","A_Id":6221593,"CreationDate":"2011-06-02T23:32:00.000","Title":"What is the exact requirement for defining a python tp_call function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My python code is calling a C function in a native library (also written by me). The function takes two strings as arguments and returns its response as a string. The two argument strings that python passes to C library are only read by the C library, so I am not worried about their memory management. AFAIK, their memory will be allocated by python and will be released when the python runtime seems it appropriate. \nHowever, I understand that the memory of the string that C library returns has to be managed explicitly. One way I can implement it is: the C function callocs a character array, populates it with answer and returns from the function. The python code uses the returned string and should call libc's free on that string or call another function of the same C library which will take care of freeing the memory. \nIs there any other way to do this? Does ctype offer any utility functions that simplify releasing the memory of data structures returned by native libraries?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":2432,"Q_Id":6229610,"Users Score":3,"Answer":"A common way to do this is adding an additional buffer parameter and a length parameter to the C function. If the function is called with a buffer size that is smaller than the required size, the function simply returns the required buffer size and performs no other action, otherwise, the data is copied into the buffer and the size is set to the actual size of the data copied.\nThis allows you to manage the buffer in Python, at the expense of adding 2 additional parameters to your C function.","Q_Score":1,"Tags":"python,memory-management,ctypes","A_Id":6229664,"CreationDate":"2011-06-03T16:00:00.000","Title":"How to manage string memory with python ctypes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing one of the Mobile monitoring program in my phone which I almost finished it. My program has a pedometer which counts human's steps in a real time manner. My question is that I am now writing GUI for phone which will show let's say some picture after they accomplish 1000 steps(like an award) and so on. I am just new to python and does not really know anything about GUI in python. My phone is Nokia N79. My question is that where can I get the information about GUI in python in N79 phones something like examples and so on.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":285,"Q_Id":6230525,"Users Score":0,"Answer":"Which phone model and OS are we talking about? Is it running Android?\nI believe pre-Android Nokia phones used Qt GUI framework\nPython has Qt wrappers, look into PyQt4 for all your UI needs.","Q_Score":0,"Tags":"python,mobile-phones","A_Id":6231462,"CreationDate":"2011-06-03T17:28:00.000","Title":"Python: Making a GUI in nokia phone","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've spent a very frustrating evening trying to get wxpython to work on my MacBook Pro (running Snow Leopard 10.6.6). From reading the various threads on this topic both here and on other websites this is my understanding so far:\n\nIf you are running python 2.6 or greater you can only work with wxpython if you access the 32-bit version\nTyping python at the command line prompt reveals that I am using python 2.6.1. \nTyping which python returns \/usr\/bin\/python so I'm using the default version installed with my OS. This means that typing the following at the command line prompt \ndefaults write com.apple.versioner.python Prefer-32-Bit -bool yes should change the version I'm using to the 32 bit version.\nWith the above in place, I can now simply type the name of my python file (with the wx module imported) and my file will run successfully.\n\nAs you can no doubt guess however my file doesn't run successfully. I can't figure out what's going on, but maybe someone else can here are some other observations that might help... \ntyping help(), modules yields the following message and then prints out the modules, including wx and wxpython\n\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/pkgutil.py:110: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained.  Please switch to the wx package as soon as possible.\n__import__(name)\n\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/pkgutil.py:110: DeprecationWarning: twisted.flow is unmaintained.\n__import__(name)\n\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/Extras\/lib\/python\/twisted\/python\/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead\nimport sha\n\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/Extras\/lib\/python\/twisted\/words\/im\/__init__.py:8: UserWarning: twisted.im will be undergoing a rewrite at some point in the future.\n  warnings.warn(\"twisted.im will be undergoing a rewrite at some point in the future.\")\nFri Jun  3 22:23:48 Paul-Pattersons-MacBook-Pro.local python[3208] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.\n_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.\nThen examining the wx module specifially yields...\nNAME\nwx\nFILE\n\/usr\/local\/lib\/wxPython-unicode-2.8.12.0\/lib\/python2.6\/site-packages\/wx-2.8-mac-unicode\/wx\/__init__.py\nCan anyone help?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":662,"Q_Id":6232629,"Users Score":11,"Answer":"I don't have a Mac, but I read almost all the messages on the wxPython mailing list. As I understand it, you don't want to use the Python that came with your Mac. It has been modified for the Mac specifically somehow, so you should download a normal version of Python and install it.\nAs for the 32-bit question, with wxPython 2.8, you are correct. You are limited to 32-bit because of the Carbon API. However, if you scroll down the download page (http:\/\/wxpython.org\/download.php) you will see that wxPython 2.9 has been released and it has a Cocoa build which (and I quote) \"requires at least OSX 10.5, and supports either 32-bit or 64-bit architectures\" and Python 2.7.\nI highly recommend that you go and seek help on the wxPython mailing list. The author of wxPython is there and he uses a Mac and there are several other Mac addicts on the list too that answer these sorts of questions.","Q_Score":5,"Tags":"macos,wxpython,32bit-64bit","A_Id":6232781,"CreationDate":"2011-06-03T20:58:00.000","Title":"Battling with wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm looking at switching programming languages due to some unavoidable roadblocks. However, before I dedicate myself to a whole new language, I need to know if it is possible for me to play .swf or .flv files underneath other GUI elements if I am using OcempGUI and pygame? Will using those two libraries back me into a corner, to where I cannot use other python GUI libraries without a lot of time-consuming patching?\nThank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":461,"Q_Id":6233805,"Users Score":0,"Answer":"Judging from the GUI's features list and usage, it does not appear to support .swf playback. If anyone has evidence to the contrary, an additional answer would be appreciated.","Q_Score":1,"Tags":"python,flash,pygame","A_Id":8205898,"CreationDate":"2011-06-04T00:12:00.000","Title":"Play .swf with Python\/Pygame\/OcempGUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a small python script which draws some turtle graphics. When my script has finished running, the turtle screen automatically closes, so to be able to see the graphics for a while I have to use time.sleep(5) at the end of the script to delay the closing.\nIs there any way I can make this more dynamic, i.e. tell python that I want to control the closing of the window myself? I don't mind if the script can't do anything else while waiting for my command, but I'd prefer if I didn't have to go to the console for a read() or something. Ideally, the canvas should stay open even after the script finishes running, but I am OK with a solution that halts the script until I close the window that holds the canvas (or click the canvas, or whatever...).\nHow do I accomplish this?","AnswerCount":5,"Available Count":1,"Score":0.1194272985,"is_accepted":false,"ViewCount":113747,"Q_Id":6234798,"Users Score":3,"Answer":"Try adding input() at the end of your code.","Q_Score":41,"Tags":"python,turtle-graphics,window-management","A_Id":8966931,"CreationDate":"2011-06-04T04:59:00.000","Title":"Turtle graphics - How do I control when the window closes?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When using wxPython, is it possible to remove or disable the \"Preferences\" menu item that gets automatically created in the Python menu on OS X?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":145,"Q_Id":6265356,"Users Score":1,"Answer":"For the benefit of others that may run into this, I figured out the solution: \"wx.App_SetMacPreferencesMenuItemId(wx.ID_NONE)\". The trick is to do this before you create the menu, not after. On wxPython 2.9.1.1 it will ghost out the Preferences menu item (which is good enough for me). On 2.9.2 it will remove the item completely.","Q_Score":1,"Tags":"macos,wxpython","A_Id":6540867,"CreationDate":"2011-06-07T12:45:00.000","Title":"Remove Preferences menu item on OS X apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner? Also, I have the impression that it only works with SDK?\nI want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?\nIf yes, please provide me help on how to start writing python for mobile, and how to make project for android in Python. I have used Eclipse for java for android, but not for python.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1492,"Q_Id":6275277,"Users Score":1,"Answer":"I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner? \n\nFrom your development machine, yes. Per your question title, you cannot use MonkeyRunner on a device.\n\nAlso, I have the impression that it only works with SDK?\n\nYes.\n\nI want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?\n\nFortunately, no, as this would be a massive security hole.","Q_Score":0,"Tags":"android,python,monkeyrunner","A_Id":6278753,"CreationDate":"2011-06-08T07:02:00.000","Title":"Can I use MonkeyRunner tool to work in mobile as application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I want to listen on a on a UDP socket for data that will be streamed in and draw it on screen as it comes in. I believe that the socket module with bind will be suitable for receiving the data on the socket, but I am not sure on the best manner to proceed in drawing the data. The image dimensions would be known beforehand and the raw data would be directly drawn starting from any corner and proceeding to fill the image box.\nI would assume the tkinter library or PyQt would be suitable for this but I don't know if there is a better choice or what I should be aware of when going down either of these paths.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":275,"Q_Id":6285553,"Users Score":2,"Answer":"kinter is included in Python, you need to install PyQt (or PySide) separately. Qt is more modern, so I would probably try it first if deployment isn't problem.","Q_Score":0,"Tags":"python,udp,pyqt,tkinter","A_Id":6285587,"CreationDate":"2011-06-08T21:33:00.000","Title":"How would you draw UDP data as it comes in?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to listen on a on a UDP socket for data that will be streamed in and draw it on screen as it comes in. I believe that the socket module with bind will be suitable for receiving the data on the socket, but I am not sure on the best manner to proceed in drawing the data. The image dimensions would be known beforehand and the raw data would be directly drawn starting from any corner and proceeding to fill the image box.\nI would assume the tkinter library or PyQt would be suitable for this but I don't know if there is a better choice or what I should be aware of when going down either of these paths.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":275,"Q_Id":6285553,"Users Score":2,"Answer":"Tkinter has a canvas widget which can be used for drawing. It is vector-based, with primitives for drawing lines, circles, etc. It is very easy to use, and surprisingly powerful.\nIf your drawing is more like a painting where you are receiving instructions for individual pixels, you can create an image, and with that you can change the colors of individual pixels.","Q_Score":0,"Tags":"python,udp,pyqt,tkinter","A_Id":6291949,"CreationDate":"2011-06-08T21:33:00.000","Title":"How would you draw UDP data as it comes in?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to integrate Cython and TG2? I have one computation (written in python) which is heavily numerical and would largly benefit from rewriting into C or cython.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":74,"Q_Id":6292320,"Users Score":2,"Answer":"Without you having additionally specificity in your question and not knowing what exactly you mean by 'integrate', all I can offer is that cython provides a fairly simple way of (often dramatically) speeding up certain code written in python either via static typing or calling external c\/c++ libraries. If there is only a single numerical calculation that can be written in cython and then called from within TG2, then this is a good candidate for using cython. Your mileage will vary though depending on how much of it can be written in something that translates to pure C, versus something that relies heavily on the Python C-API.\nSome (many actually) numerical calculations are also amenable to the type computations that numpy excels at, so if you haven't tried it, that may be another option.\nIn general though if you want a detailed answer, you should put an equivalent amount of detail in the question.","Q_Score":0,"Tags":"python,cython,turbogears,turbogears2","A_Id":6292855,"CreationDate":"2011-06-09T11:51:00.000","Title":"Mixing cython and turbogears 2.1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have multiple Tkinter.labels in a row and i would like the user to be able to click and drag their mouse over each one, activating them in the process.  \nI know about bindings, but i need multiple events in a single binding.  Ive been messing around with <Button-1> and <Enter>, however i need a callback to be called only when both are true.  \nI know l.bind('<Button-1>,<Enter>', ...) is not valid.  \nAnyone with more Tkinter experience know of a way to chain binding, or make a multi-bind??","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2142,"Q_Id":6295440,"Users Score":2,"Answer":"The way you solve this particular problem is to have a binding on ButtonPress and ButtonRelease that sets a flag. Then, in your binding for <Enter> (or any other event) you check for that flag.\nHowever, while the button is pressed you won't get any <Enter> events. This is because the widget you clicked over grabs the pointer and owns it until you release the button. The only <Enter> events you'll get while the button is pressed are when you enter the widget you originally clicked on.\nWhat you want to do instead is bind to <B1-Motion>. You can then use the x\/y coordinates of the event and winfo_containing to determine what widget you are over.\nThat being said, trying to simulate selection over a row of labels is a lot of work for very little benefit. Why not just use a text widget that already has selection built in? You can tweak it so that it looks like a bunch of labels (ie: make the background the same color as a frame) and you can turn editing off. That might be an easier way to go.","Q_Score":2,"Tags":"python,tkinter","A_Id":6296428,"CreationDate":"2011-06-09T15:32:00.000","Title":"Activate other widgets while mouse dragging","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6.\nI typed idle3.2 in the terminal and it gave me:\n\nIDLE can't import Tkinter. Your Python may not be configured for Tk.\n\nSo I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk, I rechecked that I have tclsh on the system, but I still can't manage to open idle3.2.\nAny input would be appreciated.","AnswerCount":8,"Available Count":4,"Score":0.024994793,"is_accepted":false,"ViewCount":46374,"Q_Id":6320954,"Users Score":1,"Answer":"If you installed python-tk and the system is running python 2.6 then it is most likely that  you installed Tkinter for python 2.6. Try installing python3-tk.","Q_Score":8,"Tags":"python,linux,ubuntu,python-3.x,tkinter","A_Id":6338479,"CreationDate":"2011-06-12T08:27:00.000","Title":"IDLE can't import Tkinter. Your Python may not be configured for Tk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6.\nI typed idle3.2 in the terminal and it gave me:\n\nIDLE can't import Tkinter. Your Python may not be configured for Tk.\n\nSo I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk, I rechecked that I have tclsh on the system, but I still can't manage to open idle3.2.\nAny input would be appreciated.","AnswerCount":8,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":46374,"Q_Id":6320954,"Users Score":2,"Answer":"The problem is caused by the version between python and idle not matching.\nU can check your python version by typing : python\nThen sudo aptget install the right idle version same with your python version","Q_Score":8,"Tags":"python,linux,ubuntu,python-3.x,tkinter","A_Id":13890255,"CreationDate":"2011-06-12T08:27:00.000","Title":"IDLE can't import Tkinter. Your Python may not be configured for Tk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6.\nI typed idle3.2 in the terminal and it gave me:\n\nIDLE can't import Tkinter. Your Python may not be configured for Tk.\n\nSo I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk, I rechecked that I have tclsh on the system, but I still can't manage to open idle3.2.\nAny input would be appreciated.","AnswerCount":8,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":46374,"Q_Id":6320954,"Users Score":0,"Answer":"Type \"idle-python2.6\" in the terminal..it worked for me","Q_Score":8,"Tags":"python,linux,ubuntu,python-3.x,tkinter","A_Id":18475938,"CreationDate":"2011-06-12T08:27:00.000","Title":"IDLE can't import Tkinter. Your Python may not be configured for Tk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6.\nI typed idle3.2 in the terminal and it gave me:\n\nIDLE can't import Tkinter. Your Python may not be configured for Tk.\n\nSo I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk, I rechecked that I have tclsh on the system, but I still can't manage to open idle3.2.\nAny input would be appreciated.","AnswerCount":8,"Available Count":4,"Score":0.024994793,"is_accepted":false,"ViewCount":46374,"Q_Id":6320954,"Users Score":1,"Answer":"you need to install tk or tk-dev packages for ubuntu.","Q_Score":8,"Tags":"python,linux,ubuntu,python-3.x,tkinter","A_Id":8566253,"CreationDate":"2011-06-12T08:27:00.000","Title":"IDLE can't import Tkinter. Your Python may not be configured for Tk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Every once in a while I like to take a break from my other projects to try to make a classic adventure text-based-game (in Python, this time) as a fun project, but I always have design issues implementing the item system. \nI'd like for the items in the game to descend from one base Item class, containing some attributes that every item has, such as damage and weight. My problems begin when I try to add some functionality to these items. When an item's damage gets past a threshold, it should be destroyed. And there lies my problem: I don't really know how to accomplish that.\nSince del self won't work for a million different reasons, (Edit: I am intentionally providing the use of 'del' as something that I know is wrong. I know what garbage collection is, and how it is not what I want.) how should I do this (And other similar tasks)? Should each item contain some kind of reference to it's container (The player, I guess) and 'ask' for itself to be deleted? \nThe first thing that comes to mind is a big dictionary containing every item in the game, and each object would have a reference to this list, and both have and know it's own unique ID. I don't like this solution at all and I don't think that it's the right way to go at all. Does anybody have any suggestions?\nEDIT: I'm seeing a lot of people thinking that I'm worried about garbage collection. What I'm talking about is not garbage collection, but actually removing the object from gameplay. I'm not sure about what objects should initiate the removal, etc.","AnswerCount":6,"Available Count":3,"Score":0.0333209931,"is_accepted":false,"ViewCount":1852,"Q_Id":6325775,"Users Score":1,"Answer":"You're conflating two meanings of the \"destroying\" idea.  The Item should get destroyed in a \"gameplay\" sense.  Let the garbage collector worry about when to destroy it as an object.\nWho has a reference to the Item?  Perhaps the player has it in his inventory, or it is in a room in the game.  In either case your Inventory or Room objects know about the Item. Tell them the Item has been destroyed (in a gameplay sense) and let them handle that.  Perhaps they'll now keep a reference to a \"broken\" Item.  Perhaps they'll keep track of it, but not display it to the user.  Perhaps they'll delete all references to it, in which case the object in memory will soon be deleted.\nThe beauty of object-oriented programming is that you can abstract these processes away from the Item itself: pass the messages to whoever needs to know, and let them implement in their own way what it means for the Item to be destroyed.","Q_Score":5,"Tags":"python,oop","A_Id":6325854,"CreationDate":"2011-06-13T01:02:00.000","Title":"Managing Items in an Object Oriented game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Every once in a while I like to take a break from my other projects to try to make a classic adventure text-based-game (in Python, this time) as a fun project, but I always have design issues implementing the item system. \nI'd like for the items in the game to descend from one base Item class, containing some attributes that every item has, such as damage and weight. My problems begin when I try to add some functionality to these items. When an item's damage gets past a threshold, it should be destroyed. And there lies my problem: I don't really know how to accomplish that.\nSince del self won't work for a million different reasons, (Edit: I am intentionally providing the use of 'del' as something that I know is wrong. I know what garbage collection is, and how it is not what I want.) how should I do this (And other similar tasks)? Should each item contain some kind of reference to it's container (The player, I guess) and 'ask' for itself to be deleted? \nThe first thing that comes to mind is a big dictionary containing every item in the game, and each object would have a reference to this list, and both have and know it's own unique ID. I don't like this solution at all and I don't think that it's the right way to go at all. Does anybody have any suggestions?\nEDIT: I'm seeing a lot of people thinking that I'm worried about garbage collection. What I'm talking about is not garbage collection, but actually removing the object from gameplay. I'm not sure about what objects should initiate the removal, etc.","AnswerCount":6,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1852,"Q_Id":6325775,"Users Score":0,"Answer":"Assuming you call a method when the item is used, you could always return a boolean value indicating whether it's broken.","Q_Score":5,"Tags":"python,oop","A_Id":6325828,"CreationDate":"2011-06-13T01:02:00.000","Title":"Managing Items in an Object Oriented game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Every once in a while I like to take a break from my other projects to try to make a classic adventure text-based-game (in Python, this time) as a fun project, but I always have design issues implementing the item system. \nI'd like for the items in the game to descend from one base Item class, containing some attributes that every item has, such as damage and weight. My problems begin when I try to add some functionality to these items. When an item's damage gets past a threshold, it should be destroyed. And there lies my problem: I don't really know how to accomplish that.\nSince del self won't work for a million different reasons, (Edit: I am intentionally providing the use of 'del' as something that I know is wrong. I know what garbage collection is, and how it is not what I want.) how should I do this (And other similar tasks)? Should each item contain some kind of reference to it's container (The player, I guess) and 'ask' for itself to be deleted? \nThe first thing that comes to mind is a big dictionary containing every item in the game, and each object would have a reference to this list, and both have and know it's own unique ID. I don't like this solution at all and I don't think that it's the right way to go at all. Does anybody have any suggestions?\nEDIT: I'm seeing a lot of people thinking that I'm worried about garbage collection. What I'm talking about is not garbage collection, but actually removing the object from gameplay. I'm not sure about what objects should initiate the removal, etc.","AnswerCount":6,"Available Count":3,"Score":-0.0333209931,"is_accepted":false,"ViewCount":1852,"Q_Id":6325775,"Users Score":-1,"Answer":"at first: i don't have any python experience, so think about this in a more general way\nyour item should neither know or care ... your Item should have an interface that says it is something destroyable. containers and other objects that care about things that can be destroyed, can make use of that interface\nthat destroyable interface could have some option for consuming objects to register a callback or event, triggered when the item gets destroyed","Q_Score":5,"Tags":"python,oop","A_Id":6325868,"CreationDate":"2011-06-13T01:02:00.000","Title":"Managing Items in an Object Oriented game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make a file manager in python that looks like GNOME default file manager (nautilus) Because I am developing a FilePane plugin for a python written text editor. I don't know if there is a widget to give me the same look of Nautilus. If not, what widgets can I use to get a nice looking file manager?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":622,"Q_Id":6356190,"Users Score":0,"Answer":"I searched GTK API and I found that GTK TreeView does what I want.","Q_Score":0,"Tags":"python,pygtk,glade","A_Id":6441716,"CreationDate":"2011-06-15T10:15:00.000","Title":"PyGTK Glade File Manager","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I want to have a table like display on one of panels where the user can fill in data into pre-made columns.  I'm not sure what widget will give me this functionality.  I want users to be able to edit elements they have already added, and to easily add another element.  Any suggestions?","AnswerCount":3,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":94,"Q_Id":6362228,"Users Score":3,"Answer":"Look at Grid or ListCtrl to create the columns.  I think Grid is a better choice for editing as you can add TextCtrls or the like to the columns.","Q_Score":1,"Tags":"python,wxpython","A_Id":6362267,"CreationDate":"2011-06-15T18:06:00.000","Title":"Looking for a wxpython widget that would let user's fill in data like they would in a table","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to have a table like display on one of panels where the user can fill in data into pre-made columns.  I'm not sure what widget will give me this functionality.  I want users to be able to edit elements they have already added, and to easily add another element.  Any suggestions?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":94,"Q_Id":6362228,"Users Score":0,"Answer":"Try ListCtrl with TextEditMixin - it's pretty neat and offers keyboard navigation to move between cells.","Q_Score":1,"Tags":"python,wxpython","A_Id":6383556,"CreationDate":"2011-06-15T18:06:00.000","Title":"Looking for a wxpython widget that would let user's fill in data like they would in a table","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using python GTK under Gnome (Gnome 3 in Fedora 15).\nI'd like to catch events when the user double clic on the icon in the tray area.\nI found that \"activate\" signals is called when the user do a single clic, but can't find the signal or a proper way to call a method when the user double clic on it.\nHow can I do ?\nThanks for your help!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":477,"Q_Id":6370804,"Users Score":3,"Answer":"You can't. Gtk+ itself doesn't even know if it was single or double clicked.\nFrom the Gtk+ documentation about the ::activate signal:\n\nGets emitted when the user activates the status icon. If and how status icons can activated is platform-dependent.\n\nInterestingly Qt knows about this (it has Trigger and DoubleClick). Maybe you can work around this by using ::button-press-event instead and counting it, but I'm not sure this can be called the recommended way.\nAlso, a personal note as a user: I prefer status icons that are activated by a single click.","Q_Score":3,"Tags":"python,gtk,icons,status","A_Id":6477243,"CreationDate":"2011-06-16T11:08:00.000","Title":"gtk.StatusIcon with double click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Qt Designer to set up a simple gui for a program I am writing in which I need to display a column of radio buttons.  I want to hide some of the radio buttons (not just disable them) based on whether or not their corresponding port is currently available.  The radio buttons are in a group box with a vertical layout, so whenever I hide one of them, the rest of the buttons move apart to fill the space.  \nIs there any way to make it so the buttons will compress towards top of the groupbox instead of autospacing themselves?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":437,"Q_Id":6390066,"Users Score":2,"Answer":"Insert a vertical spacer below the bottom-most radio button.","Q_Score":2,"Tags":"python,layout,pyqt4,qt-designer,groupbox","A_Id":6390326,"CreationDate":"2011-06-17T18:21:00.000","Title":"PyQt4 Vertical Layout Autospacing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to create a link button (gtk.LinkButton) with an URI to a local file. Does anyone know what is a valid URI format for a local file ? I want to specify a relative folder example: ..\/some_folder\/file_i_need_to_open.txt\nIf this is can't be done, I don't mind putting the file in the same folder as the python source code =)\nThank you.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":396,"Q_Id":6395185,"Users Score":1,"Answer":"Something like: file:\/\/\/usr\/bin\/ is generally used for local URI. But maybe just \/usr\/bin\/ works too. Have you tried it?","Q_Score":0,"Tags":"python,pygtk","A_Id":6395227,"CreationDate":"2011-06-18T09:51:00.000","Title":"How to Specify URI to a local File in PyGtk LinkButton","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a simple top down rpg in Pygame, and I have found that it is quite slow.... Although I am not expecting python or pygame to match the FPS of games made with compiled languages like C\/C++ or event Byte Compiled ones like Java, But still the current FPS of pygame is like 15. I tried rendering 16-color Bitmaps instead of PNGs or 24 Bitmaps, which slightly boosted the speed, then in desperation , I switched everything to black and white monochrome bitmaps and that made the FPS go to 35. But not more. Now according to most Game Development books I have read, for a user to be completely satisfied with game graphics, the FPS of a 2d game should at least be 40, so is there ANY way of boosting the speed of pygame?","AnswerCount":6,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29233,"Q_Id":6395923,"Users Score":0,"Answer":"You could try using Psyco (http:\/\/psyco.sourceforge.net\/introduction.html). It often makes quite a bit of difference.","Q_Score":15,"Tags":"python,performance,pygame,frame-rate","A_Id":6396048,"CreationDate":"2011-06-18T12:15:00.000","Title":"Any way to speed up Python and Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm getting a Tkinter error even though it was imported and used yesterday. I have a Windows 7 OS and am running Python 2, so I'm not sure what I'm supposed to do at this point. My google-fu is weak today, I can't seem to bring up anything relevant. Any input would be greatly appreciated.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":4656,"Q_Id":6429397,"Users Score":1,"Answer":"This happens when you most likely have more than one Python installed on your system and you're running the program from a version different from the one you programmed it in. \nBy default, a Python program on your PC will usually be opened in the latest edition of Python.","Q_Score":3,"Tags":"python,debugging,import,tkinter,importerror","A_Id":6440612,"CreationDate":"2011-06-21T17:25:00.000","Title":"\"ImportError: No module named Tkinter\" even though I've used Tkinter programs as recent as yesterday and no substantial changes were made?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm getting a Tkinter error even though it was imported and used yesterday. I have a Windows 7 OS and am running Python 2, so I'm not sure what I'm supposed to do at this point. My google-fu is weak today, I can't seem to bring up anything relevant. Any input would be greatly appreciated.","AnswerCount":2,"Available Count":2,"Score":0.3799489623,"is_accepted":false,"ViewCount":4656,"Q_Id":6429397,"Users Score":4,"Answer":"You may want to check if the version of the Python interpreter used to run the script got changed somehow.\nimport tkinter works in python 3 (instead of Tkinter).","Q_Score":3,"Tags":"python,debugging,import,tkinter,importerror","A_Id":12694818,"CreationDate":"2011-06-21T17:25:00.000","Title":"\"ImportError: No module named Tkinter\" even though I've used Tkinter programs as recent as yesterday and no substantial changes were made?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a Python application to parse a list of binary files, aggregate statistics on the data in them, and output results. I can easily output these results as a .tsv file, but this program is being written for the convenience of my coworkers, so I'm trying to have it display the results in a new window to sometimes prevent having to open the file in Excel. Right now I'm basically embedding a Tkinter frame in a scrolled canvas and gridding smaller frames containing labels of the data into the frame. (The smaller frames seem to be necessary to get all the borders to line up with the gridlines; otherwise they are shrinkwrapped to fit the labels)\nThis approach works with upwards of a hundred columns and maybe ten rows. But when I start increasing the number of rows to the hundreds, I start encountering odd problems. The program might become unresponsive, the new window might not display, and all the labels, rather than being drawn in the grid, are all placed in the top left corner of my screen. Since this appears to be a scale-related problem, I'm wondering if I'm simply overwhelming the grid manager with tens of thousands of elements to place. So I have two questions: 1) Could I be running into such limitations, or is the problem elsewhere, and 2) Is there a better way to implement an Excel-like table display in Tkinter that steers clear of these problems?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2573,"Q_Id":6431487,"Users Score":2,"Answer":"I wrote a test program to display the data two ways, once using a frame and grid and once drawing text directly on the canvas.\nUsing the frame+grid technique, the performance of 100 rows times 10 columns was quite acceptable. When I bumped that up to 200 rows the performance was more than 2x worse, and by the time I got to 300 rows, performance was unusable. And by that I mean, it took dozens of seconds for the initial display. Once the window appeared, however, the performance was acceptable.\nDrawing text items directly on the canvas, performance was considerably better. I could display 300 rows by 10 columns and the initial display was almost instantaneous. Performance was still acceptable when I had 1000 rows with 100 columns, taking maybe 2-3 seconds to start up.\nSo, for a large number of cells you're better off drawing them directly on the canvas. This means you'll need to calculate the height of a row yourself, and also do a little math for the columns -- either use fixed width columns or keep track of the widest and then adjust the coordinates accordingly.","Q_Score":0,"Tags":"python,performance,grid,tkinter","A_Id":6432380,"CreationDate":"2011-06-21T20:20:00.000","Title":"Size limitations of Tkinter grid manager","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to write a Python\/wxPython app that implements wx.FileDropTarget. This part is easy. I would also like to show the file icon as it is dragged over the app window and then display a proxy with file icon (and other meta-data, perhaps, like size) within the app window.\nI would like to implement this on Windows 7. But I am interested in being able to make this work on OS X and Linux as well.\nI have googled and searched through Python v2.7.1 documentation - but to no avail. I am somewhat new the ways of Windows, so if there is a way to divine a BMP or ICO file that is associated with a file - then I am okay with going that route...\nAny example code is always appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":600,"Q_Id":6433574,"Users Score":1,"Answer":"I think there's not only one portable way to accomplish this ... on windows platforms, default icons for file types associations are stored on the system registry (except for executables where the icon is in the exe resources) and on linux platforms it depends on the desktop environment, each one has its own standards ... so i don't think there's an \"universal\" way to do that.","Q_Score":1,"Tags":"python,windows,filesystems,icons,wxpython","A_Id":6433722,"CreationDate":"2011-06-22T00:29:00.000","Title":"Accessing file meta-data within Python\/wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to be able to load\/download a bunch of resources and notify the user of the file that's currently being loaded, but I can't just draw a frame after each file starts loading because v-sync will wait until it can draw a frame before it continues (bottle-necking the loads to less than 60\/second).\nIs there a way to check whether the device is ready to draw or not (without hacky \"has 1\/60th of a second passed yet?), so I can perform actions until it's ready? I don't mind if the notification skips over files that finished before it's ready to draw, but I want to maximize the speed of the loads while still being able to notify the user.\nAlso, I'd like to avoid disabling v-sync even temporarily because I don't want to cause a graphic card crippling 300FPS rate if the computer loads really quickly.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1246,"Q_Id":6450283,"Users Score":1,"Answer":"You don't specify which version of Direct3D you're using. With D3D9 you can pass D3DPRESENT_DONOTWAIT to your Present() call and it will return D3DERR_WASSTILLDRAWING if the hardware is busy processing or waiting for a vertical sync interval. This means if you have vsync enabled, in your main loop you can just call Present with the DONOTWAIT flag whenever you've loaded a file and load another if it returns WASSTILLDRAWING. \nNote that you need to get the swap chain and call Present() on the swap chain rather than calling Present() directly on the device to be able to pass this flag to present, or you can set it in the D3DPRESENT_PARAMETERS structure when you create the device or create an IDirect3DDevice9Ex instead of an IDirect3DDevice9 device and call PresentEx() instead of Present().\nThis doesn't solve the problem of files that take longer than a frame to load however - your frame rate will drop if you have a file that takes a long time to process. A better solution to this problem in my opinion would be to move as much of your IO as possible to another thread (in D3D9 you will still have to create D3D resources on your main thread however) and just pass the name of the file that's currently being processed to your main \/ render thread to display each time you present a frame.","Q_Score":0,"Tags":"direct3d,python-idle,vertical-sync","A_Id":6458750,"CreationDate":"2011-06-23T06:45:00.000","Title":"How can I perform actions while waiting for vertical sync?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What's the best way to detect idle state for a silverlight application? I have read quite a few articles on the net by now and usually they are either for wpf\/mobile apps etc. \nI have created a DispatcherTimer which locks the screen after 5 minutes and it seems that I will have to go to every widget in every screen(my application has around 4-5 screens) and add a mousebuttondown or mouseenter eventhandler to reset this timer. This doesn't seem to be efficient but just adding the handler to the layroot is not helping either.\nAny helpful suggestions?\nThanks","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1573,"Q_Id":6451919,"Users Score":2,"Answer":"Handled events will not bubble up to root control. Instead you should use the AddHandler method with handledEventsToo = true.","Q_Score":6,"Tags":"silverlight,python-idle,dispatchertimer","A_Id":9692923,"CreationDate":"2011-06-23T09:25:00.000","Title":"idle state detection silverlight 4 application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I wrote a simple sokoban like 2D game in python that I want to clean up.  It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen.  It works out nicely since I can loop through each position on the screen and call the object's draw function.\nI am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view.  Is there a good way to do this?  Is this a case where I should not use a MVC design?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1166,"Q_Id":6462967,"Users Score":4,"Answer":"MVC can be counter-intuitive sometimes, especially when you're first learning OO and discover that having a \"draw\" method makes things so organized!\nHere's an overview of one of many ways you might implement MVC for your game:\nModel:\n\n\"Box\": box_type, pos_x, pos_y\n\"BoxManager\": list(Box)\n\"GameState\": box_manager, player_manager, goal_manager, ...\n\"Move\": dx, dy\n\nController:\n\n\"GameController\": check_valid_move(move), move_player(move), is_goal_state(), ...\n\nView:\n\n\"Screen\": render()\n\"PlayerRenderer\": render()\n\"BoxRenderer\": render_box(box), render_all_boxes()\n\nNotice how the model is totally self-contained and does not reference the controller or view modules.  This is one of the key aspects of MVC.\nThe controller takes player input and manipulates the global game state.\nAnd the view looks at the global game state and renders the screen.\nYou don't have to go this route, but it's an option worth understanding and considering.","Q_Score":2,"Tags":"python,model-view-controller,oop","A_Id":6463049,"CreationDate":"2011-06-24T03:20:00.000","Title":"MVC Game Design with objects","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"I wrote a simple sokoban like 2D game in python that I want to clean up.  It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen.  It works out nicely since I can loop through each position on the screen and call the object's draw function.\nI am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view.  Is there a good way to do this?  Is this a case where I should not use a MVC design?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1166,"Q_Id":6462967,"Users Score":0,"Answer":"One aspect that I'll just quickly make explicit is that when your model changes, it can't call the view to say \"render this change\" - because the model shouldn't know about the view(s).\nInstead the model raises an event to say it has changed, and the view re-renders as necessary on receiving these. The view(s) know about the model, and subscribes to its events, but the model knows nothing about the things receiving the events.\nAs an example, I'm writing an OpenGL app, where the model contains simple normalized polygons and polyhedra, which are nice to work with geometrically, but are not convenient to pass to OpenGL. When the view receives an event saying the model has changed (a shape added or modified) then the view converts these polygons into the denormalised arrays of vertices that can be passed to OpenGL. This is an expensive operation, so the view caches these arrays in its own collection of \"what needs to be rendered\", and when it renders, it just iterates through this 'view collection', passing each array to OpenGL. So the view is the only code that knows about OpenGL, and is the only code that knows how to convert model state into OpenGL structures.","Q_Score":2,"Tags":"python,model-view-controller,oop","A_Id":11327596,"CreationDate":"2011-06-24T03:20:00.000","Title":"MVC Game Design with objects","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"I wrote a simple sokoban like 2D game in python that I want to clean up.  It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen.  It works out nicely since I can loop through each position on the screen and call the object's draw function.\nI am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view.  Is there a good way to do this?  Is this a case where I should not use a MVC design?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1166,"Q_Id":6462967,"Users Score":0,"Answer":"Refactoring your code to conform to MVC would mean creating a \"view\" (like  that represented your screen, and that view would have (for example) a draw method that took the \"model\" (a python object that contained all of the block states) and rendered that model to the screen.\nNow perhaps all that draw method would do to render to the screen is call a renderToScreen(screenView) method on every block object.  Or you might refactor that draw method into the view if you want to be more \"pure\".","Q_Score":2,"Tags":"python,model-view-controller,oop","A_Id":6463038,"CreationDate":"2011-06-24T03:20:00.000","Title":"MVC Game Design with objects","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have all the characters of a font rendered in a PNG. I want to use the PNG for texture-mapped font rendering in OpenGL, but I need to extract the glyph information - character position and size, etc.\nAre there any tools out there to assist in that process? Most tools I see generate the image file and glyph data together. I haven't found anything to help me extract from an existing image.\nI use the gimp as my primary image editor, and I've considered writing a plugin to assist me in the process of identifying the bounding box for each character. I know python but haven't done any gimp plugins before, so that would be a chore. I'm hoping something already exists...","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1560,"Q_Id":6481333,"Users Score":1,"Answer":"Generally, the way this works is you use a tool to generate the glyph images. That tool will also generate metric information for those glyphs (how big they are, etc). You shouldn't be analyzing the image to find the glyphs; you should have additional information alongside your glyphs that tell where they are, how big they should be, etc.\nConsider the letter \"i\". Depending on the font, there will be some space to the left and right of it. Even if you have a tool that can identify the glyph \"i\", you would need to know how many pixels of space the font put to the left and right of the glyph. This is pretty much impossible to do accurately for all letters. Not without some very advanced computer vision algorithms. And since the tool that generated those glyphs already knew how much spacing they were supposed to get, you would be better off changing the tool to write the glyph info as well.","Q_Score":2,"Tags":"python,opengl,fonts,bitmap,gimp","A_Id":6481428,"CreationDate":"2011-06-26T00:15:00.000","Title":"Tools to extract glyph data from bitmap font image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm going to develop a multimedia application which is running mostly on windows.\nI don't know whether python is a good choice or not and which GUI library (Wxpython or pyqt) is suitable for that. Maybe pyQt is enough(like it).\nThe major features of the application include:\n\nMust have a rich GUI, a great look and feel which is fast.\nHave the ability to play\/pause video and audio files with fast seeking ability( seek and play a specific portion of a long  media file quickly upon request, CRITICAL FEATURE)\nHave the ability to control the speed of playback without losing so much quality\nCan show subtitles for video files\n\nSince I'm new to Python world, it's wise to dive straightly into Python 3.x, the problem is that python 3 is fairly new and most of the resources are still based on python 2.x. Will I need to work back on python 2.x? are the required libraries compatible with python 3.x?\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":288,"Q_Id":6499507,"Users Score":0,"Answer":"Python 3 doesn't work with wxPython right now.  Python 3 does work with pyQT, but it is under GPL, so you will need to buy a license if you do not want to release your software under the GPL.","Q_Score":0,"Tags":"python,user-interface,programming-languages,multimedia","A_Id":6499936,"CreationDate":"2011-06-27T22:07:00.000","Title":"A multimedia-rich application for windows, is Python enough good?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On the wxwidgets docs, I only found the EnableGridLines, which is set to false, removes both the horizontal and vertical lines, what I wish, is to remove only the horizontal lines on the grid. Is there a possible way to do this?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":656,"Q_Id":6527640,"Users Score":0,"Answer":"I agree with Mike. Unfortunately wx.grid.Grid.Get[Col|Row]GridLinePen() isn't hooked to the wxPython level, so you can't override those functions in your code. I had been hopeful that returning None would result in the line not being drawn.","Q_Score":3,"Tags":"python,grid,wxpython,wxwidgets","A_Id":6539871,"CreationDate":"2011-06-29T21:45:00.000","Title":"Remove horizontal grid lines only on wxgrid","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On the wxwidgets docs, I only found the EnableGridLines, which is set to false, removes both the horizontal and vertical lines, what I wish, is to remove only the horizontal lines on the grid. Is there a possible way to do this?","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":656,"Q_Id":6527640,"Users Score":3,"Answer":"As far as I can tell, you either have all the lines or none of them. Feel free to try cross-posting on the wxPython mailing list to make doubly sure though.","Q_Score":3,"Tags":"python,grid,wxpython,wxwidgets","A_Id":6535996,"CreationDate":"2011-06-29T21:45:00.000","Title":"Remove horizontal grid lines only on wxgrid","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to pyqt and I've been looking for some docs about pyqt and fullscreen mode. but I couldn't find nothing. So here is my question:\nis there any way to run a PyQT 4 application on fullscreen?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":28015,"Q_Id":6541771,"Users Score":47,"Answer":"use showFullScreen() on your widget.","Q_Score":28,"Tags":"python,pyqt,fullscreen","A_Id":6541995,"CreationDate":"2011-06-30T22:22:00.000","Title":"Fullscreen with pyqt4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Tkinter in Python, and trying to create code to run when a text box's value is changed. All the code I find online uses a mysterious tk member of Tkinter widgets, and I can't find any documentation on it! I found it's of type tkapp, but there's no documentation on that either.\nWhere can I find a decent resource which explains to me the workings of this mysterious thing? (Even better, where can I just find documentation on Tkinter? All I can find are tutorials).","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2594,"Q_Id":6543413,"Users Score":0,"Answer":"tkapp is the highest \"master\". If you make a widget on the root window, tkapp is the master of that.","Q_Score":5,"Tags":"python,graphics,tkinter","A_Id":32061918,"CreationDate":"2011-07-01T03:50:00.000","Title":"What is Tkinter's tkapp?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with an API which is distributed as a dll\/so file that I need to dynamically link with my python program. To accomplish this, I want to use Cython. \nI have been able to, in the past, link with the dll statically. This works well, except that the API comes in four different flavors, with theoretically infinitely more to come and the users should be able to compile them with whatever name they want (Kinda like a plugin system). Because of that, I can't just make an so\/pxd file that statically links with just one library, or even links with a selection of them. \nWhat I need is to be able to pass the so\/dll name into the Cython code and have it \"import\" it. I know this can be done with ctypes via ctypes.cdll.LoadLibrary, but is this kind of thing possible in Cython? Am I going to have to use ctypes to do this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":981,"Q_Id":6546310,"Users Score":2,"Answer":"I assume you are talking about writing C modules here.  If so yes you can.  I don't know what the equivalent on Windows is, but in Linux you can use dlopen and friends.  There is a man page for it, and several web sites documenting it.  Try this link \"http:\/\/linux.die.net\/man\/3\/dlopen\" it provides you with a nice example near the bottom of the page.  This is doing the same thing as what ctypes does, in fact I think this might even be what ctypes uses.","Q_Score":2,"Tags":"python,cython","A_Id":6591378,"CreationDate":"2011-07-01T09:46:00.000","Title":"Cython: Dynamically linking with a dll\/so","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm attempting to convert a Python application I coded using the cmd module into a gui. Initially, I came across EasyGui. But after giving it a try, I find that it is very limited, the gui screens are not consistent, and overall not easy on the eyes. I read about IronPython (Python + .NET), but cannot find adequate documentation on it. Before I order a book from Amazon on IronPython (as this seems the most legitimate), does anyone know of a decent gui alternative for Python? Thanks!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1559,"Q_Id":6566264,"Users Score":0,"Answer":"The best GUI's for Python are tkinter, Qt (PyQt), and wx (wxPython). Search any of those terms to learn more.","Q_Score":0,"Tags":"python,user-interface","A_Id":6566268,"CreationDate":"2011-07-03T23:52:00.000","Title":"Is there a preferred Python gui to use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm attempting to convert a Python application I coded using the cmd module into a gui. Initially, I came across EasyGui. But after giving it a try, I find that it is very limited, the gui screens are not consistent, and overall not easy on the eyes. I read about IronPython (Python + .NET), but cannot find adequate documentation on it. Before I order a book from Amazon on IronPython (as this seems the most legitimate), does anyone know of a decent gui alternative for Python? Thanks!","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1559,"Q_Id":6566264,"Users Score":5,"Answer":"Tkinter is in the standard library, works on all platforms, and is fairly simple and lightweight, but it looks a bit clunky.\nWxPython tries to use platform widgets, so it looks a bit better, but it's a separate library. On Linux, I still find it doesn't look quite right.\nPyQt is a large, powerful framework - it looks good, and you can do a lot with it, but it's more complex and a larger install.\nThere are plenty of others, but those are probably the most popular.","Q_Score":0,"Tags":"python,user-interface","A_Id":6566327,"CreationDate":"2011-07-03T23:52:00.000","Title":"Is there a preferred Python gui to use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i have a wxlistbox in a class and i want to update the data inside the listbox from a different class.Is i possible to reload the class while leave the control from another class?if yes ,how?\neg:\ni have two classes,Class A and Class B.In class A there is a wxlistbox.while starting the program class A initilise the wxlistbox and bind some values.when a button inside class A clicked it call another frame class B.while close the frame B the wxlistbox inside class A should update.\nMy question is how to refresh listbox while close the frame B?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":169,"Q_Id":6581744,"Users Score":1,"Answer":"I would use the SetItems() method, which according to the docs does the following: \"Clear and set the strings in the control from a list\".\nEdit: myListCtrl.SetItems(ListOfStrings)\nThat will replace all the items in the control with whatever is in the list.","Q_Score":0,"Tags":"python,wxpython","A_Id":6584095,"CreationDate":"2011-07-05T11:13:00.000","Title":"how to update a wxlistbox from a different class?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am building an application for Android. It will interface with some C++ libraries using Android NDK through JNI. There are also some libraries that are written in Python that I want to call from my Android application (e.g. NTLK). How can I do that?\nPlease note that SL4A (Scripting Layer for Android) is something different. It allows you to build an application using a scripting language like Python, Lua etc. In my case the application will be in Java but will need to call code that has been written in Python. Is this possible in an elegant way?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":5930,"Q_Id":6596568,"Users Score":1,"Answer":"I recommend putting the NLP code into web services on a Linux server and calling those from android.\nThis is quite straight forward in a framework like django.","Q_Score":7,"Tags":"android,python,embed,android-ndk,sl4a","A_Id":15260692,"CreationDate":"2011-07-06T12:44:00.000","Title":"Want to use Python Libraries in Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In a pygame application window, the minimize, resize and close buttons are present. Is there a way to disable the close(X) button?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1851,"Q_Id":6619923,"Users Score":6,"Answer":"I don't think there is, because some window managers don't give you the ability to remove the close button. But you can write an event handler such that the close button does whatever you want, including nothing.\nWhy do you want to prevent the user from closing? If it's just a matter that you would rather provide an in-game \"quit\" button that confirms and\/or saves before quitting, you can perform the same task when the user hits the close button.","Q_Score":4,"Tags":"python,pygame","A_Id":6619966,"CreationDate":"2011-07-08T04:17:00.000","Title":"how to disable the window close button in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In a pygame application window, the minimize, resize and close buttons are present. Is there a way to disable the close(X) button?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1851,"Q_Id":6619923,"Users Score":0,"Answer":"Just for the record, another option would be to pass the following argument to the set_mode() method call:\npygame.display.set_mode(..., flags = pygame.NOFRAME)\nThis however makes the whole frame go away, including the top strip to move the window around and the other buttons, such as minimize, so it's rather overkill for just getting rid of the X button.","Q_Score":4,"Tags":"python,pygame","A_Id":49826543,"CreationDate":"2011-07-08T04:17:00.000","Title":"how to disable the window close button in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to use the beforeInsert() signal emitted by the QSqlRelationalTableModel in PyQt. However, even after I make edits to the model, the slot connected to the signal does't run. When exactly is the beforeInsert() signal emitted? Could someone show a working example of the use of beforeInsert(), or beforeUpdate() for that matter?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":99,"Q_Id":6634523,"Users Score":2,"Answer":"The documentation says \"This signal is emitted by insertRowIntoTable() before a new row is inserted into the currently active database table\". So it sounds like the signal is only emitted when insertRowIntoTable() is called, and not for any other type of model edit.","Q_Score":0,"Tags":"python,pyqt","A_Id":6644954,"CreationDate":"2011-07-09T11:46:00.000","Title":"PyQt beforeInsert() signal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to design a rounded corner TextCtrl widget? Actually I am new to wxPython and I am used to swing.\nLike in swing, is their any way in wxPython too to customize the border of the widgets?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":764,"Q_Id":6651098,"Users Score":0,"Answer":"wxPython uses native widgets for the most part. If they don't have a rounded version, then the answer is No. However, wxPython supports custom widgets, so you could create your own text control with whatever features you want.","Q_Score":0,"Tags":"python,swing,wxpython","A_Id":6652801,"CreationDate":"2011-07-11T13:50:00.000","Title":"Rounded corner border in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In wxPython, there is a ListCtrlAutoWidthMixin which makes sure that the last column in the list uses up all the space available to the list, even when it resizes.\nHowever, I have had problems with the native wxListCtrl on Windows that mean I want to use a different list, like the HyperTreeList that is new in 2.8.12.  This does not seem to have any easy way of doing what the ListCtrlAutoWidthMixin did.  Is there a way?  Is there an available mixin that I can use (I can presumably copy the existing mixin, but if someone has already done the work I would prefer to use that).","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":249,"Q_Id":6652365,"Users Score":0,"Answer":"Possibly the best answer would have been to use the UltimateListCtrl from the same library, which shares the same API.  However, this too seems to have problems.  Still investigating.","Q_Score":1,"Tags":"python,listview,wxpython","A_Id":6666289,"CreationDate":"2011-07-11T15:15:00.000","Title":"Automatically using maximum column width in wxPython's HyperTreeList","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So, Iv'e got a pygame application. Right now, it takes a command line argument to specify which display to show the main screen on. However, I'm running it on windows, where it's hard to specify command line input to a graphical application.\nSo, I'd like to have a very very very simple dialog box which pops up, prompts the user for an integer, then closes. My research has shown that pygame can't do a dialog box like this, and I can't get input in a pygame window, because the program doesn't know yet which monitor to draw the pygame window to.\nSo, my question is, what is the simplest way to create a dialog box for input? I've looked into wx and tkinter. I could use either of them, but what I'm wondering is, but I want to import the least number of extra toolkits. i.e. I don't want to have to start the wx main loop just so I can make 1 dialog, then close it, then start a whole new pygame window.\nI know how to do this in wx, so I'm mostly looking for advice\/ideas as to which toolkit would be simplest, as opposed to instruction on how to actually do it (though that's always nice too).","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":2527,"Q_Id":6656750,"Users Score":1,"Answer":"Since tkinter is built into Python, it might be better. I prefer wx, but if you just want a few dialogues, tkinter is fine.\nYou could also just try raw_input('type \"1\" for low res, \"2\" for high res'). I think it brings up a dialog window in Windows.","Q_Score":1,"Tags":"python,user-interface,tkinter,pygame","A_Id":6657099,"CreationDate":"2011-07-11T21:22:00.000","Title":"Simplest way to get initial text input in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to install pywin32 for Python 2.6.\nI have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it.\nI checked, thepython folder is the path. Is there a workaround this issue ?","AnswerCount":11,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":45238,"Q_Id":6662536,"Users Score":8,"Answer":"I had the same problem:\nOn 64 bit Windows, 32 bit apps are being registered under:\n[1] HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Python\nI reckon the installer is expecting to find Python in:\n[2] HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\nWith regedit and local admin rights, you can export a .reg file of [1], remove all the \"Wow6432Node\\\" you find, then import it as [2]","Q_Score":7,"Tags":"python,pywin32","A_Id":23008561,"CreationDate":"2011-07-12T10:10:00.000","Title":"Problem installing pywin32","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to install pywin32 for Python 2.6.\nI have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it.\nI checked, thepython folder is the path. Is there a workaround this issue ?","AnswerCount":11,"Available Count":4,"Score":0.0363476168,"is_accepted":false,"ViewCount":45238,"Q_Id":6662536,"Users Score":2,"Answer":"I had the same issue on Windows 10 64 bit with Python 3.6. It is installed for all users (I guess it uses a different registry hive in case it is installed for current user only).\nThe problem was that pywin32-220.win32-py3.6.exe searches in registry for HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Python\\PythonCore\\3.6 whilst python 3.6 setup created HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Python\\PythonCore\\3.6-32.\nNote the different endings! Exporting the 3.6-32 registry to .reg file, modifying the paths to 3.6 and reimporting the file registry again fixed the problem for me.","Q_Score":7,"Tags":"python,pywin32","A_Id":41378346,"CreationDate":"2011-07-12T10:10:00.000","Title":"Problem installing pywin32","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to install pywin32 for Python 2.6.\nI have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it.\nI checked, thepython folder is the path. Is there a workaround this issue ?","AnswerCount":11,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":45238,"Q_Id":6662536,"Users Score":15,"Answer":"From the pywin32 README\n\nIf the installation process informs you that Python is not found in the \n      registry, it almost certainly means you have downloaded the wrong version -\n      either for the wrong version of Python, or the wrong \"bittedness\".\n\nAre you sure you got the right version for your python and your cpu architecture? If you did and that did not work, you might try building from source, I think there might be a command line flag to allow you to specify the python installation location.","Q_Score":7,"Tags":"python,pywin32","A_Id":6662762,"CreationDate":"2011-07-12T10:10:00.000","Title":"Problem installing pywin32","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to install pywin32 for Python 2.6.\nI have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it.\nI checked, thepython folder is the path. Is there a workaround this issue ?","AnswerCount":11,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":45238,"Q_Id":6662536,"Users Score":0,"Answer":"I ran into this exact problem, but it seemed to me that my situation was a bit different and besides, I didn't want to have to use a registry hack.  So I started to post a new question.  Here's what I was going to write:\n\nI have both 64-bit and 32-bit versions of Python 3.7 installed on my Windows 7 machine.  The 64-bit version is installed in C:\\Python37 and the 32-bit version is installed in C:\\Python37-32.  I have the pywin32 package installed in the 64-bit version but not in the 32-bit version.  When I start a command window, switch to C:\\Python3y-32, and run \"pip install pywin32\", I am told that it is already installed in C:\\Python37.  Yes, I know that.  I want it installed somewhere else.  I tried downloading a wheel file and installing that, with the same result.  I tried renaming my C:\\Python37 folder to \"C:\\Python37 64 bits\" and renaming C:\\Python37-32 to C:\\Python37, but the pip gave me a fatal error:\nFatal error in launcher: Unable to create process using \n'\"c:\\python37-32\\python.exe\"\n\"C:\\Python37\\Scripts\\pip.exe\" install \"c:\\users\\\\downloads\\\npywin32-223-cp37-cp37m-win32.whl\"'\n(line breaks added for readability)\n\nBut then I looked again at that error message and realized that the quoted string is a command.  I copied that string, switched to the C:\\Python37-32 folder in my command window, pasted the string, removed the reference to C:\\Python37, and ran it.  No problem.","Q_Score":7,"Tags":"python,pywin32","A_Id":55397320,"CreationDate":"2011-07-12T10:10:00.000","Title":"Problem installing pywin32","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a self-taught programmer who jumped into Python as my first language about 7-8 months ago.  I'm fairly solid at making things work, though my foundational knowledge is limited thanks to my questionable choice in college to not study computer science. \nBeyond Python, I'm not really familiar with C or other lower level languages. \nI would like to teach myself Objective C as a foray into programming iPhone apps (as a hobby initially).  I initially want to create relatively simple utility apps (I think they are relatively simple, at least).  \nCould any one give me a guess as to how long it might take me to pick up Objective C and actually produce a semi-decent app? If time is of the essence, should I just scrap it and go with HTML5? \nI pick things up fairly fast but, again, my background in Comp Sci is really limited. \nSorry if this question is a bit too general and thanks for any insight!","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":5620,"Q_Id":6666499,"Users Score":1,"Answer":"You should learn both, Objective-C and HTML5. HTML5 isn't very difficult to grasp even if you don't have any experience.","Q_Score":8,"Tags":"iphone,python,objective-c,c","A_Id":6666567,"CreationDate":"2011-07-12T15:11:00.000","Title":"Python to Objective C (Expected Learning Curve)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a self-taught programmer who jumped into Python as my first language about 7-8 months ago.  I'm fairly solid at making things work, though my foundational knowledge is limited thanks to my questionable choice in college to not study computer science. \nBeyond Python, I'm not really familiar with C or other lower level languages. \nI would like to teach myself Objective C as a foray into programming iPhone apps (as a hobby initially).  I initially want to create relatively simple utility apps (I think they are relatively simple, at least).  \nCould any one give me a guess as to how long it might take me to pick up Objective C and actually produce a semi-decent app? If time is of the essence, should I just scrap it and go with HTML5? \nI pick things up fairly fast but, again, my background in Comp Sci is really limited. \nSorry if this question is a bit too general and thanks for any insight!","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":5620,"Q_Id":6666499,"Users Score":0,"Answer":"Well when i started progamming for Objective-c i was well known in Java, but nothing close to C\/Objective-c. It took me around 1 month to learn the basics (using tutorials etc).\nThere are some really good tutorials on iTunes (search for Objective-c seminar). I also used a couple of pdf's to use them as backup while making my first app. That helped alot!","Q_Score":8,"Tags":"iphone,python,objective-c,c","A_Id":6666588,"CreationDate":"2011-07-12T15:11:00.000","Title":"Python to Objective C (Expected Learning Curve)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to use Qt Designer and pyside-uic mydesign.ui > design.py\nhowever, this program doesn't exist. I looked in site packages under python 2.7, and I see:\npyside-lupdate.exe\npyside-rcc.exe\nand a bunch of other programs, but there is no such thing as pyside-uic.exe  ... why ?? Why is it missing from the installation package? Where do I get it?","AnswerCount":6,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":25947,"Q_Id":6684180,"Users Score":8,"Answer":"You should see a \/Python27\/Scripts\/pyside-uic.exe. But I'm wondering why it's not visible (not executable). Maybe it's a packaging problem (permissions, etc). You could try to call it using the complete path.","Q_Score":9,"Tags":"python,qt,pyside","A_Id":6685002,"CreationDate":"2011-07-13T19:03:00.000","Title":"Where is pyside-uic?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been searching for a way to set the tab order in a tkinter application, that I have been working on.  Currently the default order seems to be working from top-down, but it requires using CTRL + Tab to cycle through the controls.\nIs there any way to customize the order and, more so, change the CTRL + Tab to just Tab?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":12387,"Q_Id":6687108,"Users Score":0,"Answer":"I've been searching for ways to skip some widgets while tabbing and found in tkinter's tk_focusNext function description the following: \"A widget is omitted if it has the takefocus resource set to 0.\"\nyou can set takefocus on widget initialization as an argument.","Q_Score":11,"Tags":"python,python-3.x,tabs,tkinter","A_Id":69530509,"CreationDate":"2011-07-13T23:59:00.000","Title":"How to set the tab order in a tkinter application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have trouble using PySide in Eclipse.\nI installed py26-pyside using macports and added \/opt\/local\/var\/macports\/software\/py26-pyside\/1.0.4_0\/opt\/local\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/site-packages\/PySide to PYTHONPATH\nBut I got the above import error.\nWhat am I missing? Thanks","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":8855,"Q_Id":6721266,"Users Score":1,"Answer":"Add \/opt\/local\/var\/macports\/software\/py26-pyside\/1.0.4_0\/opt\/local\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/site-packages to PYTHONPATH instead of what you have added.","Q_Score":0,"Tags":"python,pyside","A_Id":6721303,"CreationDate":"2011-07-17T00:58:00.000","Title":"ImportError: No module named PySide.QtCore","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have trouble using PySide in Eclipse.\nI installed py26-pyside using macports and added \/opt\/local\/var\/macports\/software\/py26-pyside\/1.0.4_0\/opt\/local\/Library\/Frameworks\/Python.framework\/Versions\/2.6\/lib\/python2.6\/site-packages\/PySide to PYTHONPATH\nBut I got the above import error.\nWhat am I missing? Thanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":8855,"Q_Id":6721266,"Users Score":0,"Answer":"Running Linux, I had the same problem and I don't use PYTHONPATH. Simpler to put \/usr\/local\/lib\/python2.6\/site-packages in a file called \/usr\/lib\/python2.6\/site-packages\/local.pth. It's pure python so it should work on other systems. The instructions in site.py are misleading.","Q_Score":0,"Tags":"python,pyside","A_Id":6988124,"CreationDate":"2011-07-17T00:58:00.000","Title":"ImportError: No module named PySide.QtCore","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am just newbie to python and now, I am writing an interface in Nokia n79 phone. My question is that is it possible to install PyQt4 in nokia n79 or possible to run PyQt4 in Nokia n79. If yes, how? Is there anyway that I could take as a reference or take as an example.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":170,"Q_Id":6736179,"Users Score":0,"Answer":"There are python packages for symbian, look for python for S60. It's an open source project. Download the sis file to your phone and install it...  good luck.","Q_Score":0,"Tags":"python,user-interface,mobile,pyqt4","A_Id":6737107,"CreationDate":"2011-07-18T16:32:00.000","Title":"PyQT4 installation in nokia n79","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project in Python 2.7 and wxPython. I have both IDLE and Boa Constructor available as IDEs.\nI need to change one or more properties of a GUI object, such as a button, at run time - especially size, location, and text (the latter in buttons and labels).\nHow do I change these properties at run time? Mind you, I'll be using absolute position with most GUI objects.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":249,"Q_Id":6736195,"Users Score":1,"Answer":"Changing the widget's label or value are simple things. You can probably change a widgets location if you are using absolute positioning, but I think that would be counter-intuitive for the user. I know I wouldn't want my Close button to change locations all the time. I think you can set the size using its SetSize() method, but that might require a refresh. It would take you about 10-15 minutes to actually try this yourself.","Q_Score":0,"Tags":"python,properties,wxpython,runtime,wxwidgets","A_Id":6737329,"CreationDate":"2011-07-18T16:34:00.000","Title":"Change an object's properties at run time?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to programming and thought Python would be a good language to learn. Most of the tutorials I found were 2.7 based so I started to learn using that version. I've recently found a tkinter tutorial that I'd like to try out but I'm having a problem. If I run a script it will use Python 2.7 which contains Tkinter and not tkinter.\nThis problem made me think, how can I get my two versions to co-exist so I can program in both 2.x and 3.x?","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":15701,"Q_Id":6737694,"Users Score":0,"Answer":"It depends on what you are trying to do. You can have them coexist because 3.2 is backwards-compatible. Now you can install both versions on your computer 3.2 and 2.7, but 3.2 unfortunately will have to be used in IDLE....ugh.... Just install both and then depending on which one you want to use. Run that IDLE for either one or the other.\nNow if you are meaning that you want more stable version that can be professionally done, go with 2.7 ( I have done otherwise, but if you run into problems 2.7 is more supported.\nIf you want the more cutting edge stuff, go with 3.2. Either one you go with works with about eveyrthing. If it doesn't, give it a month or two and the rest of the world will catch up.","Q_Score":10,"Tags":"python","A_Id":6738871,"CreationDate":"2011-07-18T18:40:00.000","Title":"How to I get Python 2.x and 3.x to co-exist?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I use MonkeyRunner to switch the screen mode(Portrait mode and Landscape mode)?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1576,"Q_Id":6741863,"Users Score":1,"Answer":"There is a indirect way,you can toggle between portrain & landscape, but only the setting page.Steps:-\n\n1.Disable auto-rotate screen option in settings page,keep the same page open.\n  2.Keep device in horizontally(It wont go to landscape mode as auto rotate is disabled\n  3.Get coordinates of disable\/enable by enabling 'show pointer location'\n  4.touch the cordinates using monkeyrunner-it will goto landscape,touch again it will goback to portrait.","Q_Score":3,"Tags":"android,python,monkeyrunner,monkey","A_Id":11164138,"CreationDate":"2011-07-19T03:01:00.000","Title":"Switch the screen mode with MonkeyRunner?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I use MonkeyRunner to switch the screen mode(Portrait mode and Landscape mode)?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1576,"Q_Id":6741863,"Users Score":0,"Answer":"If its a physical device then I do not know of a way to change the screen mode without actually physically putting the device on its side.","Q_Score":3,"Tags":"android,python,monkeyrunner,monkey","A_Id":6820953,"CreationDate":"2011-07-19T03:01:00.000","Title":"Switch the screen mode with MonkeyRunner?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I use MonkeyRunner to switch the screen mode(Portrait mode and Landscape mode)?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1576,"Q_Id":6741863,"Users Score":1,"Answer":"There is no such way.","Q_Score":3,"Tags":"android,python,monkeyrunner,monkey","A_Id":8223351,"CreationDate":"2011-07-19T03:01:00.000","Title":"Switch the screen mode with MonkeyRunner?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't find anything in the docs. All the code I find is messy and all over the place;\nall I want to do, is have a table take up the whole frame, and have 6 columns;\n\nID\nName\nAuthor\nType\nTags\nMore Info\n\nThe \"More Info\" column should have a button, which will call a function with the ID column as param. How would I do this? I want to be able to \"fill\" this table using an array, with each row","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1980,"Q_Id":6749250,"Users Score":0,"Answer":"Have you thought about using a ListCtrl instead? I think that might work better. I especially like the ObjectListView widget, which is a nice object oriented wrapper of the ListCtrl.\nNote that neither the grid nor the ListCtrl really support buttons in their cells, although the grid might work better by using a custom renderer. On the other hand, there's a new widget called the UltimateListCtrl that supports putting ANY widget anywhere in it, so that's an option.","Q_Score":0,"Tags":"grid,wxpython","A_Id":6750499,"CreationDate":"2011-07-19T14:55:00.000","Title":"wxPython Tables to display data on full frame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Title says it all.I can't find a way to do it... .Refresh() doens't do anything, other than crash the program.\nThe situation I'm in, is that I have a frame which is launched from the \"main\" frame. This frame makes changes to the \"main\" frame's menu bar and panel. What can I call to refresh the main frame, from the second frame?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1371,"Q_Id":6750717,"Users Score":0,"Answer":"This one could be done with pubsub. Have the second frame publish a message to the first frame telling it to refresh. I actually think you'll want to use Layout() though. That's what I usually use when I remove or add visible elements. You shouldn't need to Refresh() a menu when removing items from it. At least, the example in the wxPython demo doesn't do that.","Q_Score":0,"Tags":"wxpython,refresh,frames","A_Id":6751443,"CreationDate":"2011-07-19T16:37:00.000","Title":"wxPython refresh frame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a list L of objects of my class A. This class implements __str__\/__repr__, so each object has it's own string representation (not necessary unique). I have a GUI in pygtk, where I have a TreeView widget with only one column. I want to populate it with string representations of the objects in L, but then I want to get selected items as objects, not as string. Is there a way to make TreeView to store list of objects, but display them as stings? If not, then what is the best way to know what objects are selected in the TreeView?\nThe problem also is that depending on some conditions I can populate TreeView not with the whole L, but with some sublist of it, and so indexes of items in TreeView won't correspond to ones in L.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2143,"Q_Id":6752146,"Users Score":0,"Answer":"If the strings are unique you can use a dictionary to link the strings with the objects by using the strings as keys. In this case you can find the objects by its string.","Q_Score":6,"Tags":"python,pygtk,gtktreeview","A_Id":6755133,"CreationDate":"2011-07-19T18:24:00.000","Title":"Custom objects in ListStore\/TreeStore","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a button on a new form. When this button clicked I need a show some information on new form using label \/or other component\/. How to do it in OpenERP 6? I don't have any idea. Please give me a hand. thanks.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":103,"Q_Id":6755995,"Users Score":0,"Answer":"are you trying to raise any kind of error message or you want to have confirmation ?\nif you want to raise exception, then it's possible , check in the addons\/account.py \nyou'll find something that you are looking for.","Q_Score":0,"Tags":"python,openerp","A_Id":6854128,"CreationDate":"2011-07-20T01:24:00.000","Title":"Dynamically create a message","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a Python GUI that uses Tkinter. I have to SSH into another place to get data. I start a new thread to do this so that the GUI doesn't hang. During this time, I want to pop up a screen that lets the user know it is loading. Once the program is finished getting the data, I want to close the loading screen. What must I do to have my main loop recognize that the thread is done? I've tried to use that thread to close the loading screen that exists in the main loop, but then I discovered that doesn't work.\nI have seen some producer consumer models that don't use GUIs, and they have while loops. This doesn't help me though. I also don't want to download and install other packages, but imports are ok. Thank you for your help!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":163,"Q_Id":6764217,"Users Score":0,"Answer":"Have your thread set a flag when it is done. Have the GUI periodically check for that flag and dismiss the window when it is set.\nYou can check for the flag by creating a function that checks for the flag, and if it's not set it uses after to have itself run again a few hundred ms later. The window won't go away immediately after the thread exits, but as long as the lag isn't more than a couple hundred ms the user will never notice.","Q_Score":0,"Tags":"python,multithreading,user-interface,consumer,producer","A_Id":6766383,"CreationDate":"2011-07-20T15:13:00.000","Title":"How do I close a loading screen right when the other thread is finished in Python using Tk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For those of you who have written fairly complex PyQt applications, what tips and tricks would you offer for speeding up your applications? I have a few examples of where my program begins to slow down as it grows larger:\n\nI have a 'dashboard' written that is destroyed and re-created when a user clicks on an item in a TreeWidget. What would be a better way to have a modular interface where clicking an item in the TreeWidget changes the dashboard, but doesn't require destroying a widget and recreating it.\nEach dashboard also loads an image from a network location. This creates some slowdown as one navigates around the application, but after it's loaded into memory, 'going back to that same dash' is faster. Is there a good method or way to run a thread on program load that maybe pre-loads the images into memory? If so, how do you implement that?\nWhen you have a large variety of dashboard items and data that gets loaded into them, do you guys normally thread the data load and load it back in which each thread completes? Is this viable when somebody is browsing around quickly? Would implementing a kill-switch for the threads such that when a user changes dashboards, the threads die work? Or would the constant creation and killing of threads cause some sort of, well, meltdown.\n\nSorry for the huge barrage of questions, but they seemed similar enough to warrant bundling them together.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3849,"Q_Id":6764329,"Users Score":8,"Answer":"I'm not sure if this is exactly the same thing you are doing, but it sounds similar to something I have in some apps, where there is some list of custom widget. And it does significantly slow down when you are creating and destroying tons of widgets.\nIf its an issue of lesser amounts of total widgets, but just being created and deleted a lot, you can just create the widgets once, and only change the data of those widgets as information needs to be updated... as opposed to creating new widgets each time the information changes. That way you can even change the data from threads without having to worry about creating widgets.\nAnother situation is where you are displaying a list with custom widgets and there are a TON of results. I notice it always slows down when you have 1000's of custom widgets in a list. A trick my co-worker came up with was to have a fake kind of list where it is using a static number of slots in the display. Say, it shows 10 slots in the view. The scrollbar doesn't really scroll down across MORE widget...what it does is scrolls the DATA through the 10 visible widgets. You can a crazy performance increase doing that. But only if it is an acceptable display style for your application.","Q_Score":6,"Tags":"python,optimization,pyqt","A_Id":6821582,"CreationDate":"2011-07-20T15:21:00.000","Title":"Optimizing your PyQt applications","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For those of you who have written fairly complex PyQt applications, what tips and tricks would you offer for speeding up your applications? I have a few examples of where my program begins to slow down as it grows larger:\n\nI have a 'dashboard' written that is destroyed and re-created when a user clicks on an item in a TreeWidget. What would be a better way to have a modular interface where clicking an item in the TreeWidget changes the dashboard, but doesn't require destroying a widget and recreating it.\nEach dashboard also loads an image from a network location. This creates some slowdown as one navigates around the application, but after it's loaded into memory, 'going back to that same dash' is faster. Is there a good method or way to run a thread on program load that maybe pre-loads the images into memory? If so, how do you implement that?\nWhen you have a large variety of dashboard items and data that gets loaded into them, do you guys normally thread the data load and load it back in which each thread completes? Is this viable when somebody is browsing around quickly? Would implementing a kill-switch for the threads such that when a user changes dashboards, the threads die work? Or would the constant creation and killing of threads cause some sort of, well, meltdown.\n\nSorry for the huge barrage of questions, but they seemed similar enough to warrant bundling them together.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":3849,"Q_Id":6764329,"Users Score":1,"Answer":"Are you using QNetworkAccessManager to load you images? It has cache support. Also it loads everything in background with finishing callbacks.\nI don't really understand what your dashboard is doing. Have you think about using QWebkit? Maybe your dashboard content is easy to be implemented in HTML?\nPS. I don't like threads in Python and don't think they are good idea. Deferred jobs delegated to Qt core is better.","Q_Score":6,"Tags":"python,optimization,pyqt","A_Id":6774281,"CreationDate":"2011-07-20T15:21:00.000","Title":"Optimizing your PyQt applications","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Python 2.7, PyGTK 2.24, and Glade 2.8.0. I'm trying to set an image to (stretch to) fill all of the given space, but I cannot find the properties to do that. Furthermore, I may need to shrink images to fit sometimes as well. \nHow do I do those two things in Glade?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":238,"Q_Id":6795169,"Users Score":0,"Answer":"Glade does not allow for stretching images. This must be done in code, by scaling the pixbuf, creating a pixmap and mask from it, and then creating the image from the pixmap.","Q_Score":1,"Tags":"python,image,pygtk,glade","A_Id":7046931,"CreationDate":"2011-07-22T19:37:00.000","Title":"Set Image to Fill PyGTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is my first post to stack overflow. I've been lurking this site for information for years, and it's always helpful, so I thought that I would post my first question. \nI've been searching for some similar examples, but can't seem to find anything. \nUltimately, I'm trying to write a simple text ui for finding false positives and false negatives in a text extraction program.  The false positive module is a simple yes\/no selection, and displaying colored text and using getch() is easy enough.  The False negative portion however, is a becoming difficult. \nSo this is what I want to do:\n\nDisplay a string onto the screen (forget scrolling for now.... ugh) It will only be a string with no newlines. \nThe user sees the text, and pushes 'h' to enter highlight mode.  \nThe user can then control the cursor to move it over a portion of the text (still displayed), and select 'v' to begin highlighting (I trying to make this as close to vi as I can)\nThe user then uses control keys (arrows, hjkl) to move the cursor from a starting point to and end point, highlighting the text on the way.  This highlighted portion should be a word which is a false negative\nThe user presses some key ('y' probably), and the selected text is colored, or stays highlighted, and the highlighted text is save to some variable that I'll handle later. \nThe user exits highlight mode and proceeds. \n\nAny ideas to even START?  I'm trying simple things like keeping text on the screen and moving the cursor around, but to no avail. \nI'm aware of the curses.textpad.TextBox() module, but it performs editing like insertion and deletion, which I don't want to do.  Perhaps there is a way to disable it.  \nI have other questions, but I'll keep this specific for now.\nThanks!! \nNeal \nEdit:  To be more specific, I'm not looking for help writing the whole program, just help moving the cursor over displayed text, highlighting it, and selecting it and saVing it in a variable.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":9844,"Q_Id":6807808,"Users Score":0,"Answer":"I don't know anything about ncurses, but using Tkinter or one of the other GUI toolkits, it could be done with a canvas.  You would first set the scroll region, then\nbind the \"h\" key so it sets a highlight variable to True, \nbind a mouse click to a function that retrieves the location to start, \nbind the left and right arrows to move left or right one letter, and move the cursor and reverse the colors of the next letter as well as keep track of how many letters you are from the starting point, which also tells you the end location, and\nbind \"y\" to copy the text.\nIt is not as complicated as it might seem as each part is a fairly simple function.  All of this would of course depend on the font size, and I would suggest displaying the text with a fixed font so each letter occupies the same width.  Once again, I do not know ncurses, but it would be similiar with any toolkit.  If you can work it around so that the user can select one entire line with a mouse click, it makes the coding much easier.  Post back with some code if you do indeed decide to go with Tkinter or wxPython and want some additional help.","Q_Score":8,"Tags":"python,ncurses,tui","A_Id":6808886,"CreationDate":"2011-07-24T15:44:00.000","Title":"Highlighting and Selecting text with Python curses","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"the subject says it all: is it possible to take an image present in the clipboard and save it to file under Tkinter?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":951,"Q_Id":6817600,"Users Score":0,"Answer":"Well tkinter uses the PIL for most of its advanced image stuff, in which case this problem is quite simple: Just use Image.frombuffer(mode, size, data) with the bytebuffer representing the image and then save it ala im.save(filename)- if you want a special format you can also specify it.\nIf you want to do it without the PIL, I don't think tkinter offers that kind of functionality out of the box, its image support is extremely limited in itself.","Q_Score":0,"Tags":"python,tkinter","A_Id":6818171,"CreationDate":"2011-07-25T14:23:00.000","Title":"save the image in the clipboatd - in Python\/Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I disable a wxFrame from being resized by the user? If there's a flag to put in when creating the frame, what is it?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":16096,"Q_Id":6829853,"Users Score":1,"Answer":"You can use SetSizeHints (or SetMaxSize and SetMinSize) to restrict the maximum and minimum sizes or th","Q_Score":11,"Tags":"resize,wxpython,frame","A_Id":6829965,"CreationDate":"2011-07-26T12:16:00.000","Title":"wxPython Disable Frame Resizing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i am trying to install pygtk on my mac which then asked me to install pygobject which then asked me to get gobject-introspection . the problem i have in this installation is while configuring it shows this error :\n\nchecking for FFI... no\n  checking for ffi.h... configure: error: ffi.h not found\n\nplease do help me with this as i need to get gtk . \n\/usr\/include\/ffi->location of ffi.h\nthanks in advance","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2065,"Q_Id":6864484,"Users Score":0,"Answer":"ffi.h is provided by the package libffi-dev, which is actually from the gcc source package. and most probably it's available for linux.","Q_Score":0,"Tags":"python,pygtk,gobject,pygobject","A_Id":6864549,"CreationDate":"2011-07-28T19:22:00.000","Title":"problem with configuring gobject-introspection for pygobject and pygtk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm not sure on how to articulate this...  \nI have a Tkinter window, and I need to hide half of this window when a button is pressed. \nHowever, I need the left-most side to be hidden, so that the window is now half the size it originally was,\nand shows the right half of the original window.  \nAll of Tkinter's resize functions span from the left side of the window. \nChanging the geometry values can only show the left side whilst hiding the right; \nI need the inverse.\nDoes anybody know how to go about doing this?  \n(I don't want the user to have to drag the window border, \nI need the button to automate it).\n\nSpecs:\n\nPython 2.7.1\nTkinter\nWindows 7","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":1136,"Q_Id":6870118,"Users Score":2,"Answer":"You can use right-anchored geometry specifications by using a minus sign in the right place:\n123x467-78+9\nHowever, I don't know if this will work on Windows (the above is an X11 trick, and I don't know if it is implemented in the platform-compatibility layer or not); you might have to just calculate the new position given the projected size of the left side and use that.","Q_Score":0,"Tags":"python,resize,tkinter,tk","A_Id":6870304,"CreationDate":"2011-07-29T07:51:00.000","Title":"Resize Tkinter Window FROM THE RIGHT (python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm not sure on how to articulate this...  \nI have a Tkinter window, and I need to hide half of this window when a button is pressed. \nHowever, I need the left-most side to be hidden, so that the window is now half the size it originally was,\nand shows the right half of the original window.  \nAll of Tkinter's resize functions span from the left side of the window. \nChanging the geometry values can only show the left side whilst hiding the right; \nI need the inverse.\nDoes anybody know how to go about doing this?  \n(I don't want the user to have to drag the window border, \nI need the button to automate it).\n\nSpecs:\n\nPython 2.7.1\nTkinter\nWindows 7","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1136,"Q_Id":6870118,"Users Score":0,"Answer":"My IT teacher had a suggestion:\nAdd a Scrollbar out of sight,\nand after resizing the root window,\nforce the scrollbar to scroll all the way to the right.  \n(So I guess I'd have to create a canvas,\npack all my widgets to the frame,\npack the frame to the canvas,\nconfigure the canvas with the scrollbar?)  \nI'm not sure if there's a function to set the current position of the scrollbar (thus xview of the window),\nbut I'd imagine there is.\nHave yet to implement this, but it looks promising.  \nThanks for the suggestions!","Q_Score":0,"Tags":"python,resize,tkinter,tk","A_Id":6954676,"CreationDate":"2011-07-29T07:51:00.000","Title":"Resize Tkinter Window FROM THE RIGHT (python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a USB camera (uEye) which has a C++ interface allowing you to configure some features of the camera. The C++ program can read the image data from the camera and store it somewhere in pre-allocated memory. All of this runs under Windows.\nPython with numpy gives me a simple environment to manipulate images and spend some quality time working on my processing algorithms.\nWhat I would like to do is:\n\nUse the c++ program to configure the camera and obtain images (at video rate),\nPass the data to Python\nProcess the data in Python\n\nI am under the impression that I do not want to embed C++ in Python or Python in C++, as I prefer to have two stand-alone systems (so I can use the camera without the Python stuff, or use the Python stuff without the camera).\nWhat I can find so far are methods to share some data using pipes, sockets, or mapped memory, though it appears to be restricted to small amounts of data or strings. What I can not find, however, is an indication if this is fast enough and something that I should attempt to implement. Should I want to do this?\nIf this is a bad idea, what would be a better alternative? Embed the Python code in C++ or vice versa? Or ditch Python all together because the savings in development time there do not offset the additional effort in getting the interprocess communication to work?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1214,"Q_Id":6871537,"Users Score":2,"Answer":"Since you say the device has a \"C++ interface\", I assume it provides a header file + DLL which you can link to and control the device via an API. In such a case, the fastest approach would be to wrap this API in Python (using Swig or other C++-to-Python API tools). This will provide a very low overhead of just a couple of procedure calls, passing the data directly as pointers to memory.\nIf you don't want to \"marry\" Python, write yourself a controlling app in C++ too, but I think the fastest and most convenient way of connecting the API to Python is the above.","Q_Score":1,"Tags":"c++,python,windows,ipc","A_Id":6872320,"CreationDate":"2011-07-29T10:08:00.000","Title":"Share video data between C++ and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like my wxPython application to support cut\/copy\/paste operations between different running instances of the application. Is it OK to simply pickle a data structure, copy it to clipboard as text, and then unpickle it for paste operations?\nI know I'd have to check the data for some sign that it's from my app. Or could I just TRY to unpickle whatever is there? How robust is pickle at nicely failing if it tries to unpickle arbitrary text left on the clipboard?\nAlso, is there a practical limit to how much data could be copied this way?\nI'm running on Windows and Linux today - have not tried Mac.\nEDIT\nI'm aware of that comment in the documentation. I don't really care about a malicious user trying to compromise his own instance of the software, if that's what people are worried about they should deprecate pickle. My questions are of practicality, not security.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":261,"Q_Id":6877326,"Users Score":1,"Answer":"You should not trust data from the clipboard for unpickling, unless you have a sure way to make sure it was wrtten by your app, and has not been altered.\nFrom the python documentation: \n\nWarning The pickle module is not intended to be secure against\n  erroneous or maliciously constructed data. Never unpickle data\n  received from an untrusted or unauthenticated source.","Q_Score":2,"Tags":"python,wxpython,clipboard,pickle","A_Id":6878114,"CreationDate":"2011-07-29T18:18:00.000","Title":"Is it OK to pass complex data structures through the clipboard with wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like my wxPython application to support cut\/copy\/paste operations between different running instances of the application. Is it OK to simply pickle a data structure, copy it to clipboard as text, and then unpickle it for paste operations?\nI know I'd have to check the data for some sign that it's from my app. Or could I just TRY to unpickle whatever is there? How robust is pickle at nicely failing if it tries to unpickle arbitrary text left on the clipboard?\nAlso, is there a practical limit to how much data could be copied this way?\nI'm running on Windows and Linux today - have not tried Mac.\nEDIT\nI'm aware of that comment in the documentation. I don't really care about a malicious user trying to compromise his own instance of the software, if that's what people are worried about they should deprecate pickle. My questions are of practicality, not security.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":261,"Q_Id":6877326,"Users Score":1,"Answer":"If applicable I suggest you to convert your data to and from json using one of the many python implementations.\nBeing plain text is easy to transfer using clipboard moreover there are no risks converting back a json object back to python.\nOne last thing: no risks of deprecation.","Q_Score":2,"Tags":"python,wxpython,clipboard,pickle","A_Id":6878268,"CreationDate":"2011-07-29T18:18:00.000","Title":"Is it OK to pass complex data structures through the clipboard with wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I noticed that the width argument for the Tkinter entry widget is in characters, not pixels. \nIs it possible to adjust the width in pixels?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":25061,"Q_Id":6881010,"Users Score":6,"Answer":"You cannot specify the width in pixels using the '-width' option, but there are ways to accomplish the same thing. For example, you could pack an entry in a frame that has no border, turn off geometry propagation on the frame, then set the width of the frame in pixels.","Q_Score":11,"Tags":"python,tkinter,widget,width,tkinter-entry","A_Id":6883301,"CreationDate":"2011-07-30T04:04:00.000","Title":"How do I set the width of an Tkinter Entry widget in pixels?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to get a Python script which I normally run on my PC to run on my Android phone (HTC Hero). I have SL4A running on my phone and have made a few tweaks to the Python script so that this does now run. The problem that I am having is how to pass parameters to the script. I have tried creating a sh script in SL4A which called the python file with the parameters, but this didn't work. I have also tried using the app TaskBomb to call through to the python file, but again this doesn't work when parameters are supplied. When no params are supplied the file loads correctly, but when I add -h to the filename it says it can no longer find the python file I am calling.\nIs anybody able to provide assistance with how to this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2086,"Q_Id":6882218,"Users Score":1,"Answer":"I used a round about method to circumvent the problem. First the python script needs to be modified to look for a text file containing the attributes. Now whenever I need to start the script, i have to push the txt file containing the attributes and then start the script.","Q_Score":2,"Tags":"android,python,sl4a","A_Id":10452996,"CreationDate":"2011-07-30T09:17:00.000","Title":"Passing parameters to a python script using SL4A on Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"A friend of mine is making the jump from graphic designer to game developer, and I have decided to work with him in my free time. Neither of us have much development experience, but I am very interested in learning Python, and my friend wants to learn C++.\nI have read that C++ is the common denominator in game programming, but related questions here on SO recommend that new users avoid more difficult languages like C++. My #1 concern is creating games that are portable between operating systems. I will be using Linux to develop and play-test the game, but we would like it to run on OSX and Windows as well. We have no interest in 3D game development since we don't have any experience with 3D graphics. I would be perfectly happy with graphics equivalent to a game like VVVVVV - very simple 2D with minimal (or zero) texturing.\nAlso, is it necessary to use OpenGL for 2D graphics, or do C++\/Python have some graphics libraries capable of producing game-worthy graphics? Remember, by game-worthy I mean simple, pixelated graphics like Minecraft or VVVVVV.\nWe have some books on Python, C++, and OpenGL, and can dive into those if that's the right way to get started. What does everyone recommend?","AnswerCount":6,"Available Count":3,"Score":0.0333209931,"is_accepted":false,"ViewCount":6008,"Q_Id":6886553,"Users Score":1,"Answer":"I agree with newlymintedcocoaguy something such as Pygame is the way to go in your situation.  But to awnser your second question, you can make 2D games in C++ without the use of OpenGL\/DirectX.  I have done this in the past using the Windows libraries for bitmaps, RECTS etc.  I assume Linux will have similiar functionality.  Though if you want your game to be cross platform then OpenGL is probably the way to go.","Q_Score":3,"Tags":"c++,python,opengl","A_Id":6886657,"CreationDate":"2011-07-30T23:22:00.000","Title":"2D Game Programming for Linux, OSX, and Windows - C++\/Python\/OpenGL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A friend of mine is making the jump from graphic designer to game developer, and I have decided to work with him in my free time. Neither of us have much development experience, but I am very interested in learning Python, and my friend wants to learn C++.\nI have read that C++ is the common denominator in game programming, but related questions here on SO recommend that new users avoid more difficult languages like C++. My #1 concern is creating games that are portable between operating systems. I will be using Linux to develop and play-test the game, but we would like it to run on OSX and Windows as well. We have no interest in 3D game development since we don't have any experience with 3D graphics. I would be perfectly happy with graphics equivalent to a game like VVVVVV - very simple 2D with minimal (or zero) texturing.\nAlso, is it necessary to use OpenGL for 2D graphics, or do C++\/Python have some graphics libraries capable of producing game-worthy graphics? Remember, by game-worthy I mean simple, pixelated graphics like Minecraft or VVVVVV.\nWe have some books on Python, C++, and OpenGL, and can dive into those if that's the right way to get started. What does everyone recommend?","AnswerCount":6,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":6008,"Q_Id":6886553,"Users Score":0,"Answer":"As someone whose familiar with the \"I'm new, I want to do X, what should I learn?\" thing, having done it quite recently, I'd say stick with Python for now. As others have mentioned, there are some decent libraries like PyGame out there, and C++ is well, a little complex.\nIf you're learning both how to put the parts together to make a game and tangling with the language, it starts getting difficult to untangle which one is actually causing your particular problem. And its always possible, once you have a good feel for what you are doing to learn a new way to do it by picking up C++.","Q_Score":3,"Tags":"c++,python,opengl","A_Id":6887227,"CreationDate":"2011-07-30T23:22:00.000","Title":"2D Game Programming for Linux, OSX, and Windows - C++\/Python\/OpenGL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A friend of mine is making the jump from graphic designer to game developer, and I have decided to work with him in my free time. Neither of us have much development experience, but I am very interested in learning Python, and my friend wants to learn C++.\nI have read that C++ is the common denominator in game programming, but related questions here on SO recommend that new users avoid more difficult languages like C++. My #1 concern is creating games that are portable between operating systems. I will be using Linux to develop and play-test the game, but we would like it to run on OSX and Windows as well. We have no interest in 3D game development since we don't have any experience with 3D graphics. I would be perfectly happy with graphics equivalent to a game like VVVVVV - very simple 2D with minimal (or zero) texturing.\nAlso, is it necessary to use OpenGL for 2D graphics, or do C++\/Python have some graphics libraries capable of producing game-worthy graphics? Remember, by game-worthy I mean simple, pixelated graphics like Minecraft or VVVVVV.\nWe have some books on Python, C++, and OpenGL, and can dive into those if that's the right way to get started. What does everyone recommend?","AnswerCount":6,"Available Count":3,"Score":0.0333209931,"is_accepted":false,"ViewCount":6008,"Q_Id":6886553,"Users Score":1,"Answer":"i will recommend c++. Many people say that its difficult, true to some extent, but you can make a good 2d game in c++, without getting into the 'difficult' part. And for this you will need a library like SDL , SFML etc.\nIts worth your time, if you learn C++, at least you will never run in performance problem.","Q_Score":3,"Tags":"c++,python,opengl","A_Id":6888494,"CreationDate":"2011-07-30T23:22:00.000","Title":"2D Game Programming for Linux, OSX, and Windows - C++\/Python\/OpenGL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started learning a bit of python and would now like to toy around a bit with gui-building. Qt seems to be a good choice because of its cross-platformishness.\nNow there seem to be two bindings available: PyQt by Riverbank Computing and PySide, originally developed by Nokia.\nSo which one should I choose? All I can find are two year old feature comparisons, but what differences are there nowadays?\nWhich one is easier to use, has more\/better documentation? Are both still in active development?\nLicensing isn't of much concern to me since I don't intend to write commercial applications.","AnswerCount":6,"Available Count":5,"Score":1.2,"is_accepted":true,"ViewCount":57758,"Q_Id":6888750,"Users Score":34,"Answer":"Both toolkits are actively maintained, and by now more or less equal in features and quality.  There are only few, rather unimportant differences.\nStill, I'd recommend PySide for Python 2.  It has a more reasonable API, mainly it doesn't expose Qt types, which have a direct equivalent in Python (e.g. QString, QList, etc.) or which are completely superfluous due to Python's dynamic nature, like QVariant.  This avoids many tedious conversions to and from Qt types, and thus eases programming and avoids many errors.  \nPyQt also supports this modern API, and uses it by default for Python 3, but not for Python 2 to maintain backwards compatibility.","Q_Score":72,"Tags":"python,pyqt,pyside","A_Id":6889577,"CreationDate":"2011-07-31T09:58:00.000","Title":"PyQt or PySide - which one to use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started learning a bit of python and would now like to toy around a bit with gui-building. Qt seems to be a good choice because of its cross-platformishness.\nNow there seem to be two bindings available: PyQt by Riverbank Computing and PySide, originally developed by Nokia.\nSo which one should I choose? All I can find are two year old feature comparisons, but what differences are there nowadays?\nWhich one is easier to use, has more\/better documentation? Are both still in active development?\nLicensing isn't of much concern to me since I don't intend to write commercial applications.","AnswerCount":6,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":57758,"Q_Id":6888750,"Users Score":18,"Answer":"I recently ported a significant code base (over 8,000 lines of code) from PyQt to PySide.\nRight now I'd say PyQt is a much more mature, performant and stable project. I hit a number of bugs in PySide, and suspect that any big project will hit issues. Having said that, I reported a bug to the project and it was fixed and in a new release within a few weeks. I'm also having a problem where the app takes about 15 seconds to quit. I've not yet spent the time to find out why. However it's only a matter of time before there will be no reasons for choosing PyQt over PySide.\nIf you do decide to go with PyQt for now, make sure you use API v2 throughout. It is a better API, and will ease any future transition to PySide. Also if you do port, just follow the guidelines on the PySide wiki. Even for an 8+ kloc app consisting of about 20 source files it just took an afternoon.","Q_Score":72,"Tags":"python,pyqt,pyside","A_Id":7159812,"CreationDate":"2011-07-31T09:58:00.000","Title":"PyQt or PySide - which one to use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started learning a bit of python and would now like to toy around a bit with gui-building. Qt seems to be a good choice because of its cross-platformishness.\nNow there seem to be two bindings available: PyQt by Riverbank Computing and PySide, originally developed by Nokia.\nSo which one should I choose? All I can find are two year old feature comparisons, but what differences are there nowadays?\nWhich one is easier to use, has more\/better documentation? Are both still in active development?\nLicensing isn't of much concern to me since I don't intend to write commercial applications.","AnswerCount":6,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":57758,"Q_Id":6888750,"Users Score":25,"Answer":"There is also the licensing difference.  PySide is LGPL while PyQt is GPL.  This could make a difference if you don't wish to make your project opensource. Although PyQt always has the propriety version available for a fairly reasonable price.\nI tend to find the PySide documentation more intuitive.  The API, in my opinion is slightly more Pythonic and the rate of bug fixes is quite impressive at the moment.\nPyQt has the advantage of Python 3 support and incumbency.  There is a lot more 3rd party documentation\/tutorials for it.","Q_Score":72,"Tags":"python,pyqt,pyside","A_Id":6906509,"CreationDate":"2011-07-31T09:58:00.000","Title":"PyQt or PySide - which one to use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started learning a bit of python and would now like to toy around a bit with gui-building. Qt seems to be a good choice because of its cross-platformishness.\nNow there seem to be two bindings available: PyQt by Riverbank Computing and PySide, originally developed by Nokia.\nSo which one should I choose? All I can find are two year old feature comparisons, but what differences are there nowadays?\nWhich one is easier to use, has more\/better documentation? Are both still in active development?\nLicensing isn't of much concern to me since I don't intend to write commercial applications.","AnswerCount":6,"Available Count":5,"Score":0.1651404129,"is_accepted":false,"ViewCount":57758,"Q_Id":6888750,"Users Score":5,"Answer":"I have a 20k line Python app that I unsuccessfully tried to convert to PySide.\nConversion is easy and most of the functionality works.\nThere are several methods that are not implemented because they are 'deprecated', so I had to fix those.  That was OK.\nOn Windows, using PySide-1.1.2, the '==' operator is not implemented for many Qt objects.  One workaround is to say: \"if id(item1) == id(item2):\".\nThe other observation is that PySide seemed noticeably slower.  I did not isolate PySide as the cause of the slowness, but the problem went away when I reverted back to PyQt.\nLastly, as of now, the Android kit with PySide does not seem ready for prime time.","Q_Score":72,"Tags":"python,pyqt,pyside","A_Id":17322123,"CreationDate":"2011-07-31T09:58:00.000","Title":"PyQt or PySide - which one to use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started learning a bit of python and would now like to toy around a bit with gui-building. Qt seems to be a good choice because of its cross-platformishness.\nNow there seem to be two bindings available: PyQt by Riverbank Computing and PySide, originally developed by Nokia.\nSo which one should I choose? All I can find are two year old feature comparisons, but what differences are there nowadays?\nWhich one is easier to use, has more\/better documentation? Are both still in active development?\nLicensing isn't of much concern to me since I don't intend to write commercial applications.","AnswerCount":6,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":57758,"Q_Id":6888750,"Users Score":10,"Answer":"Although they might have similar interface for Qt\/C++ classes, their interface for Qt\/C++ macros such as signal\/slot\/property are very different.\nPorting one to another is not an easy job. It would be better to make the right decision at the very beginning.\nBeyond the grammar\/license differences, I just want to point out some deficiency of PyQt in language binding, which might be essential to write QML project in Python.\nThese differences finfally push me to PySide from PyQt.\n\nqmlRegisterType\nqmlRegisterType is essential to create runtime C++ binding with QML.\nIn PySide, it is part of PySide.QtDeclarative. And this works pretty well with Python.\nIn PyQt, qmlRegisterType does not exist. And I could not find an alternative approach.\nI know some simple task could be done by setting QML context. \nBut if you really need runtime binding with qmlRegister and Q_INVOKABLE, I think PySide is the only choice at the moment.\nShiboken VS SIP\nBoth can wrap Qt\/C++ into python plugin. \nFor Shiboken, I feel it is simpler and requires less coding.\nJust create a typesystem xml including the NAME of classes you want to export, and that's all.\nShiboken does not require extra manual descriptions for the structure of the target classes.\nFor SIP, it would require more extra coding. We will have to create a SIP file that almost reimplements everything the C++ header.\nIt requires not only the NAME of the class, but also the DETAILS of what methods the target classes have.\nIf the C++ class is in good design using Pimp and we want to export all methods within it, SIP should provide a way of automatically export all class methods, which it cannot at the moment.\nThis would also add the burden for maintaining the consistency between the SIP and the C++ headers.\nBut I have to say that the documentation for Shiboken on Qt wiki is very bad and misleading.\nCreating Python plugin with Shiboken on Windows do not necessarily require CMake at all.\ngeneratorrunner is also not required.\nI only use a windows cmd script to invoke shiboken, and a qmake pro for compiling the target plugin.","Q_Score":72,"Tags":"python,pyqt,pyside","A_Id":12804098,"CreationDate":"2011-07-31T09:58:00.000","Title":"PyQt or PySide - which one to use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for solutions that make it possible to create AJAX-enabled web applications without need to write JavaScript code manually. The requirements are:\n\nPerformance doesn't matter. It can be slow, JavaScript may be unoptimized, amount of code it generates may be large.\nPlatform doesn't matter as long as I can work with it on either Linux or Windows.\nLanguage doesn't matter as long as it's Python, Java or C#.\nI want to be able to create composite 'widgets' that can be updated dynamically using AJAX. For instance, I want to be able to load data dynamically and replace existing controls with the other ones when user clicks the button on that page.\nAs long as this solution provides concepts like 'Panel' (composite widget), 'EditBox' and 'Label', I don't care if it's hard to create my own controls.\n\nWhat do you think?","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":217,"Q_Id":6888856,"Users Score":2,"Answer":"I'd recommend you GWT from Google. It is great, well done framework that allows creating Web 2.0 applications without dealing with HTML\/JavaScript at all.","Q_Score":0,"Tags":"c#,java,javascript,python","A_Id":6888882,"CreationDate":"2011-07-31T10:20:00.000","Title":"AJAX web applications with no hand-written JavaScript","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"in my Text widget I have here and there many tags, taking care of the text appearance (bold, italic etc).\nTkinter takes care by default of cut\/copy\/paste in the text widget, but only of the text content, not of the associated tags. Do you know if it is possible to implement it?\nI anticipate some problems if I would cut in the middle a region where e.g. bold text appears: I would have to leave behind a tag marker for 'bold begin' so that the remaining text is still bold...","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":598,"Q_Id":6895545,"Users Score":2,"Answer":"Yes, it's possible to implement it. You can use the dump method of the text widget to get all the text and tags in a given range. To paste, you just have to use that information when inserting the text.\nIt gets somewhat complicated when you try to paste, say, italic text inside a range of already bolded text since you may have to retag the inserted text to have both bold and italic attributes. However, I know it can be done because I've done it with tcl\/tk in the past.","Q_Score":0,"Tags":"python,tkinter","A_Id":6897584,"CreationDate":"2011-08-01T07:49:00.000","Title":"python\/tkinter: is it possible to copy paste text AND tags?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C++ process running in the background that will be generating 'events' infrequently that a Python process running on the same box will need to pick up.\n\nThe code on the C side needs to be as lightweight as possible.  \nThe Python side is read-only.\nThe implementation must be cross-platform.\nThe data being sent is very simple.\n\nWhat are my options?\nThanks","AnswerCount":7,"Available Count":2,"Score":0.0285636566,"is_accepted":false,"ViewCount":40430,"Q_Id":6915191,"Users Score":1,"Answer":"How complex is your data? If it is simple I would serialize it as a string. If it was moderately complex I would use JSON. TCP is a good cross-platform IPC transport. Since you say that this IPC is rare the performance isn't very important, and TCP+JSON will be fine.","Q_Score":43,"Tags":"c++,python,cross-platform,ipc","A_Id":6915320,"CreationDate":"2011-08-02T16:17:00.000","Title":"Simple IPC between C++ and Python (cross platform)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C++ process running in the background that will be generating 'events' infrequently that a Python process running on the same box will need to pick up.\n\nThe code on the C side needs to be as lightweight as possible.  \nThe Python side is read-only.\nThe implementation must be cross-platform.\nThe data being sent is very simple.\n\nWhat are my options?\nThanks","AnswerCount":7,"Available Count":2,"Score":-0.0855049882,"is_accepted":false,"ViewCount":40430,"Q_Id":6915191,"Users Score":-3,"Answer":"I will say you create a DLL that will manage the communication between the two. The python will load DLL and call method like getData() and the DLL will in turn communicate with process and get the data.\nThat should not be hard.\nAlso you can use XML file or SQLite database or any database to query data. The daemon will update DB and Python will keep querying. There might be a filed for indicating if the data in DB is already updated by daemon and then Python will query.\nOf course it depends on performance and accuracy factors!","Q_Score":43,"Tags":"c++,python,cross-platform,ipc","A_Id":6915884,"CreationDate":"2011-08-02T16:17:00.000","Title":"Simple IPC between C++ and Python (cross platform)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I hope my title was clear. I'm using wxpython for making a GUI and I want it to be able to be opened, extracted, and have it work on all operating systems. I was able to include twill by finding a folder called twill inside the twill archive, which worked fine. However, I'm unable to figure out how to correctly package wxpython.\nEDIT: I'm not using either. py2exe is only for windows, and bbfreeze doesn't seem to work on mac (so it's not cross platform)","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":697,"Q_Id":6917456,"Users Score":2,"Answer":"Unfortunately, there's just no one stop solution so that a single installable executable will work across all operating systems.  The right solution is really to provide a different installer or executable for each OS;  For windows, use py2exe, for mac, py2app is a good choice, and for linux you should just provide a tarball with a reasonable setup.py (that you will need for the first two, anyway).","Q_Score":2,"Tags":"python,wxpython,packaging","A_Id":6921159,"CreationDate":"2011-08-02T19:25:00.000","Title":"How can I package my python application with external python libraries?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've just bought a new computer with Lion on it. I've downloaded and installed both Python 2.7 and wxPython 2.8 (for 2.7). I know Python comes with the system, but I rather go with the official one.\nAnyway, upon typing \"import wx\" on the IDLE, I get the following message:\n\nTraceback (most recent call last):\n    File \"\", line 1, in \n      import wx\n    File \"\/usr\/local\/lib\/wxPython-unicode-2.8.12.1\/lib\/python2.7\/site-packages\/wx-2.8-mac-unicode\/wx\/init.py\", line 45, in \n      from wx._core import *\n    File \"\/usr\/local\/lib\/wxPython-unicode-2.8.12.1\/lib\/python2.7\/site-packages\/wx-2.8-mac-unicode\/wx\/_core.py\", line 4, in \n      import core\n  ImportError: dlopen(\/usr\/local\/lib\/wxPython-unicode-2.8.12.1\/lib\/python2.7\/site-packages\/wx-2.8-mac-unicode\/wx\/core.so, 2): no suitable image found.  Did find:\n      \/usr\/local\/lib\/wxPython-unicode-2.8.12.1\/lib\/python2.7\/site-packages\/wx-2.8-mac-unicode\/wx\/core.so: no matching architecture in universal wrapper\n\nI believe it happens because wxPython only supports 32-bit, but I can't figure out how to force python to run on 32-bit.\nAnyone could help?\nThank you in advance.","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":5631,"Q_Id":6946503,"Users Score":1,"Answer":"This may not work for python versions below 2.9. Running 'python' did not work for me...I am using 2.7 for compatibility. But figured out that 'python' may be an alias for a 64 bit mode and for some reason the arch command does not work. \nSo, here is what I have to use under Lion to get wx to work (this works for 2.6 or 2.7):\n$ arch -i386 python2.7\nThen when python loads:\n\n\n\nimport wx\n\n\n\nworks fine. You may have to call the specific python with the arch command, such as python2.7, or whatever version you are using.","Q_Score":8,"Tags":"python,wxpython,osx-lion","A_Id":8763927,"CreationDate":"2011-08-04T18:16:00.000","Title":"Run wxPython on Lion","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have written a GTK app in Python (using PyGObject). I'm confused about how to handle deployment, specifically icons.\nI understand that in most cases, I would be able to load my images from a specific path; however, the recommended way seems to be to register icons as named icons with the system, so they can be themed. In some cases, like Ubuntu's app indicators, it seems like using named icons is the only thing that is supported.\nI have all this working; expect I'd like my app to work when just run from the source directory, without installing it system-wide. Surely this is possible somehow?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":254,"Q_Id":6973774,"Users Score":0,"Answer":"I know this isn't 100% what you're looking for but Gnome will also recognize icons installed at ~\/.local\/share\/icons\/. When the program is run from the source directory, the icons could be copied there.","Q_Score":2,"Tags":"python,gtk,icons","A_Id":6974550,"CreationDate":"2011-08-07T15:42:00.000","Title":"GTK Named Icons: Load while running from source, during development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In my Group class, there must be an attribute particles which should be an array-like but resizable type that can only hold Particle-instances.\nBoth classes, Group and Particle are declared using cdef.\nAs Python-lists can carry any Python-object, I thought there might be a more performant way of declaring some kind of C-list that does only accept Particle-instances.\nIn C it would be something like List<Particle> particle = new List<Particle>(); i think.\nIs there any equivalent for Cython or should I just stay with the Python-list ?","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4416,"Q_Id":6997102,"Users Score":1,"Answer":"The question begs to be asked : why do you want this ? \n\nis it for efficiency (looping over the array) or to lower memory footprint ? \ndo you need an array or a linked list would be enough ? \nis your particle class a simple struct or something with behavior\/method ?\n\nDepending on these, the best solution goes from using a python array to numpy or a stl container.\n( Note, for example, that looping over python list in cython could be quite efficient. )","Q_Score":3,"Tags":"python,list,cython","A_Id":7010304,"CreationDate":"2011-08-09T13:43:00.000","Title":"Cython, is there a way to create lists of only one type ? (Unlike Python-lists)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using a module named spynner with python. spynner runs on a QApplication instance. I need to run functions using spynner asynchronously. \nI have tried calling these functions in different threads, using something like:\nthread.start_new_thread(function_using_spynner)\nThis works if I run just one function, but if I try to run 2 of them I get an error saying that QApplication can not be created outside of main thread. Is there a way to run functions  asynchronously in the same thread? The functions return nothing, so just running them will be enough. \nIf not, is there a workaround for creating QApplication instances outside of main thread? I don't need a display.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1045,"Q_Id":7004709,"Users Score":0,"Answer":"You could run function_using_spynner in the main thread and do whatever else you need to do in the other thread. Alternatively, you could start the QApplication in spynner in the main thread before branching into multiple threads.","Q_Score":0,"Tags":"python,qt,asynchronous,spynner","A_Id":7005338,"CreationDate":"2011-08-10T00:42:00.000","Title":"QApplication in threads","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm unit-testing a python c module in Eclipse using PyDev unit-testing.\nThe development steps are: \nI first write the python tests in Eclipse and then the c code that passes\nthe tests for the module in Codeblocks. Here is where a script is called\nto create a dll and ctypes bindings for it. After that the  \u201cdll\u201d and the\n\u201cpy\u201d code is copied to a directory where the module can be easily imported.\nBut sometimes I get the error:\nIOError: [Errno 13] Permission denied: 'C:\\...\\pyCModule.dll'\nI\u2019ve haven\u2019t found the reason for that (deactivating code analysis and code\ncompletion haven\u2019t helped). I\u2019ve checked with the Process Explorer (from\nsysinternals) and it shows that the eclipse process has python.exe as child\n(I suppose that\u2019s from PyDev) and that one is using my pyCModule.dll (and\nnot always releasing it). \nDoes someone have and idea of want could be done here? or what is wrong?\nThanks in advance !\nFrancis","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":260,"Q_Id":7007635,"Users Score":2,"Answer":"This happens because PyDev launches a shell that imports that dll (to do code-completion). You can do Ctrl+2 kill (with focus in a PyDev editor), to kill all the shells that PyDev may have spawned (that way you can update it).\nCheers,\nFabio","Q_Score":1,"Tags":"python,unit-testing,dll,pydev","A_Id":7011545,"CreationDate":"2011-08-10T08:05:00.000","Title":"Dll from python module is not released in Eclipse \/ PyDev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In wxPython I'm trying to update an existing UI to use wxPropertyGrid instead of an array of individual UI elements.  Currently the underlying object model is updated and validation is applied after each key press and I want to do the same with the PropertyGrid.\nThe problem I'm having is that there doesn't seem to exist a wxPropertyGridEvent which triggers on every key stroke like wx.EVT_TEXT, the closest is EVT_PG_CHANGED but that only triggers when you change between rows in the grid.  I can get round this to an extent by binding wx.EVT_TEXT to the PropertyGrid but then I'm unable to use event.GetProperty() in order to access the property data as the event is not a PropertyGridEvent.\nSo the question is have I missed something and is there an existing event which I can use? Failing that any ideas on how I get around this problem?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":377,"Q_Id":7011416,"Users Score":0,"Answer":"Turns out you can capture EVT_CHAR events by binding directly to the text ctrl.  As the text ctrl is only created when the property is selected however you can't do this when setting up the grid, rather you have to bind it following a EVT_PG_SELECTED event.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":7038368,"CreationDate":"2011-08-10T13:19:00.000","Title":"How to capture events for each key press in wxPropertyGrid","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm implementing a profiler in an application and I'm a little flummoxed about how to implement Python profiling such that the results can be displayed in my existing tool. The application allows for Python scripting via communication with the python interpreter.\nI was wondering if anyone has ideas on how to profile Python functions from C++\nThank you for your suggestions :)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":447,"Q_Id":7033612,"Users Score":0,"Answer":"The usual technique for profiling already-existing functions that we use in Lua a lot is to overwrite the function with your own version that will start timing, call the original function, and stop timing, returning the value that the original function returned.","Q_Score":2,"Tags":"c++,python,profiling","A_Id":7033696,"CreationDate":"2011-08-11T22:19:00.000","Title":"How can I \"hook into\" Python from C++ when it executes a function? My goal is to profile","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need an event for detecting if an user has moved the scrollbar position to another one.\nIn other words, if the user does scroll up\/down, would it be possible to catch a signal so I can know the scroll has been changed its position?\nI think it's not important, but the scrollbar I refer to is inside a QGraphicsView.\nRegards.\nEdit:\nQGraphicsView is for displaying items in the screen, and if those items are too big it shows the scrollbars I refer to. What I need is to know when the user changes the position of those scrollbars.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4663,"Q_Id":7060534,"Users Score":7,"Answer":"Sliders have a sliderMoved(int value) signal, where value is the new position of slider.","Q_Score":10,"Tags":"c++,python,qt,events,pyqt","A_Id":7060600,"CreationDate":"2011-08-14T23:47:00.000","Title":"A scrollbar event when scrolling?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to write a python program with wxPython GUI. Program must to collect some information in background (infinite loop), but GUI should be active at this time. Like, if I click on the some button, some variable or another information must change, and at the new cycle this variable should be used instead of the old.\nBut I don't know, how to make it. I think that I must use threading, but I don't understand how to use it.\nAnyone can suggest how to solve this problem?\nThanks in advance!","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4727,"Q_Id":7082529,"Users Score":0,"Answer":"Have you considered having wxPython invoke an event handler of yours periodically, and perform the background processing in this? This depends on you being able to divide your work into discrete pieces, of course. Be aware that your background processing would have to be non-blocking so control would return to wxPython in a timely manner, to allow responsive GUI processing. Not sure what's the idiomatic way to implement such background processing in wxPython, but if I recall correctly the technique in (Py)Qt was to use a timer.","Q_Score":3,"Tags":"python,loops,wxpython,infinite","A_Id":7083015,"CreationDate":"2011-08-16T17:42:00.000","Title":"Python: Infinite loop and GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Okay, I'm completely new to this. \nI created a python script that imports tkinter. On my Ubuntu, I can execute the program from the terminal program. Till now there is no problem. However, my friends asked if I could deliver the program to them so that they could use it on their PC. They have 0 knowledge of programming and they use Windows -.-. So my question is, how I can create an executable file from Ubuntu so that it can run under Windows? I've already read something about py2exe, but I could not manage installing it. If","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":245,"Q_Id":7087529,"Users Score":3,"Answer":"You can't use py2exe on plain Ubuntu. It needs to run from Windows. Right now, py2exe doesn't work well with Wine. Do you not have access to any Windows computers (maybe one of your friends')?\nYou can also get your friends to install Python on their Windows machines and teach them how to run your programs, if you're willing to put in the extra effort.","Q_Score":0,"Tags":"python,executable","A_Id":7087550,"CreationDate":"2011-08-17T03:06:00.000","Title":"python executable file in windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I want to use VTK together with Python on a Windows system.\nIt seems that I cannot use the windows installer but \"have to compile VTK from source code using CMake and a native build system\". So far I have installed CMake.\nBut now I wonder how to proceed? It seems that I need MS Visual Studio to create the project files?!\nBut I don't have Visual Studio. So what can I do?","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":1416,"Q_Id":7089620,"Users Score":1,"Answer":"You can use VTK with python just installing pythonxy framework, it is just a python with many many libraries included VTK, ITK, Qt and many other, also it is very well documented, and also have many examples, all in python. I recommend it to you, I have worked a lot with it, and is very amazing.\nJust make a try. All you have to do is in the installer wizard select among the tools, VTK, and it will be installed with vtk.","Q_Score":6,"Tags":"python,compilation,cmake,vtk","A_Id":28362827,"CreationDate":"2011-08-17T08:09:00.000","Title":"VTK \/ Python \/ compile","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working with a pressure-sensing mattress having a USB interface. The maker provides USB device drivers for Windows, and an API written in C++ which has functions to request data and set some parameters.\nCurrently, I cannot use this sensor for testing some Python data-visualization scripts directly, having had to ask my coworkers to write a text-logger for me, and then I read this information offline with Python.\nAlso, I cannot use Linux at all with the sensor, because there are not drivers for Linux, and I do not know where to start to \"hack\" the sensor, and that is why I am asking:\n\"If I were to try to read data from this sensor directly with Python and perhaps in Linux, what should I do first, or read first?\"\nEDIT: the device has an FTDI driver (FTD2XX.dll) if it helps.\nAny help would be very welcome","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1493,"Q_Id":7112063,"Users Score":1,"Answer":"The FTDI chips have a linux driver.  Just go to the FTDI website and download it. The driver creates a virtual serial port. You can use PySerial to interface with it.\nToo bad I didn't see the post sooner!","Q_Score":2,"Tags":"c++,python,usb,sensors,hardware-interface","A_Id":16451772,"CreationDate":"2011-08-18T18:12:00.000","Title":"Access USB hardware (pressure sensor matrix with native C++ API) using Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is about wxPython.\nI would like to have 2 Panels laying one over the other:\nPanelBG should be some sort of a \"background\", with its own GridBagSizer with subPanels, StaticTexts and so on;\nPanelFG should be the \"foreground\" panel, also with its own GridBagSizer with some StaticTexts, Buttons... but a transparent background, in such a way that PanelBG is visible wherever PanelFG doesn't lay widgets.\nI need both Panels to stretch to all the sides of the frame, even when resizing the window, though never changing the reciprocal proportions, that's why I'm not sure if there's a way to use absolute positioning.\nIn case you are wondering, the reason why I don't want to use a single Panel is that merging the 2 GridBoxSizers would require me to place many many more cells in the sizer, because rows and columns of foreground and background don't always coincide, and I should split them in many cells, with grid dimensions growing up to hundreds**2.\nSince the content I want to put in the foreground needs to be updated and refreshed quite often, this would require redrawing all the cells every time, which would take 10 - 20 seconds to complete the operation (tested). Updating only the foreground would require just some hundredths of a second instead.\nThank you!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1387,"Q_Id":7113605,"Users Score":0,"Answer":"As I understand it, this is a calendar with rectangles for the days containing the events for the days.\nThe simple thing would be to use a wxGrid, with seven columns and four or five rows, to represent the months.  You would then place the events into the grid cell for the correct date.  The wxGrid widget would look after the details of refreshing everything properly.\nUsing wxGrid you might lose a little control over the exact appearance, though wxGrid is very flexible and feature rich once you learn its many methods, but you would save yourself having to write large amounts of code that would require significant effort to debug.","Q_Score":2,"Tags":"python,wxpython,wxwidgets,panel,sizer","A_Id":7122837,"CreationDate":"2011-08-18T20:17:00.000","Title":"wxPython: how to lay one panel over another","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is about wxPython.\nI would like to have 2 Panels laying one over the other:\nPanelBG should be some sort of a \"background\", with its own GridBagSizer with subPanels, StaticTexts and so on;\nPanelFG should be the \"foreground\" panel, also with its own GridBagSizer with some StaticTexts, Buttons... but a transparent background, in such a way that PanelBG is visible wherever PanelFG doesn't lay widgets.\nI need both Panels to stretch to all the sides of the frame, even when resizing the window, though never changing the reciprocal proportions, that's why I'm not sure if there's a way to use absolute positioning.\nIn case you are wondering, the reason why I don't want to use a single Panel is that merging the 2 GridBoxSizers would require me to place many many more cells in the sizer, because rows and columns of foreground and background don't always coincide, and I should split them in many cells, with grid dimensions growing up to hundreds**2.\nSince the content I want to put in the foreground needs to be updated and refreshed quite often, this would require redrawing all the cells every time, which would take 10 - 20 seconds to complete the operation (tested). Updating only the foreground would require just some hundredths of a second instead.\nThank you!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1387,"Q_Id":7113605,"Users Score":1,"Answer":"This would be at least partially a change of direction, but it might be worth examining what other rendering options you have. \nIn particular, I'm thinking of wxWebKit (http:\/\/wxwebkit.kosoftworks.com\/), which would let you do layering, etc. using the WebKit browser rendering engine. I'm not sure whether it's at a stage that would provide everything you need since I haven't actually used it, but even if it doesn't work then it may be an approach worth trying - using HTML\/CSS for part of your display, while wrapping the whole in a wxPython app.","Q_Score":2,"Tags":"python,wxpython,wxwidgets,panel,sizer","A_Id":7123083,"CreationDate":"2011-08-18T20:17:00.000","Title":"wxPython: how to lay one panel over another","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There is no tray in Unity under Ubuntu 11.04.\nHow can I make icon appear somewhere in Unity? wx.TaskBarIcon is not appear anywhere.\nThanks","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":1293,"Q_Id":7144756,"Users Score":6,"Answer":"With Ubuntu Unity desktop environment (i.e. Ubuntu 11.04 or 11.10), you need to \"whitelist\" your application.\nThere are different ways to do this using the 'gsettings' application from the command line.\nI had to do this to get programs like Skype showing in the system tray again, not just for my own custom apps that use wxPython.","Q_Score":3,"Tags":"python,ubuntu,wxpython,wxwidgets,ubuntu-unity","A_Id":8073276,"CreationDate":"2011-08-22T08:24:00.000","Title":"wx.TaskBarIcon on Ubuntu 11.04","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am developing a python program (my native platform is Ubuntu) for which I would like to build a simple gui. I would like the GUI to be cross platform.I came across python-gtk\/wxpython\/qt.  What is the best tool to use? \nThanks\nsuresh","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":549,"Q_Id":7167985,"Users Score":1,"Answer":"I'm going to suggest tkinter. It's part of python, ridiculously easy to use, and of course is very cross platform.\nMany people dismiss tkinter based on years-old knowledge, but tkinter has evolved a lot. Some say it looks ugly, but more often than not functionality and ease of use is more important. Tkinter is definitely the best pragmatic choice in my opinion.\nThat being said, however, there is no \"best\". Qt, Wx and Tk are all fine, all do pretty much the same, and are all more-or-less equally cross-platform. Pick any one of them and don't look back. Once you get experience with one of tnem you'll be in a position to decide for yourself which one is \"best\"","Q_Score":1,"Tags":"python,user-interface,cross-platform","A_Id":7168535,"CreationDate":"2011-08-23T21:47:00.000","Title":"cross platform gui..which tool to use?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a python program (my native platform is Ubuntu) for which I would like to build a simple gui. I would like the GUI to be cross platform.I came across python-gtk\/wxpython\/qt.  What is the best tool to use? \nThanks\nsuresh","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":549,"Q_Id":7167985,"Users Score":0,"Answer":"As Matt already suggested, wxPython should be the most portable choice. On Windows it uses the native GUI toolkit, on Linux it will use Qt as backend (I dunno what it does on OSX though, but you can probably find out all of that on their website).","Q_Score":1,"Tags":"python,user-interface,cross-platform","A_Id":7168033,"CreationDate":"2011-08-23T21:47:00.000","Title":"cross platform gui..which tool to use?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a python program (my native platform is Ubuntu) for which I would like to build a simple gui. I would like the GUI to be cross platform.I came across python-gtk\/wxpython\/qt.  What is the best tool to use? \nThanks\nsuresh","AnswerCount":3,"Available Count":3,"Score":0.2605204458,"is_accepted":false,"ViewCount":549,"Q_Id":7167985,"Users Score":4,"Answer":"Your best bet would be either wxPython or Qt, although I'd lean strongly towards wxPython based on my previous use. Both of these have fairly good fidelity on both Windows and OSX and feel and look like native applications.\nGTK has marginal Windows support and pretty bad support on OSX. I would recommend against it.","Q_Score":1,"Tags":"python,user-interface,cross-platform","A_Id":7168005,"CreationDate":"2011-08-23T21:47:00.000","Title":"cross platform gui..which tool to use?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to display real-time text in Tkinter after a Button command calls a function.  The function should display a \"timestamp\" when PycURL receives \"HTTP\/1.1 200 OK\".  The function POSTs energy data to a server every 2 minutes.\nPseudocode, a basic example, and\/or general discussion should get me headed in the right direction.  I have got the energy data POSTing OK.  Now I need to get the GUI working.\nThanks - Brad","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2891,"Q_Id":7182084,"Users Score":0,"Answer":"How are you trying to display real-time text in Tkinter after a button calls a function? What I get so far is, user presses button, function starts and every two minutes posts some data  to a server, and tries to display some text somewhere after each post, but has a problem?\nHow does it try to display the text, and what's the problem?\n(I dont know PycURL, so apologies if that would make everything clear)","Q_Score":0,"Tags":"python,text,tkinter,real-time","A_Id":7182219,"CreationDate":"2011-08-24T20:49:00.000","Title":"Displaying real-time text in Tkinter after Button command calls function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can do the measure of text with tkFont, but I don't want a root window --> tk.Tk()","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1989,"Q_Id":7193798,"Users Score":3,"Answer":"You did mean to ask: \u201cHow can I measure the width of a string rendering via tkFont without creating a window first?\u201d\nAn the answer is: you can\u2019t. Tk needs it\u2019s root instance to do drawing and such.\nyou can however create it, measure your text, and immediately dispose it via .delete(). This is so fast that the window doesn\u2019t appear for me.","Q_Score":4,"Tags":"python,fonts,tkinter","A_Id":7195241,"CreationDate":"2011-08-25T16:17:00.000","Title":"How can I measure the width of a string rendering via tkFont without creating a window first?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want a Excel like table widget in tkinter for a gui I am writing. Do you have any suggestions?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36436,"Q_Id":7208961,"Users Score":0,"Answer":"I had a similar problem trying to show a complete panda's DataFrame using tkinter.\nMy first option was to create a grid like suggested someone in the first answer, but it bacame too heavy for so many info.\nI guess is beter to create a finite numbers of cells and show only a part of the DF, changing that part with the movement of the user","Q_Score":11,"Tags":"python,tkinter,widget,tktable","A_Id":69322875,"CreationDate":"2011-08-26T18:19:00.000","Title":"Which widget do you use for a Excel like table in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running Python 2.7 on OS X Snow Leopard. I installed Python using Macports. Then, I installed py27-pyqt4 and py27-pyside, and I can't get them to work.\nPython doesn't give errors when I import, but I get the following errors in the terminal when I test either:\n\npyside-uic : command not found\npyuic4 : command not found","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2652,"Q_Id":7211672,"Users Score":1,"Answer":"You are still using the default Mac OS Python and not using the new installed one.\n\nCheck the python version: python must be 2.7. \nfind the new\nversion (should be inside \/usr\/local\/bin ) \nupdate your\n.bash_profile PATH=\/usr\/local\/bin\/:$PATH \nTry again and try to\nimport PyQt4","Q_Score":1,"Tags":"python,macos,pyqt4,pyside","A_Id":7352201,"CreationDate":"2011-08-27T00:09:00.000","Title":"pyside-uic\/pyuic4: command not found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing some 3D math classes for Python. I'd like to make a Point3 class that is separate from Vec3 in the following respects:\n\nPoint3 - Point3 = Vec3\n  Point3 + Vec3 = Point3\n\nOtherwise, all operations on Vec3 you can perform on Point3. The motivation for this is to separate the mathematical concept of a point from a vector, hopefully leading to clearer type separation and an easier to understand API.\nHowever, with Python's duck typing and the common practice of expecting a certain interface regardless of type, is it better just to use a Vec3? Is it more efficient?","AnswerCount":4,"Available Count":4,"Score":0.1488850336,"is_accepted":false,"ViewCount":751,"Q_Id":7247648,"Users Score":3,"Answer":"I don't think this is particularly unpythonic.  It's not too unusual to distinguish types when they have the same domain, but when one has a particular frame of reference, such as a time zone,  Since a point is the sum of a vector and the origin, it's reasonable to encode that in some way.","Q_Score":0,"Tags":"python,math","A_Id":7247764,"CreationDate":"2011-08-30T17:58:00.000","Title":"Is the concept of a Point3 class, separate from a Vec3 class, unpythonic?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing some 3D math classes for Python. I'd like to make a Point3 class that is separate from Vec3 in the following respects:\n\nPoint3 - Point3 = Vec3\n  Point3 + Vec3 = Point3\n\nOtherwise, all operations on Vec3 you can perform on Point3. The motivation for this is to separate the mathematical concept of a point from a vector, hopefully leading to clearer type separation and an easier to understand API.\nHowever, with Python's duck typing and the common practice of expecting a certain interface regardless of type, is it better just to use a Vec3? Is it more efficient?","AnswerCount":4,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":751,"Q_Id":7247648,"Users Score":3,"Answer":"It seems superfluous.  If you think about it, a point in cartesian space is entirely equivalent to a bound vector which begins at the origin.  Sounds like you could be making a lot of work for yourself for nothing.","Q_Score":0,"Tags":"python,math","A_Id":7247805,"CreationDate":"2011-08-30T17:58:00.000","Title":"Is the concept of a Point3 class, separate from a Vec3 class, unpythonic?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing some 3D math classes for Python. I'd like to make a Point3 class that is separate from Vec3 in the following respects:\n\nPoint3 - Point3 = Vec3\n  Point3 + Vec3 = Point3\n\nOtherwise, all operations on Vec3 you can perform on Point3. The motivation for this is to separate the mathematical concept of a point from a vector, hopefully leading to clearer type separation and an easier to understand API.\nHowever, with Python's duck typing and the common practice of expecting a certain interface regardless of type, is it better just to use a Vec3? Is it more efficient?","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":751,"Q_Id":7247648,"Users Score":1,"Answer":"I understand your argument.  I, too, have always struggled with classes for points.  In my experience it's better (although I guess perhaps not \"more pythonic\") to take a more functional approach and write your API in terms of functions that takes lists\/tuples.\nThe main objection to this, I think, is that you probably want a compact way of writing simple algebraic operations (sums etc.),  but for that I would suggest using numpy.  Not only does numpy support element-wise addition, but it gives you efficiency where you are likely to need it in the future, with matrix operations and the like.\nAt the same time, while you say that you want a clean API, the differences you are adding to the API will be invisible, except in the documentation.  And really, an invisible API is not that useful.\nI know this is nothing like what you were originally asking, but I suspect it is the best design in the long term (i.e. as your library grows and you want to support more ambitious transformations of points, batch processing, etc., etc.).","Q_Score":0,"Tags":"python,math","A_Id":7248651,"CreationDate":"2011-08-30T17:58:00.000","Title":"Is the concept of a Point3 class, separate from a Vec3 class, unpythonic?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing some 3D math classes for Python. I'd like to make a Point3 class that is separate from Vec3 in the following respects:\n\nPoint3 - Point3 = Vec3\n  Point3 + Vec3 = Point3\n\nOtherwise, all operations on Vec3 you can perform on Point3. The motivation for this is to separate the mathematical concept of a point from a vector, hopefully leading to clearer type separation and an easier to understand API.\nHowever, with Python's duck typing and the common practice of expecting a certain interface regardless of type, is it better just to use a Vec3? Is it more efficient?","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":751,"Q_Id":7247648,"Users Score":1,"Answer":"Yes, this is poor design, as adding or subtracting two points has no conceptual meaning.\nYou can, however, add a vector to a point (obtaining a point) or add two vectors (obtaining a vector), so it sounds like you are just confusing points with vectors.\nA point is not a vector, but it can be implemented in terms of one.  In programming, we model \"implemented-in-terms-of\" relationships using composition - the Point class will contain a single private Vector instance, and use it to handle the logic of whatever methods it exposes.\nIn fact, because a Vector can already do all the same things a Point can (plus more), you may want to consider not even bothering to make the distinction, and using only the Vector class, with no Point class at all.  Whether or not this is a good idea depends on what your API will be used for.","Q_Score":0,"Tags":"python,math","A_Id":7249813,"CreationDate":"2011-08-30T17:58:00.000","Title":"Is the concept of a Point3 class, separate from a Vec3 class, unpythonic?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created some Python code which is really complicated but it basically asks for an input and then outputs a huge DNA sequence depending on the input given, along with some graphs and many equations. I would like to embed this code into the user interface that I will most likely make with wxPython or Tkinter. I don't understand how to plug my code into the user interface. Please Help! Thanks!","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":2928,"Q_Id":7259001,"Users Score":1,"Answer":"The best advice for you is not to start trying to build the actual GUI. Learning GUI programming is not trivial and you should start slowly and work up to the real thing.\nPick a framework (Tkinter, wxPython, Qt) and start with the simplest tutorial you can find. Then try progressively harder tasks until you have enough experience to do a good job with your real task.","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":7262848,"CreationDate":"2011-08-31T15:01:00.000","Title":"Embedding a python code to a GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a python application that uses a C-extension module I also developed myself. The extension module does some heavy number crunching and makes use of OpenMP.\nI was recently adding some GUI components to my Python application using PyQt4. However, when I show a window, the application crashes before the window is fully drawn (The window shows up very shortly). I was able to track the problem down: When I compile my number-crunching C-extension without OpenMP support the Window shows up fine and everything works. I guess it has something to do with the threading stuff between OpenMP and Qt. Has anyone ever made a similar observation?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":246,"Q_Id":7273779,"Users Score":1,"Answer":"As a workaround, you can create a stand alone program using openmp, and a Qt frontend program. and make them communicate by using tcp socket or something you familiar (dll is another option?).\nthe point is, isolate different modules, if one module fails, you know which part fails.\nas one whole big program, it is hard to find one wild pointer...","Q_Score":1,"Tags":"python,qt,pyqt,openmp,python-c-extension","A_Id":7441730,"CreationDate":"2011-09-01T17:01:00.000","Title":"Crash when showing a PyQt4 Window after importing a python extension that uses OpenMP","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a python application that uses a C-extension module I also developed myself. The extension module does some heavy number crunching and makes use of OpenMP.\nI was recently adding some GUI components to my Python application using PyQt4. However, when I show a window, the application crashes before the window is fully drawn (The window shows up very shortly). I was able to track the problem down: When I compile my number-crunching C-extension without OpenMP support the Window shows up fine and everything works. I guess it has something to do with the threading stuff between OpenMP and Qt. Has anyone ever made a similar observation?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":246,"Q_Id":7273779,"Users Score":1,"Answer":"Make sure that the OpenMP number crunching extension is free of race conditions.\nAvoid updating windows or any other GUI operations from multiple threads - use #pragma omp single or #pragma omp master to this kind of stuff.\nIf you have a variable\/callback to the python code, make sure that all threads have finished what they were supposed to before changing the variable or making the callback.\n\nThe threads from QT and the thread from OpenMP are completely different threads, so this shouldn't pose any problems.","Q_Score":1,"Tags":"python,qt,pyqt,openmp,python-c-extension","A_Id":7467392,"CreationDate":"2011-09-01T17:01:00.000","Title":"Crash when showing a PyQt4 Window after importing a python extension that uses OpenMP","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been tasked with inserting and re-sizing several hundred images to a powerpoint.\nI need to use a particular source format that is similar to other power points used by our company.\nI have been playing around with activepython's win32com API's and I have figured out how to open up a file and create a blank slide.\nMy question is how would I go about inserting an image and resizing it to whatever size I need(the images will be the only thing on each page).  Also I am trying to use my company's theme for the background and title page but this is not as important as getting the images on page and re-sized.\nany help would be greatly appreciated, thanks!","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":6999,"Q_Id":7284658,"Users Score":0,"Answer":"I agree with the accepted answer.  I would like to point out that I needed to prefix the FileName string with an 'r' to treat the backslashes as literal characters.  Escaping the backslashes by replacing single backslashes with double also works.  @vestland this may be helpful","Q_Score":3,"Tags":"python,powerpoint","A_Id":57909052,"CreationDate":"2011-09-02T14:06:00.000","Title":"Insert images to powerpoint slide using python (win32com.client)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"All the examples I've seen seem very complicated.\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":399,"Q_Id":7288543,"Users Score":3,"Answer":"The wx demo has an image example, under Using Images|Image.  It shows how to convert and display a jpg, and other types as well.  If you don't already have the demo, you can get it from the main wx download page.","Q_Score":0,"Tags":"python,wxpython","A_Id":7291001,"CreationDate":"2011-09-02T19:47:00.000","Title":"What is the easiest way to display a JPG using wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Sorry if this question is incredibly easy to answer, or I sound like an idiot. I'm wondering how I would execute a script in one file, pygame event loop, blits, etc, then switch to another file, SelectWorld.py, which has it's own event loop, and blits, and etc. If I just call it's main function, does it create any slowdown because I still have the original file open, or am I fine just doing that? SelectWorld.transition() sort of thing. Thanks in advance.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":790,"Q_Id":7296987,"Users Score":1,"Answer":"Here, what is wanted is to be able to share the variables between two different applications: 2 different scripts with event loops, blits, etc. So by definition, they should be on different process (if they must be running at the same time).\nThere is two major ways of doing this:\n1 - Client-Server Architecture (like a Game server would be) (the server and client can both run on the same machine)\n2 - Multiprocessing with 2 process running on the same machine with different ways of communicating and synchronize the variables. (Pipe Queue, Event, etc)\nI understand that you're trying to do a kind of variables profiling of your game? If it is used to debug your game or test it. I consider that you need a lot of code to gain a little useful information (because the game might run too fast for you to analyse the variables)\nYou have those alternatives:\n1 - import pdb, pdb.set_trace(): it will stop the process at the line where you called the function and, on the terminal, you can see the variables values.\n2 - You can use Eclipse (with pyDev): Very good debugger (line by line)\n3 - Unittest, Mock: Is something you should start to use, because it is useful, because you can easily see when you break some old code (with unittest) and\/or testing new code...\nI hope it helps you :)","Q_Score":1,"Tags":"python,transition,pygame,blit","A_Id":7300851,"CreationDate":"2011-09-04T02:02:00.000","Title":"Python\/Pygame transitioning from one file to another","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Sorry if this question is incredibly easy to answer, or I sound like an idiot. I'm wondering how I would execute a script in one file, pygame event loop, blits, etc, then switch to another file, SelectWorld.py, which has it's own event loop, and blits, and etc. If I just call it's main function, does it create any slowdown because I still have the original file open, or am I fine just doing that? SelectWorld.transition() sort of thing. Thanks in advance.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":790,"Q_Id":7296987,"Users Score":0,"Answer":"Turns out the answer to this was painfully simple, and I asked this back when I was just learning Python. There is no speed downgrade from just calling a function from another file and letting it do all the work. Thanks for all the answers, guys.","Q_Score":1,"Tags":"python,transition,pygame,blit","A_Id":10609284,"CreationDate":"2011-09-04T02:02:00.000","Title":"Python\/Pygame transitioning from one file to another","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to Python and PyQt. What is the best way to keep 4 QtTreeWidgets synchronized so that the items are the same as well as all the attributes of all the items? These widgets appear in different dialog boxes at different times during a session. For a number of reasons, I need to keep as much of the existing code, signals and layout as intact as possible. The Model\/View division would be the obvious first place to go, but I don't want to touch any of the methods that are used to access or update the tree. I'm planning to refactor the whole thing in a few months, but I need something quickly to carry me until then.\nSince each QTreeWidget is a convenience class, each has its own data. The UI is maintained in Qt Designer and I don't want to keep it that way.\nWhen each dialog is initialized, the tree appears. The application has a singleton class that all dialogs can use to reference its variables\/attributes. \nIn the initialization of each parent dialog, couldn't I check to see if a 'locationTree' attribute exists in the singleton. If not, I would need to populate it with its initial state and have the tree in the dialog use it or a copy of it. Any time the state of the dialog tree is altered in ways that I can trap, I'd like to update the singleton 'locationTree' to mirror the change. Although there's a clone method on a QTreeWidgetItem, I didn't see a corresponding method for the entire QTreeWidget.\nHow can I accomplish this with the least amount of change to the existing code base and GUI layout? \nJohn","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":451,"Q_Id":7297507,"Users Score":3,"Answer":"Yes using the MVC facilities is the way to go ...\nEven though you are using QTreeWidget you are still working with a class derived from QAbstractItemView therefore the model() and setModel() calls are available. Take a model from one of the widgets that you are creating and then set it in the other widgets. Whenever you change the data in one of the widgets the other widgets will follow suit as they are using the same instance of model.\nIf you need to maintain the same selection state in all for widgets (which parts of the tree are open or close) that might be a little bit harder but it might actually work by using the same selectionModel selectionModel() and setSelectionModel()","Q_Score":2,"Tags":"python,qt,pyqt,qtreewidget","A_Id":7299389,"CreationDate":"2011-09-04T05:06:00.000","Title":"Synchronized Qt TreeWidgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to Python and PyQt. What is the best way to keep 4 QtTreeWidgets synchronized so that the items are the same as well as all the attributes of all the items? These widgets appear in different dialog boxes at different times during a session. For a number of reasons, I need to keep as much of the existing code, signals and layout as intact as possible. The Model\/View division would be the obvious first place to go, but I don't want to touch any of the methods that are used to access or update the tree. I'm planning to refactor the whole thing in a few months, but I need something quickly to carry me until then.\nSince each QTreeWidget is a convenience class, each has its own data. The UI is maintained in Qt Designer and I don't want to keep it that way.\nWhen each dialog is initialized, the tree appears. The application has a singleton class that all dialogs can use to reference its variables\/attributes. \nIn the initialization of each parent dialog, couldn't I check to see if a 'locationTree' attribute exists in the singleton. If not, I would need to populate it with its initial state and have the tree in the dialog use it or a copy of it. Any time the state of the dialog tree is altered in ways that I can trap, I'd like to update the singleton 'locationTree' to mirror the change. Although there's a clone method on a QTreeWidgetItem, I didn't see a corresponding method for the entire QTreeWidget.\nHow can I accomplish this with the least amount of change to the existing code base and GUI layout? \nJohn","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":451,"Q_Id":7297507,"Users Score":0,"Answer":"I'm sure you're right that using Model\/View is the best approach.\nBut without an idea of roughly how many items your tree widgets will have, and how frequently they'll be updated, it's hard to weigh up alternative approaches. Also, what version of Qt are you using?\nIf the number of updates and items are not huge, one approach is to introduce a class that inherits QObject (so it has signals and slots), and make it responsible for keeping all your QTreeWidgets in sync.\nBy connecting signals and slots for each QTreeWidget to a single other object, you avoid the nightmare of having every tree widget know about every other one.","Q_Score":2,"Tags":"python,qt,pyqt,qtreewidget","A_Id":7298076,"CreationDate":"2011-09-04T05:06:00.000","Title":"Synchronized Qt TreeWidgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using MonkeyRunner to automate some UI test cases.\nI need to collect logs from the device using tool like QXDM.\nI see that win32com python module can be used to launch QXDM and collecting logs.\nBut when i use from win32com.client import Dispatch in python script which is passed as argument to MonkeyRunner, MonkeyRunner throws:\n\n\"Import Error: No Module named win32com\".\n\nI have installed win32com on my machine, and when i use win32com in a python script which ran using \"python test.py\" its working fine.\nDo we need to install win32com python module on Android device also? or what need to be done to make this work?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2667,"Q_Id":7311676,"Users Score":1,"Answer":"Monkeyrunner use Jython as its Python interface (jython.jar under tools\\lib folder).\nIt uses 2.5.0 version. Now the latest Jython version is 2.5.2. \nEither one does not support pywin32 or any other modules. It only supports standard Python modules in version 2.5.","Q_Score":4,"Tags":"python,monkeyrunner","A_Id":8291126,"CreationDate":"2011-09-05T18:40:00.000","Title":"MonkeyRunner::How to install python modules?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm not using sharpdevelop or visual studio for ironpython app development. I have my reasons for not using them for app development. What are my console based options for compiling ironpython .exe file and packaging it manually ? \nIs it possible to create executable app with ironpython and pack it using installer ?","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":653,"Q_Id":7313004,"Users Score":3,"Answer":"I use IronPython\\Tools\\Scripts\\pyc.py to create .exe and then xcopy deployment instead of installer.","Q_Score":2,"Tags":".net,python,ironpython","A_Id":7317306,"CreationDate":"2011-09-05T21:45:00.000","Title":"Packing ironpython app into .exe and Installer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm not using sharpdevelop or visual studio for ironpython app development. I have my reasons for not using them for app development. What are my console based options for compiling ironpython .exe file and packaging it manually ? \nIs it possible to create executable app with ironpython and pack it using installer ?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":653,"Q_Id":7313004,"Users Score":1,"Answer":"I've used pyc and InnoSetup to create my installers.  You can also download and run WIX from the command line without using #Develop or Visual Studio. The key is make sure you include all of the DLL's you need and to NGEN them on install for shorter start times and better performance.","Q_Score":2,"Tags":".net,python,ironpython","A_Id":7324311,"CreationDate":"2011-09-05T21:45:00.000","Title":"Packing ironpython app into .exe and Installer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been wanting to get into mobile\/tablet app development but I'm not sure whether to go with iOS or Android.  Here are a few specific questions I had:\n\nWhat would you recommend for someone who has a background in python and C++?  \nIs developing for the honeycomb os for tablets pretty much the same as android development?\nThis might be a silly question but I've also wanted to start developing GUI programs for windows and Mac OS.  Is there any way to write something in python using PyQt or wxPython and make it usable on mobile operating systems as well?  Just wondering.","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":882,"Q_Id":7315126,"Users Score":3,"Answer":"What would you recommend for someone who has a background in python\n  and C++?\n\nAndroid uses Java as the main programming language, iOS uses Objective-C.\nIMHO Java is easier to learn and more consistent compared to Obj-C. \n\nIs developing for the honeycomb os for tablets pretty much the same as\n  android development?\n\nHoneycomb is Android version 3. So yes, developing for Honeycomb is developing for Android, albeit differences in UI guidelines.\n\nThis might be a silly question but I've also wanted to start\n  developing GUI programs for windows and Mac OS. Is there any way to\n  write something in python using PyQt or wxPython and make it usable on\n  mobile operating systems as well? Just wondering.\n\nMouse and keyboard interactions are pretty much different than touch screen interactions (assuming you're talking about touch screen smartphones). When I began mobile app development, I always use the wrong sizes for the buttons etc.\nThe nearest can be done is maybe using Adobe AIR that allows you to deploy to desktops and mobile phones using same code base.","Q_Score":0,"Tags":"android,c++,python,ios","A_Id":7315189,"CreationDate":"2011-09-06T05:00:00.000","Title":"choosing between android and iOS for a programming novice","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been wanting to get into mobile\/tablet app development but I'm not sure whether to go with iOS or Android.  Here are a few specific questions I had:\n\nWhat would you recommend for someone who has a background in python and C++?  \nIs developing for the honeycomb os for tablets pretty much the same as android development?\nThis might be a silly question but I've also wanted to start developing GUI programs for windows and Mac OS.  Is there any way to write something in python using PyQt or wxPython and make it usable on mobile operating systems as well?  Just wondering.","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":882,"Q_Id":7315126,"Users Score":1,"Answer":"To be honest, your current skill set is insufficient for neither Android nor iOS. So, it doesn't matter which platform you decide. Either way, you will have some deep learning curve. However, you could write code in C++ for Android and iOS.\nI'm not aware that Python supports both iOS and Android. There're a dozen of framework for that, like Flash. If you're not confident in Flash, you might as well develop GUIs for each indidivual platform. Remember, Android and iOS and PCs have very different UI design, any general framework for building an app for all platforms could be very limitied.","Q_Score":0,"Tags":"android,c++,python,ios","A_Id":7315249,"CreationDate":"2011-09-06T05:00:00.000","Title":"choosing between android and iOS for a programming novice","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been wanting to get into mobile\/tablet app development but I'm not sure whether to go with iOS or Android.  Here are a few specific questions I had:\n\nWhat would you recommend for someone who has a background in python and C++?  \nIs developing for the honeycomb os for tablets pretty much the same as android development?\nThis might be a silly question but I've also wanted to start developing GUI programs for windows and Mac OS.  Is there any way to write something in python using PyQt or wxPython and make it usable on mobile operating systems as well?  Just wondering.","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":882,"Q_Id":7315126,"Users Score":2,"Answer":"What would you recommend for someone who has a background in python and C++?\n\nI would recommend going for android development. As Android is an open source OS, in future more devices will have it installed for its cost effectiveness. Android development needs you to learn java, which unlike objective-C, will not restrict your development capability to one brand of OS. Also java and C++ are very similar syntactically, hence will be easier for you to learn it. Java is everywhere. So go with Android.\n\nIs developing for the honeycomb os for tablets pretty much the same as android development?\n\nYes, its the same. There are a few new features in honeycomb dedicated to tablets, but creating some samples on honeycomb should get you started for both.","Q_Score":0,"Tags":"android,c++,python,ios","A_Id":7315444,"CreationDate":"2011-09-06T05:00:00.000","Title":"choosing between android and iOS for a programming novice","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was hoping to find a tool similar to Borland Delphi or VisualBasic for Python. Basically, I want to be able to program Windows apps with ease, without actually having to code every single widget. Does such a software exist? Thanks!","AnswerCount":4,"Available Count":1,"Score":-0.049958375,"is_accepted":false,"ViewCount":13231,"Q_Id":7328338,"Users Score":-1,"Answer":"All these tools are light years behind Delphi or Lazarus in Pascal world. The sad truth is that there is no real RAD GUI tools comparable to Delphi in Python world.","Q_Score":12,"Tags":"python,qt,user-interface,wxpython,pyqt4","A_Id":56841168,"CreationDate":"2011-09-07T02:40:00.000","Title":"WYSIWYG tool for programming GUI in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a python interface to a c++ library and am wondering about the correct design of the library.\nI have found out (the hard way) that all methods passed to python must be declared static. If I understand correctly, this means that all functions basically must be defined in the same .cpp file. My interface has many functions, so this gets ugly very quickly.\nWhat is the standard way to deal with this problem? Possibilities I could think of:\n\ndon't worry about it and use one looong .cpp file\ncompile into more than one library (.so file)\nwrite a .cpp for each group of functions and #include that .cpp into the body of the main defining cpp file (the one with the PyMethodDef)\n\nboth of them seem very ugly","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":61,"Q_Id":7330279,"Users Score":0,"Answer":"Why do you  say that all functions called by Python have to be\nstatic?  It's usual for that to be the case, in order to avoid\nname conflicts (since any namespace, etc. will be ignored\nbecause of the extern \"C\"), but whether the function is static\nor not is of no consequence.  \nWhen interfacing a library in C++, in my experience, it's\ngenerally not a big problem to make it static, and to put all of\nthe functions in a single translation unit, because the\nfunctions will be just small wrappers which call the actual C++,\nand normally, will be automatically generated from some sort of\ndescripter file; you surely aren't going to write all of the\nnecessary boilerplate by hand.","Q_Score":0,"Tags":"c++,python,interface","A_Id":7330536,"CreationDate":"2011-09-07T07:30:00.000","Title":"What is the pythonic structure of the code of a python-c++ interface with many functions?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using glade interface designer for developing a simple application. I was actually following a tutorial which was based on libglade format. But I want to use the gtkbuilder format. So I switched to the gtkbuilder format. But I just want to know what is the exact difference  between libglade format and gtkbuilder format.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":852,"Q_Id":7343714,"Users Score":3,"Answer":"Libglade was a separate library. It since has been deprecated, and the functionnalities have been integrated in GTK, which uses the GTK builder format which is a bit different. Both formats allow almost the same things, but the GtkBuilder one is prefered.","Q_Score":2,"Tags":"python,linux,gtk,glade","A_Id":7347414,"CreationDate":"2011-09-08T06:00:00.000","Title":"What is the difference between gtk builder file and libglade file when using Glade designer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way way to create multiple screens in Pygame without redrawing to the screen every time. For example, if we want to create a splash screen, then a main menu with buttons. On clicking the 'Start Game' button, it would go to a new screen which is the actual game. What I mean is anything similar to the 'Form' on Visual Studio or the Activites on Android.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":6820,"Q_Id":7376479,"Users Score":0,"Answer":"Just fill the screen with white and then draw the second screen onto the main screen. Then when you need the other screen, just refill the screen with black and then continue. It would help if both of your screens a function and you used a key like tab to \"switch\" between screens.","Q_Score":2,"Tags":"python,pygame","A_Id":31993464,"CreationDate":"2011-09-11T05:30:00.000","Title":"Creating multiple screens in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way way to create multiple screens in Pygame without redrawing to the screen every time. For example, if we want to create a splash screen, then a main menu with buttons. On clicking the 'Start Game' button, it would go to a new screen which is the actual game. What I mean is anything similar to the 'Form' on Visual Studio or the Activites on Android.","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":6820,"Q_Id":7376479,"Users Score":9,"Answer":"Depends on what you mean.\nIf you mean making multiple windows at the same time, no, you can't do that--it's a limitation of SDL (although you CAN fake it by using multiprocessing (not multithreading)).\nIf you mean changing one screen around, yes, you can do that, with multiple calls to pygame.display.set_mode(...).  You can change the resolution, arguments, etc.  If you're doing OpenGL stuff, that will remake the context too.\nIf you just mean drawing different things to the same window, of course!  That's sorta the point of PyGame.\nOther than that, you'll have to clarify.","Q_Score":2,"Tags":"python,pygame","A_Id":9288321,"CreationDate":"2011-09-11T05:30:00.000","Title":"Creating multiple screens in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to figure out how i can have a 3 column layout where the (smaller) left and right columns are resizable with a draggable separator on each side of the center\/main area. I've tried using splitwindow but that seems to only split in two parts.\nHope someone can give me pointers on how it can be done.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":383,"Q_Id":7389417,"Users Score":0,"Answer":"I susggest that you create three panels, side by side.  When one of the panels is resized by the user, you will have to adjust the size of the other panels to compensate - so that there are no gaps or overlaps.  You can do this by handling the resize event, probably in the parent windows of the three panels.\nAnother way, which requires you to write less code, would be to use wxGrid with one row and three columns and zero width labels for columns and rows.  You will lose the flexibility of panels, but wxGrid will look after the resizing of the column widths for you.","Q_Score":0,"Tags":"python,user-interface,wxpython,wxwidgets","A_Id":7389557,"CreationDate":"2011-09-12T14:25:00.000","Title":"WxWidget\/WxPython; 3 column resizable layout","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to compile my application for both PC and Mac, but I don't have access to Mac in my area (very rare, mostly PC). My application written in Python with 2 C++ modules, I used pyInstaller for Python and MinGW for C++ in PC, but question is for Mac?\nWhat can I do? is there any OS emulator or something helpful out there?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":391,"Q_Id":7393005,"Users Score":2,"Answer":"You can emulate Apple OS and any other OS on VMWare.","Q_Score":0,"Tags":"python,compilation","A_Id":7393082,"CreationDate":"2011-09-12T19:36:00.000","Title":"How to compile executable for Mac, but from a PC?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"There is a library for Python that enables the calling ability (can call functions in C++ format without extern \"C\". Please, could you remind me the name of the library? I forgot it's name and can't find it.\nIt's not Boost.Python.\nThank you very much. Your answer will be rewarded.","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":496,"Q_Id":7393672,"Users Score":1,"Answer":"SWIG, Boost.Python, SIP, Shiboken, PyBindgen, ...\nSWIG and Boost.Python are most popular, i.e. they have the largest user base and the most active development teams. Which of these two to use is largely a matter of taste. So if you don't want to use Boost.Python, then SWIG is the obvious choice.","Q_Score":1,"Tags":"c++,python,dll,shared-libraries","A_Id":7400723,"CreationDate":"2011-09-12T20:34:00.000","Title":"Library for Python: How to call C++ functions from Python program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've noticed that when you bind keys in tkinter (python3.2 winxp), the binds are case sensitive with the letter characters. In other words binding <Control-o> does not work if you press Control+o if caps lock is active. Does it mean I need to write two bindings for each case insensitive key combination with letter characters? Or is there any way to solve this?\nThanks for help :)","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1371,"Q_Id":7402516,"Users Score":5,"Answer":"Yes, you have to make two bindings.","Q_Score":4,"Tags":"python,tkinter,bind,case-sensitive","A_Id":7403049,"CreationDate":"2011-09-13T13:17:00.000","Title":"tkinter case insensitive bind","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to not block PyGTK while performing some expensive operation? I know threading would work but it would take a lot of code and setup.\nThanks,","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":734,"Q_Id":7435419,"Users Score":0,"Answer":"Avoid threads, they don't work well at all with PyGTK. Some alternatives:\n\nFor IO\/networking operations where you read from a file descriptor, use\nglib.io_add_watch() \nMove the operations to a separate process and\ncommunicate with it using glib.spawn_async()\n\nTwisted is a great library for doing networking, which is completely non-blocking and integrates well with the PyGTK mainloop, consider using that.","Q_Score":1,"Tags":"python,pygtk","A_Id":7566631,"CreationDate":"2011-09-15T18:04:00.000","Title":"PyGTK nonblocking","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to create a window with two panels, with a collapsible folder browser in the left panel and a list of files in the right panel that are contained in the selected folder on the left (similar to nautilus or an older windows explorer). Both the folders on the left and files on the right need a check box beside them so users can make a selection of a mix of folders and files across their whole file system.\nI've had a look around and found similar-ish built-in bits in wx like GenericDirCtrl but before I get started I wanted to ask if anyone had come across something like this before that's available or if there was a better starting point that GenericDirCtrl?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":432,"Q_Id":7443076,"Users Score":0,"Answer":"There isn't a built-in file explorer. The GenericDirCtrl or one of the other tree controls is a good place to start for the tree. Then use a ListCtrl (or ObjectListView) for the other panel. Something like that should give you the functionality you need.","Q_Score":1,"Tags":"python,wxpython","A_Id":7446240,"CreationDate":"2011-09-16T10:04:00.000","Title":"Best starting point for multiple selection in file\/folder tree structure wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to create a window with two panels, with a collapsible folder browser in the left panel and a list of files in the right panel that are contained in the selected folder on the left (similar to nautilus or an older windows explorer). Both the folders on the left and files on the right need a check box beside them so users can make a selection of a mix of folders and files across their whole file system.\nI've had a look around and found similar-ish built-in bits in wx like GenericDirCtrl but before I get started I wanted to ask if anyone had come across something like this before that's available or if there was a better starting point that GenericDirCtrl?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":432,"Q_Id":7443076,"Users Score":1,"Answer":"I've got it all working now. I used CustomTreeCtrl for the tree and a list control that has multi inheritance from ListCtrl and CheckListCtrlMixin for the report like list with check boxes.\nI can share the code if anyone's interested","Q_Score":1,"Tags":"python,wxpython","A_Id":7485064,"CreationDate":"2011-09-16T10:04:00.000","Title":"Best starting point for multiple selection in file\/folder tree structure wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to get and change the active row in a QTreeView (not QTreeWidget)? By active, I mean the row with the focus highlight, not the selected row. In the paint event, I can use QStyle.State_HasFocus to get the active row, but this doesn't seem to work elsewhere.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":9304,"Q_Id":7462054,"Users Score":4,"Answer":"You can get\/set the active row with the currentIndex() and setCurrentIndex() functions that you can find in both QTreeView and QItemSelectionModel (the latter is returned by QTreeView.selectionModel()).\nAnd despite its name, the QItemSelectionModel handles the view current item, and the view selection independently.","Q_Score":5,"Tags":"python,qt,pyqt,qtreeview,qabstractitemmodel","A_Id":7463100,"CreationDate":"2011-09-18T14:20:00.000","Title":"Get and set the active row in QTreeview programmatically (PyQt)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having some undesired behavior with movable panels in wxpython. I'm using the wxpython Cocoa build 2.9.2.3 for Python 2.7 on Mac OS X 10.6.7. I'm importing wx.aui and trying to create dockable panels. \nI have a panel that I've created a wx.aui.AuiManager on and have added two panels, one on top and one on below. For both of them I have disabled the close button. Right now, the panels can be dragged into different dockable positions on the frame or off of the frame to create a floating window. This window shows up as the Mac native MiniFrame with a disabled close button. I do not want users to be able to separate the panels from the main frame.\nI have passed .Floatable(False) to each pane's PaneInfo, but this won't allow the panels to be moved around at all, even if I pass a .Dockable(True)\nCan I have panes in AUI that are dockable and movable, but not floatable?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":456,"Q_Id":7474916,"Users Score":0,"Answer":"I don't know if there's a way to do that or not. It may be a limitation of wx.aui. You should ask on the wxPython mailing list. Or you could try the mostly drop-in replacement: wx.agw.aui (http:\/\/xoomer.virgilio.it\/infinity77\/AGW_Docs\/aui_module.html#aui). It fixes a bunch of bugs in the default wx.aui and is written in pure Python.","Q_Score":2,"Tags":"macos,wxpython","A_Id":7521698,"CreationDate":"2011-09-19T17:34:00.000","Title":"wxpython AUI panels dockable but not floatable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i'm checking out pyglet, but, funny enough, i can't find how to do a simple button!\nso\n\nwhat is the standard way to create a standard button?\nis there a standard way to create a Message-Box? open\/save dialogs? \nor am i missing the point of pyglet? isn't it yet-another gui toolkit\nfor creating (also) forms, windows, buttons, texts, standard widgets, etc. ?\n\ni'm using Python 2.x on a windows PC if that matters.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":6713,"Q_Id":7484924,"Users Score":3,"Answer":"I didn't use Pyglet yet, but is not a GUI library, it doesn't have to have widgets like buttons, or containers etc. It's a multimedia library like Pygame, it draws stuff on screen, plays sounds, and has some helper functions.\nIf you want to draw a button on screen, you should first draw a rectangle, print some text in it, and then listen mouse clicks to know if it's clicked on this rectangle.\nSee PyQT, PyGTK, WxPython for some examples of GUI libraries.","Q_Score":3,"Tags":"python,pyglet","A_Id":7485069,"CreationDate":"2011-09-20T12:11:00.000","Title":"where is the button widget in pyglet ?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am  making some programs which includes while loops(to illustrate some number calculatings) and when I use Tkinter for GUI, the program windows is freezing until the loop finished. I want to add a stop button and I want the windows not to freeze. How can I do these two things?\nThank you","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1117,"Q_Id":7491777,"Users Score":3,"Answer":"You'll have to use separate threads or processes.  Tkinter uses a single thread to process display updates, and the same thread is used to do event callbacks.  If your event handler blocks then no Tkinter code will execute until it completes.\nIf you have the Tkinter thread (the one that calls Tk.mainloop) and another thread for the rest of your application, then the event handlers running within the Tkinter thread can simply pass messages (possibly using Queue.Queue) to your application event handler.","Q_Score":1,"Tags":"python,tkinter","A_Id":7491885,"CreationDate":"2011-09-20T21:06:00.000","Title":"Tkinter is freezing while the loop is processing, how can i prevent it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Full question\n\nWhy did Google choose Java for the Android Operating System and not the X language?\n\nWhere X would be one of the below:\n\nPython version 2.7 or version 3\n\nwhich is equally as powerful as Java\nhas a lot of useful third party libraries\nis faster to develop in thanks to it's dynamic nature\n\nC\/C++ or ObjC\n\nwhich are harder to develop in but\nrun faster thanks to less overhead\nwould require less beefy hardware, especially RAM\nare equally as robust as Java but are more prone to app-wide crashes when just one module fails\n\n\nAnd so on. My main concern when I asked this question was why Java and not Python. I can add other elements (languages) of comparison later if anyone else is also interested.\nInfo: I'm not a full-blown developer.\nEDIT I was very much aware that my question was going to be met with some opposition and bashing, that's why I said that I'm not a full-blown developer. I have my personal opinions to support me and just that but even thus, I still got great answers. I understand now, yes, Dalvik VM runs Java bytecodes on ARM devices, but how different is that Java from any other Oracle\/Sun Java spec, I don't know. I've been playing with both Java and Python and wrote at least one useful program in both + GUIs (Swing and PySide) and at least one third party library used. The order I did this was Java, then Python which made me realize how much faster it was for me to write everything from scratch in Python than it was in Java. Even packages seemed much easier to manager than Java's way of importing packages (thank God for Eclipse and a few intuitive clicks)... and then how complex would embedded apps be that you'd need to take extra care for type checking and unit tests (and afaik, unit tests are supposed to be a must nowadays for any serious developer)... but anyway, thanks for the answers so far. It's a learning process. ;)","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":9975,"Q_Id":7497199,"Users Score":10,"Answer":"Google, as a company, uses Java a lot.  The search features are written in Java.  As far as I can tell from the outside, Google likes Java.\nFor most tasks, Java is faster than Python.  I would rather work in Python, and I know how to write reasonably efficient Python, and yes PyPy is really shaking things up, but Google needed to provide a snappy experience on relatively underpowered phone processors so they likely didn't consider Python a contender.\nJava, like Python, provides a great deal of isolation from details of the underlying hardware.  I think all Android phones are ARM-based, but in theory you could make an Android phone based on an x86 chip or something completely different, and as long as you do a good job of porting the Dalvik VM, your code will run.  (Aside from apps that have native ARM code compiled in, of course.)\n\nGoogle likes the Java language, but they chose to write their own VM (\"Dalvik\") rather than license the Java VM.  Compiled Java can be directly translated into Dalvik bytecodes.  (Oracle sued Google over this.  Oracle lost the lawsuit.)","Q_Score":19,"Tags":"java,android,python","A_Id":7497322,"CreationDate":"2011-09-21T09:02:00.000","Title":"Why did Google choose Java for the Android Operating System?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm looking for a good cross platform (mac, windows & linux) python GUI framework \/ library that will make my life easier while writing a data analysis program. Since my data is represented by custom data classes, it would be great if the GUI framework \/ library could take away the burden of having to code input checks, validation, etc (i.e., create input dialogs that take care of checking for the correct data range \/ data type based on the data model). The only library that I've found so far is TraitsUI. Are there more (similar) libraries \/ frameworks out there?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1209,"Q_Id":7538282,"Users Score":3,"Answer":"Then Enthought Suite (not just TraitsUI) is the most complete as it provides everything from building the model to showing it including input validation. It  plays nicely with numpy and scipy which is nice for a scientific app. Enthought UI can use Qt (via PySide or PyQt) or wx as backends.\nYou can also use Qt directly via PyQt or Pyside and embed plots using matplotlib or PyQwt. QtDesigner allows you to generate nice UI with very little effort. You can achieve the type of initialization, validation as with Traits but with more effort.","Q_Score":2,"Tags":"python,user-interface,traits,enthought","A_Id":7538648,"CreationDate":"2011-09-24T09:58:00.000","Title":"python GUI frameworks \/ libraries suited for data analysis programs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way I can tell gtk to automatically call gtk.main_quit() when the last open window of the application is closed\/destroyed?\nIf there is no direct feature offering this functionality, I could think of the following:\nIn the window's destroy method: get a list of open windows in the process, if its empty quit. Is there a way to get such a list?\nThe obvious solution would be to keep manually track of all open windows, but I would want to avoid this if possible.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":3003,"Q_Id":7567707,"Users Score":2,"Answer":"Use the method gtk.main_level() to get the current nesting level of the main loop. The nesting level is increased by calling the gtk.main() function and reduced by calling the gtk.main_quit() function","Q_Score":5,"Tags":"python,gtk,window,pygtk,quit","A_Id":7839037,"CreationDate":"2011-09-27T10:33:00.000","Title":"How to quit a pygtk application after last window is closed\/destroyed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can I create a button with text with a background image? In wxPython, there are certain functions which create buttons such as wx.lib.buttons.GenBitmapTextButton and other functions like that. I'm wondering if I can create a button with a fancy background image, as well as label text.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":707,"Q_Id":7605254,"Users Score":0,"Answer":"There is no built-in button that allows a background image underneath the text. You can probably look at one of the generic button widgets though and use them as a template. Basically you just need to draw the bitmap on and then draw text on top, probably by using wx.DC or wx.GCDC or similar. The generic buttons include such things as wx.lib.buttons, wx.lib.agw.aquabutton and wx.lib.platebtn among others.","Q_Score":0,"Tags":"image,button,wxpython,label,background-image","A_Id":7611324,"CreationDate":"2011-09-30T02:03:00.000","Title":"wxPython Button Background Image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a program that loads the RGB values of each pixel in a image and saves them in some kind of list\/dictionary\/tuple and then when I type in a value it tells me how much pixels in the image have that value. So far I have read through the whole PIL documentation trying to find a method that could fit my needs and I have tried several other approaches with for example the .getpixel() or the .load() function, but it is very difficult to save and evaluate that information for each pixel.","AnswerCount":4,"Available Count":1,"Score":0.1488850336,"is_accepted":false,"ViewCount":2218,"Q_Id":7625984,"Users Score":3,"Answer":"New in version 1.1.5 of PIL is the method getcolors() which should do exactly what you're looking for. The documentation from the PIL web documentation follows:\n\ngetcolors\nim.getcolors() => a list of (count, color) tuples or None\nim.getcolors(maxcolors) => a list of (count, color) tuples or None\n(New in 1.1.5) Returns an unsorted list of (count, color) tuples,\n  where the count is the number of times the corresponding color occurs\n  in the image.\nIf the maxcolors value is exceeded, the method stops counting and\n  returns None. The default maxcolors value is 256. To make sure you get\n  all colors in an image, you can pass in size[0]*size[1] (but make sure\n  you have lots of memory before you do that on huge images).","Q_Score":3,"Tags":"python,python-imaging-library,pixel","A_Id":12994553,"CreationDate":"2011-10-02T11:07:00.000","Title":"Pixel Loading and Evaluating with PIL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to make widgets with Python on Android?\nI mean, that I know only Python, HTML, DOM, JS, maybe jQuery and nothing more (not C, Java or something).\nMaybe it's simple?\nI honestly searched stackoverflow but search returned no answers :(\nHelp me, please. Give me a hope.","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4546,"Q_Id":7636732,"Users Score":2,"Answer":"Personally I wrote a google app engine app in python to collect and display the data, and then used an app called \"meta widget\" that allows you to turn a website's content into a widget. The app pulls the content from my GAE website and shows it in a widget on the android homescreen.\nYou might be able to do something completely local if you can make something to serve HTTP requests in sl4a python, then have meta widget go to a local http address.","Q_Score":3,"Tags":"python,android-widget,android,sl4a","A_Id":13672739,"CreationDate":"2011-10-03T14:56:00.000","Title":"How to make android widgets using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project where I have to show some sort of changing bar graph with results from a function. This bar graph should be in colour and 3d. I want it to look good since it's an open source educational program where it teaches the user about different voting systems and how they effect the outcome of an election. I would like to use python but I have no idea about using GUI frameworks since all my work in python has been command line based. Your help will be appreciated.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":228,"Q_Id":7637199,"Users Score":2,"Answer":"You might want to look at matplotlib, which is probably the most widely used library for doing graphs, including 3-D.","Q_Score":2,"Tags":"python,qt,user-interface,pyqt","A_Id":7637393,"CreationDate":"2011-10-03T15:36:00.000","Title":"Picking a suitable GUI framework for project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create an application in PYTHON with graphical interface (using pyqt), with a COM automation server. \nSo that COM clients could call this app using COM, and this would result in events in the main gui window. But I'm not sure how to integrate pyqt (signals\/slots) to COM automation server (using pywin).","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":441,"Q_Id":7650348,"Users Score":1,"Answer":"Your software is built from three different parts:\n\nThe program core - what actually does the stuff.\nThe GUI - in this case built in pyqt.\nThe COM server - one more UI that has nothing to do with 2.\n\nLet the COM client do its thing. The output can be doing stuff and updating the GUI interface.\nWhat I am saying is that the two interfaces have nothing to do thin each other.","Q_Score":2,"Tags":"python,com,pyqt,pywin","A_Id":10190909,"CreationDate":"2011-10-04T15:30:00.000","Title":"Using COM automation server and PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to check whether the images is downloaded completely. Is there any library to use?\nThe images I want to verify including various formats such jpeg, png, bmp etc.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1726,"Q_Id":7674580,"Users Score":0,"Answer":"You can guess by attempting to load the image into memory (using PIL or somesuch), but it's possible that some images could be loaded ok without being complete - for example an animated GIF might load fine if you have the header and the first frame of the animation, and you won't notice that later frames of the animation were missing.\nA more reliable approach would probably be to use some out-of-band communication, like rather than watching a folder and processing new files as soon as they exist, find some way of hooking into the downloader process and getting it to give you a signal when it decides it is ready.","Q_Score":2,"Tags":"c++,python,image,boost,image-processing","A_Id":7674970,"CreationDate":"2011-10-06T13:01:00.000","Title":"How to verify the integrity of a image file in c++ or python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to put a bunch of widgets into an MDIChildFrame , using wxpython, but i cant find much documentation on how to do so. has anyone created a child frame with alot going on it in so i can take a look at the source code? would be really Helpful \nCheers \nKemill","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":317,"Q_Id":7690324,"Users Score":0,"Answer":"The wxPython demo has a fairly complicated window in their MDI with SashWindows demo. However, I keep seeing on the wxPython mailing list that MDI in general isn't usually recommended anyway. If I were you, I'd look at wx.lib.agw.aui. It's a pure python implementation of AUI and fixes a lot of the bugs in wx.aui. I know it's not quite the same, but at least it gets active development.","Q_Score":0,"Tags":"wxpython,widget","A_Id":7691411,"CreationDate":"2011-10-07T16:47:00.000","Title":"Using wx.MDIChildFrame Widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to change the opacity or color of a gtk.IconView select box (I want actually to make the selection more visible).\nI noticed that the gtk.IconView widget had style properties selection-box-alpha & selection-box-color but only accessible for reading.\nThe set_select_function() method of the gtk.TreeSelection class would have been useful to do what I want but it's used for a gtk.TreeView and I haven't found an equivalent for gtk.IconView\nSo, how can I do to have control over the selection and perform an action when the user select or unselect stuff ?\nEdit :\nIn fact, change the values of selection-box-alpha and selection-box-color style properties wouldn't be a solution.\nI don't really want to change the selection box opacity but the \"opacity\" of the pixbuf (by compositing with a color).\nSo, I need an equivalent method of set_select_function for a gtk.IconView widget.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":735,"Q_Id":7698217,"Users Score":1,"Answer":"You might be able to set the pixmap opacity by implementing a custom gtk.CellRenderer that draws the pixmap according to the selection state, and replacing the gtk.IconView's default cell renderer with your own.","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":7705370,"CreationDate":"2011-10-08T16:32:00.000","Title":"How to get the control over the selection in a gtk.IconView?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've decided to try and create a game before I finish studies. Searching around the net, I decided to create the basic game logic in python (for simplicity and quicker development time), and the actual I\/O engine in c# (for better performance. specifically, I'm using Mono with the SFML library). \nAfter coming to grips with both languages and IDEs, I've gotten stuck on integrating the two, which leads me to three questions (the most important one is the second):\na. which module should encapsulate the other? should the python game logic call the c# I\/O for input and then update it for output, or should it be the other way around?\nb. whatever the answer is, how can I do it? I haven't found any specific instructions on porting or integrating scripts or binaries in either language. \nc. Will the calls between modules be significantly harmful for performance? If they will, should I just develop everything in in one language?\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":814,"Q_Id":7792013,"Users Score":2,"Answer":"Have you considered IronPython? It's trivial to integrate and since it's working directly with .net the integration works very well.","Q_Score":1,"Tags":"c#,python,mono","A_Id":7792073,"CreationDate":"2011-10-17T09:48:00.000","Title":"Integrating python and c#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've decided to try and create a game before I finish studies. Searching around the net, I decided to create the basic game logic in python (for simplicity and quicker development time), and the actual I\/O engine in c# (for better performance. specifically, I'm using Mono with the SFML library). \nAfter coming to grips with both languages and IDEs, I've gotten stuck on integrating the two, which leads me to three questions (the most important one is the second):\na. which module should encapsulate the other? should the python game logic call the c# I\/O for input and then update it for output, or should it be the other way around?\nb. whatever the answer is, how can I do it? I haven't found any specific instructions on porting or integrating scripts or binaries in either language. \nc. Will the calls between modules be significantly harmful for performance? If they will, should I just develop everything in in one language?\nThanks!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":814,"Q_Id":7792013,"Users Score":2,"Answer":"Sincerely, I would say C# is today gives you a lot of goods from Python. To quote Jon Skeet:\n\nDo you know what I really like about dynamic languages such as Python, Ruby, and \n  Groovy? They suck away fluff from your code, leaving just the essence of it\u2014the bits \n  that really do something. Tedious formality gives way to features such as generators, \n  lambda expressions, and list comprehensions.\n  The interesting thing is that few of the features that tend to give dynamic lan-\n  guages their lightweight feel have anything to do with being dynamic. Some do, of \n  course\u2014duck typing, and some of the magic used in Active Record, for example\u2014 \n  but statically typed languages don't have to be clumsy and heavyweight.\n\nAnd you can have dynamic typing too. That's a new project, I would use just C# here.","Q_Score":1,"Tags":"c#,python,mono","A_Id":7792064,"CreationDate":"2011-10-17T09:48:00.000","Title":"Integrating python and c#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wanted to say \"best python GUI compared to Swing\"... but was sternly told my question was \"too subjective\".  I apologise to the deterministic ghost in the machine.\nI'm currently using Jython... have been using it for maybe 6 months now following years of Java.  I love Jython's ability to call on all the Java classes, and also to ease the transition from a Java way of doing things to a Python way.\nBut thinking about it I realise that by far the most common Java packages I'm using are the Swing ones.  I have spent many years wrestling with Swing and finally think I have the beast under some kind of body-lock.  I also think Swing is wonderful, by the way, and I have to say that I am something of a keyboard fanatic, for example, so wouldn't want to switch to a GUI where you don't have power akin to that lurking in ActionMap-InputMap, which maybe not many people care that much about.  It would also be a shame   really to turn my back on JTree and JTable, having spent so much time tearing out what was left of my hair about them.  Seriously, they are fiendishly powerful...\nBut at the same time I'm fast becoming hooked on the Python way of doing things.  I can and intend to stick with Jython.  But I was just wondering what the various CPython GUIs are like... and specifically how their power and versatility compare with Swing?\nadded:\nI have been asked to provide some specifics: OK, what about a tree GUI object sitting on a scroll pane where it is possible, if you want to, to control navigation and collapsing\/expanding of nodes using the keyboard... where the scrolling happens automatically (if you want it to) and where you have control over look and feel, etc.  Or tables where you have comprehensive control over resizing, over what happens when individual cells gain\/lost focus.  Where you can subclass renderers and editors. As I said in my comment, someone who is\/was keen on, and a big user of, Swing but nonetheless made a transition to a CPython GUI and was happy\/unhappy... might be the ideal person to answer this.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":12297,"Q_Id":7798393,"Users Score":0,"Answer":"I think Python has many toolkit for GUI.\nJava has Swing. If you want to develop \ncross-platform friendly GUI,I suggest\nwxPython.","Q_Score":9,"Tags":"python,swing,user-interface,comparison,jython","A_Id":22448500,"CreationDate":"2011-10-17T19:15:00.000","Title":"python GUI compared to Swing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to catch when a User moves the mouse over the GUI, but not when they're holding down the mouse button (which would do something different).\nI can't find any conveniant method to do this,\nexcept to periodically find the mouse position and check it to it's previous position...\nWhich would suck.\nThe mouseMoveEvent is only called when the mouse is moved whilst the left mouse button is pressed,\nunless ofcourse the widget has 'mouse tracking'.  Mouse tracking is not an option for me, because the GUI must behave differently when the mouse is moved and the left mouse button is pressed.\nAre there any inbuilt methods to do this? \n(or just any clever ideas?)\neg:\nIs there a way to check if the left mouse button is being pressed at any time?\nOr a 'mouse hover' event that can be applied to a QRect (coordinates)?\nMuchas gracias.\n\nWindows 7  (32)\npython 2.7\nPyQt4","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":20559,"Q_Id":7829829,"Users Score":2,"Answer":"call setMouseTracking(True) method first. Then mouseMoveEvent will be fired without any button pressed.","Q_Score":9,"Tags":"python,pyqt,mouseevent,pyqt4,mouseover","A_Id":7829879,"CreationDate":"2011-10-20T00:31:00.000","Title":"PyQt4 MouseMove event without MousePress","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a VB6 application running on a number of old 486 Windows 95 machines and sometimes the application is upgraded. The only way to accomplish this today is to use Hyperterminal and send the file over a null modem cable. Replacing the machines is not an option at this point.\nI want to write an application that can take care of transferring the updating app over null modem without rewriting the VB6 app. This means I'm free to use anything I see fit. What alternatives are there?\nThese are the ones I can think of but I'd like to know if I'm wrong and any pros\/cons. Also, I'd prefer to avoid C\/C++ if at all possible.\n\nPython with py2exe\nAnother VB6 app\nC\/C++\n\nEdit: Some clarifications after reading the comments:\nI want to make the process as easy as possible, today we have to remove and dismantle the computer, connect a keyboard and then fire up Hyperterminal to get going. That's why I want something more automatic. I'm open to suggestion of existing solutions but given the specific needs I didn't think there were any.\nThere is no ethernet on some of the computers either so the solution needs to be able to run RS232.\nAnd again: Replacing the machines is not an option at this point. Just trust me on this.","AnswerCount":4,"Available Count":2,"Score":0.1488850336,"is_accepted":false,"ViewCount":547,"Q_Id":7833831,"Users Score":3,"Answer":"If you must use a null modem, how about the built in serial line networking support?\nThen you can just use normal network methods (psexec, file share, etc) methods to do the update.","Q_Score":3,"Tags":"python,vb6,native,windows-95","A_Id":7835341,"CreationDate":"2011-10-20T09:29:00.000","Title":"Make new software for Windows 95 on 486 machines, what to use?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a VB6 application running on a number of old 486 Windows 95 machines and sometimes the application is upgraded. The only way to accomplish this today is to use Hyperterminal and send the file over a null modem cable. Replacing the machines is not an option at this point.\nI want to write an application that can take care of transferring the updating app over null modem without rewriting the VB6 app. This means I'm free to use anything I see fit. What alternatives are there?\nThese are the ones I can think of but I'd like to know if I'm wrong and any pros\/cons. Also, I'd prefer to avoid C\/C++ if at all possible.\n\nPython with py2exe\nAnother VB6 app\nC\/C++\n\nEdit: Some clarifications after reading the comments:\nI want to make the process as easy as possible, today we have to remove and dismantle the computer, connect a keyboard and then fire up Hyperterminal to get going. That's why I want something more automatic. I'm open to suggestion of existing solutions but given the specific needs I didn't think there were any.\nThere is no ethernet on some of the computers either so the solution needs to be able to run RS232.\nAnd again: Replacing the machines is not an option at this point. Just trust me on this.","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":547,"Q_Id":7833831,"Users Score":0,"Answer":"I guess the answer is pretty simple if you are happy using VB6 and the other app is already VB6, then use it. \nThat will do whatever serial comms you require quite adequately. Remember though you may want to update the application you write to do the updating in which case you are back to using hyperterminal!","Q_Score":3,"Tags":"python,vb6,native,windows-95","A_Id":7835783,"CreationDate":"2011-10-20T09:29:00.000","Title":"Make new software for Windows 95 on 486 machines, what to use?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using a Tkinter Text box in my Python (using 2.7.2) script as an entry-type box -- when enter is pressed, it copies the contents into a different text box and then deletes it out of the entry one.\nI've bound the necessary event to the Text box when the Enter key is pressed. \nThe only problem I have is that whenever I hit the Enter key, it seems to execute my event and then the widgets \"default\" binding: adding a newline. I'm not sure of a way to either delete the newline after it is added, or simply get rid of the widgets default binding. \nThanks a lot!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":889,"Q_Id":7842538,"Users Score":0,"Answer":"Returning 'break' at the end of your event handler will interrupt event propagation.","Q_Score":0,"Tags":"python,binding,tkinter","A_Id":7843137,"CreationDate":"2011-10-20T21:33:00.000","Title":"Python Tkinter - Overwriting\/Deleting \"Default\" Widget Bindings","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have to store\/retrieve a large number of images to use in my program.\nEach image is small: an icon 50x50, and each one has associated a string which is the path the icon is related to.\nSince they are so small I was thinking if there is some library which allows to store all of them in a single file. \nI would need to store both the image and the path string.\nI don't know if pickle is a possible choice - I also heard about much more complicated libraries such as HDF5...\nthanks for your help!\nalessandro","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":165,"Q_Id":7846413,"Users Score":0,"Answer":"You could pickle a dict that associates filenames to byte strings of RGBA data.\nAssuming you have loaded the image with PIL, make sure they have all the same size and color format. Build a dict with images[filename] = im.tostring() and dump() it with pickle. Use Image.fromstring with the right size and mode parameters to get it back.","Q_Score":2,"Tags":"python,database","A_Id":7847894,"CreationDate":"2011-10-21T07:41:00.000","Title":"python: container to memorize a large number of images","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a 2D game on Python with heavy user interface: windows, buttons, text input, etc. So far I've been using PyGame for a few simple games.\nThe game is a 2D MUD, with the standard rendering loop to draw stuff on the screen. I need the user interface to interact with the game entities like sales, blacksmith, etc.\nI am looking for something like a mix of Pygame and wxPython\/pyQT\/pyGTK.\nWhich libraries can I use?","AnswerCount":6,"Available Count":1,"Score":0.0333209931,"is_accepted":false,"ViewCount":5109,"Q_Id":7869589,"Users Score":1,"Answer":"tkinter is one choice. It has a canvas widget that is very easy to use -- you can draw objects (lines, circles, etc) as well as embed images (for tiles, for example). And of course it comes with a standard collection of widgets (buttons, comboboxes, listboxes, menus, etc) that can either be embedded in a canvas or used in the more traditional sense.","Q_Score":18,"Tags":"python,user-interface","A_Id":7870721,"CreationDate":"2011-10-23T22:08:00.000","Title":"Which Python user interface library can I use for 2D games?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I set a style for treeview widgets so that alternate rows have different background colors, for example, rows 1,3,5 have white backgrounds and rows 2,4,6 have light blue-grey backgrounds?\nI'd also like to set gridlines.","AnswerCount":6,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":27341,"Q_Id":7878730,"Users Score":3,"Answer":"I realise this is an old question but just for the record configuring the tags just after creating the tree (i.e. when no items have yet been added to it) also works. As items get inserted later on they will be given the background colour appropriate to their 'oddrow' or 'evenrow' tag.","Q_Score":15,"Tags":"python,tkinter,treeview,ttk","A_Id":32121255,"CreationDate":"2011-10-24T16:24:00.000","Title":"ttk treeview: alternate row colors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to build a \"live coding framework\".\nI should explain what is meant by \"live coding framework\". I'll do so by comparing live coding to traditional coding.\nGenerally put, in traditional programming you write code, sometimes compile it, then launch an executable or open a script in some sort of interpreter. If you want to modify your application you must repeat this process. A live coding framework enables code to be updated while the application is running and reloaded on demand. Perhaps this reloading happens each time a file containing code is changed or by some other action. Changes in the code are then reflected in the application as it is running. There is no need to close the program and to recompile and relaunch it. \nIn this case, the application is a windowed app that has an update\/draw loop, is most likely using OpenGL for graphics, an audio library for sound processing ( SuperCollider? ) and ideally a networking lib.\nOf course I have preferred languages, though I'm not certain that any of them would be well suited for this kind of architecture. Ideally I would use Python, Lua, Ruby or another higher level language. However, a friend recently suggested Clojure as a possibility, so I am considering it as well.\nI would like to know not only what languages would be suitable for this kind of framework but, generally, what language features would make a framework such as this possible.","AnswerCount":8,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":1317,"Q_Id":7884010,"Users Score":4,"Answer":"The only thing that\u2019s necessary to make this work is a form of dynamic binding, e.g., message passing in Erlang or eval in many other languages.\nIf you have dynamic binding, then you can change the target of a message without affecting the message, or a message without affecting the target\u2014provided that a target is defined when you try to send a message to it, and a message is defined for the targets to which you send it, when you send it.\nWhen changing a target, all you have to do is serve messages to the previous version until the new version is in place, then do a small locked update to transition to the new version. Similarly, when changing a message, you just serve the old version till the new one is available.\nReadily hot-swappable code must still be designed as such, however\u2014the application must be modular enough that replacing the implementation of a component does not cause an interruption, and that can only come from careful programming.","Q_Score":13,"Tags":"python,ruby,clojure,lua,livecoding","A_Id":7898079,"CreationDate":"2011-10-25T02:20:00.000","Title":"What programming language features are well suited for developing a live coding framework?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I would like to build a \"live coding framework\".\nI should explain what is meant by \"live coding framework\". I'll do so by comparing live coding to traditional coding.\nGenerally put, in traditional programming you write code, sometimes compile it, then launch an executable or open a script in some sort of interpreter. If you want to modify your application you must repeat this process. A live coding framework enables code to be updated while the application is running and reloaded on demand. Perhaps this reloading happens each time a file containing code is changed or by some other action. Changes in the code are then reflected in the application as it is running. There is no need to close the program and to recompile and relaunch it. \nIn this case, the application is a windowed app that has an update\/draw loop, is most likely using OpenGL for graphics, an audio library for sound processing ( SuperCollider? ) and ideally a networking lib.\nOf course I have preferred languages, though I'm not certain that any of them would be well suited for this kind of architecture. Ideally I would use Python, Lua, Ruby or another higher level language. However, a friend recently suggested Clojure as a possibility, so I am considering it as well.\nI would like to know not only what languages would be suitable for this kind of framework but, generally, what language features would make a framework such as this possible.","AnswerCount":8,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":1317,"Q_Id":7884010,"Users Score":2,"Answer":"Smalltalk is probably the best bet for this. As unlike the others, it has a whole IDE for live coding, not just a REPL","Q_Score":13,"Tags":"python,ruby,clojure,lua,livecoding","A_Id":36677720,"CreationDate":"2011-10-25T02:20:00.000","Title":"What programming language features are well suited for developing a live coding framework?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I would like to build a \"live coding framework\".\nI should explain what is meant by \"live coding framework\". I'll do so by comparing live coding to traditional coding.\nGenerally put, in traditional programming you write code, sometimes compile it, then launch an executable or open a script in some sort of interpreter. If you want to modify your application you must repeat this process. A live coding framework enables code to be updated while the application is running and reloaded on demand. Perhaps this reloading happens each time a file containing code is changed or by some other action. Changes in the code are then reflected in the application as it is running. There is no need to close the program and to recompile and relaunch it. \nIn this case, the application is a windowed app that has an update\/draw loop, is most likely using OpenGL for graphics, an audio library for sound processing ( SuperCollider? ) and ideally a networking lib.\nOf course I have preferred languages, though I'm not certain that any of them would be well suited for this kind of architecture. Ideally I would use Python, Lua, Ruby or another higher level language. However, a friend recently suggested Clojure as a possibility, so I am considering it as well.\nI would like to know not only what languages would be suitable for this kind of framework but, generally, what language features would make a framework such as this possible.","AnswerCount":8,"Available Count":3,"Score":0.024994793,"is_accepted":false,"ViewCount":1317,"Q_Id":7884010,"Users Score":1,"Answer":"Tcl has such a thing already. For example, you can write a gui program that creates a separate window that has an interactive prompt. From there you can reload your code, type in new code, etc.\nYou can do this with any gui toolkit, though some will be much harder than others. It should be easy with python, though the indentation thing -- IMHO -- makes interactive use challenging. I'm reasonably certain most other dynamic languages can do this without too much trouble.\nLook at it this way: if your toolkit lets you open more than one window, there's no reason why one of those windows can't be an interactive prompt. All you need is the ability to open a window, and some sort of \"eval\" command that runs code fed to it as a string.","Q_Score":13,"Tags":"python,ruby,clojure,lua,livecoding","A_Id":7897130,"CreationDate":"2011-10-25T02:20:00.000","Title":"What programming language features are well suited for developing a live coding framework?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am making programs that solve and show work for math problems. I would like to add a GUI, and I think wxPython will be best. If I use wxPython for the GUI, will the end user need wxPython on their computer in order to use the program with the GUI? If not, what would should I use? \nThese apps will be used on mostly Windows, but I would also like them to work on Macs and Linux. I'm not for sure if any Python GUI elements will work on Android through SL4A, but if you know any, that would be appreciated.\nAlso, I know Tkinter is bundled with Python, but is it a dying technique, as I have read?\nThanks!","AnswerCount":5,"Available Count":3,"Score":0.0399786803,"is_accepted":false,"ViewCount":469,"Q_Id":7898489,"Users Score":1,"Answer":"If your software is mostly about the complicated processing, with a fairly simple UI, tkinter is probably fine","Q_Score":1,"Tags":"python,user-interface,wxpython,tkinter","A_Id":7900401,"CreationDate":"2011-10-26T03:37:00.000","Title":"Is wxPython Needed on the End  User's Computer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making programs that solve and show work for math problems. I would like to add a GUI, and I think wxPython will be best. If I use wxPython for the GUI, will the end user need wxPython on their computer in order to use the program with the GUI? If not, what would should I use? \nThese apps will be used on mostly Windows, but I would also like them to work on Macs and Linux. I'm not for sure if any Python GUI elements will work on Android through SL4A, but if you know any, that would be appreciated.\nAlso, I know Tkinter is bundled with Python, but is it a dying technique, as I have read?\nThanks!","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":469,"Q_Id":7898489,"Users Score":0,"Answer":"Tkinter comes with Python, so it can be handier in some respects just because of that. On the other hand, wxPython uses the native widgets of the OS (which has it's own set of pros and cons). I personally prefer wxPython. But no, Tkinter is not dead to my knowledge.\nYou can use py2exe to bundle up your app on Windows or you could use cx_freeze or bb_freeze. There's also PyInstaller, which I think can create some kind of Linux bundle, but the docs are kind of confusing. For Mac, see py2app.\nI'm not aware of any specific Python GUI toolkits for Android.","Q_Score":1,"Tags":"python,user-interface,wxpython,tkinter","A_Id":7903064,"CreationDate":"2011-10-26T03:37:00.000","Title":"Is wxPython Needed on the End  User's Computer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making programs that solve and show work for math problems. I would like to add a GUI, and I think wxPython will be best. If I use wxPython for the GUI, will the end user need wxPython on their computer in order to use the program with the GUI? If not, what would should I use? \nThese apps will be used on mostly Windows, but I would also like them to work on Macs and Linux. I'm not for sure if any Python GUI elements will work on Android through SL4A, but if you know any, that would be appreciated.\nAlso, I know Tkinter is bundled with Python, but is it a dying technique, as I have read?\nThanks!","AnswerCount":5,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":469,"Q_Id":7898489,"Users Score":0,"Answer":"PyInstaller.\ninstall and run.\ncmd -> python pyinstaller.py NAMEOFSCRIPT.py --onefile --noconsole.\neasy as 123.","Q_Score":1,"Tags":"python,user-interface,wxpython,tkinter","A_Id":13719743,"CreationDate":"2011-10-26T03:37:00.000","Title":"Is wxPython Needed on the End  User's Computer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I will admit that starting programming on your own as a newbie can seem a bit daunting. However after toying around very basically in both Python and currently C++ I'm wondering if C may be more suitable for a hobbyist. By hobbyist I mean someone who foresees no real future in actually programming for a living but rather sees it (at least currently) as an interesting exercise. So while I would like to be able to do things I'm don't really see myself y'know making a 3d game engine.\nI know that I don't NEED to learn C to learn C++. But from what I've read a couple of people have said that C is easier to learn because it's a smaller language. It seems like it would be more suitable to me given that, and I know that C is certainly fine for anything I'd want to do with it, and thus not really need to learn or use it as a stepping stone for C++. From what I can see C would be a) Easier to program with, meaning easier to get in and make things and keep one interested. b) lower level means more flexibility, whereas Python would be hindered perhaps by it's high level nature. C) Still widely used (though perhaps not to the extent of C++)\nA lot of people ask about learning C to get to C++ but I'm wondering more about C's own merits in and of them self. I wonder if what I'm thinking is true or if I've been filled with misconceptions. Thanks for any help :)","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":784,"Q_Id":7909666,"Users Score":3,"Answer":"You're looking at this wrong.  What's your goal?  If your goal is to \"learn a language\" then you are wasting your time.  That is like investing your time into learning to use photoshop with no ambition to ever create any neato graphics.\nInstead of focusing on the tool, focus on what you want to do with it.  If I learn how to use a power saw it's probably because I want to build something out of wood, not because I think power saws are just really awesome.\nAsk yourself; what do I want to build?  Once you answer that then you set forth finding out which tools would be most appropriate.","Q_Score":2,"Tags":"c++,python,c","A_Id":7909723,"CreationDate":"2011-10-26T22:23:00.000","Title":"Learning programming as a hobbyist... the merits of C vs C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I recently downloaded OpenCV 2.3.1, compiled with the CMake flags withQt and withQtOpenGL turned on. My Qt version is 4.7.4 and is configured with OpenGL enabled. Supposedly I only need to copy cv2.pyd to Python's site-package path:\n\nC:\\Python27\\Lib\\site-packages\n\nAnd in the mean time make sure the OpenCV dlls are somewhere in my PATH. However, when I try to call\n\nimport cv2\n\nin ipython, it returned an error:\n\nImportError: DLL load failed: The specified procedure could not be found.\n\nI also tried OpenCV 2.3, resulting the same error. If OpenCV is compiled without Qt, the import works just fine. Has anyone run into similar problem before? Or is there anyway to get more information, such as which procedure is missing from what DLL?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":488,"Q_Id":7940848,"Users Score":0,"Answer":"Probably need the qt dll's in the same place as the opencv dlls - and they have to be the version built with the same compiler as opencv (and possibly python)","Q_Score":2,"Tags":"python,qt,opencv,import","A_Id":7940923,"CreationDate":"2011-10-29T18:33:00.000","Title":"Error when importing OpenCV python module (when built with Qt and QtOpenGL)","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use Qt4 Designer and I want that when I click on the \"yes\" button, some code will execute. And when I click on the \"no\", some other code will be execute. How can I do it?","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":38462,"Q_Id":7964869,"Users Score":7,"Answer":"Right-click on your widget\nSelect \"Go to slot...\"\nSelect a signal and click OK\n\nYour custom slot declaration and definition for that signal will be added to *.cpp and *.h files. Its name will be generated automatically.\nupd:\nSorry, I didn't notice that the question is about Python & QtDesigner itself, I was thinking of the designer mode in QtCreator IDE. However, this still may be useful for someone who is looking for Qt\/C++ info, so I leave the answer.","Q_Score":22,"Tags":"python,qt4,qt-designer","A_Id":34307822,"CreationDate":"2011-11-01T09:59:00.000","Title":"Qt Designer: how to add custom slot and code to a button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use Qt4 Designer and I want that when I click on the \"yes\" button, some code will execute. And when I click on the \"no\", some other code will be execute. How can I do it?","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":38462,"Q_Id":7964869,"Users Score":45,"Answer":"Click on the Edit Signal\/Slots tool.\nCreate a connection for your button. For this, select your button in the designer by pressing on it with the left button of the mouse. Move the mouse to some place in the main window to create a connection with the main window (it is like a red line with a earth connection).\nWhen you release the mouse button, the Configure Connection dialog appears.\nIn this dialog select a signal in the left text control (the sender), for example, pressed().\nThen press edit in the right text control (the receiver). A dialog for the Signals\/Slots of MainWindow appears.\nIn the slot panel add a new slot (green cross). The text slot1() appears. Double click on it to edit the line and write instead the name of your function doit_when_yes_ispressed(). Accept.\nNow in the Configure Connection dialog you will see your function in the right text control. Select and Accept.\nIn the designer now you can see the signal and your function in the widget.","Q_Score":22,"Tags":"python,qt4,qt-designer","A_Id":7965081,"CreationDate":"2011-11-01T09:59:00.000","Title":"Qt Designer: how to add custom slot and code to a button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder if there's a python GUI like pyqt etc. which works purely with html and javascript for layouting desktop applications...\nDo you know if there are projects like this? Does this make sense at all ;-) Or it it just me finding that a nice tool...","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3024,"Q_Id":7967575,"Users Score":0,"Answer":"you could always use django, django templates support html, js, css, php etc.","Q_Score":5,"Tags":"python,html,css,user-interface","A_Id":7967656,"CreationDate":"2011-11-01T13:59:00.000","Title":"HTML\/Javascript\/CSS GUI for the development of desktop applications with python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I wonder if there's a python GUI like pyqt etc. which works purely with html and javascript for layouting desktop applications...\nDo you know if there are projects like this? Does this make sense at all ;-) Or it it just me finding that a nice tool...","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":3024,"Q_Id":7967575,"Users Score":2,"Answer":"Since you mention PyQt yourself, you could perhaps just create a simple GUI using these tools, with your entire application made up of a QtWebKit module. Then just point to some files you created locally, and browse them using your appliction? But, this would not be any different compared to using a normal browser, so there's not really any point in doing this in my opinion...","Q_Score":5,"Tags":"python,html,css,user-interface","A_Id":7967652,"CreationDate":"2011-11-01T13:59:00.000","Title":"HTML\/Javascript\/CSS GUI for the development of desktop applications with python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I developed an application with wxPython and used cx_freeze to covert it to a .exe. I installed the app on WinXP and it works fine. My only misgiving is that the gui app is running with a command prompt behind it. How can I get rid of this command prompt? I imagine that it is there to display errors etc.... There must be a way to redirect errors to a log file instead of showing this command prompt? Thanks in advance.\nCode:","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":370,"Q_Id":7970055,"Users Score":0,"Answer":"You can rename your .py file to .pyw  it will then run without displaying the console.","Q_Score":0,"Tags":"windows,wxpython","A_Id":7970931,"CreationDate":"2011-11-01T17:06:00.000","Title":"Running a wxPython application in a Windows environment w\/o the command prompt displaying","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can I port existing python scripts on android using SL4A or ASE ? What I specifically want to do is to create an android application with normal UI elements and run the python scripts from the application itself, get the output and display it. Is this possible ?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1064,"Q_Id":7995202,"Users Score":0,"Answer":"I think, what you want to do is make an independently apk file, that includes the python interpret and your script code.\nI don't know if this can be done in Android. The only whay I know is running your script from Android Scripting Environment.","Q_Score":4,"Tags":"android,python,sl4a","A_Id":7995273,"CreationDate":"2011-11-03T12:53:00.000","Title":"Android and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Can I port existing python scripts on android using SL4A or ASE ? What I specifically want to do is to create an android application with normal UI elements and run the python scripts from the application itself, get the output and display it. Is this possible ?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1064,"Q_Id":7995202,"Users Score":2,"Answer":"Personnaly I think that you ask implicitly for three points:\nCompatibility Desktop\/Mobile\nThe first is the compatibility between the python library on the phone and the python library in your computer. If you don't use third party library and be sure to include the extra python library provided by sl4a, you should generally be ok.\nPackaging\nThe second point is about how to package a Python app for android. It can easily be done with a wrapper as well described on the sl4a website. In fact they distribute a copy of a chapter of a book about SL4A that describes how to do that. So that is possible, but bear in mind that the user will be required to install python if he hasn't done so already (this is a sort of alert at the launch of the app) \nUI\nThe third thing that you should have in mind is that you are not a 100% free concerning the widget\/layout you can use with sl4a. Namely you can't really do whatever you would be able to do in Java or Scala. So you might have to consider altering your UI and do a webview instead (that can communicate back and forth with the python) with a framework to obtain a \"mobile look and feel\"\nHope this helps.","Q_Score":4,"Tags":"android,python,sl4a","A_Id":7995341,"CreationDate":"2011-11-03T12:53:00.000","Title":"Android and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I've got a pygtk app which uses gtk print_run_page_setup_dialog. For some reason, some widgets (siblings to button that invoked the dialog) are no more redrawn after closing this dialog. Forcibly calling queue_draw on them works fine.\nI'd like to identify where are the events going, and reconnect them to proper location. How do I go about this problem?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":8008220,"Users Score":0,"Answer":"It sounds incredibly unlikely that the dialog should somehow mess with event handler connections for unrelated widgets.\nMake sure the dialog is not stuck in a nested main loop (the call you mention has run in its name, implying a call to gtk_main() is taking place to make the dialog modal).","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":8008432,"CreationDate":"2011-11-04T10:59:00.000","Title":"Redraw events lost?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am porting my console app to a QT gui. The app get data from a website and prints the rsult line by line in the console ( I use spyder). Each line are a few strings.\nNow I want to add a gui to the app so others can use the app as well. \nWith QT designer I designed a nice gui. In a Main module I call the UI. Now I am trying to 'connect' my app to the gui. Since I am new to Qt (with PySide) I would like to build step by step and learn.\nNow I would like to show ('print' line by line) the results in a widget (e.g. QListView).\nCan you show me a example where [\"this is line 1\", \"This is line two\"] are show in two rows in a QT Widget.\nThanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":970,"Q_Id":8022035,"Users Score":1,"Answer":"I usually use QTextBrowser for a \"logging\" widget.\n\nJust create a QTextBrowser widget in your main window (i.e. self.log_widget = QTextBrowser())\nAdd it to some layout to be visible and part of the window\nLog messages to it with the append method (which accepts a string). (i.e. self.log_widget.append('Hello'))\n\nQTextBrowser is a powerful widget that can also accept HTML for formatted output.","Q_Score":1,"Tags":"python,qt,widget,pyside","A_Id":8022220,"CreationDate":"2011-11-05T17:46:00.000","Title":"Print results in Qt widget iso console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I've been tinkering with a few different GUI's but I haven't been able to even find a point to begin researching this question:\nHow do I make a GUI like Steam (Digital distribution app) has? More specifically, I'm interested in how they manage to make their SHIFT+TAB menu pop up in-game, without disrupting\/pausing\/effecting the game. I've been somewhat successful in making a GUI window \"stay on top\" when a game is in window mode, but Steam pops this little menu up over the top of a running, fullscreen game.\nThat's what I'm interested in learning about. Any info would be much appreciated. :)\nSorry if this isn't the correct place to post this. I wasn't sure exactly where to ask.\nPS> Preferably something I could implement in Python!!!","AnswerCount":2,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":1878,"Q_Id":8059845,"Users Score":-2,"Answer":"Hmm, that looks very much like they are using Adobe AIR or maybe Flash.","Q_Score":0,"Tags":"python,user-interface","A_Id":8059885,"CreationDate":"2011-11-09T03:00:00.000","Title":"Programming a GUI Like Steam?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a few functions written in C for a game project. These functions get called quite a lot (about 2000-4000 times per second). The functions are written in C for raw speed.\nNow, the easiest way for me to include these functions into Python is to use ctypes. The alternative is to write a C extension to Python around these functions (which takes quite a bit of extra effort). So I wondered, not including the initial loading of the DLL, how big is the overhead of ctypes?\n\nI'm using Python 2.7 (the standard CPython release), and I do not want to use an external library like Cython.\nI know this question has been asked before, but I haven't seen much information about the performance comparison between the two options.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":7501,"Q_Id":8067171,"Users Score":18,"Answer":"I've compared the performance of a C extension vs. a ctypes wrapper. In my particular test, the difference was about 250x. There were multiple calls into the C library so the ctypes wrapper was also executing Python code. The running time for the C library was very short which made the extra overhead for Python code even more significant. So the ratio will likely be different for you but was significant in my case.","Q_Score":25,"Tags":"python,c,ctypes,overhead","A_Id":8069179,"CreationDate":"2011-11-09T15:21:00.000","Title":"ctypes vs C extension","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a few functions written in C for a game project. These functions get called quite a lot (about 2000-4000 times per second). The functions are written in C for raw speed.\nNow, the easiest way for me to include these functions into Python is to use ctypes. The alternative is to write a C extension to Python around these functions (which takes quite a bit of extra effort). So I wondered, not including the initial loading of the DLL, how big is the overhead of ctypes?\n\nI'm using Python 2.7 (the standard CPython release), and I do not want to use an external library like Cython.\nI know this question has been asked before, but I haven't seen much information about the performance comparison between the two options.","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":7501,"Q_Id":8067171,"Users Score":9,"Answer":"The directly C coded interface has the potential to be much much faster. The bottleneck is the interface from Python to C and marshalling arguments and results may for example involve copying strings or converting Python lists to\/from C arrays. If you have a loop that makes several hundred of these calls and some of the data doesn't have to be marshalled separately for each call then all you have to do is recode the loop in C and you may be able to massively reduce the bottleneck. ctypes doesn't give you that option: all you can do is call the existing functions directly.\nOf course that all depends on exactly what sort of functions you are calling and what sort of data you are passing around. It may be that you can't reduce the overheads in which case I would still expect ctypes to be slower but perhaps not significantly.\nYour best best would be to put together some sample of your code written each way and benchmark it. Otherwise there are just too many variables for a definitive answer.","Q_Score":25,"Tags":"python,c,ctypes,overhead","A_Id":8067399,"CreationDate":"2011-11-09T15:21:00.000","Title":"ctypes vs C extension","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been requested to create an application with a webview in it.\nI've tried to import QtWebKit module but I have this error:\n\nTraceback (most recent call last):   File \"\", line 1, in\n   ImportError:\n  dlopen(\/Library\/Python\/2.6\/site-packages\/PyQt4\/QtWebKit.so, 2): Symbol\n  not found: _kCFWebServicesProviderDefaultDisplayNameKey   Referenced\n  from: \/Library\/Frameworks\/QtWebKit.framework\/Versions\/4\/QtWebKit\n  Expected in:\n  \/System\/Library\/Frameworks\/CoreFoundation.framework\/Versions\/A\/CoreFoundation\n\nIt's the only one module that returns this error. All other installed modules are ok. The file \/Library\/Python\/2.6\/site-packages\/PyQt4\/QtWebKit.so exists.\nWhat could the problem be?\nThank you all.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":503,"Q_Id":8077703,"Users Score":1,"Answer":"I was able to fix the problem by upgrading to MacOSX Lion, but if that is not an option I would just ensure that PyQt4 is not using qt4.8, which is where this issue was introduced. If I remember correctly, everything works well with qt4.7.4","Q_Score":1,"Tags":"python,macos,pyqt,osx-leopard,qtwebkit","A_Id":8760805,"CreationDate":"2011-11-10T09:57:00.000","Title":"PyQt4 ImportError for QtWebKit\u200f on Mac OS Leopard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started new clear Main Window project,\nThere are 4 Objects: MainWindow, centralWidget, menubar, and statusbar.\nI need to set default layout inside the window, so probably for centralWidget.\nBut I didnt found way how to do it.\nI can get LayoutWidget with some particular size into centralWidget.\nBut I want to set layout for the whole centralWidget.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":2793,"Q_Id":8095062,"Users Score":1,"Answer":"Add some widgets to the central widget first.\nThen select the central widget and use the \"Layout in a Grid\", \"Layout Vertically\", etc buttons on the toolbar to add a main layout.\nThe layouts in the \"Widget Box\" side-bar are used for adding child layouts to a main layout.","Q_Score":1,"Tags":"python,qt,pyqt","A_Id":8095328,"CreationDate":"2011-11-11T14:04:00.000","Title":"pyqt designer and layout for central widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started new clear Main Window project,\nThere are 4 Objects: MainWindow, centralWidget, menubar, and statusbar.\nI need to set default layout inside the window, so probably for centralWidget.\nBut I didnt found way how to do it.\nI can get LayoutWidget with some particular size into centralWidget.\nBut I want to set layout for the whole centralWidget.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2793,"Q_Id":8095062,"Users Score":3,"Answer":"Right click anywhere within your centralWidget go to the Lay Out sub menu and select the Layout you want. This will be applied automatically to all contents of your centralWidget. \nIn order to see how it works place inside it 2 or 3 push buttons and try changing the layouts.","Q_Score":1,"Tags":"python,qt,pyqt","A_Id":8095337,"CreationDate":"2011-11-11T14:04:00.000","Title":"pyqt designer and layout for central widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a software based on embedded Python and C++. I want to secure some of my python code and prevent people from copying it. \nFor now I am using PyRun_SimpleString to execute the python code and the string is generated using my C++ code. \nIf I use this method, will it secure the Python code from being copied?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":409,"Q_Id":8116901,"Users Score":0,"Answer":"So, as I understand it the actual program will not exist in the executable, either in python source form, nor in 'marshalled' form (basically .pyc image) or compiled form, though I guess it will exist in some encrypted or obfuscated form which is converted into python source at run time.\nThis definitely makes it harder to extract the code, but an attacker who can trace the code as it runs will be able to catch calls to PyRun_SimpleString and obtain the plain source.\nIt's a question of degree - how hard you want to work to make the job harder for the attacker.\nYou might want to look into the 'frozen module' facility which is in the python source. This basically allows '.pyc' images to compiled in as byte arrays, and imported at runtime by un-marshalling them. So there's never any plain text source, but there is the .pyc image which is reasonably easy to analyze if you find it in the image. Take it one step further and obfuscate the pyc image - now attacker needs to analyze or trace past the de-obfuscation, and still won't see plain source code.","Q_Score":1,"Tags":"python,security,embed","A_Id":8116988,"CreationDate":"2011-11-14T03:12:00.000","Title":"Can python source code executed using PyRun_SimpleString be extracted?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a library and some head files, no c++ source code, I want to use it with python.\nI tried py++, but gccxml report error.\nI tried swig, but some many \"undefined symbol\" errors.\nAre there some smart tools can do such things automatically?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2475,"Q_Id":8119799,"Users Score":0,"Answer":"This approach requires a bit a bit of work, and might not be feasible if you have a lot of functions, that you want to wrap\/the functions use a lot of c++ intrinsic types as arguments\/return values. \nIf that is not the case, you can define some c-wrapper functions, with the \"extern c\" keyword in front of them, with pure c arguments and return types. Compile and link the \"wrapper functions\" to your c++ library. Then you can use the ctypes module (from python) to call your wrapper functions, which then in turn call the c++ functions in your library.","Q_Score":3,"Tags":"c++,python","A_Id":8120273,"CreationDate":"2011-11-14T09:52:00.000","Title":"How to wrap a c++ library for python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I checked out wxPython and wxWidgets into two directories C:\\dev\\wx\\wxPtyhon and C:\\dev\\wx\\wxWidgets:\n\n\nmkdir \/D c:\\dev\\wx\\\ncd c:\\dev\\wx\ngit clone https:\/\/github.com\/wxWidgets\/wxPython.git\ngit clone https:\/\/github.com\/wxWidgets\/wxWidgets.git\n\n\nI successfully build wxWidgets by running:\n\n\ncd wxwidgets\\build\\msw\nmingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release\n\nThe problem is that when I try to build wxPython, it cannot find wx.h\n\nWXWIN=c:\\dev\\wx\\wxWidgets\n:: Note c:\\dev\\wx\\wxWidgets\\include\\wx\\wx.h exists !\n\nC:\\dev\\wx\\wxPython>python setup.py COMPILER=mingw32 BUILD_GLCANVAS=0 BUILD_ACTIVEX=0 WX_CONFIG=\"wx-config\" build_ext --inplace  \nPreparing CORE...                                                                                                               \nPreparing STC...                                                                                                                \nPreparing GIZMOS...                                                                                                             \nrunning build_ext                                                                                                               \nrunning build_ext                                                                                                               \nbuilding '_core_' extension                                                                                                     \nc:\\dev\\mingw\\bin\\gcc.exe -mno-cygwin -mdll -O -Wall -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREA\nD=1 -UNDEBUG -Iinclude -Isrc -IC:\\Python25\\include -IC:\\Python25\\PC -c src\/helpers.cpp -o build\\temp.win32-2.5\\Release\\src\\helpe\nrs.o -O3                                                                                                                        \nIn file included from src\/helpers.cpp:17:0:                                                                                     \ninclude\/wx\/wxPython\/wxPython_int.h:35:19: fatal error: wx\/wx.h: No such file or directory                                       \ncompilation terminated.                                                                                                         \nerror: command 'gcc' failed with exit status 1","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":727,"Q_Id":8125968,"Users Score":1,"Answer":"On Linux I got what seemed like an identical error.\nI removed the error in this manner:\n\nI used the find command to get a list of wx-config programs\nFrom the list, I chose a wx-config that seemed right & used\nits full path for WX_CONFIG","Q_Score":1,"Tags":"wxpython,wxwidgets","A_Id":10554783,"CreationDate":"2011-11-14T18:01:00.000","Title":"How to build wxPython trunk with mingw on Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to import a python library into SL4A. From my understanding, the easiest way to do this is to import the zipped files (egg files) of the python library into the SD Card and then import it into SL4A. Since I do not have an android device yet, I am working with the emulator. Whenever I try to push the zipped folder using the adb push command, it pops out an error saying the device is not connected. How do I push zipped files into the SD Card of an emulator and then access it via SL4A ? I want to use the commands in that library in the command line in SL4A.\nThanks !","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1245,"Q_Id":8141746,"Users Score":0,"Answer":"You can create your own sdcard image, put files on it and after that mount in emulator.\nTo create image you can use mksdcard <size> <file>: mksdcard 1024M sdcard1.iso. After that you need to mount sdcard: mount -o loop sdcard1.iso \/mnt\/cdrom\/. Next step: copy files, umount \/mnt\/cdrom\/ and point to image in virtual machine properties.","Q_Score":0,"Tags":"android,python,android-emulator,sl4a","A_Id":8142934,"CreationDate":"2011-11-15T19:09:00.000","Title":"ADB push command android emulator","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a beginning programmer and i need a way to get python to recognize a keyboard event. So far i can only find these methods in vPython or tkinter, and i want to simply use the normal python shell. if anyone can help me with a module name\/where i could download a module for free that would be very helpful. or simply the code if there is no need for a module.Thanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":318,"Q_Id":8161108,"Users Score":1,"Answer":"There is no generic \"keyboard event\", they all depend on what your environment is. \nIn a terminal there are no keyboard events at all, you simply get sent text on stdin. In Windows you need to use the Win32, on Unix you need to use the X11 API and on Mac you have to use whatever OS X uses is it Cocoa?). wxPython and tkinter all work on all these platforms to provide an API that works on all of them. And the same goes for other GUI toolkits of the same sort like KDE and GTK. So you should use one of those. Which one is a matter of taste, but since tkinter is included in Python, that seems the obvious choice. \nYou can call the respective API's for the respective platforms directly, but it's generally not worth the trouble.","Q_Score":0,"Tags":"python-3.x,keyboard-events","A_Id":8161308,"CreationDate":"2011-11-17T01:42:00.000","Title":"Recognition of keyboard event in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to add a popup dialog box on my GUI. \nSo, when ever I hover my mouse over a label, it should be able to show a popup( Like the type we get while hovering over a file in windows).\nIt should also disappear as soon i move away the mouse.\nTo start with, I am not even sure which module or class to use. I tried menu, but the results are not what i expected.\nI also tried to learn tkCommonDialog, but couldn't understand it properly.\nPlease Advice!","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":863,"Q_Id":8163195,"Users Score":1,"Answer":"Take a look at the Balloon widget in the Tix package. I think it is just what you are looking for.","Q_Score":3,"Tags":"python,popup,tkinter,tk,ttk","A_Id":8183103,"CreationDate":"2011-11-17T06:50:00.000","Title":"Popup Dialog in Tkinter\/Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I'm coding Pacman in Python just for fun and I want to create pacman's open face (when he is eating food) using Tkinter graphics. How exactly do I draw an open face? I was thinking about using canvas.create_arc to create the open mouth but it doesn't work properly :(\nAny help? Thanks!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2778,"Q_Id":8176599,"Users Score":2,"Answer":"You are correct that you would use the create_arc method. Set the start to 45 and the extent to 270 and it will look like pacman is facing to the right with his mouth open. \nSince you are just learning I'll not post the exact code so you'll have a chance to figure it out on your own.","Q_Score":2,"Tags":"python,tkinter,pacman","A_Id":8189097,"CreationDate":"2011-11-18T01:10:00.000","Title":"Drawing Pacman's Face in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a simple project (the language doesn't really matter\/but I prefer C++) which simply takes a window title as it's input and duplicate it's visual part, bit by bit, to a new window. just like a mirror better I'd say.\nAs far as I remember there was a win32 API for this but I can't remember, so would you please tell me how can I achieve this?\nAnd please tell me, will your answers work with DirectX\/Open-GL applications as well or not?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":226,"Q_Id":8196618,"Users Score":0,"Answer":"You can get DC of first window, and get DC of second window. And after this do BitBlt or StretchBlt. It has to work... But I don't know what about DirectX\/Open-Gl... I think it has to work too. But anyway. It won't take much time to check it.","Q_Score":3,"Tags":"c++,python,c,winapi,api","A_Id":14110911,"CreationDate":"2011-11-19T19:24:00.000","Title":"How to duplicate a window's clientarea to another window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have this cellphone which runs Android OS 2.6. Due to some reasons, I want to write code directly on my cellphone just as what we do in front of our PC.\nSo,\n\nCan we make the Android cellphone a develop-platform? I mean write\/compile\/run C code on Android cellphones?\nIf we can, how?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":4409,"Q_Id":8200317,"Users Score":1,"Answer":"I installed sl4a which eventually gave me a sandboxed perl\/python\/tcl\/lua enviroment. I then found their binaries in the shell and relocated them to my path so I could call them from cli. I also purchased c4droid and found that it had the tiny c binary in the shell.","Q_Score":2,"Tags":"android,python,c,platform","A_Id":8921098,"CreationDate":"2011-11-20T08:24:00.000","Title":"Write C\/C++\/Python code on an Android cellphone","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"that it is possible to get the mouse position in wxpython using \nevent.GetPosition()\nhowever, is it possible to get the position of a mouse in a sizer? Would this work even in an expanding sizer?\nThanks.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":852,"Q_Id":8221586,"Users Score":3,"Answer":"The X,Y position in a sizer is exactly the same as the window that the sizer belongs to, assuming that the sizer is the sizer assigned to that window.  If you've got nested sizers then you can use sizer.GetPosition and sizer.GetSize to figure out if the position is inside that nested sizer.  \nHowever I would guess that the knowing the mouse position within the sizer is not going to be very useful.  You are probably wanting to know which item within the sizer that the mouse position is over, like a HitTest type of method.  You can implement something like that using the sizer.GetChildren() method and iterate over its items (they are wx.SizerItem objects) and look at the item's position and size to find the one that has the point within it.  If the item is a sizer then you can recursively descend to that sizer and do the same thing until you find the leaf item at the desired point.","Q_Score":1,"Tags":"python,wxpython","A_Id":8234755,"CreationDate":"2011-11-22T03:22:00.000","Title":"Get mouse position in sizer? wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"that it is possible to get the mouse position in wxpython using \nevent.GetPosition()\nhowever, is it possible to get the position of a mouse in a sizer? Would this work even in an expanding sizer?\nThanks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":852,"Q_Id":8221586,"Users Score":0,"Answer":"Sizers don't work with absolute positioning. They're for relative positioning. Sizers are the best at making your layout look right across multiple platforms and themes. If you really want to be able to insert stuff at specific x-y coordinates, then don't use a sizer.","Q_Score":1,"Tags":"python,wxpython","A_Id":8234664,"CreationDate":"2011-11-22T03:22:00.000","Title":"Get mouse position in sizer? wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a monte carol pricer and I need to improve the efficiency of the engine.\n\nMonteCarlo path are created by a third party library (in c++)\nPricing is done in IronPython (script created by the end user)\nEverything else is driven by a c# application\n\nthe pricing process is as follow:\n\nC# application request the path and collect them\nC# application push the paths to the script, who price and return the values\nC# application display the result to the end user\n\nThe number and size of the paths collected are know in advance. \nI have 2 solutions with some advantages and drawback:\n\nRequest path generation, for each path, ask the script to return the result and finaaly aggregate the results once all paths are processed\nRequest path generation, collect all of them, request the script to process all of them at once and retrun me the final price\n\nThe first solutions work fine in all scenarios but as the number of path requested increase the performance decrease (I think it's due to the multiple call to ironpython)\nThe second solution is faster but can hit an \"out of memory\" exception (I think it's not enough virtual memory addressing space) if the number of path requested is too large\nI choose the middle ground and process a bunch of path then aggregate the prices.\nWhat I want now is to increase the performance futher by knowing in advance how many path I can process withou hitting the \"out of memory\" exception\nI did the math and I know in advance the size (in memory) of path for a given request. However because I'm quiet sure it's not a memory problem but more virtual memory addressing issue\n\nSo all this text is summarize by the following 2 questions:\n\nIs it possible to know in advance how much virtual memory address my\nprocess wil need to store n instance of a class (size in memory and structure are known)?\nIs it possible to know how much virtual memory address are still available for my process\n\nbtw I'm working on the 32 bit computer\nThanks in advance for the help","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":871,"Q_Id":8257686,"Users Score":1,"Answer":"Finding out how much memory an object takes in .NET is a pretty difficult task. I've hit the same problem several times. There are some imperfect methods, but none are very precise.\nMy suggestion is to get some estimate of how much a path will take, and then pass a bunch of them leaving a good margin of safety. Even if you're processing them just 10 at a time, you've reduced the overhead 10 times already.\nYou can even make the margin configurable and then tweak it until you strike a good balance. An even more elegant solution would be to run the whole thing in another process and if it hits an OutOfMemoryException, restart the calculation with less items (and adjust the margin accordingly). However, if you have so much data that it runs out of memory, then it might be a bit slow to pass it across two processes (which will also duplicate the data).\nCould it be that the memory overflow is because of some imperfections in the path processor? Memory leaks maybe? Those are possible both in C++ and .NET.","Q_Score":3,"Tags":"c#,memory-management,ironpython","A_Id":8257843,"CreationDate":"2011-11-24T13:16:00.000","Title":"Virtual memory address management in c#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've tested pyglet and I'm sure pyglet works well.\nBut when I ran the script in samples\/hello_world_actions.py , or anything with color, only thing in the Scene is Label.\nCould anyone tell me what has happend?\nPS:my env :\nPython2.7 cocos2d 0.5.0 pyglet 1.1.4\nWindows7","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":172,"Q_Id":8264192,"Users Score":1,"Answer":"I try to rollback the graphics driver to the old version, the issue is resolved.","Q_Score":1,"Tags":"windows-7,python-2.7,cocos2d-python","A_Id":9655468,"CreationDate":"2011-11-25T02:08:00.000","Title":"The Sprites and ColorLayers in cocos2d-python doesn't work","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way that I can build an interactive text console using wxPython window application? It will be used to allow user to provide natural language input for the application to parse the grammar based on the language selected. It is not going to be used to run any shell or commands.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":194,"Q_Id":8280667,"Users Score":0,"Answer":"You can use a wx.TextCtrl for input and then when the user is done typing, you can have them press a button to do whatever checking you want done. Alternatively, you could use a wx.Timer to watch for idleness so when the user is idle for x seconds, it does the checking you want automatically too.","Q_Score":0,"Tags":"python,user-interface,console,wxpython","A_Id":8298887,"CreationDate":"2011-11-26T18:39:00.000","Title":"Specialized Text Console in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a wxPython GUI where I currently configure some of the widgets and some default values by using \"import data\" for a module file containing several lists.\nBut I need to compile the whole program using py2exe for a user without a python installation.\nIn so doing, I lose the capability of letting the user edit the data.py file to change\nthose configuration defaults.\nI could put each list as a series of text strings and read and parse the whole thing, but that\nseems like a huge waste when python already can do all that by a simple import statement.\nI could probably do it with xrc\/xml or perhaps ConfigParser but it would seem there should be an easy way to sort of\nimport data.txt\nor something similar and let python do it's thing!  Then when py2exe gets hold of it it, it wouldn't create un-editable byte-code for the data.txt file.\nAny suggestions?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":290,"Q_Id":8281067,"Users Score":0,"Answer":"files that are imported are bundled in the executable by py2exe. The way to go is to use a configuration file that you package with your executable in a zip or with Inno Setup. Configuration files are files made to be changed at some moment, contrarily a user should not be modifying a python script. I tell you because some 'negative' experiences to say something polite.\nFor my programs (practically all use wxPython GUIs) I use to have a py module with configuration data (directories, etc) and some globals. This module is used to load default parameters if the program does not find my .ini file or if that especific parameter has not been set in the ini. Then I distribute everything (exe and auxiliary files) with inno setup.","Q_Score":1,"Tags":"python,py2exe","A_Id":8281140,"CreationDate":"2011-11-26T19:41:00.000","Title":"How to retain an \"import\" capability after py2exe compile","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want my Python program to be AppleScript-able, just like an Objective C program would be. Is that possible?\n(Note, this is not about running AppleScript from Python programs, nor about calling Python programs from AppleScript via Unix program invocation. Those are straightforward. I need genuine AppleScriptability of my program's operations.)\nThere is some documentation about how to do this. Python 2.7.2 documentation describes MiniAEFrame, for example, but even a minimal reference to from MiniAEFrame import AEServer, MiniApplication dies with an ImportError and a complaint that a suitable image can't be found \/ my architecture (x86) not supported. Rut roh! It seems that MiniAEFrame might pertain to the earlier (\"Carbon\") API set. In other words, obsolete.\nThere's a very nice article about \"Using PyObjC for Developing Cocoa Applications with Python\"\n(http:\/\/developer.apple.com\/cocoa\/pyobjc.html). Except it was written in 2005; my recently-updated version of Xcode (4.1) doesn't have any of the options it describes; the Xcode project files it provides blow up in an impressive build failure; and the last PyObjC update appears to have been made 2 years ago. Apple seems to have removed all of the functions that let you build \"real\" apps in AppleScript or Python, leaving only Objective C. \nSo, what are my options? Is it still possible to build a real, AppleScriptable Mac app using Python? If so, how?\n(If it matters, what I need AppleScripted is text insertion. I need Dragon Dicate to be able to add text to my app. I'm currently using Tk as its UI framework, but would be happy to use the native Cocoa\/Xcode APIs\/tools instead, if that would help.)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":206,"Q_Id":8282352,"Users Score":0,"Answer":"You can also use the py-aemreceive module from py-appscript. I use that to implement AppleScript support in my Tkinter app.","Q_Score":5,"Tags":"python,xcode,applescript","A_Id":13686960,"CreationDate":"2011-11-26T23:13:00.000","Title":"Can a program written in Python be AppleScripted?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I need to create a GUI in Python for a client server interaction. The GUI is on the client side for which I want to create complex tables. I tried to use wxPython's grid class, but its too tough to create a complex table in that. I saw a couple of examples for simple table layouts. \n I tried to put up a snapshot of the complex table layout but the site doesn't allow me to. So, I am just drawing a format here : \n[ Blah Blah      Heading ]\n--------------------------\n[col1] | [col 2] | [col 3]\n--------------------------\n   |   |    |    |   |   |\n   |   |    |    |   |   |\n   |   |    |    |   |   | \nCan someone please help regarding how to draw the complex layout and which module to use?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":903,"Q_Id":8290781,"Users Score":0,"Answer":"Tkinter would be enough for this.\nYou can create any level of complexity on the layout even with the \"grid\" \nlayout manager, which allows you to specify \"columnspam\" and \"rowspam\" for widgets that\nwill take more than a single cell.","Q_Score":1,"Tags":"python,user-interface,tablelayout","A_Id":8295831,"CreationDate":"2011-11-28T02:03:00.000","Title":"Draw complex table layout in Python GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using pygame to write a program and I need some GUI configuration text field and button for control. I've already made the button using pygame, but I just can write a text field out of pygame. Maybe I need to use tkinter together with pygame.\nI think if there is no way to made to pygame part and tkinter part together in 1 window, then I could put them into 2 separate windows.\nI hope the tkinter part can update the global variable in my pygame part, would there if any problem? I might create a child process of tkinter from the pygame part so that the tkinter part can probably \"see\" the global variable in pygame part and modify them.\nCan I do this? Are there any pitfalls?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":6571,"Q_Id":8291274,"Users Score":1,"Answer":"I have also found pgu is awful. However, what you say about the tkinter event loop taking control is wrong. You just call root.update instead of mainloop, and this can go inside of a while loop to replace the mainloop. Answering your main question however, there is something you should be aware of. It seems that whenever I run the two programs alongside each other, this traceback occurs:\nTclError: expected boolean value but got \"-1\"\nFatal Python error: (pygame parachute) Segmentation Fault\nThis application has requested the Runtime to terminate it in an unusual way.\nPlease contact the application's support team for more information.\nBecause of this I would avoid the combination, although I suspect this particular issue may pertain to my use of threads.","Q_Score":8,"Tags":"python,tkinter,pygame","A_Id":23665352,"CreationDate":"2011-11-28T03:39:00.000","Title":"Is there anything I need aware of using Tkinter and pygame together?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a Python implementation of Dawkins' biomorphs as described in his book, The Blind Watchmaker.\nIt works like this: A parent organism is displayed, as well as its offspring which are just mutated versions of the parent. Then the user clicks on a descendant it wants to breed, and all the offspring will \"evolve\" based on cumulative selection. \nWhat I'm unsure of is how to get started in Python. I've already created genetic algorithm and l-system programs that are supposed to be used. The l-system program evolves trees given certain parameters (which is my goal in this biomorph implementation), and the genetic algorithm program evolves the genotypes that are created in the l-system program. \n\nWhat library would be good to use (turtle, pygame, etc)?\nI am familiar with turtle, but the documentation says, \"To use multiple turtles an a screen one has to use the object-oriented interface.\" I'm not sure what that means. The reason I thought of using multiple turtles on a screen is to have the the parent and its descendants displayed on one screen, as they are in online apps. Then the user can click on the organism it wants to breed by using mouse events. Is this a good idea, or is there better way to do it?\n\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":718,"Q_Id":8299966,"Users Score":1,"Answer":"Depending on graphical requirements, I would say that for a lightweight app you could get away with PyQt or PyGame. For more demanding real-time graphical requirements you could use something like PyOgre or PyOpenGL.\nYou may need to also research graph-layout\/data-visualisation algorithms or libraries (e.g. dot) depending on your UI goals.","Q_Score":3,"Tags":"python","A_Id":8425387,"CreationDate":"2011-11-28T17:40:00.000","Title":"Biomorph Implementation in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project that has code which will communicate with a python script and call python functions. In the proj file, i've added the includePath for the python header files, and added external python library to the project (python27.a). However the qt compiler gave me an error:\n\nNo rule to make target\n\/home\/pgeng\/work\/OpenModelica-rev.9876.CSA\/OMEdit\/OMEditGUI\/..\/..\/..\/..\/..\/..\/usr\/lib\/python2.7\/libpython2.a\n, needed by ..\/bin\/OMEdit. Stop\n\nWhat does this mean? How can i fix it? this is anything related to PyQt?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":107,"Q_Id":8313051,"Users Score":1,"Answer":"It seems like libpython2 is missing.\nYou will have to :\n\nFind out what package provides this library.\nYou can Google for that.\nOr search a repo for the lib.","Q_Score":0,"Tags":"python,qt,dll,pyqt","A_Id":8314327,"CreationDate":"2011-11-29T15:07:00.000","Title":"Error on connecting to python libraries","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python program that implements pygtk for GUI.  I have it running successfully on some MAC computers running os 10.6.*, after installing pygtk with macports.  I have just installed pygtk on a mac 10.5.8 system.  When I execute the program I get these errors:\n\nXlib:  extension \"RANDR\" missing on display \"\/tmp\/launch-CQ7og4\/:0\".\n\nand \n\nADP_2.1.py: Fatal IO error 35 (Resource temporarily unavailable) on X server \/tmp\/launch-CQ7og4\/:0.\n\nAfter this second error the program does not continue.  I looked at the \/tmp\/launch-CQ7og4\/ directory and there is only \":0\" in there.\nOn the other Macs that run this program the first Xlib warning always appears but the program still runs seemingly correctly.\nAny help would be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":674,"Q_Id":8342215,"Users Score":1,"Answer":"You need to install X11-2.6.*","Q_Score":0,"Tags":"python,pygtk,x11,osx-leopard","A_Id":9190899,"CreationDate":"2011-12-01T13:35:00.000","Title":"X11 errors with pygtk on Mac OS X 10.5.8","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a program in Python that generates a 10,000 tile coordinate plane with each tile having characteristics such as texture, temperature, elevation etc. I am doing this for a project and thought a much better way to show this part of the project would be to show a 3d rendering of it and the best program i know for that is Blender. I know scripts can be written in Python for Blender but I'm not sure how blender can generate things based off of a text file that my Python program writes to. If anyone knows if and how Blender can generate things from a text file or any other way i could have my Python program write to Blender would be excellent!\n~ Thanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1046,"Q_Id":8350067,"Users Score":1,"Answer":"You will have to make a Python script for that - that would read your text file and use blender API internally to create the tiles and the scene. Blender can only render files if it does have programs (plug-ins) that do that. Actually most file-formats can be read by blender just due to plug-ins implemented in Python that are shipped with the program.\nAlternatively, you can adapt your program that generates the scene to be able to, beyond generating the text file, to draw it inside blender using its API instead. This approach might be easier than writing a separate logic to parse your own file.\nIf your script is Python2.x you will have to use blender 2.49 - as Blender 2.5 and newer versions use Python 3 for scripting.","Q_Score":4,"Tags":"python,blender,render-to-texture","A_Id":8431966,"CreationDate":"2011-12-01T23:55:00.000","Title":"Can Blender generate a scene based off of a text file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using py2exe to make executable.\nI want to know how to pause the program until a button is pressed..  just like we do in C using system(\"pause\");\nAs the program terminates automatically in windows, I need this tool.\nIs there anything better than py2exe which does similar work ?","AnswerCount":3,"Available Count":1,"Score":-0.1325487884,"is_accepted":false,"ViewCount":21409,"Q_Id":8370135,"Users Score":-2,"Answer":"import os\nThen in your code\nos.system(\"pause\")","Q_Score":2,"Tags":"python,py2exe","A_Id":23424057,"CreationDate":"2011-12-03T18:59:00.000","Title":"how to pause a program until a button is pressed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Pygame and Pyglet are for 2D game development.\nPysoy needs many requirements to be installed.\nI can't figure out how to install Pyogre.\nPanda3d is giving me this error and don't know how to fix it.\n\n\nimporterror no module named direct.showbase.showbase\n\nIs there any other good 3D game development library that could be installed on Windows XP with Python 2.7?  I prefer to install it using pypm or pypi to avoid possible errors that I'm currently having with Panda3d.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2006,"Q_Id":8370951,"Users Score":0,"Answer":"You can use pyopengl.\ni think you might have to install pygame...","Q_Score":0,"Tags":"python,3d","A_Id":8874392,"CreationDate":"2011-12-03T20:57:00.000","Title":"What is the best Python library for 3D game development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I intend to write a networking application with a GUI frontend, presumably using GTK.\nI'm completely new to GTK (and GUI programming in general). My current guess would be to use two threads, one that handles networking and the other one running the GTK frontend.\nIs this the common design pattern for this kind of problem or are there better alternatives, e.g. handling networking from within the GTK main loop?\nIf I have to resort to using two threads, what's the best way to tell the GTK thread that there's data available from the networking thread?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":762,"Q_Id":8371453,"Users Score":1,"Answer":"First thing to read up on in GUI programming is the Model View Controller pattern.  You want to separate the data flow from the GUI as much as possible.  The networking code updates the data model.  When the data model has changed, it signals the front end so the GUI can redraw.","Q_Score":2,"Tags":"python,c,gtk,pygtk","A_Id":8371633,"CreationDate":"2011-12-03T22:13:00.000","Title":"GTK networking app: need design pattern","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using QItemSelectionModel with QTableView to allow the users to select rows. The problem is that when the user then clicks on a column header to sort the rows, the selection disappears and all the sorted data is displayed. How can I keep the selection, and just sort that, rather than having all the rows appear?\nThanks!\n--Erin","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":623,"Q_Id":8388659,"Users Score":0,"Answer":"Here is the way I ended up solving this problem:\n\nWhen row selections are made, put the unique IDs of each hidden row into a list, then hide all hidden rows\nUse self.connect(self.myHorizontalHeader, SIGNAL(\"sectionClicked(int)\"), self.keepSelectionValues) to catch the\nevent when a user clicks on a column header to sort the rows\nIn self.keepSelectionValue, go through each row and if the unique ID is in the hidden row list, hide the row\n\nThis effectively sorts and displays the non-hidden rows without displaying all the rows of the entire table.","Q_Score":0,"Tags":"python,pyqt","A_Id":8539266,"CreationDate":"2011-12-05T16:41:00.000","Title":"How can I keep row selections in QItemSelectionModel when columns are sorted?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've read that in CPython, the interpreter stack (the list of Python functions called to reach this point) is mixed with the C stack (the list of C functions that were called in the interpreter's own code). If so, then how are generators and coroutines implemented? How do they remember their execution state? Does CPython copy each generator's \/ coroutine's stack to and from an OS stack? Or does CPython simply keep the generator's topmost stack frame on the heap, since the generator can only yield from that topmost frame?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":6580,"Q_Id":8389812,"Users Score":21,"Answer":"The yield instruction takes the current executing context as a closure, and transforms it into an own living object. This object has a __iter__ method which will continue after this yield statement.\nSo the call stack gets transformed into a heap object.","Q_Score":58,"Tags":"python,coroutine","A_Id":8390077,"CreationDate":"2011-12-05T18:10:00.000","Title":"How are generators and coroutines implemented in CPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've read that in CPython, the interpreter stack (the list of Python functions called to reach this point) is mixed with the C stack (the list of C functions that were called in the interpreter's own code). If so, then how are generators and coroutines implemented? How do they remember their execution state? Does CPython copy each generator's \/ coroutine's stack to and from an OS stack? Or does CPython simply keep the generator's topmost stack frame on the heap, since the generator can only yield from that topmost frame?","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":6580,"Q_Id":8389812,"Users Score":54,"Answer":"The notion that Python's stack and C stack in a running Python program are intermixed can be misleading.\nThe Python stack is something completely separated than the actual C stack used by the interpreter. The data structures on Python stack are actually full Python \"frame\" objects (that can even be introspected and have some attributes changed at run time). This stack is managed by the Python virtual machine, which itself runs in C and thus have a normal C program, machine level, stack.\nWhen using generators and iterators, the interpreter simply stores the respective frame object somewhere else than on the Python program stack, and pushes it back there when execution of the generator resumes. This \"somewhere else\" is the generator object itself.Calling the method \"next\" or \"send\" on the generator object causes this to happen.","Q_Score":58,"Tags":"python,coroutine","A_Id":8391403,"CreationDate":"2011-12-05T18:10:00.000","Title":"How are generators and coroutines implemented in CPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been using REALbasic for a number of years to develop cross-platform apps.  I have become frustrated developing with a proprietary language and so have decided to change languages and have settled on Python and QT.\nSince I know no Python, would people recommend Python 2 or 3?\nI think I will be using PyQt or PySide. I know that of these two, only PyQt (currently) supports Python 3.  Does this give enough of an advantage over PySide? It's just that PySide seems to have a 'cleaner' syntax.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":567,"Q_Id":8396569,"Users Score":1,"Answer":"PySide and PyQt4 are almost identical. In fact, you can often replace PyQt4 with PySide (and vice versa) in your code's import declarations.\nPython2 and Python3 are almost identical as well, with a few minor changes that a beginner won't notice for a while (aside from print being made a function).\nPython2 has more support in terms of modules (Python3 broke backwards-compatibility with Python2), so I'd suggest you use Python2 until you figure out a reason to switch to Python3. There really is no benefit, as both releases are maintained separately.\n\nIn short, stick with the stuff that's known to work.","Q_Score":0,"Tags":"python,qt,user-interface,pyqt,pyside","A_Id":8396619,"CreationDate":"2011-12-06T07:26:00.000","Title":"Best setup to develop cross-platform GUI-based apps using Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Background:\nI am writing an ebook editing program in python. Currently it utilizes a source-code view for editing, and I would like to port it over to a wysiwyg view for editing. The best (only?) html renderer I could find for python was webkit (I am using the PyQt version).\nQuestion:\nHow do I accomplish wysiwyg editing? The requirements\/issues are as follows:\n\nAn ebook may be up to 10,000 paragraphs \/ 1,000,000\ncharacters.\n\nPyQt Webkit (ContentEditable): No problem.\nPyQt Webkit (TinyMce, etc): Takes forever to open them!\n\nThe format is <body><p>...<\/p><p>...<\/p>...<\/body>. The body element contains only paragraphs, there are no divs, etc (but in the paragraph there may be spans, links, etc.). Editing must take place with no significant delays as far as the user is concerned.\n\nPyQt Webkit (ContentEditable): If you try deleting text across multiple paragraphs, it takes forever!! My understanding is that this is because it resets the common-parent of the elements being changed - i.e. the entire body element, since two different paragraphs are being deleted\/merged. But, there should be no need for this - it should need only delete\/merge\/change those individual paragraphs!\n\n\nI am open to implementing my own wysiwyg editing, but for the life of me I can't figure out how to delete\/cut\/paste\/merge\/change the html code correctly. I searched online for articles about html wysiwyg design theory, and came up dry.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1587,"Q_Id":8412215,"Users Score":1,"Answer":"Can i suggest a complete another approach ? Since your ebook is only <p><\/p>:\n\nSplit the text on <p><\/p> to get an indexed array of all your paragraphs\nMake your own pagination system, and fill the screen with N paragraphs, that automatically get enough text to show from the indexed array\nWhen you are doing selection, you can use [paragraph index + character index in the paragraph] for selection start \/ end\nThen implement cut\/copy\/paste\/delete\/undo\/redo based on thoses assumptions.\n\n(Note: when you'll do a selection, since the start point is saved, you can safely change the text on the screen \/ pagination, until the selection end.)","Q_Score":2,"Tags":"python,html,wysiwyg","A_Id":8413073,"CreationDate":"2011-12-07T08:17:00.000","Title":"Python\/Javascript: WYSIWYG html editor - Handle large documents fast and\/or design theory","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"In CPython, I think, import means compile the py file to a pyc file and execute the file in the current frame, and the next time CPython will load the pyc file directly without compiling again. What about import in ironpython? I guess ironpython don't have a pyc-like format. Does it compile every time when import?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":499,"Q_Id":8426999,"Users Score":7,"Answer":"Yes, IronPython recompiles the imported module on every run. Twice, actually.\nIt's complicated.\nOn the first pass, the Python code is parsed into an AST, the AST is converted into a DLR expression tree, and the expression tree is stored. When it is time to execute it, the expression tree is compiled into a set of instructions for a simple stack-based interpreter and the module code is executed on that interpreter. It's not fast when running, but it has very little start up time.\nAfter a piece of code has run for a while, IronPython gets fed up with how slow it is, goes back to the expression tree, and recompiles the code into a .NET delegate. This means that it gets converted to MSIL and then native code by the .NET JIT. This code is fast to execute, but takes time to create.\nThis conversion is done a per-function (or even per-loop) basis, so that if you use one function from a module repeatedly and none of the rest, only the one commonly-used function will undergo full IL code generation and JITting.\nNone of this compilation is saved to disk, however. The pyc.py program included with IronPython can precompile the code, but it's not done automatically because the code generated at runtime is different than the code generated by pyc.py. The runtime code is usually collectible, while the code generated by pyc.py is not - and generating non-collectible code at runtime leads to memory leaks. pyc.py should make imports faster by saving a few steps, but I'm not sure by how much.","Q_Score":6,"Tags":"python,import,ironpython,dynamic-language-runtime","A_Id":8434676,"CreationDate":"2011-12-08T06:19:00.000","Title":"What happens when import a module in ironpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project that contains a QTreeWidget. This widget will have Parent nodes with childs nodes and or other siblings nodes. Attached to each node will be a unique ID in the form of an integer as well as a name.  \nNow..... what methods can or should I use to save all the nodes in the QTreeWidget to  disk and how to read them back in?????\nWhat I would do is traverse the tree and save each node into a sqlite DB. I already can do that in exactly the same order as it is in the tree. BUT...... QTreeWidget and its related QTreeWidgetItem objects do NOT have a uniq index that you can USE to insert other nodes around.\nWhen I rebuild the tree, childs have to be attached to their parents\/ancestor (which by then exists in the tree). To do so I keep track of the Parents and their IDs I already added to the tree, like (parent name, parentID) inside an array. Note that the parentID has nothing to do with location as a node inside the QTreeWidget\/WidgetItem. It is created by myself and stored insite the sqlite db allong with the name of the node just as some sort of tag since QTreeWidget\/QTreeWidgetItem does not supply any.\nTo determine the correct parent I\n\ntake the ParentID from the sqlite DB,\nsearch the array or the QTreeWidget for that same ID,\nselect that parent in the QTreeWidget,\nadd the sqlite db item as a child node to the parent in the\ntreeview.\n\nBut it feels clumsy this way, because of the search each time a node is added and because of a missing index inside the QTreeWidget\/WidgetItem I can use for inserting nodes around.\nI know this should be done much more elegant and less resource intensive.\nI'm not looking for exact coding examples but more for ideas and hints of the methods and properties to use from QTreeWidget and QTreeWidgetItem. \nAny ideas?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2266,"Q_Id":8432620,"Users Score":0,"Answer":"I managed this by using the data property of the TreewidgetItem by setting a value in it. Using that value as a reference to find one or more or even all TreewidgetItem(s) makes it easy to save a complete tree.","Q_Score":2,"Tags":"python,sqlite,pyqt,qtreewidget,qtreewidgetitem","A_Id":14873799,"CreationDate":"2011-12-08T14:35:00.000","Title":"QTreeWidget and PyQt: Methods to save and read data back in from file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can I execute Python on Windows Phone? I have heard about IronPython but is it the way to go when I need to compile to a lot of existing Python code for Windows Mobile?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":967,"Q_Id":8436112,"Users Score":2,"Answer":"Only (some) mananged .net languages are supported on Windows Phone (note. this is not the same as Windows Mobile).\nIronPython is the only option available to you when it comes to executing python code on the phone.","Q_Score":0,"Tags":".net,python,windows-phone-7","A_Id":8436266,"CreationDate":"2011-12-08T18:54:00.000","Title":"Python on Windows Phone?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a beginner in python. For practice reasons I want to learn how to upload a python code to a website.\nI have a domain and web hosting service, however I'm really confused about how to integrate my code with a\nweb page on my website.\n(I have a decent bit of knowledge with Tkinter)\nCan anybody show me how to upload this simple function to my website?:\nThere are two entries on the interface for the user to enter two numbers. On pressing a button a new\nwindow(web page) with the answer displayed.\nThank you.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3068,"Q_Id":8453362,"Users Score":0,"Answer":"I would recommend you look at something like Django and mod_wsgi.\nGenerally helps if you have shell access to the server.","Q_Score":0,"Tags":"python,interface,upload,web","A_Id":8453549,"CreationDate":"2011-12-10T00:25:00.000","Title":"Simple python code to website","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I build a range slider from which I can get the range of two values, e.g., min and max? The scale widget seems not meet this requirement. I can only get one value from it and I don't want to use two scale to do this. \nThanks","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1222,"Q_Id":8453871,"Users Score":2,"Answer":"You could create one by drawing the individual parts of the widget on a canvas. It's pretty easy to add bindings for dragging things around.","Q_Score":3,"Tags":"python,tkinter","A_Id":8458598,"CreationDate":"2011-12-10T02:08:00.000","Title":"How to build a range slider using tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm building simple PyGTK app with Glade.\nIn one dialog I have table layout with labels in first column, and text entries in second column.\nThe problem is that two columns have always same width, and I want 2nd column to be wider then the first one.\nHow can I achieve that?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1466,"Q_Id":8455516,"Users Score":2,"Answer":"If you use a gtk.Table to display your widgets in your dialog. You can set the homogeneous property to False, so that cells in the table don't have the same dimensions.\nAfter that, if the largest widget in the second column is wider than the largest widget in the first column (which I assume is your case), then the secound column will be wider than the first column as you need.","Q_Score":2,"Tags":"python,pygtk,glade","A_Id":8456076,"CreationDate":"2011-12-10T09:11:00.000","Title":"Setting separate GtkTable column width","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The FileDialog in pyqt is an excellent way to get one path for a file from the user, but is there a good way to get a large number of file selections from the user?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5368,"Q_Id":8498475,"Users Score":0,"Answer":"I would suggest you to let the user use drag & drop to add files directly from their favorite file browser. As I did this in wxpython without any trouble and user-feedbacks are pretty good :)","Q_Score":1,"Tags":"python,pyqt,pyqt4,qfiledialog","A_Id":8498496,"CreationDate":"2011-12-14T01:17:00.000","Title":"PyQt: How can I get a large list of filenames from the user?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the fastest or most efficient way of maintaining some sort of array for pixels on a screen in Python ? I don't want to use game libraries, just a simple array as I already have parts of it done without any libraries.\nI'm developing a program which moving random stuff around the screen and i need to know whether a portion of the screen is already being used. what do you think ?\nShould i be maintaining an entire array for the whole screen with 0s and 1s for on and off ?\nor perhaps just a list of 'currently used pixels' ? \nor could i use sets for this ? as they don\u2019t seem to store something twice.\nnot sure if you could somehow try and store a new pixel in it and use the failure as a result of that pixel is already used. \nor.. perhaps you have another idea that is better than what I've thought of so far.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":57,"Q_Id":8513821,"Users Score":0,"Answer":"Since you're going to be bouncing off these boundaries, use a range of values to indicate the angle of the surface rather than just 0 or 1. Keep the array the same way you're storing the image pixels.","Q_Score":0,"Tags":"python,graphics","A_Id":8513902,"CreationDate":"2011-12-15T00:56:00.000","Title":"Speedy lookups from some kind of table (for graphics collisions)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using the pyglet (OpenGL) library and I want to be able to change the virtual resolution without changing the size of the window. For example a 2x2 box would be drawn as 4x4 pixels on the screen. I know I can find everything that is being draw and scale it individually, but this would probably be costly.\nI could not find a solution for this online (if it even exists), so any help would be greatly appreciated.\nClarification: I am thinking along the lines of the resolution settings in most games. The window stays in full screen at the same size, but the scale changes.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2504,"Q_Id":8556589,"Users Score":2,"Answer":"Clarification: I am thinking along the lines of the resolution settings in most games. The window stays in full screen at the same size, but the scale changes.\n\nNo, the window does change the size, because the screen resolution is changed, and the window follows.\nHowever what you intend to do it perfectly possible: First render your image to a FBO of the desired smaller size, then render the contents of that FBO covering the full window. In the case a 3D engine uses some form of post processing (like for depth of field, color grading, compositing effects), this comes virtually for free.","Q_Score":2,"Tags":"python,opengl,scale,resolution,pyglet","A_Id":8559413,"CreationDate":"2011-12-19T02:39:00.000","Title":"Scale Resolution in Pyglet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using wxpython and I would like to get all the elements in the listbox and returned in a list.\n(Almost like the Oposite of the \"Set\" function)\nExample:\nListbox has\nDog \nCat\nFun\nThe function should return [\"Dog\",\"Cat\",\"Fun\"]\nThanks","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":603,"Q_Id":8556752,"Users Score":1,"Answer":".GetItems()\nThis function can get all elements in your Listbox as a list.","Q_Score":2,"Tags":"wxpython,wxwidgets","A_Id":8556812,"CreationDate":"2011-12-19T03:13:00.000","Title":"How to get listbox elements in a list? wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have .ui, .py and .pyc files generated. Now, when I edit the .py file, how will it reflect changes in the .ui file? How do I connect .the ui and .py files together as QT designer allows only .ui files for running purposes?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":227,"Q_Id":8571366,"Users Score":0,"Answer":"the .py file generated from pyuic is not supposed to be edited by the user, best way it is intended to use is to subclass the class in .py file into your own class and do the necessary changes in your class..","Q_Score":0,"Tags":"python,pyqt","A_Id":8571839,"CreationDate":"2011-12-20T05:57:00.000","Title":"Running .py files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wanted to recompile PIL after having installed libjpeg because it threw the decoder jpeg not available whenever I tried importing JPEG images.\nSo, I've downloaded libjpeg, compiled it and installed it. Then I removed the .\/build folder from PIL's source cache, and recompiled it (using sudo python setup.py install). \nNow the selftest.py thing is failing with *** The _imaging C module is not installed. I have no idea what the issue is.\n\nThere are no symbol errors.\nThe _imaging module is importable\nAll dylibs are loaded properly (according to -v)\nThe decoder error is still there.\n\nDoes anyone know what could be causing this? I'm on OS X Lion.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":672,"Q_Id":8590714,"Users Score":1,"Answer":"What would I try:\n\nRemove old PIL and install new it from scratch (maybe it did not override properly).\nIf you missed something when compiling the libjpeg, like path specifications it will not find some of the libraries, so I recomend trying MacPorts py27-pil port for PIL installation, which will place all dependancies.","Q_Score":0,"Tags":"python,python-imaging-library","A_Id":8591901,"CreationDate":"2011-12-21T13:41:00.000","Title":"Can't get PIL to work on Mac OS X","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a python application using tkinter. One of my classes only uses the delete method on an Entry widget object. I wanted to know if there was a way to only import that method instead of importing the entire package.\nI have tried looking around online and have tried different things, but I have not had much luck as of yet.\nI am finding the online documentation for the standard python libraries to be very unclear and confusing.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":106,"Q_Id":8597543,"Users Score":2,"Answer":"No, there is no way to import only one method of a widget, or only one method of any class. When you import a class you get the whole class. \nWhy do you think it would be advantageous to import only one method? If you're concerned about memory consumption, don't be.","Q_Score":0,"Tags":"python,import,tkinter","A_Id":8598161,"CreationDate":"2011-12-21T23:02:00.000","Title":"How to import only one Tkinter widget method instead of a whole package?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing an Onscreen Keyboard in python, with clutter. I've gotten the ClutterStage's XWindow object, but I can't find any properties which prevent the window from stealing focus. Basically, it needs to accept mouse events (click, motion, etc), while not stealing keyboard focus from the window it is trying to type in. Any ideas? :)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1660,"Q_Id":8611290,"Users Score":0,"Answer":"by the way input delivery works on X11, this cannot happen: an X11 window has to have focus in order to receive input events - in other words: events are delivered only to the focused window.\nthe input method and accessibility support in GTK+, for instance, relies on the toolkit sending and receiving data to and from another process, through a specific API (IM and ATK, respectively). all virtual keyboard in GNOME use either methods to handle input events.\non pure X11 you could use the XTest extension API to send events from the virtual keyboard to the application that invoked it.","Q_Score":1,"Tags":"python,x11,xlib,clutter","A_Id":8623734,"CreationDate":"2011-12-23T01:09:00.000","Title":"What XWindow property can prevent a window from getting focus, while letting it receive mouse events?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to learn about graphical libraries by myself and toy with them a bit. I built a small program that defines lines and shapes as lists of pixels, but I cannot find a way to access the screen directly so that I can display the points on the screen without any intermediate.\nWhat I mean is that I do not want to use any prebuilt graphical library such as gnome, cocoa, etc. I usually use Python to code and my program uses Python, but I can also code and integrate C modules with it.\nI am aware that accessing the screen hardware directly takes away the multiplatform side of Python, but I disregard it for the sake of learning. So: is there any way to access the hardware directly in Python, and if so, what is it?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":4998,"Q_Id":8622667,"Users Score":1,"Answer":"This is rather an old thread now, but I stumbled upon it while musing the same question.\nI used to program in assembly language. In my day, drawing on screen was simply(?) a matter of poking a value into a memory location. The value turned a pixel on or off and defined its colour. \nThe term 'poke' comes from Basic by the way, not assembler. In assembler, you had to write a value into a data register then tell the processor where to put the data using another command and specifying an address register, usually in hexadecimal form! And each different processor had its own assembly language. But hec was the code fast!\nAs hardware progressed, I found that graphics hardware programming became more and more complex. There's much more to it than now simply defining a pixel. The graphics subsystem has its own processor -- or processors -- and it's that that you've got to learn to talk to. The processor doesn't just plonk stuff in memory locations. (I believe that what used to be the fastest supercomputer in the world for a while ran on graphics chips!) 'Plonk' is not a Basic command by the way.\nSorry; I digress. In answer to the original poster's query, I believe that the goal of understanding the graphics-drawing process could have been best achieved by experimenting with a Raspberry Pi. It's Python compatible and hence perfect for the job. Its hardware is well documented and it's cheap and easy to use.\nHope this helps someone, Cheers, M","Q_Score":11,"Tags":"python,hardware,graphics","A_Id":18431135,"CreationDate":"2011-12-24T00:32:00.000","Title":"Is there a way to access hardware directly in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to learn about graphical libraries by myself and toy with them a bit. I built a small program that defines lines and shapes as lists of pixels, but I cannot find a way to access the screen directly so that I can display the points on the screen without any intermediate.\nWhat I mean is that I do not want to use any prebuilt graphical library such as gnome, cocoa, etc. I usually use Python to code and my program uses Python, but I can also code and integrate C modules with it.\nI am aware that accessing the screen hardware directly takes away the multiplatform side of Python, but I disregard it for the sake of learning. So: is there any way to access the hardware directly in Python, and if so, what is it?","AnswerCount":3,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":4998,"Q_Id":8622667,"Users Score":7,"Answer":"No, Python isn't the best choice for this type of raw hardware access to the video card.  I would recommend writing C in DOS.  Well, actually, I don't recommend it.  It's a horrible thing to do.  But, it's how I learned to do it, and it's probably about as friendly as you are going to get for accessing hardware directly without any intermediate.\nI say DOS rather than Linux or NT because neither of those will give you direct access to the video hardware without writing a driver.  That means having to learn the whole driver API, and you need to invoke a lot of \"magic,\" that won't be very obvious because writing a video driver in Windows NT is fairly complicated.\nI say C rather than Python because it gives you real pointers, and the ability to do stupid things with them.  Under DOS, you can write to arbitrary physical memory addresses in C, which seems to be what you want.  Trying to get Python working at all under an OS terrible enough to allow you direct hardware access would be a frustration in itself, even if you only wanted to do simple stuff that Python is good at.\nAnd, as others have said, don't expect to use anything that you learn with this project in the real world.  It may be interesting, but if you tried to write a real application in this way, you'd promptly be shot by whoever would have to maintain your code.","Q_Score":11,"Tags":"python,hardware,graphics","A_Id":8622706,"CreationDate":"2011-12-24T00:32:00.000","Title":"Is there a way to access hardware directly in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed cocos2d today on OS X Lion, but whenever I try to import cocos in the Python interpreter, I get a bunch of import errors.\n\nFile \"\", line 1, in     File\n  \"\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/ \n  python2.7\/site-packages\/cocos2d-0.5.0-py2.7.egg\/cocos\/init.py\", \n  line 105, in  \n      import_all()    File \"\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/ \n  python2.7\/site-packages\/cocos2d-0.5.0-py2.7.egg\/cocos\/init.py\", \n  line 89, in import_all \n      import actions    File \"\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/ \n  python2.7\/site-packages\/cocos2d-0.5.0-py2.7.egg\/cocos\/actions\/ \n  init.py\", line 37, in  \n      from basegrid_actions import *    File \"\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/ \n  python2.7\/site-packages\/cocos2d-0.5.0-py2.7.egg\/cocos\/actions\/ \n  basegrid_actions.py\", line 62, in  \n      from pyglet.gl import *    File \"build\/bdist.macosx-10.6-intel\/egg\/pyglet\/gl\/init.py\", line  510,\n  in     File\n  \"build\/bdist.macosx-10.6-intel\/egg\/pyglet\/window\/init.py\",  line\n  1669, in     File\n  \"build\/bdist.macosx-10.6-intel\/egg\/pyglet\/window\/carbon\/ \n  init.py\", line 69, in     File \"build\/bdist.macosx-10.6-intel\/egg\/pyglet\/lib.py\", line 90, in \n  load_library    File\n  \"build\/bdist.macosx-10.6-intel\/egg\/pyglet\/lib.py\", line 226, in \n  load_framework    File\n  \"\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/ \n  python2.7\/ctypes\/init.py\", line 431, in LoadLibrary \n      return self._dlltype(name)    File \"\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/ \n  python2.7\/ctypes\/init.py\", line 353, in init \n      self._handle = _dlopen(self._name, mode)  OSError: dlopen(\/System\/Library\/Frameworks\/QuickTime.framework\/  QuickTime, 6):\n  no suitable image found.  Did find: \n          \/System\/Library\/Frameworks\/QuickTime.framework\/QuickTime: mach-o, but  wrong architecture \n          \/System\/Library\/Frameworks\/QuickTime.framework\/QuickTime: mach-o, but  wrong architecture\n\nSince I can't fix it, I'd like to remove cocos2d entirely. The problem is that I can't seem to find a guide anywhere that details how to remove it from the Python installation.\nAny help regarding either of these problems is greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":559,"Q_Id":8626180,"Users Score":1,"Answer":"You could fix it.\nThe problem comes from the fact that cocos2D is built on top of Pyglet, and the stable release of pyglet does not yet support Mac OS X 64 bits architecture. You have to use the 1.2 release of pyglet or later, which by now is not released yet.\nA workaround is to remove any existing Pyglet install:\npip uninstall piglet\nThen install the latest Pyglet from the mercurial repository\npip install hg+https:\/\/pyglet.googlecode.com\/hg\/","Q_Score":0,"Tags":"python,cocos2d-python","A_Id":10575373,"CreationDate":"2011-12-24T18:25:00.000","Title":"Removing cocos2d-python from Mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"in pygtk when I set the label mylabel = gtk.Label(\"Hello World!\") I can get the string of label from it by mylabel.get() method. but in python interpreter I can't get the docstring of this method: help(gtk.Label.get). Anyone know why?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":149,"Q_Id":8648537,"Users Score":2,"Answer":"It might be that what you wanted to ask was answered by @DonQuestion already... however if you truly just wanted to ask why help(gtk.Label.get) doesn't return a help... the answer is actually very simple: because the get method in the Label object lacks a docstring in the source code. :)\nIn fact the call to help doesn't generate an error, just an empty answer.","Q_Score":0,"Tags":"python,gtk,pygtk,docstring","A_Id":8648804,"CreationDate":"2011-12-27T19:37:00.000","Title":"How to get help of PyGTK methods?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"in pygtk when I set the label mylabel = gtk.Label(\"Hello World!\") I can get the string of label from it by mylabel.get() method. but in python interpreter I can't get the docstring of this method: help(gtk.Label.get). Anyone know why?","AnswerCount":3,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":149,"Q_Id":8648537,"Users Score":3,"Answer":"Because the method gtk.Label.get is an object itself, and has some attributes. The builtin function help looks the __doc__ attribute and some other dictionaries of the object and the Class of the object up and returns them (formatted). You could do a help(help) for example! ;-) so help(gtk.Label.get) returns the attribute \"__doc__\" of the method\/object gtk.Label.get and some other information gathered by class-introspection. It doesn't give you a help on the actual values of your gtk.Label instance.","Q_Score":0,"Tags":"python,gtk,pygtk,docstring","A_Id":8648722,"CreationDate":"2011-12-27T19:37:00.000","Title":"How to get help of PyGTK methods?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've spent hours on this.  Seems like our job on Linux is to debug scripts that don't work across the fragmented distros rather than getting work done.\nSetup.py tries to find what it needs and build the c modules used to wrap certain dependencies if it can find what it needs.  This makes the script super fragile relative to paths and file names.\nWhile it is VERY hard to tell from the .py source, it seems for tkinter we need tcl, tk, and tix.  Latest versions of these are all installed.  I can verify this because Python 2.6 that comes with the SUSE distro imports_tkinter and Tkinter modules and runs the test script correctly.\nThe script seems to need to find the libraries.  I have both 32 bit and 64 bit installed.  So, these libraries exist:\n                    32bit                 64bit\n   libtk8.5.so     \/usr\/lib               \/usr\/lib64\n   libtcl8.5.so        \"                      \"\nBoth paths are included in the appropriate search list in Setup.py.  But, I don't think Setup.py searches for the correct file names.  It seems to search for files that begin with tk and tcl, catenating a variety of different versions (including '8.5').  But, the file names don't begin with 'lib'.   Before I begin tampering more, could the Python.org folks have really messed this up so badly?  That doesn't seem likely.  Is SUSE Linux so odd a distro?  This doesn't seem likely either.\nI don't think setup.py would look for the binaries (would matter at run time it would seem...) but they are present in usr\/lib and usr\/lib64.\nThe only include file I can find is for tclextend.  It is tclextend.h found in usr\/include.  I could not find other .h files for tcl or tk.  Of course the include files that the Python c wrappers require are supplied with the download of Python 2.7.\nSo, I am kind of at my wit's end.  This is such a colossal waste of time.  Is there a way to just skip the build process and just build the tcl\/tk support?  I also have the same problem with ssl:  it would not build.  One thing at a time.\nThanks for your help.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1235,"Q_Id":8650079,"Users Score":0,"Answer":"I found many distribution points for sets of rpm packages.  This enabled me to install individual packages such as the headers for tcl.  But, this was a bad approach because the full dependency hierarchy to build Python support for tkinter is something on the order of 60 packages.\nI found that the OpenSuSE repository for version 11.3 of the OS contained everything I needed.  My Novell distro came with Novell's repositories which exclude nearly all devel packages.\nProblem solved.  The make of python found all of the prerequisites for tkinter.\nSorry to post such a nube question.","Q_Score":0,"Tags":"python,build,suse","A_Id":8662523,"CreationDate":"2011-12-27T22:48:00.000","Title":"Python 2.7.2 install on Suse Linux Server 11.3 can't find tkinter dependencies","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Is it possible to embed a wxPython based GUI in an HTML page?\nIf not, is there any other option other than Java applets to make GUIs that can be embedded onto an HTML page?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":669,"Q_Id":8654165,"Users Score":0,"Answer":"You can use Javascript to create your own GUI to show. Maybe Google's NaCl is far enough advanced but it won't give you the cross browser compatibility you'll probably like.\nIf you look at broadway (which is linked in one of the other answers), you'll need to run an X session for each user.","Q_Score":1,"Tags":"python,html,wxpython","A_Id":8654270,"CreationDate":"2011-12-28T09:37:00.000","Title":"wxPython GUI on a web page?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have an Android application that has user contributed images. There are a lot of users that submit black or really dark images to the backend application, that I want to filter out. Best solution would be to filter the images already at the phone and notify the user to make more light and retake the picture. Another solution if easier to achive would be to filter it at the backend written in python. I took a look into opencv, but I do not really have a clue where to start. Any hints where to get information to measure the brightness\/color of an image in Android and\/or in python ?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2293,"Q_Id":8659663,"Users Score":0,"Answer":"What about converting the image into greyscale one, calculate average color of the greyscale image, and filter out images than go over some threshold?","Q_Score":2,"Tags":"android,python,image-processing","A_Id":8659766,"CreationDate":"2011-12-28T18:19:00.000","Title":"Detecting black images on Android or python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an NSMutableArray filled with BeziarPaths. I'd like to serialize it so that its accessible on Python. Someone suggested to me that I can try GZIP + InkML or GZIP +JSON. I was wondering what the best way to do this is. I am also really new to this, so example code would be extremely helpful.\nThanks","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":318,"Q_Id":8661415,"Users Score":0,"Answer":"Choose what you like most. Both are standards, but JSON is a generic format used for serializing dictionaries and arrays, while InkML focuses on drawing related objects.\nJSON support is available in both Python and Objective-C, while InkML has no built-in support in either.","Q_Score":1,"Tags":"python,objective-c,serialization","A_Id":8661467,"CreationDate":"2011-12-28T21:15:00.000","Title":"Objective C to Python Serialization","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a number of text widgets floating on a scrollable canvas widget. I want to allow users to resize them by dragging their edges and\/or corners, possibly moving them if they drag the upper left edges or corner. I'm open to making them into frames with text widgets inside them, since I'm likely to do that anyway.\nI figure I can handle the events manually if I can just get it to show resize handles. Do I need to catch mouseovers and clicks on a border myself?\nAdding a \"<Configure>\" event binding does nothing, as one would expect. ttk.Sizegrip allegedly only works on top-level windows. There are lots of resources for preventing resizes, but very few for facilitating them, and they all seem to be for top-level windows.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":3942,"Q_Id":8735668,"Users Score":1,"Answer":"You could use the PanedWindow widget, or a combination of a few of them, inside your canvas. They are designed to do that. Getting the PanedWindow to stretch like the \"sticky\" command inside the canvas is an unknown though.\nThat is what I was looking for when stumbled across this post.","Q_Score":1,"Tags":"python,tkinter","A_Id":12025488,"CreationDate":"2012-01-04T23:37:00.000","Title":"Make widgets\/frames inside tkinter canvas resizable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to use a file that uses PIL and when I try to run it I get the following error:\nImportError: The _imaging C module is not installed\nI know theres a bunch of threads online about this but most of them see pretty specific. I'm 100% sure there is no problem with the code I'm running. Python version 2.7.2 64bit windows 7. I've been trying to fix it for almost an hour or so and I'm losing my mind. Any suggestions?","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":6417,"Q_Id":8747299,"Users Score":1,"Answer":"try to install pillow. you can install it with the command: pip install pillow \nyou have install the python-imaging??\nsudo apt-get install python-imaging. install first the python-imaging and next install the pillow","Q_Score":0,"Tags":"python,module,imaging","A_Id":11829919,"CreationDate":"2012-01-05T17:56:00.000","Title":"Python: PIL _imaging C module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to determine a user's wallpaper path with PyGTK.\nIf possible, I would like to not rely on a Desktop Environment's function to do this - this is because some users(like myself) do not use a DE. Because of this, I am wondering if you can use X11 or something else to determine the current wallpaper being used.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":382,"Q_Id":8774388,"Users Score":2,"Answer":"You MUST rely on a desktop environment, otherwise it is not possible, since X11 isn't supposed to handle such things as wallpapers. When you set a background image, an external program loads the image and sets it as the background pixmap of the root window. Therefore, unless the specific loading mechanism stores the image path somewhere, X11 itself will never know where the image file is located on the disk.","Q_Score":0,"Tags":"python,pygtk,x11","A_Id":8778003,"CreationDate":"2012-01-08T00:36:00.000","Title":"Determining path to current wallpaper with pygtk (maybe X11?)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My GUI consists of a wx.ListCtrl on the left, with a list of objects to edit, and a set of wx.TextCtrls on the right, for editing the selected object.\nMy strategy for implementing this was:\n\nOn a textbox's wx.EVT_KILL_FOCUS , update the relevant attribute of the currently selected object\nOn the list's wx.EVT_LIST_ITEM_DESELECTED, either hide the textboxes or blank them out and disable them (needed for when the user clicks the blank space in the list control)\nOn the list's wx.EVT_LIST_ITEM_SELECTED, populate the text controls with the values of the selected object's attributes\n\nWith this setup, there are 3 use cases, and 2 of them work:\n\nWhen the user is clicking\/tabbing between textboxes, the correct wx.EVT_KILL_FOCUSs occur, and the attributes get updated.\nWhen the user clicks from a textbox into the blank space in the list, that's OK as well: first wx.EVT_KILL_FOCUS causes the attribute to update, and then wx.EVT_LIST_ITEM_DESELECTED hides the textboxes.\nThe problem is when the user clicks directly from a textbox to another object in the list control. The order of events in this case is wx.EVT_LIST_ITEM_DESELECTED, wx.EVT_LIST_ITEM_SELECTED, and then finally wx.EVT_KILL_FOCUS. You can probably see the problem: by the time the method that updates attributes is called, a new object has already been selected and the textboxes have been populated with new values.\n\nSo I know exactly what the problem is, but I can't come up with a nice, clean way to fix it. Ideally I'd like to be able to change the order of the wx events (putting wx.EVT_KILL_FOCUS at the front), but I doubt that's possible. Is there some other obvious solution I'm missing?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":256,"Q_Id":8783236,"Users Score":1,"Answer":"wx.EVT_LIST_ITEM_DESELECTED will only fire when the user changes the selected object in the list box.  This serves the same purpose as losing focus on the text box.  Call the update routines from that event as well.  To skip the subsequent wx.EVT_KILL_FOCUS from the text box set a \"isDirty\" attribute in the parent object after you update the attributes.  You can check the isDirty value anytime to confirm there are changes to commit.  This attribute would have to be reset when you populate the text boxes for the new selection and then set during other textbox events.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":8783458,"CreationDate":"2012-01-09T02:12:00.000","Title":"The order of wxPython events is causing me problems","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am  looking for a way in which wxPython GUI elements can be added into pygame. If there is an alternative to solve the purpose of adding GUI elements to a pygame please suggest so. I am having problem in installing PGU.Thanks for help.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1738,"Q_Id":8798043,"Users Score":0,"Answer":"I dont think its possible since wxPython (using wxWidgets c++) is a wrapper around the window management system, it rely on the OS functions to draw on screen (it convert to the right system calls depending on OS). \nPygame uses SDL and a simple code to window management system, it calls few OS functions just to create the window and give it to SDL to draw on it, like a canvas. \nOne way is:\n\nusing ctypes to make C calls into OS library files to draw system native widgets, this way you aren't using any pygame functions.\n\nOther way(ugly and not sure if works):\n\nI dont know how, but finding a way to convert widgets into image buffer objects and use it like surfaces(plain bitmaps).\n\nWhat I think you should do:\n\nUse pygame, build your own GUI using surfaces and mouse\/keyboard events to control it or download some pre-made.\nStick with wx, you can build your GUI easily on system native theme, also you can use DC (draw contexts) to draw like pygame, and maybe (not sure) include pygame context into wx as one widget.\nYou can benefit from wx having its own event handler.\n\nI hope it helps you in some way.","Q_Score":6,"Tags":"user-interface,wxpython,pygame","A_Id":9446899,"CreationDate":"2012-01-10T02:57:00.000","Title":"Adding wxpython in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Two part question:\nI have a 10x10 QTableWidget with QTableWidgetItem in each cell.\nFor some reason, clicking on a cell is not sufficient to edit it, I need to double-click the cell to enter it. \n\nIs there a way to change this behavior to single click \nIs there a way to have 2nd cell in 1st row selected and ready for editing by default when window is created?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":3799,"Q_Id":8826688,"Users Score":2,"Answer":"You can also use setCurrentCell.\ntable.setCurrentCell(0,1)\nQTableWidget.setCurrentCell (self, int row, int column)","Q_Score":2,"Tags":"python,pyqt,pyqt4,editing,qtablewidget","A_Id":8948046,"CreationDate":"2012-01-11T21:11:00.000","Title":"QTableWidget how to have a cell selected for editing from code and\/or with single click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyQT v4.9 for Windows 7, and Visual Studio 2010 (extension PTVS 1.1 )\nAutocomplete is good function in IDE. Example:\n   object.method_of_class() #when I press the dot, see a list of possible methods.\nBut with pyqt class, this not works, exapmle:\n    QtGui.QDesktopWidget()\nHow can I solve this problem?\nP.S. Forgive me for my bad English","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":1633,"Q_Id":8830355,"Users Score":3,"Answer":"I had the same problem with PTVS version 1.1.1 . I did the following . Now auto completion works for PyQT libraries.\n1. upgraded the  PTVS to 1.5\n2. In visual studio , select tools-options- python tools-interpreter options. Click on \"Generate completion\" , then restart  the visual studio.","Q_Score":1,"Tags":"python,visual-studio-2010,pyqt,ptvs","A_Id":11158550,"CreationDate":"2012-01-12T05:01:00.000","Title":"PyQT and Visual Studio 2010","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the use of the wx.App class (apart from what the documentation says), when you can just create a frame and .Show(True) it?\nWhen should a wx.App class be used, or why shouldn't you create a frame and just show it?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":661,"Q_Id":8835679,"Users Score":2,"Answer":"The wx.App does a bunch of behind the scenes stuff to make your application work. It does the main loop, which is what waits for the user to do something and then responds. You have to have it. As FogleBird mentioned. By the way, you should NOT have more than one. Doing so will cause weird issues, if it works at all.","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":8837486,"CreationDate":"2012-01-12T13:17:00.000","Title":"purpose of wx.App when just showing a frame is enough","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a question about the virtual memory in Python.\nWhen the process is consuming a relatively large amount of memory, it doesn't \"release\" the unused memory. For example, after creating a massive list of strings, let's say the list uses 30MB of memory, so the entire process takes roughly 40MB, when the list is deleted, the process still consuming 40MB, but if another list with the same amount of data is created, the process will not take more memory, because it will use the virtual memory that is available but not released to the OS.\nMy question is: What kind of data will reuse that non-released virtual memory? I mean, that 30MB was \"taken\" from the OS when I created a list of strings, and even when I delete it, the next list of strings will not take more memory from the OS as long as it fits in the 30MB. But if instead a list of strings another type of data is created, like a QPixmap (from Qt, using PyQt), will it use that 30MB originally allocated by the list of strings?\nThank you in advance.\nEdit: Well, this question sounds lazy. I know I could simply test this specific case, but i want to know in theory, I don't want the answer for this \"list of strings and qpixmap\" specific case, but in general.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3099,"Q_Id":8836536,"Users Score":0,"Answer":"At the C level (CPython's implementation), anything that is allocated on the heap with malloc() will consume memory and this memory will not be released to the OS when that memory is freed with free(). It will only be returned when the process dies. But when new blocks are allocated with malloc() they will use the freed-up memory.\n(Unless the free memory is really badly fragmented and there is not enough contiguous free space in the freed-up zones to accommodate new allocations. But let's not worry about this pathological case.)\nEvery Python object is implemented by CPython as one or more blocks of memory allocated with malloc() so the answer to your question is: pretty much any piece of Python data can reuse the space that was freed by the deallocation of some other piece of Python data.","Q_Score":1,"Tags":"python,memory-management,virtual-memory","A_Id":8836643,"CreationDate":"2012-01-12T14:18:00.000","Title":"Virtual memory management in Python (2.6-2.7) - Will it reuse the allocated memory for any type of data?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"A simple question, (hopefully with a simple answer).\nQTreeView will pass Qt.DisplayRole to the model's data function when fetching rows for display, by default.\nBut say I wanted to pass 'MyAwesomeTreeDisplayRole' instead of Qt.DisplayRole, what would I need to do?\nI can't seem to find anything about where the view decides to use displayrole or how to override it. \nJust before you ask why I want to do such awful things..\nBasically, my QAbstractItemModel is intended to be usable both for a treeview (1 column) and a tableview (multiple columns, based on parent).\nUsing the same DisplayRole for both types of views doesn't really work, since then I'm forced to return the same data for both. This results in me only seeing the first column in the treeview when I want to return a concatenation of a couple of columns.  \nI think the simplest way would be to just use custom roles (TreeDisplayRole and TableDisplayRole).\nThanks in advance.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1128,"Q_Id":8860192,"Users Score":0,"Answer":"I've used QTreeView to view a simple table with many columns - it works well - you can adjust the column count by sending it the columnCountChanged signal.  So I'm not sure you need to do what you are asking.\nBut I've used ItemDelegates too: use my_treeview.setItemDelegate() to point the treeview to your item delegate.  If this subclasses QStyledItemDelegate then it doesn't need to do much work - it can mostly just pass it all through to super.\nThe user roles then are just agreed between your custom ItemDelegate and your ItemModel and can be anything you like as long as they are >= than QtCore.Qt.UserRole.\n(Edit: Sorry, I put this in as a new answer but it's really just an elaboration on what Lol4t0 said - apart from the columnCountChanged thing)","Q_Score":2,"Tags":"python,qt,model,pyqt","A_Id":9890722,"CreationDate":"2012-01-14T04:40:00.000","Title":"Using custom role in QTreeView instead of DisplayRole","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As the title suggests it, I`m looking for the best solution for creating a 2D or a 3D graphic simulator. I need to build a program that simulates the behavior of some custom solar panels (how the rays fall on the surface of the panels, what happens if the panels are rotated etc). The main problem is that it has to be done in a very short amount of time and depending on how big the difference between the 2D and the 3D one will be (in terms of needed time for completion), I will choose the most appropriate solution. The program has to create also some charts based on the input data.\nThus, I`m interested looking for you suggestions in regard to which one of the aforementioned languages would provide the best and easiest to use tools (for both the 2D and the 3D one), and a good combination of the final code complexity, ease of the graphic design and final appearance.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1475,"Q_Id":8866301,"Users Score":4,"Answer":"If you don't have much time you should choose the language you know better. \nPersonally I'd go for python because I think it's a very productive language. To do the rendering I'd rely on the module pygame. Nevertheless there are numerous possible libraries that can do what you need. I've used XNA a while ago and it was a real pleasure. Especially its support for 2d graphics is excellent. On the bottom-line I guess it boils down to this:\nPython is \"working pseudo code\". It will allow you to code the logic very efficiently. Pygame however is a 3d game library. It's great for creating games and visualizations but you'll have trouble to make a nice gui.\nC# is a little more \"heavy\" than python. You'll definitely end up writing more code, just in terms of the number of lines. XNA + WPF is a powerful combo though and has very good tools - VisualStudio has a great gui designer","Q_Score":0,"Tags":"c#,python,graphics,simulator","A_Id":8866408,"CreationDate":"2012-01-14T23:33:00.000","Title":"C# vs. Python - Best choice for a 2D\/3D graphic simulator","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know how to draw images using pygame. I know how to load them.\nI have made a blank window.\nWhen I use screen.blit(blank, (10,10)), it does not draw the image and instead leaves the screen blank.","AnswerCount":4,"Available Count":1,"Score":0.1488850336,"is_accepted":false,"ViewCount":36330,"Q_Id":8873219,"Users Score":3,"Answer":"After using blit or any other update on your drawing surface, you have to call pygame.display.flip() to actually update what is displayed.","Q_Score":16,"Tags":"python,image,pygame","A_Id":8873270,"CreationDate":"2012-01-15T20:43:00.000","Title":"What is a good way to draw images using pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a window that is opened up in a Python script (NOT THROUGH Tkinter), and all I want is to send an \"enter\" (keypress) command to that window. I was hoping I could do this with Tkinter, but I'm at a bit of a loss as to how to send this command to the current focused window.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":260,"Q_Id":8898662,"Users Score":0,"Answer":"You cannot do this with Tkinter. Tkinter can only send events to its own windows.","Q_Score":1,"Tags":"macos,tkinter,python-2.7","A_Id":8900000,"CreationDate":"2012-01-17T17:02:00.000","Title":"Tkinter keypress on current focused window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the best framework to use for building the GUI on a python widget?\nI'm currently using gnome 3, but would prefer it to be independent of the desktop environment.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1565,"Q_Id":8905128,"Users Score":1,"Answer":"I have used the 3 following toolkits.\n\nwxPython is a popular choice. It supports Windows, Mac and Linux but may be tricky to install on some of these platforms (that's what i've recently noticed on 64 bits MAC and Ubuntu). It has a lot of nice widgets which can be seen with the demo app that can be downloaded separately. I do recommend to have a look to this app. In my opinion, it is missing a great form designer even if wxFormBuilder seems to be a good tool. I am less confortable with Xrced which is another graphical form designer but you may prefer this one.\nPySide is the python wrapper for Qt. It seems to me as a very professional toolkit. It is cross-platform as well and have a very good graphical form designer (QtDesigner). It is the best choice for open-source development. If you want to make a commercial app, you would have to buy a license which is in my opinion a bit expensive for small to medium size projects. (that's why I didn't use Qt recently)\nTkInter is included in the Python standard lib and is also cross-platform. I like it very much and I am using it for my little apps. For bigger projects, i think that it is missing widgets, documentations and a easy-to-use graphical designer. If you have a little time to dive into this lib, it may not be a problem.\n\nI hope it helps","Q_Score":0,"Tags":"python,gtk,widget,gnome","A_Id":8906510,"CreationDate":"2012-01-18T04:19:00.000","Title":"Python Widget\/GUI framework","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if any of you know where I could find a simple tutorial on the web maybe to make a very simplistic gui. I have no idea how to start out in code to make one so I need your help. What I want the gui to be used for is I have written a program that I want to be to use it on other computers that already don't have python on it. I have already made an executable but I would much rather use a gui just because of the more \"polished\" look it has.","AnswerCount":10,"Available Count":2,"Score":0.0199973338,"is_accepted":false,"ViewCount":104449,"Q_Id":8912327,"Users Score":1,"Answer":"If you're more into gaming you can use PyGame for GUIs.","Q_Score":23,"Tags":"python,user-interface","A_Id":8913722,"CreationDate":"2012-01-18T15:03:00.000","Title":"How to make a gui in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if any of you know where I could find a simple tutorial on the web maybe to make a very simplistic gui. I have no idea how to start out in code to make one so I need your help. What I want the gui to be used for is I have written a program that I want to be to use it on other computers that already don't have python on it. I have already made an executable but I would much rather use a gui just because of the more \"polished\" look it has.","AnswerCount":10,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":104449,"Q_Id":8912327,"Users Score":0,"Answer":"While some suggestions have included tkinter and wxPython, the other part of the answer to your question is that you will also need to package it using something like py2app, pyinstaller, or py2exe (depending on the operating system). You mentioned the other machines do not have python, so this would be required in order to distribute the entire python environment with your app.\nAlso have a look at PySide or PyQt. They have a ton of tutorials everywhere and heavy documentation from Qt.","Q_Score":23,"Tags":"python,user-interface","A_Id":8912460,"CreationDate":"2012-01-18T15:03:00.000","Title":"How to make a gui in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"EDIT: Solved, thanks everyone!\nWhat I would like to be able to do in simple terms is take user input from one programming language, convert it into another programming language and have it compiled automatically. \nFor example (simplified and not precisely what I want to do but along similar lines):\n1) Write a python script, userData = raw_input(\"blah blah blah, example, example\")\n2) if userData == \"blah blah blah, example, example\", serialize to a text file called \"example.cpp\" and put in some predetermined data which is based on the user's input (written in C++ form, though represented as a string in python script). For simplification this predetermined data will be called predeterminedData.\n3) The extent of predeterminedData will be essentially a cout << \"this is a different message to before\" << endl;\n4) The compiler (g++\/gcc) compiles this automatically and the overall program structure calls the newly created executable file.\nIf someone could help point me toward the topic\/topics I should read up on to be able to achieve this - if it's possible - that'd be fantastic.\nEdit: I've made a classic mistake I think. In an attempt to not be accused of asking other people to do my \"homework\" for me I've been too vague and consequently misleading. Thank you for the responses so far but perhaps now I should be more specific. It isn't particularly python nor c++ specific but I will explain beneath. I apologize for not being more explicit before.\nWhat I actually want to achieve is quite simple. I want to use user input from one programming language (python, c++, java) and have it create a Lilypond script which will automatically compile and create a midi file.\nSo for example:\n1) User is asked to enter alphabetically a series of notes: e.g. \"C\" then \"E\" then \"F\", so on and so on.\n2) These \"notes\" are checked by a control loop statement and a string is created in the Lilypond script and serialized to a file which is compatible with its compiler (example.ly)\n3) This file is automatically compiled by the Lilypond compiler and creates a midi file (example.midi)\n4) Later in the program this example.midi can be called on and played back because of this creation process. It would not have existed prior to this creation.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":161,"Q_Id":8918183,"Users Score":5,"Answer":"To me it sounds like you just want to write a user interface for interactive creation of lilypond files.\nI don't see what all this has to do with compilation. Your python script will need to write a file in lilypond notation and afterwards your script needs to call lilypond on that file (e.g. with os.system). You could even skip writing to a file and just pipe the output to stdin which lilypond can also read.","Q_Score":0,"Tags":"c++,python","A_Id":8918813,"CreationDate":"2012-01-18T22:06:00.000","Title":"Automatic compiling between languages","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a treeview that is populated from a treemodel.\nI would like to add a colum to the treeview.  Is it possible to draw the data for that column from a separate treemodel or can I append at runtime a column to the existing treemodel?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1854,"Q_Id":8930460,"Users Score":0,"Answer":"In a gtk.TreeView object there's an append_column method, so yes, you can programmatically add a column to a gtk.TreeView.\nHowever, I'm not aware of any method for adding a new column to an existing model or using multiple models for the same gtk.TreeView. Anyway, I guess you can create a new model with an extra column, copy the contents of the previous one and update the tree view to use the new model.","Q_Score":5,"Tags":"python,gtk,pygtk,gtktreeview","A_Id":8931266,"CreationDate":"2012-01-19T17:24:00.000","Title":"Can I add a column to an existing treemodel in gtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a treeview that is populated from a treemodel.\nI would like to add a colum to the treeview.  Is it possible to draw the data for that column from a separate treemodel or can I append at runtime a column to the existing treemodel?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1854,"Q_Id":8930460,"Users Score":0,"Answer":"To answer the question in the title:  No, you can't add columns to a GtkTreeModel after it's been created.","Q_Score":5,"Tags":"python,gtk,pygtk,gtktreeview","A_Id":32256786,"CreationDate":"2012-01-19T17:24:00.000","Title":"Can I add a column to an existing treemodel in gtk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i am grabbing PIL images with screengrab from the screen, saving them in a queue and writing them into a jpg image sequence. \nI use a producer thread to capture and a worker to write the images down to disk.\nHowever i noticed, that this queue gets really large really fast, even though the written output is not really that large, when compressen with jpg. That leads to the grabs being put into extended memory on the disk, making the write process even slower. Since my data comes in bursts, i can use up some time to write to the disk, but if the memory is written to disk, it gets just too slow. \nIs there a way to compress the images before adding them into the queue?\ncheers,","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":775,"Q_Id":8938442,"Users Score":0,"Answer":"Here's an idea, merge the images as they come in.\nAfter a set period of time or set amount merged, compress the image. Divide the image back into separate ones.\n\/profit","Q_Score":2,"Tags":"python,python-imaging-library,screen-grab","A_Id":8938645,"CreationDate":"2012-01-20T08:15:00.000","Title":"Reducing PIL image size in memory","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to make a simple GUI that offers buttons which I can drag and drop into other Windows applications such that this other applications receives a certain string depending on the button chosen.\nWhat would be the easiest GUI framework for Python that allows this drag and drop?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1910,"Q_Id":8943446,"Users Score":1,"Answer":"Theoretically, you can use any library for which a graphical drag-and-drop designer exists. Such tools often generate markup language which the library parses, and sometimes they generate code directly. The latter is language-dependent whilst the former shouldn't be. Either way, you'll find a way of doing it with Python.\nPractically, some libraries have better visual designing tools that others. WinForms designer was really elegant and seamless when I used it, so maybe IronPython? How about PyGTK, with Glade, or the aforementioned PyQt? Maybe Jython using Swing designed in NetBeans?\nEDIT: Whoops, I didn't read the question properly. What you're looking for is a framework with drag-and-drop capabilities, i.e. most of them. There's lots of things to consider though, for example are the destination and source windows going to be from the same process? Will they be written with the same framework? These things could be relevant or not, depending on how it's all written.","Q_Score":2,"Tags":"python,windows,user-interface,drag-and-drop","A_Id":8944479,"CreationDate":"2012-01-20T15:06:00.000","Title":"Simple GUI Windows Drag&Drop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A real newbie question here.\nI'm using IDLE 2.7.2 on OSX 10.7.2 and reading Zelle's Python:Programming. I haven't programmed since the 80's, so after going through the command line stuff, I'm excited to dive into Objects. I grab his graphics.py file and copy it into documents (this seems like the default location for IDLE) and start up IDLE.\nHe then suggests a few commands into the shell:\nfrom graphics import *\nwin = GraphWin() #which opens a graphics window with no problem \nHe then goes on to have you draw some lines and shapes in the window. Those graphics show up just fine in the window.\nHere's my problem. If I try to mouse over the graphics window, I get the Mac pinwheel. Moving the window doesn't help. So the window seems like it's crashing (though IDLE is doing fine), but strangely, if I keep entering commands into IDLE, the shapes keep drawing normally in the window.\nAm I doing something wrong? Is this normal? Thanks,\nHenry","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2037,"Q_Id":8972462,"Users Score":0,"Answer":"Idle runs the python commands you enter in another process, so it's reasonable to expect this \"lock up\" behavior to be different between the program controlled window and Idle.\nWhat's probably going on, though is that everything is fine, but you have not yet started the event loop in the program you're typing in.  The operating system notices that the program is not emptying out its event queue when you mouse over it (which creates lots of events) and it's helpfully informing you (by way of the pinwheel) that the program seems to be busy.\nYou will likely reach a point later in the tutorial where you do start the event loop, and the pinwheel will magically go away.","Q_Score":0,"Tags":"python,python-idle","A_Id":8972537,"CreationDate":"2012-01-23T13:35:00.000","Title":"Graphics Window Crashing in IDLE","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running into some really weird problems with ctypes.  I'm using ctypes to interface to a C++ library that has a C interface.  The library has lots of parallel functionality.  More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too.  I'm wondering if there is any restriction on whether the Python interpreter and the C++ code need to be compiled with the same version of the C++ compiler?  If so, how do I find out what c++ was used to build Python?  I've tried to run strings on Python and grep for gcc and g++, nothing shows up.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":337,"Q_Id":8989328,"Users Score":0,"Answer":"CPython doesn't contain C++ code and thus there is no requirement with regards to the C++ compiler used to compile a C++ library loaded into a CPython process.  However, the C layer and the C++ library must generally be compiled with the same C++ compiler.  And if the C++ library or the C layer link against libpython, they must be compiled against the same version of CPython that is later used to run the ctypes code that loads the library.","Q_Score":2,"Tags":"python,ctypes","A_Id":8989530,"CreationDate":"2012-01-24T15:22:00.000","Title":"ctypes - does python need to be compiled with same version as C library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm running into some really weird problems with ctypes.  I'm using ctypes to interface to a C++ library that has a C interface.  The library has lots of parallel functionality.  More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too.  I'm wondering if there is any restriction on whether the Python interpreter and the C++ code need to be compiled with the same version of the C++ compiler?  If so, how do I find out what c++ was used to build Python?  I've tried to run strings on Python and grep for gcc and g++, nothing shows up.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":337,"Q_Id":8989328,"Users Score":4,"Answer":"There's no requirement at all that the native library that you call with ctypes has to be built with a matching runtime. In fact there's not even a requirement that the native library even uses a C runtime.\nFor example you can use ctypes to call code written in other languages, e.g. Delphi. Or you can use ctypes to call Windows API functions which are not linked against MSVC.\nI guess you'll have to look elsewhere to resolve your problem!","Q_Score":2,"Tags":"python,ctypes","A_Id":8989579,"CreationDate":"2012-01-24T15:22:00.000","Title":"ctypes - does python need to be compiled with same version as C library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I don't know if this is a simple matter of RTFM, but bear with me as it was a while ago I used a statically typed language...\nI'm porting some C# code to IronPython, and I just stumbled on this statement below. I'm not at liberty to post the actual code, so I'll write it in pseudo code instead:\ndata_type_1 variable_1 = variable_2 as data_type_2;\nwhere\nvariable_2 is a COM object from earlier parts of the code, variable_1 is a new variable, and data_type_1 is a class that interacts with the data in the COM object.\nWhat does it mean? I'm guessing it is some form of conversion. How can I convert it to something IronPython can make sense of?","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":138,"Q_Id":9001219,"Users Score":2,"Answer":"The as operator is a \"safe cast\" operator, it converts the variable_2 to type data_type_2. If that conversion fails, it doesn't throw an exception but returns null.\nFurther, to be able to assign a value of data_type_2 (the result of the 'as' expression) to a variable of data_type_1, that data_type_2 must be derived from data_type_1 (or implement the interface data_type_1).","Q_Score":0,"Tags":"c#,com,ironpython","A_Id":9001555,"CreationDate":"2012-01-25T10:35:00.000","Title":"How can I translate this C# variable declaration to something IronPython can handle?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I don't know if this is a simple matter of RTFM, but bear with me as it was a while ago I used a statically typed language...\nI'm porting some C# code to IronPython, and I just stumbled on this statement below. I'm not at liberty to post the actual code, so I'll write it in pseudo code instead:\ndata_type_1 variable_1 = variable_2 as data_type_2;\nwhere\nvariable_2 is a COM object from earlier parts of the code, variable_1 is a new variable, and data_type_1 is a class that interacts with the data in the COM object.\nWhat does it mean? I'm guessing it is some form of conversion. How can I convert it to something IronPython can make sense of?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":138,"Q_Id":9001219,"Users Score":1,"Answer":"After killing a few hours I figured I might as well do it the simple but perhaps not the prettiest way. I simply downloaded Visual C# 2010 Express (free version) and wrote a minimal Class Library containing one method consisting of only the troublesome statement. I then built the dll, which was promptly imported and used in the original IronPython script.\nFrom idea to a working solution it only took 10 minutes. Kudos to Microsoft, it was a whole lot simpler to build a dll than I thought.","Q_Score":0,"Tags":"c#,com,ironpython","A_Id":9004636,"CreationDate":"2012-01-25T10:35:00.000","Title":"How can I translate this C# variable declaration to something IronPython can handle?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a program in Codeblocks (wxWidgets Application) I have compiled it and it runs perfectly when executed from the codeblocks interface ....however when i go into the release folder and run the executable it gives me *.dll file errors :\/\nHow do i make the program ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":825,"Q_Id":9028174,"Users Score":2,"Answer":"There's a good chance that Code:Blocks has a default setting for the executable path that includes the path to the libraries. As Windows finds the DLLs using the PATH environment variable this will ensure that your application works inside CodeBlocks.\nHowever in order to run it outside CodeBlocks you'd need to either copy all the dependencies into the directory that holds your application or you'll have to set your PATH variable to include the directories that hold the dependencies.","Q_Score":1,"Tags":"c++,visual-c++,wxpython,wxwidgets,codeblocks","A_Id":9028282,"CreationDate":"2012-01-27T02:11:00.000","Title":"How to compile a program in wxSmith ( Codeblocks ) with all the libraries?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use wxpython for GUI. In main thread I fired some threads in background and showed modal dialog in main thread immediately. Now I want this modal dialog to be updated with some info at the moment all background threads finish they job. What's the best way to do this?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":173,"Q_Id":9038128,"Users Score":2,"Answer":"Pass a Queue as an argument to the threads, and let them put() a done \/ result object into that. Then count them.","Q_Score":3,"Tags":"python,multithreading","A_Id":9038289,"CreationDate":"2012-01-27T18:19:00.000","Title":"Execute action when all threads in except main are finished? (Python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"First of all, I am sorry if this question doesn't belong to SO since I don't know where else to post it, anyway...\nI am looking for a decent python based database development RAD framework with nice data aware widgets and grids. A desktop framework would be much preferable to a web framework (I've developed heavy DB-centric apps in django but the web dev experience is still painful compared to a desktop one), although a web framework will do as long as there are powerful data-centric widgets to go along with it.\nIdeally, it should be as useful as say Delphi or MSAccess \/ VBA (I used to develop using those a long time ago). For the record, I have very good development experience in django and wxPython and as I've said developing heavy data-centric web apps is tough and wxPython although very powerful lacks DB-related widgets.\nPlease note that the use of Python is mandatory because I've been using this language exclusively for all my projects in the last few years and I can't bear the idea of switching back to more mundane languages.\nThanks for any suggestion...","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":684,"Q_Id":9045723,"Users Score":1,"Answer":"I am also looking for something similar to Kexi. Unfortunately python scripting is not supported in Kexi for windows. I would like to find something better than MS Access, and it does not have to be based on python. So far I have looked at quite a few IDE's but have not found anything where a GUI and database application can be built us as quickly as in access.\n I think of all the best one I have seen is Alpha 5. There could be something based on Net Beans but I really do not know. Oracle APEX is another one I have heard about but it doesn't support desktop applications (as far as I know).","Q_Score":3,"Tags":"python,database,widget,rad","A_Id":15711432,"CreationDate":"2012-01-28T13:49:00.000","Title":"Python database widgets\/environment like MSAccess","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I just turned on the pygame.OPENGL flag in my set_mode out of curiosity.  It made my code very unhappy: pygame.error: Cannot call on OPENGL Surfaces on the first screen.fill((0, 0, 0)).\nI don't NEED OpenGL, but I'm kind of curious about it.  Where could I find info about pygame\/SDL and OpenGL?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":919,"Q_Id":9047958,"Users Score":2,"Answer":"The OpenGL flag in Pygame is used to turn your window into an OpenGL projection for other libraries - such as Rabbyt or PyOpenGL - to use.\nFor sites on reading up on all of this, I would recommend starting out at the respective sites for PyGame, OpenGL, et al. I'd post links for them, but the spam protection mechanism requires for me to have some manner of reputation.","Q_Score":0,"Tags":"python,opengl","A_Id":9048066,"CreationDate":"2012-01-28T19:35:00.000","Title":"Where can I find information about what\/why pygame can(not) do with openGl surfaces?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a simple Python script that loads a GUI (created with Tkinter) when run. I used py2app to convert the Python script into a double-click app for OSX. When the app is clicked, Python executes the script. However, Python (and the GUI) load minimized. The user has to click on the Python icon in the tray in order to bring the GUI into the foreground.\nI have tried adding lift() to the main Tkiner window but it doesn't seem to have any effect (I've tried similar methods with no success in bringing the window to the foreground). After the app is double-clicked, it is hard for users to tell what's going on if the GUI doesn't pop-up (especially if they are expecting some kind interface to appear). I am running Lion and didn't have this problem on Leapord.\nAny help would be greatly appreciated.\nThanks.","AnswerCount":3,"Available Count":1,"Score":0.2605204458,"is_accepted":false,"ViewCount":1769,"Q_Id":9083687,"Users Score":4,"Answer":"I just faced the same issue and found the general cause. The problem with all the published workarounds is that they either don't work for a py2app-built executable (the '-topmost' workaround doesn't) or have serious side effects (the iconify\/deiconify works but causes all future modal windows from the app to stop being dismissible, including tkMessageBox and tkFileDialog).\nThe problem is caused by the argv_emulation of py2app, which is enabled by default. That option puts some OSX-specific Carbon event code in the boot loader of the app, which can be found at dist\/appname\/Contents\/Resources\/__ boot __.py of your built application bundle. I don't need the argv_emulation so for now I just disabled the feature by changing argv_emulation to False in the OPTIONS dictionary of the setup.py built by py2applet:\nOPTIONS = { 'argv_emulation' : False }","Q_Score":1,"Tags":"python,user-interface,tkinter,osx-lion","A_Id":32492044,"CreationDate":"2012-01-31T17:02:00.000","Title":"Python Tkinter GUI Always loads minimized","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"IDLE is being very dodgy as to when it will actually show an Auto-complete menu. As of late it hasn't been working at all, or, more specifically, only works during an interactive session. \nI've been using Code Blocks for C, and have gotten really used to the very nice auto-complete features, so it's a bit frustrating not having them -- especially while trying to learn a new frame work and what class is associated with which methods, etc, etc..\nIs there an easy fix to get IDLE auto-complete working again? I'm using python version 2.7. \nIs there perhaps a simple editor I should look into? I've tried Vim, which was a little too heavy for my simple needs, Ninja, which I couldn't get to work for anything, and Sublime text 2, which I couldn't get my wxpython stuff to play with. What would a nice option be? Anything similar to Code Blocks would be cool, although, I'd be perfectly happy with IDLE if it would consistently work!\nREQUESTED CLARIFICATION:\nOK, so it seems I may have some of my terminology backwards. By non-interactive, I mean, for instance, right clicking on a python file and selecting \"edit with IDLE\". This brings up what I guess could be described as a text editor. You can enter all you code here. Once ready, you then hit F5, or select Run, and it launches (what I've been referring to as) the interactive terminal. It's here that you can type in code, press return, and instantly have that code evaluated. \nWhat my question is referring to it the former, the part of IDLE where you edit the code. Sometimes while typing, after a . it will display the available methods, or after an open parenthesis it'll give hints as to the values expected. but the thing is, sometimes it does these things, sometimes it doesn't.","AnswerCount":5,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":52127,"Q_Id":9089476,"Users Score":12,"Answer":"I had the same problem with IDLE, because I want to learn Qt and therefore autocompletion is very useful.\nAs it says in the settings of IDLE, you can trigger the autocomplete with \"Control + Space\", e.g. after a \"QtGui.\". Then a menu opens where you can arrow-scroll through the entries.","Q_Score":19,"Tags":"python,autocomplete,codeblocks,python-idle","A_Id":16467896,"CreationDate":"2012-02-01T01:22:00.000","Title":"Python IDLE. Auto-complete\/Show completions not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"IDLE is being very dodgy as to when it will actually show an Auto-complete menu. As of late it hasn't been working at all, or, more specifically, only works during an interactive session. \nI've been using Code Blocks for C, and have gotten really used to the very nice auto-complete features, so it's a bit frustrating not having them -- especially while trying to learn a new frame work and what class is associated with which methods, etc, etc..\nIs there an easy fix to get IDLE auto-complete working again? I'm using python version 2.7. \nIs there perhaps a simple editor I should look into? I've tried Vim, which was a little too heavy for my simple needs, Ninja, which I couldn't get to work for anything, and Sublime text 2, which I couldn't get my wxpython stuff to play with. What would a nice option be? Anything similar to Code Blocks would be cool, although, I'd be perfectly happy with IDLE if it would consistently work!\nREQUESTED CLARIFICATION:\nOK, so it seems I may have some of my terminology backwards. By non-interactive, I mean, for instance, right clicking on a python file and selecting \"edit with IDLE\". This brings up what I guess could be described as a text editor. You can enter all you code here. Once ready, you then hit F5, or select Run, and it launches (what I've been referring to as) the interactive terminal. It's here that you can type in code, press return, and instantly have that code evaluated. \nWhat my question is referring to it the former, the part of IDLE where you edit the code. Sometimes while typing, after a . it will display the available methods, or after an open parenthesis it'll give hints as to the values expected. but the thing is, sometimes it does these things, sometimes it doesn't.","AnswerCount":5,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":52127,"Q_Id":9089476,"Users Score":0,"Answer":"using the 'IDLE Editor window', you need to save and execute your code first.\nThe application running, turn back to the Editor window to use the auto-completion.","Q_Score":19,"Tags":"python,autocomplete,codeblocks,python-idle","A_Id":50496493,"CreationDate":"2012-02-01T01:22:00.000","Title":"Python IDLE. Auto-complete\/Show completions not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"IDLE is being very dodgy as to when it will actually show an Auto-complete menu. As of late it hasn't been working at all, or, more specifically, only works during an interactive session. \nI've been using Code Blocks for C, and have gotten really used to the very nice auto-complete features, so it's a bit frustrating not having them -- especially while trying to learn a new frame work and what class is associated with which methods, etc, etc..\nIs there an easy fix to get IDLE auto-complete working again? I'm using python version 2.7. \nIs there perhaps a simple editor I should look into? I've tried Vim, which was a little too heavy for my simple needs, Ninja, which I couldn't get to work for anything, and Sublime text 2, which I couldn't get my wxpython stuff to play with. What would a nice option be? Anything similar to Code Blocks would be cool, although, I'd be perfectly happy with IDLE if it would consistently work!\nREQUESTED CLARIFICATION:\nOK, so it seems I may have some of my terminology backwards. By non-interactive, I mean, for instance, right clicking on a python file and selecting \"edit with IDLE\". This brings up what I guess could be described as a text editor. You can enter all you code here. Once ready, you then hit F5, or select Run, and it launches (what I've been referring to as) the interactive terminal. It's here that you can type in code, press return, and instantly have that code evaluated. \nWhat my question is referring to it the former, the part of IDLE where you edit the code. Sometimes while typing, after a . it will display the available methods, or after an open parenthesis it'll give hints as to the values expected. but the thing is, sometimes it does these things, sometimes it doesn't.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":52127,"Q_Id":9089476,"Users Score":1,"Answer":"Sometimes it has to do with the time you have to wait to get a suggestions. \nWhen you go to options > extensions > general at completions popup wait you can change it to about 500ms.\nIn my case it was 2000ms by default.","Q_Score":19,"Tags":"python,autocomplete,codeblocks,python-idle","A_Id":49978980,"CreationDate":"2012-02-01T01:22:00.000","Title":"Python IDLE. Auto-complete\/Show completions not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"IDLE is being very dodgy as to when it will actually show an Auto-complete menu. As of late it hasn't been working at all, or, more specifically, only works during an interactive session. \nI've been using Code Blocks for C, and have gotten really used to the very nice auto-complete features, so it's a bit frustrating not having them -- especially while trying to learn a new frame work and what class is associated with which methods, etc, etc..\nIs there an easy fix to get IDLE auto-complete working again? I'm using python version 2.7. \nIs there perhaps a simple editor I should look into? I've tried Vim, which was a little too heavy for my simple needs, Ninja, which I couldn't get to work for anything, and Sublime text 2, which I couldn't get my wxpython stuff to play with. What would a nice option be? Anything similar to Code Blocks would be cool, although, I'd be perfectly happy with IDLE if it would consistently work!\nREQUESTED CLARIFICATION:\nOK, so it seems I may have some of my terminology backwards. By non-interactive, I mean, for instance, right clicking on a python file and selecting \"edit with IDLE\". This brings up what I guess could be described as a text editor. You can enter all you code here. Once ready, you then hit F5, or select Run, and it launches (what I've been referring to as) the interactive terminal. It's here that you can type in code, press return, and instantly have that code evaluated. \nWhat my question is referring to it the former, the part of IDLE where you edit the code. Sometimes while typing, after a . it will display the available methods, or after an open parenthesis it'll give hints as to the values expected. but the thing is, sometimes it does these things, sometimes it doesn't.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":52127,"Q_Id":9089476,"Users Score":1,"Answer":"In my case, I had to open Options menu -> Extensions tab on the editor and look to make sure AutoComplete and other relevant options were enabled. They actually were, but by just clicking on 'Apply' even though I dint have to change anything did the trick for me.","Q_Score":19,"Tags":"python,autocomplete,codeblocks,python-idle","A_Id":39969989,"CreationDate":"2012-02-01T01:22:00.000","Title":"Python IDLE. Auto-complete\/Show completions not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"In Pygame, you can set repeated (held down) Key detection with pygame.key.set_repeat().\nIn my case, I want to mix keys that can be held down and keys that will only be recognized once. Specifically, I want to be able to Move (by holding down key(s)), but I want to require one key press per Fire Missile.\nTo be clearer, I want to recognize held-down key presses for movement keys (Up, Down, Left, Right, etc.) only. Other keys, when held down, should only be recognized once.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":727,"Q_Id":9091073,"Users Score":2,"Answer":"You can keep a state tracker for the keys you only want to recognize once per press - set a flag to True when you see a KEYDOWN event, and then set it to False again when you see a matching KEYUP. Then only respond to a KEYDOWN event if the flag wasn't already True.\nThe other option is that you can keep a state tracker for the keys you do want to repeat and just poll that state every so often (e.g. every X milliseconds, see if the key is marked as 'down' and if so, do whatever should be done for that keypress).","Q_Score":3,"Tags":"python,key,pygame,keypress","A_Id":9091093,"CreationDate":"2012-02-01T05:05:00.000","Title":"Pygame Mixing Repeated Key Presses and Singular Key Presses","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"how to pickle wx.frame(python GUI) object and unpickle it?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":460,"Q_Id":9095796,"Users Score":1,"Answer":"Instead of pickling the object, pickle the necessary attributes of the object required to reconstruct a new instance of the object.","Q_Score":0,"Tags":"python,wxpython,python-2.5","A_Id":9095942,"CreationDate":"2012-02-01T12:27:00.000","Title":"how to pickle wx.frame(python GUI) object and unpickle it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to set an array into a wxListCtrl.\nSimilar to the Set function when using wx.ListBox or the SetItems function when using wx.ComboBox.\nOn the wxpython API there only seems to be an Append function.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":186,"Q_Id":9097097,"Users Score":1,"Answer":"I don't see an easy way to do this in the API other than just using a loop. There is a weird example in the wxPython demo for the ListCtrl where they somehow set a dict as the data for the list control. You might like that. Alternatively, I enjoy using the ObjectListView widget (http:\/\/pypi.python.org\/pypi\/ObjectListView) as I find it easier to use anyway.\nIn wxPython 2.9, there's the new DVC_ListCtrl, but it also probably needs a loop.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":9097809,"CreationDate":"2012-02-01T14:05:00.000","Title":"How to set an array to ListCtrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a Python program and want at some point to load HTML pages from the web and display them, in particular the support forum section\/news section of my program. How can I easily integrate that into my program?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":720,"Q_Id":9099618,"Users Score":0,"Answer":"Tkinter has no native support for displaying HTML. With a little bit of work you can download the raw html, do a little text manipulation (assuming it's mostly plain text and a few tags for bold, headers, etc), and display it in a text widget. If it's well formed xhtml you can use an xml parser to pull out the relevant data and give it appropriate formatting. \nIf the pages have embeded images, or use css or javascript, the problem becomes exponentially harder to the point of not being practical.","Q_Score":2,"Tags":"python,browser,tkinter","A_Id":9101909,"CreationDate":"2012-02-01T16:41:00.000","Title":"How do i integrate a browser in my tk application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a Python program and want at some point to load HTML pages from the web and display them, in particular the support forum section\/news section of my program. How can I easily integrate that into my program?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":720,"Q_Id":9099618,"Users Score":3,"Answer":"It would be easier to switch toolkits - Gtk+\/Qt both have support for WebKit rendering engine. Both toolkits also have Python bindings support.","Q_Score":2,"Tags":"python,browser,tkinter","A_Id":9133448,"CreationDate":"2012-02-01T16:41:00.000","Title":"How do i integrate a browser in my tk application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I find out when the text has been changed in a text view widget in the GTK3 framework? I think there must be a signal associated with it, but could not find it.\nFor example, there is an ontextchanged signal in qt4, so there should be a similar signal in GTK. I am using Python.","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":1337,"Q_Id":9113717,"Users Score":11,"Answer":"Every TextView widget is associated to a TextBuffer object. The signal you are looking for is changed but of the associated text buffer. If you create a TextView without an associated buffer, a default one is created for you and you can retrieve it with textview.get_buffer()","Q_Score":5,"Tags":"python,gtk3","A_Id":9114062,"CreationDate":"2012-02-02T14:07:00.000","Title":"Text changed signal for Text View widget in GTK3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on cloud storage project and want to build GTK client for it. Possible choices found are pygtk\/glade and vala. For the moment I am not familiar neither with pygtk nor with vala. Some googling showed that vala is quite a good choice. But I know python and completely new to vala. So I am looking for very strong arguments for vala in order to decide whether to use it or not. Any help is appreciated.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":2190,"Q_Id":9121255,"Users Score":2,"Answer":"A lot of Gnome apps are currently being rewritten in vala. This gives better performance and a better integration with the gtk libraries.\nI personally think the language is pretty good, for a compiled language, but no doubt it is not as powerful or widely used as python.\nIf you are building an open source app (or something other people are going to maintain), you might want to go with the language that more people use. However there are also many benefits on being on the new, officially pushed wagon, like integration and a \"coolness\" factor.","Q_Score":3,"Tags":"python,gtk,pygtk,vala","A_Id":9122595,"CreationDate":"2012-02-02T22:55:00.000","Title":"GTK GUI: pygtk vs vala","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a bunch of widgets and right now I am using Hide() and Show() to each widget individually when I flip through different sections\/pages of my program.\nBecause I did this, You can see each widget leaving\/showing one by one (which kinda sucks).\nIs there anyway to group all these widgets and then be able to Hide() and Show() this group, to avoid this \"one by one\" habit?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":346,"Q_Id":9136567,"Users Score":1,"Answer":"Put your group of widgets organized in a sizer in the same parent container (p.e. a panel) and hide the parent. All the widgets disappear with the parent.\nNote that sometimes hiding (for example) buttons or checkboxes is not the best solution. Available functionality for the user can be also modulated using widget.Disable()","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":9137127,"CreationDate":"2012-02-03T22:48:00.000","Title":"Assiociate Widgets into Groups, for Hide and Show, wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a bunch of widgets and right now I am using Hide() and Show() to each widget individually when I flip through different sections\/pages of my program.\nBecause I did this, You can see each widget leaving\/showing one by one (which kinda sucks).\nIs there anyway to group all these widgets and then be able to Hide() and Show() this group, to avoid this \"one by one\" habit?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":346,"Q_Id":9136567,"Users Score":3,"Answer":"Try using Freeze\/Thaw\/Layout when you are showing and hiding the widgets. This way they should all appear\/disappear at the same time.","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":9143928,"CreationDate":"2012-02-03T22:48:00.000","Title":"Assiociate Widgets into Groups, for Hide and Show, wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a question.\nThere are two classes: A and B. A creates object of type B. So from A, it is easy to access methods of B, but how can I access methods of object A from object B? I am trying to use bidirectional signal-slot mechanism in Qt. A can easily have a slot for a signal in B, but B cannot see signals in A.\nI have a vague idea that somehow the creator class can be referenced as a 'member' while an object is being created, but I am not sure how to do code this.\nThanks in advance.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":298,"Q_Id":9148782,"Users Score":0,"Answer":"There's no way to do this automatically. You'll just have to give each B a reference to A when you create it, something like b_instance.parent = a_instance.","Q_Score":0,"Tags":"python,pyqt4,python-2.7","A_Id":9148796,"CreationDate":"2012-02-05T11:17:00.000","Title":"How to reference creator object in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a disabled button, and it does not receive clicks when I use EVT_BUTTON on it. Is there a way to receive clicks even when it has been Disabled()?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":97,"Q_Id":9152827,"Users Score":2,"Answer":"The whole point of disabling a button is so that the EVT_BUTTON event is not fired. I'm sure you could create create an ugly hack using EVT_LEFT_DOWN and detecting where the mouse is in your app as a workaround, but why bother? This is intended behavior.","Q_Score":1,"Tags":"python,wxpython","A_Id":9161998,"CreationDate":"2012-02-05T20:41:00.000","Title":"How to get clicks on disabled buttons with wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a disabled button, and it does not receive clicks when I use EVT_BUTTON on it. Is there a way to receive clicks even when it has been Disabled()?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":97,"Q_Id":9152827,"Users Score":0,"Answer":"Perhaps wxpython has a mechanism similar to pygtk.\nIn pygtk you create a input-only (that is transparent) window over the widget you want to get clicks for and get your clicks there.","Q_Score":1,"Tags":"python,wxpython","A_Id":9160600,"CreationDate":"2012-02-05T20:41:00.000","Title":"How to get clicks on disabled buttons with wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to know if it is possible to incorporate Buttons in a ListCtrl in report mode on each line in a column.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":142,"Q_Id":9159368,"Users Score":0,"Answer":"If you use the UltimateListCtrl, then yes. The normal ListCtrl widget does not support that.","Q_Score":0,"Tags":"wxpython,listctrl","A_Id":9162017,"CreationDate":"2012-02-06T11:23:00.000","Title":"Buttons in a wx.ListCtrl in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Python's CTypes to bind to a shared library; I have a callback registered with this library, which is called in the context of a thread that the library itself creates. I've found that if I call libc.malloc() (libc = cdll.LoadLibrary('libc.so.6')) from within my callback, that it returns bogus values. Not NULL, but an address which will cause a segfault if I dereference it.\nCan anyone provide me with any insight to what may be happening, or alternatively, tell me that they call malloc() in the same way, and that it works for them.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":811,"Q_Id":9160294,"Users Score":1,"Answer":"Are you properly anottating the malloc call so that ctypes know it should return pointers not integers? (Doubly so if you are working on a 64bit box?)","Q_Score":0,"Tags":"python,multithreading,ctypes","A_Id":9163769,"CreationDate":"2012-02-06T12:44:00.000","Title":"Malloc failing when called via ctypes from a c thread","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"We are developing a small c server application. The server application does some data processing and responds back to the client. To keep the data processing part configurable and flexible we decided to go for scripting and based on the availability of various ready modules we decided to go for Python. We are using the Python-C api to send\/receive the data between c and python.\nThe Algorithm works something like this:-\n\nServer receives some data from client, this data is stored in a dictionary created in c. The dictionary is created using the api function PyDict_New(); from c. The input is stored as a key value pair in the dictionary using the api function PyDict_SetItemString();\nNext, we execute the python script PyRun_SimpleString(); passing the script as a parameter. This script makes use of the dictionary created in c. Please note, we make the dictionary created in c, accessible to the script using the methods PyImport_AddModule(); and PyModule_AddObject();\nWe store the result of the data processing in the script as a key value pair in the same dictionary created above. The c code can then simply access the result variable(key-value pair) after the script has executed.\n\nThe problem\nThe problem we are facing is in the case of concurrent requests coming in from different clients. When multiple requests come in from different clients we tend to object reference count exceptions. Please note, that for each request which comes in for a user, we create an independent dictionary for that user alone. To overcome this problem we encompassed the call to PyRun_SimpleString(); within PyEval_AcquireLock(); and PyEval_ReleaseLock();, but doing this has resulted in the script execution being a blocking call. So if a script is taking long time to execute, all the other users are also waiting for a response.\nCould you please suggest the best possible approach or give pointers to where we are going wrong. Please ping me for more information.\nAny help\/guidance will be appreciated.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":615,"Q_Id":9175940,"Users Score":1,"Answer":"I suggest you investigate the multiprocessing module.","Q_Score":5,"Tags":"python,c,multithreading,thread-safety,python-c-api","A_Id":9177358,"CreationDate":"2012-02-07T12:03:00.000","Title":"Python-C api concurrency issue","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My application has a custom dialog box that enables the user to set options on creating a new document. The main window has a toolbar, and even after dismissing the dialog, the toolbar buttons don't return to an active state. I've seen if fileDialog.ShowModal() == wx.ID_OK:\nto get the return value, but is there something else that enables the buttons again? Just sending dialog.Destroy() doesn't seem to do it.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":328,"Q_Id":9178342,"Users Score":0,"Answer":"Well, if you have a \"fileDialog\" and a \"dialog\" object open, then you probably need to Destroy them both. If you set the toolbar buttons into a Disabled state, you'll want to Enable them after you dismiss the dialogs.","Q_Score":0,"Tags":"wxpython,modal-dialog,toolbar","A_Id":9178527,"CreationDate":"2012-02-07T14:50:00.000","Title":"properly exiting custom modal dialog in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am planning to write a card game in python, and now looking for a GUI (I'm new to Python). \nI have so far tried out two GUI's :TK(inter) and wxPython.  \nNeither of them seem to be able , and correct me if I'm wrong, to do this  : \n\ndragging a panel with an image of a Card in it\n\nAnd it's not even about the dragging. This is the situation \n\nI want to place the Card in a container.  It should be able to show both front and backside of the card so I want each card to be a panel rather than a bare image.\nThe image should be able to have transparent areas (card corners are rounded) \nThe panel (container) should be able to be transparant (So the card can be dragged over different backgroundcolors, the table other cards,....)  \n\nTKinter : can't do 3 as I understand it\nwxPython : can't do 2 as I understand it. \nI can go along and discover GUI after GUI, but this is kind of time-consuming, so my questions are : \n\nIs it so that TKinter and wxPython have these shortcomings?\nIf so, what GUI to go to?  \n\nI've heard of pygame, but it's really not that much I am asking of the GUI.  Swing (java) could do it, and that's not gaming centered either.","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":8471,"Q_Id":9180803,"Users Score":1,"Answer":"Tkinter can handle transparent gifs. Your \"container\" requirements are a bit hard to understand, though. I don't understand what transparency has to do with the ability to drag it over different colored backgrounds.\nCertainly you can group objects (images, rounded retangles, ec) together on a canvas, and those objects can have blank spaces between \/ around them, and you can certainly draw round corners and drag objects.","Q_Score":3,"Tags":"python,user-interface,wxpython,tkinter","A_Id":9183516,"CreationDate":"2012-02-07T17:23:00.000","Title":"Python GUI for cardgame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing my first gedit plugin, a directory browser for the sidebar.\nShow sidepanel with content of the cwd.\n\nself._side_widget = self.get_dir() #returns a Gtk.Treestore obj\nself.side_panel = self.window.get_side_panel()\nself.side_panel.add_item(self._side_widget, \"dir-browser\", \"Directory\n  Browser\", None)\nself.side_panel.activate_item(self._side_widget)\n\nWith a double click on a file, i open the document in gedit.\nWith a double click on a directory I change the directory and I want to update the content of the side panel. \nI can build the a new treestore from the current working directory with self.get_dir() but I don't know how to update self.side_panel.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":543,"Q_Id":9212350,"Users Score":1,"Answer":"Either empty the current tree store and fill it again from the new directory, or call set_model(new_treestore) on the tree view widget. It will update itself.","Q_Score":0,"Tags":"python,pygtk,gedit,pygobject","A_Id":9213736,"CreationDate":"2012-02-09T14:09:00.000","Title":"Update Gedit side panel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a program using wxpython which entails the need to create many sub-windows for each of menubar items. I am currently creating those sub-windows by writing different class definition for each and instantiating those classes for each event. Is this better than to have wx.window? How does two compare and what are the situations where they should be used?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":938,"Q_Id":9216792,"Users Score":0,"Answer":"If each toolbar item is to open a new \"window\", then I would recommend a wx.Frame or wx.Dialog. You almost never need to use wx.Window directly. wx.Window is the parent of wx.Frame and wx.Dialog. As such, wx.Frame and wx.Dialog potentially add additional functionality.\nDialogs are modal and should be used when you want program execution to stop while the dialog is dealt with (like when you need to get special information to complete some task). Frames are used when you don't need to stop program execution.","Q_Score":0,"Tags":"python,user-interface,wxpython,wxwidgets","A_Id":9217489,"CreationDate":"2012-02-09T18:41:00.000","Title":"creating child windows in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When using wx.grid for creating table with wxpython, how can I automatically extend the number of rows and columns in the table once the user resizes the frame? \nIf I create 5*5 table(grid) to fit on my frame and user resizes the frame( say, makes it bigger), how can I implement automatic increase to the number of rows and\/or column which responds to increase in frame size?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":522,"Q_Id":9222734,"Users Score":1,"Answer":"Sadly there is no builtin way to do this that I'm aware of. You'll need to catch the frame's EVT_SIZE and then use AppendRows and AppendCols as necessary with the grid. You'll need to take into account how much the frame size has changed and only append when it gets bigger, not smaller.","Q_Score":1,"Tags":"python,user-interface,event-handling,wxpython,wxwidgets","A_Id":9230043,"CreationDate":"2012-02-10T04:34:00.000","Title":"automatic resizing of table in wx","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently using the C\/Python API to read data from a large binary file.\nThis result in Python is not as efficient as the pure C result (time x2) because, I think, of the time took to wrap things up into a PyObject. Typically, I store 42-elements tuples in a PyArrayObject. To do this, I use:\nPyObject *r = Py_BuildValue(\"(f, I, i, K, f, K, K, etc..)\", a, b, c, etc...) ;\nMy question is the following: Is there a more efficient way to do it (quicker execution time)?\nFor example: will PyTuple_Pack(n, args) do it more quickly ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":796,"Q_Id":9228771,"Users Score":0,"Answer":"For time critical code, I create a tuple of the desired length and then create the components individually and stuff them into the tuple.","Q_Score":0,"Tags":"python,c","A_Id":9231111,"CreationDate":"2012-02-10T13:51:00.000","Title":"C\/Python API : efficiency of Py_BuildValue use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a quick question that I hope someone can help me with.\nI'm in the process of creating\/planning an app that needs to run cross platform and use a com library from Windows.  In the past I've used win32py to run these com objects in a python app, I've been doing a bunch of research finding a solution on Mac but I've had no luck.  Ideally I'd like to stay in Python as I already have working code for Python 2.7 working with this library.  If there is a solution in another language however, I would like to hear it.\nI realize that this sounds almost sort of backwards, but to make a long story short I have to make this com library work on Mac.  I'm going to be doing some automated testing of some iOS stuff with the iOS SDK simulator.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":19626,"Q_Id":9233461,"Users Score":7,"Answer":"COM is Windows only.  COM requires extensive use of the Windows registry and WinAPI.  I've seen some frameworks emulate or mock COM behavior on other operating systems (e.g. MainWin on Linux\/Solaris), but I don't know of one for Mac.  \nThe win32py module is just a wrapper around WinAPI calls.  So if the WinAPI isn't available, win32py won't work.\nIs the logic you need something you can wrap a service around?  In other words, can you host a service on a Windows box and have the Mac application invoke the service?","Q_Score":5,"Tags":"python,ios,macos,winapi,com","A_Id":9234067,"CreationDate":"2012-02-10T19:14:00.000","Title":"Pywin32 (com objects) on Mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python program that is mostly complete, and there is one thing that I'd like to change, which may or may not be possible.\nThis program uses PyQT to display a GUI and I have it pretty much pinned up so I was wondering if I can make Python not open up a termianl when I open the program.\nI am using Windows XP right now, but the machines it will run on will be Windows 7.  I generally work with Linux, so I'm not terribly familiar with Windows.\nIf the terminal has to be there, it's no big deal, but I feel like it's extraneous at this point.\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1931,"Q_Id":9246204,"Users Score":5,"Answer":"Use the python extension .pyw. \nE.g program.pyw \nThis causes your program to be run with pythonw.exe instead of python.exe which suppresses the terminal.","Q_Score":2,"Tags":"windows,python-3.x,pyqt4","A_Id":9246252,"CreationDate":"2012-02-12T03:35:00.000","Title":"How to make a Python PyQT program not open the command line in Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is quite an essential part of my program and I need to have sorted out as soon as possible so anything would be a massive help.\nMy program consists of three modules which are imported to each other. One module consists of my user interface for which I am using tkinter. The user inputs data on a canvas which is sent to a second program to be processed and is then sent to the third module which contains the algorithm which I intend to step through with the user.\nThe \"first\" and \"third\" modules can interact with each other and during certain points in explaining the algorithm I change the appearance of the canvas and some text on the interface. The third module should then pause (for which I'm currently using a basic sleep method), and wait (ideally it will wait for the user to press the \"Next Step\" button on the user interface). It is during this step that my interface decides that it wants to freeze.\nIs there any way I can stop this?\nMany thanks in advance.\nEdit: I've found a way to fix this. Thank you for all the suggestions!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":4892,"Q_Id":9250624,"Users Score":0,"Answer":"A GUI program is always waiting for some action to occur.  When actions do occur, the event code corresponding to that action is executed.  Therefore, there is no need to call sleep().   All you need to do is set it up so that the third program is executed from the appropriate event.","Q_Score":2,"Tags":"python,tkinter","A_Id":9252989,"CreationDate":"2012-02-12T16:53:00.000","Title":"stop tkinter window from freezing while program is sleeping","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is quite an essential part of my program and I need to have sorted out as soon as possible so anything would be a massive help.\nMy program consists of three modules which are imported to each other. One module consists of my user interface for which I am using tkinter. The user inputs data on a canvas which is sent to a second program to be processed and is then sent to the third module which contains the algorithm which I intend to step through with the user.\nThe \"first\" and \"third\" modules can interact with each other and during certain points in explaining the algorithm I change the appearance of the canvas and some text on the interface. The third module should then pause (for which I'm currently using a basic sleep method), and wait (ideally it will wait for the user to press the \"Next Step\" button on the user interface). It is during this step that my interface decides that it wants to freeze.\nIs there any way I can stop this?\nMany thanks in advance.\nEdit: I've found a way to fix this. Thank you for all the suggestions!","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":4892,"Q_Id":9250624,"Users Score":1,"Answer":"H.E.P - \nThe traditional way to do this does indeed involve using a separate thread and co-ordinating the work between the \"worker\" thread and the GUI thread using some sort of polling or eventing mechanism.\nBut, as Thomas K. points out, that can get very complex and tricky, especially regarding Python's use of the Global Interpreter Lock (GIL) etc. and having to also contend with Tkinter's processing loop.\n(The only good reason to use a multi-threaded GUI is if you absolutely MUST ensure that the GUI remains responsive during a potentially long-running background task, which I don't believe is the issue in this case.)\nWhat I would suggest instead is a generator-based \"co-routine\"-type architecture.\nAs noted in \"The Python (2.7) Language Reference\", Section 6.8, [the \"yield\" statement is used when defining a generator function and is only used in the body of the generator function. Using a yield statement in a function definition is sufficient to cause that definition to create a generator function instead of a normal function.]\n(This effectively forms the basis of a co-routine architecture. (ed.))\n[When a generator function is called, it returns an iterator known as a generator iterator, or more commonly, a generator. The body of the generator function is executed by calling the generator\u2019s next() method repeatedly until it raises an exception.\nWhen a yield statement is executed, the state of the generator is frozen and the value of expression_list is returned to next()\u2018s caller. By \u201cfrozen\u201d we mean that all local state is retained, including the current bindings of local variables, the instruction pointer, and the internal evaluation stack: enough information is saved so that the next time next() is invoked, the function can proceed exactly as if the yield statement were just another external call.]\n(Also see \"PEP 0342 - Coroutines via Enhanced Generators \" for additional background and general info.)\nThis should allow your GUI to call the next part of your algorithm specification generator, on demand, without it having to be put to sleep until the operator presses the \"Next\" button.\nYou would basically just be creating a little 'domain-specific language', (DSL), consisting of just the list of steps for your presentation of this particular algorithm, and the generator (iterator) would simply execute each next step when called (on demand).\nMuch simpler and easier to maintain.","Q_Score":2,"Tags":"python,tkinter","A_Id":9265601,"CreationDate":"2012-02-12T16:53:00.000","Title":"stop tkinter window from freezing while program is sleeping","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently working on a GUI for a science experiment. I am using wxPython.\nI have done the design part and also the data logging in an SQLite database. Is it possible for the GUI to behave as a web-client and write data onto a website. I have a Kodingen account. Can this GUI write to my homepage everytime I run it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":260,"Q_Id":9260561,"Users Score":0,"Answer":"You should be able to use httplib or similar to communicate with your website and use wxPython as the front-end. When you hit you're Submit button or whatever, you would call httplib or a similar library to post the data to your website. You might need to use threads to keep the GUI responsive.","Q_Score":0,"Tags":"wxpython,client,web","A_Id":9261900,"CreationDate":"2012-02-13T12:31:00.000","Title":"wxPython GUI as a web-client","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"import wx\n\nTraceback (most recent call last):\n  File \"\", line 1, in \n    import wx\n  File \"C:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode\\wx\\__init__.py\", line 45, in \n    from wx._core import *\n  File \"C:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode\\wx\\_core.py\", line 4, in \n    import _core_\nImportError: DLL load failed: %1 is not a valid Win32 application\n\n\nI have tried python2.6 and python2.7 with several wxpython versions,they all turned out to be like this.All the versions are win64 as well as my OS,please hep!","AnswerCount":3,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":20396,"Q_Id":9277875,"Users Score":17,"Answer":"As mentioned by the other fellow, make sure you have a 64-bit Python AND a 64-bit wxPython version downloaded. If one or the other is 32-bit, it won't work. Personally, I have never had any problems installing wxPython on Windows.","Q_Score":18,"Tags":"wxpython","A_Id":9294892,"CreationDate":"2012-02-14T13:40:00.000","Title":"DLL load failed: 1% is not valid win32 application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"import wx\n\nTraceback (most recent call last):\n  File \"\", line 1, in \n    import wx\n  File \"C:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode\\wx\\__init__.py\", line 45, in \n    from wx._core import *\n  File \"C:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode\\wx\\_core.py\", line 4, in \n    import _core_\nImportError: DLL load failed: %1 is not a valid Win32 application\n\n\nI have tried python2.6 and python2.7 with several wxpython versions,they all turned out to be like this.All the versions are win64 as well as my OS,please hep!","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":20396,"Q_Id":9277875,"Users Score":2,"Answer":"I had this problem in windows 7 with Python2.7 as I have installed 32bit wx version earlier. Try installing 64bit and it will work fine.If you are in 64 bit system and trying to install 32bit wx you will get some error at the beginning. So try 64bit wx.","Q_Score":18,"Tags":"wxpython","A_Id":18842884,"CreationDate":"2012-02-14T13:40:00.000","Title":"DLL load failed: 1% is not valid win32 application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to modify an exe (of mine) with a hex editor.  It was originally written in Python using wx and turned into an exe via py2exe.  I lost the source code (ugh) and need to change one of the items in a dropdown menu.  It's a simple one character change, from a \"6\" to a \"9\". (Makes me think of Jimi Hendrix)\nI have used several hex editors, and I can find the string and make the change and save the file.  However, when I open the modified exe, the drop down entry has not changed.  I can verify that the exe is different by opening it in the hex editor again and checking, and the string is set to the new value I need.  It just doesn't display that way when running the app.  \nI obviously don't play with hex editors (or hex, for that matter) much.  What am I missing?  TIA.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":411,"Q_Id":9283788,"Users Score":0,"Answer":"You may find this next to impossible to do this way, since there could be thousands of characters like this in the exe.  You'd probably be better off first searching for a less common item in your dropdown to give you a better chance of finding the \"area\" where it may be occurring.  Then do a more localized search nearby for the \"6\".  Even then, there's no guarantee these dropdown items will be located near each other in the executable (but I think it likely).","Q_Score":0,"Tags":"python,exe,hex-editors","A_Id":9284042,"CreationDate":"2012-02-14T20:34:00.000","Title":"Hexedit of ASCII in exe not changing in app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Am wondering does twisted framework work well with wxPython GUI framework. From the docs its seems like twisted does not support wxPython well. The example given seems to be a bit shy on the details.\n\nIf not, what is the best way of using twisted with wxPython?\nWhich other non-blocking event-driven networking framework can i use with wxPython?\n\nThanks\nGath","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":762,"Q_Id":9296393,"Users Score":1,"Answer":"I'm using wxPython with Twisted on Linux, Mac and Windows without any crazy things happening.","Q_Score":1,"Tags":"python,wxpython,twisted","A_Id":9319541,"CreationDate":"2012-02-15T15:42:00.000","Title":"Does Python Twisted work with wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm building a database front-end with python and glade. I need to present SQL query results in the form of database tables inside my app's window (schema followed by tuples\/records). Both the schema and the database entries are dynamic because the schema could be that of a join operation or in general altered and the number of tuples could be any valid number.One possible solution could be to format a given table with python, create a text object in my GUI and change its' value to that produced by python. Advices and suggestions are very welcome.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2104,"Q_Id":9299934,"Users Score":3,"Answer":"Given that the number and name of the columns to display isn't known beforehand, you could just create a gtk.TreeView widget in glade and modify it as you need in the application code.\nThis widget could be updated to use a new model using gtk.TreeView.set_model and the columns could be adapted to match the information to be dsplayed with the gtk.TreeView.{append,remove,insert}_column columns.\nRegarding the model, you coud create a new gtk.ListStore with appropriate columns depending on the results from the database.\nI hope this helps.","Q_Score":3,"Tags":"python,user-interface,gtk,pygtk,glade","A_Id":9302750,"CreationDate":"2012-02-15T19:28:00.000","Title":"GUI for database tables with pygtk and glade","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting getting into PyQt. Therefore I would need some good tutorials. I searched a bit but didn't find any good. Most tutorials only post \"full\" applications but don't go into detail.\nCan you advise me some?\nCurrently im programming in Notepad++. Are there better lightweight editors or simple IDEs for python in combination with PyQt?","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":28223,"Q_Id":9319878,"Users Score":1,"Answer":"The C++ docs for QT are actually a pretty good reference for PyQT.  Last time I used PyQT (> 5 years ago), they were actually the best available reference.","Q_Score":20,"Tags":"python,user-interface,pyqt","A_Id":9319895,"CreationDate":"2012-02-16T22:11:00.000","Title":"Good PyQt tutorial needed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"(first question on StackOverflow, glad to be there :))\nI am using IronPython 2.7.1 and C# .net 4.0.\nI use C# to launch my python script.\nI have about 20 personal modules that are imported a lots of time.\nE.g :\nIf I have module1.py, module2.py, module3.py, module4.py\nand main_script.py.\nmain_script.py imports module1 and module2\nBoth module1 and module2 import module3.\nmodule1 and module3 import module4\netc.\nModules can have a large amount of code lines.\nWhat I see is when I execute my main_script.py, it takes about 4-5 sec to just import modules.\nI tried to use pyc.py to compile all my modules in a dll, and then used ngen on it, but I saw no differences when adding this dll using myEngine.Runtime.LoadAssembly().\nThen I wanted to use py_compile.py to get the pyc files, but is seems not working as the IronPython.Runtime.FunctionCode type is not supported in the IronPython.Modules.MarshalWriter class (function WriteObject(object o). (I got \"unmarshallable object\" exception when trying to compile).\nI am not very familiar with Python nor IronPython, and maybe I did not understood all the subtleties of the language (I think so, actually). I was searching the net for a solution, but it seems I am stuck right now.\nAny idea to improve the import performance ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1258,"Q_Id":9327606,"Users Score":3,"Answer":"Taking 4-5 seconds to do imports, especially for large modules, is not unexpected for IronPython 2.7.1. I would pyc.py to improve it, but I also think that it isn't as useful as it once was - IronPython's imports are a lot faster than they used to be, so pyc.py is less useful.\nThe thing is, IronPython does a lot more than Python does when it imports a module[1]. Python has to parse it and produce bytecode which it then executes. IronPython has to produce DLR trees which are then converted to interpreter instructions - and possibly also IL if they trip the compilation limit, which means running the .NET JIT to produce machine code.\nAll of that work is wasted if the script only takes a few seconds to run; IronPython is better for long-running processes. However, the short Python script is extremely common, and IronPython is extremely poor for those sorts of scripts.\nThere are two ways we're working at solving this, one of which you alluded to. Work is being done to support standard .pyc files with an interpreter optimized for startup time but not throughput - short scripts will benefit, but long-running code will suffer. Second, porting IronPython to mobile platforms requires disabling dynamic code generation, so making the DLR interpreter fast will be very important; this work will make uncompiled code faster to start as well.\nThe one thing we cannot overcome is the fact that .NET processes generally take longer to start than plain C ones. That overhead can be reduced, but it requires some fairly deep optimization that probably won't be done for a while.\n[1] Python's import process is so fast that the stat calls to find the file are much greater than the time to parse & compile it.","Q_Score":1,"Tags":"import,module,ironpython","A_Id":9332166,"CreationDate":"2012-02-17T11:41:00.000","Title":"Import module in IronPython 2.7.1 very slow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a battleship game for a project. While I have completed the logic and the game works with text input. I was hoping make a (very basic) GUI while still use the methods created for the text.\nThe two options I've been looking at are PyGame and Tkinter. PyGame does not seem to have a text output\/label function. Tkinter does, but it doesn't seem as easy (i feel) as PyGame is.\nThough I would love to give either of these frameworks the time they deserve, I have just over 60hrs before this is due. \nI wanted to know if anyone one has any experience or insights and if it is a realistic option.\nThanks as always!","AnswerCount":5,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2309,"Q_Id":9345307,"Users Score":2,"Answer":"This is a fairly trivial thing to do in Tkinter. A battleship game shows an array of coordinates which you can display as a grid of checkbuttons.","Q_Score":0,"Tags":"python,tkinter,pygame","A_Id":9345389,"CreationDate":"2012-02-18T23:53:00.000","Title":"Opinion on GUI for a Battleship game in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I activate autocompletion feature for wx classes in pyDev? I cannot find anything to prompt me to change that will activate this feature from PyDev>Preference>Autocompletion. How can I get autocompletion from packages like wx and other third-party packages?\nUpdate:\nI added wx path in configuration to pyDev and it now shows autocompletion for wx. However, I cannot see the method arguments and properties. For example if I seek for wx.Button, I just get autocompletion to complete writing Button but I want to know the required arguments for wx.Button as wx.Button(,....,size,pos...) etc. This works for the other methods of built-in methods when I press Ctrl+Space but I don't know how should I configure to get that from wx and other third party packages?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":324,"Q_Id":9350183,"Users Score":0,"Answer":"Regarding missing parameters on the constructor for wx.Button, unfortunately that's currently expected. Please create a bug report for PyDev specifying that.","Q_Score":1,"Tags":"java,c++,python,eclipse,wxpython","A_Id":9363014,"CreationDate":"2012-02-19T14:46:00.000","Title":"Autocompletion in Pydev- Eclipse for wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I will start a project ( not commercial, just for learning ) but I would like to choose to work with the right tools as I would if I were doing it for a company.\nFirst of all small description of what I will need.\nIt would be a server-client(s) application.\nFor the server:\n- GUI for Windows\n- ORM \n- Database without installation (sqlite ???)\n- GUI builder (RAD Tool)\n- Ability to create easily REST Services\nClients would be android devices\n- GUI for android mobile\nClients would connect to the server and get some initial settings and then start to \nsend  information to the server.\nServer should be able to display properly the information collected from the clients and \nedit them if needed.\nOpen source technologies are mandatatory.\nFirst I am thinking to use sqlite ( I should not make any installation except the programm). Any alternatives here?\nFor the server maybe python with a gui library and sql alchemy. What about Camelot?\nAnd for the clients (android) java. I think there are no other options here.\nCan you make some comments on the above choices?\nMaybe you can suggest something different which will make the development faster...","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":657,"Q_Id":9354695,"Users Score":0,"Answer":"As you have asserted: client is java only.\nOn server:\n\nGUI for Windows : WPF  \nORM - Database without installation : SQLCE 4.0 - Maybe use codefirst \nGUI builder (RAD Tool) : Visual Studio lets you do that for WPF apps \nAbility to create easily REST Services : Use WCF\n\nhope that helps","Q_Score":0,"Tags":"android,python,client-server","A_Id":9354732,"CreationDate":"2012-02-20T00:15:00.000","Title":"Right tools for GUI windows program","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to write server code for my python computer and make the android phone a client. The client needs to be able to send its location as well as be able to get data from the server and should run in the background and start itself every 5 minutes or so and send location data to the server. The python side should just receive and send messages as I want to. Can you guys point me in the write direction. I would like to have a GUI for this so should I use the SL4A for the android?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":604,"Q_Id":9355779,"Users Score":2,"Answer":"You are talking about Client-Server to set the location of your client. You have to create one server which will be provide you a webservice to submit your data. \nYou can you any web service like xmlrpc, soap ... to fulfill your needs. Python provide the module to develop this services.\nYou have to use SL4A to develop a client script which will be sending data to the server every 5 min.","Q_Score":2,"Tags":"android,python,sl4a","A_Id":9356229,"CreationDate":"2012-02-20T03:19:00.000","Title":"Python Computer -to- Android Phone","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Looking at the API there doesn't seem to be a way to center a wx.BusyInfo message to the center of the screen like with other pop  up modals by using Center().\nIs there a way to center wx.BusyInfo()?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":485,"Q_Id":9370794,"Users Score":0,"Answer":"Little late: but you can center a busyInfo window by specifying a parent. It will center on the parent, otherwise it will center on the screen.","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":13944075,"CreationDate":"2012-02-21T01:11:00.000","Title":"How to center a wx.BusyInfo() - wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Looking at the API there doesn't seem to be a way to center a wx.BusyInfo message to the center of the screen like with other pop  up modals by using Center().\nIs there a way to center wx.BusyInfo()?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":485,"Q_Id":9370794,"Users Score":1,"Answer":"not with wx.BusyInfo, as far as I know (although it should be already centered by default... have you tried not giving a parent window to the wx.BusyInfo?). \nAlternatively, you may want to try wx.lib.agw.PyBusyInfo instead: if it doesn't do exactly what you need, you can always hack it to suit your needs (it's pure Python).\nHope this helps.\nAndrea.","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":9374668,"CreationDate":"2012-02-21T01:11:00.000","Title":"How to center a wx.BusyInfo() - wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A good example is MS OneNote. It has the option to be fixed to one side of the screen and pushes all other windows to the side. When maximizing or resizing other windows, they can only expand up to the edge of OneNote. Does Python have this capability using Tkinter or another module? Thank you for any assistance.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":528,"Q_Id":9371916,"Users Score":0,"Answer":"Tkinter has very little control over the behavior of the rest of the windows on the OS. There's no built-in cross-platform function for this.","Q_Score":4,"Tags":"python,winapi,pywin32","A_Id":9372040,"CreationDate":"2012-02-21T03:49:00.000","Title":"How can I set up a dedicated screen area for an application in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A good example is MS OneNote. It has the option to be fixed to one side of the screen and pushes all other windows to the side. When maximizing or resizing other windows, they can only expand up to the edge of OneNote. Does Python have this capability using Tkinter or another module? Thank you for any assistance.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":528,"Q_Id":9371916,"Users Score":2,"Answer":"The win32 feature you're looking for is called Application Desktop Toolbars - it allows your application to cooperate with the shell and reserve space along the side, similar to the taskbar.\nIf you want to implement this yourself, you'll likely need to use Win32 somehow.\nIt looks like there's a python wrapper for this, however: searching for python and appbar turned up wxAppBar which seems to be a python wrapper for it.","Q_Score":4,"Tags":"python,winapi,pywin32","A_Id":9375993,"CreationDate":"2012-02-21T03:49:00.000","Title":"How can I set up a dedicated screen area for an application in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a grid wit n*n column with wxpython using wx.grid.Grid class. I want to use some of the cells of the grid as a drop-down list and some as buttons. How can widgets be implemented as a part of grid class in wxpython?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":710,"Q_Id":9372107,"Users Score":0,"Answer":"The wxPython demo shows how to put checkboxes in it. The event you want is probably wx.grid.EVT_GRID_CELL_LEFT_CLICK, so when you click on the cell, you could check which cell you clicked on and react appropriately. Even if you can't use a custom cell renderer, you could create a little frame with the widget you need over the cell you clicked on.","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":9397106,"CreationDate":"2012-02-21T04:17:00.000","Title":"using cells in grid as buttons and drop-down list","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a proof of concept for an in-memory database. I do know about stuff like redis and love things like intersecting sets but that is not enough. I want to find out how to implement a service which is like the parstream database or the drawntoscale solutions. \nAnd therefore I like to have a daemon which keeps stuff in the memory.\nI did a prototype with pyro which does what it should: generate a random bitmap index and accept an bitmap mask as input from a pyro client and return all primary keys which match the bitmap mask.\nBut iterating over the index is too slow by some magnitudes which is obvious since it is python. I would like to use an C extension which does the index scan. Therefore the bitmap index shoud be kept in memory inside the c extension.\nThe very next step would be to keep the same data in the gpu ram iterate over inside my gpu.\nHaving no experience writing c extensions and pyOpenCL my question is: can I keep data inside my C Extension and use python ( pyro daeomon or maybe even flask\/tornado ) just for receiving and returning the queries without copying the whole bitmap index all the time?\nRegards\nChristian","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":167,"Q_Id":9385251,"Users Score":0,"Answer":"Yes, C extensions can have internal structures allocated, but be sure to destroy your data properly when needed. \nYou can also write your code as  a C\/C++ DLL and use the ctypes python extension to access C functions directly and pass them C variables (ints, char *, etc.).","Q_Score":0,"Tags":"python,c,database,daemon,opencl","A_Id":9497466,"CreationDate":"2012-02-21T21:12:00.000","Title":"python c extension \/ opencl daemon","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm kinda new to programming, and I wanna write a simple program that needs to OCR a particular window. Currently, I'm using (w.GetForegroundWindow()), but that gets me the current window which would always be the Python shell, since that is the one that is active when I run it, even if it is for a split second only. \nAfter searching around for a bit, I found the .Getwindows function, but not much of it on Python. What does it do, and what are the parameters? Will i be able to target a particular process (=window) with it? If not, what can I use then?\nThis is using the pywin32 module on Python 2.7 in Windows\n\nI'm in Windows, Python 2.7 . The GetWindows function comes with the module pywin32, if im not wrong","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":815,"Q_Id":9414906,"Users Score":0,"Answer":"The usual way is to call EnumWindows with a callback and then get information about each hwnd - for example name, title or window class. Check that against what you are looking for and save the matched hwnd. After EnumWindows returns, check that you found a valid hwnd and use that for your program.\nIt's not pleasant - there's not much support for this kind of thing in windows. I've heard that using accessibility features is better but I have no experience using that.","Q_Score":0,"Tags":"python,process,window,pywin32","A_Id":9429657,"CreationDate":"2012-02-23T14:25:00.000","Title":"What are the parameters for .GetWindow function in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm working on a program that outputs a text procedure file, based on user input. ie, the user will have a few options they can select from, and I'd like for them to be able to add them, reorder them, etc. into a custom order, and have it output that list into a text file.\nI'd like to write this in python, and I am familiar with wxWidgets, but not tied to that. Any ideas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":189,"Q_Id":9423127,"Users Score":0,"Answer":"If you're talking about some kind of list box with strings in it, then you might want to look at the EditableListBox, which is in wx.gizmos.EditableListBox. See the wxPython demo for more info.\nOtherwise you'll have to roll your own, which really shouldn't be that hard.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":9432185,"CreationDate":"2012-02-23T23:29:00.000","Title":"Widget to add, remove, and sort entries in a wxpython program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to PySide and Qt at all, and now need to create an application which has a tree view with styled items. Each item needs two lines of text (different styles), and a button. Many items are supposed to be in the view, so I chose QTreeView over QTreeWidget. Now I managed to add simple text items (non-styled) to the QTreeView and have almost no idea about how to place several widgets on one item. Could you please give me an example of how to create such design?\nI've found some samples on the Internet, that are similar to what I want, but they all are in C++, and it's not obvious how to convert delegates and other things to Python. I'm now really confused about it all...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1305,"Q_Id":9431870,"Users Score":1,"Answer":"I'd recomend you use simple QTreeWidget and insert complex widgets with setItemWidget. While Qt's widhets are alien, they are not so heavy to draw, but:\n\nYou shouldn't create delegates.\nYou shouldn't handle events (If you are going to place button in view and draw it using delegates, you had to handle all its events, such as mouseOver, focus changing, etc. It is a lot of work.","Q_Score":0,"Tags":"python,qt,customization,pyside,qtreeview","A_Id":9434264,"CreationDate":"2012-02-24T13:53:00.000","Title":"Customize QTreeView items","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm doing a little user\/password emulator with a super simple visual interface (using Tkinter) and I need to hide the characters when the user is typing his password.\nI need to hide them by that kind of dots that all the systems use when you are going to login into somewhere.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1068,"Q_Id":9452318,"Users Score":1,"Answer":"TKinter's Entry widget has a show option. If you set this option to a single character (e.g. *), this character is displayed instead of the actual characters. \nIf you don't want the asterisk (*) character, you can try the the bullet (\u2022, \"\\u2022\" in Python).","Q_Score":0,"Tags":"python,login","A_Id":9452378,"CreationDate":"2012-02-26T10:24:00.000","Title":"Hiding characters in Python by dots","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program that receives serial data and uses matplotlib to graph it using Tkinter. I have this working currently, but I've had to use the .after() function to poll a queue for data.  In other UI frameworks I've used in the past (different projects in C) there has been a way to ask the UI framework to call a function given to it from the mainloop (either after some amount of time, during idle, etc). If I try to use .after() on a thread which isn't the mainloop, it doesn't work and complains at me.\nIs there a way to call a user supplied function, provided on a thread which isn't the mainloop, from the mainloop? Or, is there a way to instruct the mainloop to wake up and do some work if a Queue gets some data?\nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":269,"Q_Id":9457170,"Users Score":1,"Answer":"I've heard that you can call event_generate from the non-GUI thread. If you do call event_generate, I've read that you should give the value of tail to the when parameter. \nI've personally only done this in one project, but it seemed to work fine.","Q_Score":1,"Tags":"python,multithreading,tkinter","A_Id":9457843,"CreationDate":"2012-02-26T21:08:00.000","Title":"Is there a way to request a function to be called on Tkinter mainloop from a thread which is not the mainloop?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anyone know if it's possible to add a label to a single tool in a wx.ToolBar? I've found a global setting but no option to set it for a single tool.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":172,"Q_Id":9463565,"Users Score":1,"Answer":"I have a feeling that's a limitation of the native widget. It's an all or nothing affair. You could make the label a part of the image on the tool item though. Or you might be able to do it with FlatMenu which has a Toolbar widget equivalent that's written in pure Python, so you can hack it. See the wxPython demo for an example of its API.","Q_Score":0,"Tags":"python,wxpython","A_Id":9466460,"CreationDate":"2012-02-27T10:36:00.000","Title":"Can I add a label to a single tool in a wxPython toolbar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application written in Python and 'compiled' with PyInstaller. It also uses PyQt for the GUI framework.\nRunning this application has a delay of about 10 seconds before the main window loads and is shown. As far as I can tell, this is not due to slowness in my code. Instead, I suspect this is due to the Python runtime initializing.\nThe problem is that this application is started with a custom laucncher \/ taskbar application. The user will click the button to launch the app, see nothing appear to happen, and click elsewhere on another application. When my application shows it's window, it cannot come to the foreground due to the rules for SetForegroundWindow.\nI have access to the source for the PyInstaller win32 loader, the Python code, and even the launcher code.\nMy questions are:\n\nHow can I make this application start faster?\nHow can I measure the time spend i the first few seconds of the process's lifetime?\nWhat is the generally accepted technique for reducing time until the first window is shown?\n\nI'd like to avoid adding a splash screen for two reasons - one, I expect it won't help (the overhead is before Python code runs) and two, I just don't like splash screens :)\nIf I need to, I could probably edit the PyInstaller loader stub to create a window, but that's another route i'd rather not take.","AnswerCount":7,"Available Count":7,"Score":1.0,"is_accepted":false,"ViewCount":58999,"Q_Id":9469932,"Users Score":43,"Answer":"Tell PyInstaller to create a console-mode executable. This gives you a working console you can use for debugging.\nAt the top of your main script, even before the first import is run, add a print \"Python Code starting\". Then run your packaged executable from the command line. This way you can get a clear picture whether the time is spent in PyInstaller's bootloader or in your application.\nPyInstaller's bootloader is usually quite fast in one-dir mode, but it can be much slower in one-file mode, because it depacks everything into a temporary directory. On Windows, I\/O is very slow, and then you have antiviruses that will want to double check all those DLL files.\nPyQt itself is a non-issue. PyQt is generated by SIP which generates very fast lazy bindings; importing the whole PyQt is faster than any other GUI library because it basically does nothing: all bindings to classes\/functions are dynamically created when (and if!) you access them, saving lots of memory too.\nIf your application is slow at coming up, that will be true without PyInstaller as well. In that case, your only solution is either a splash screen (import just PyQt, create QApplication, create a display the splashscreen, then import the rest of your program and run it), or rework your code. I can't help you much without details.","Q_Score":71,"Tags":"python,windows,performance,pyinstaller","A_Id":9474575,"CreationDate":"2012-02-27T18:08:00.000","Title":"App created with PyInstaller has a slow startup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application written in Python and 'compiled' with PyInstaller. It also uses PyQt for the GUI framework.\nRunning this application has a delay of about 10 seconds before the main window loads and is shown. As far as I can tell, this is not due to slowness in my code. Instead, I suspect this is due to the Python runtime initializing.\nThe problem is that this application is started with a custom laucncher \/ taskbar application. The user will click the button to launch the app, see nothing appear to happen, and click elsewhere on another application. When my application shows it's window, it cannot come to the foreground due to the rules for SetForegroundWindow.\nI have access to the source for the PyInstaller win32 loader, the Python code, and even the launcher code.\nMy questions are:\n\nHow can I make this application start faster?\nHow can I measure the time spend i the first few seconds of the process's lifetime?\nWhat is the generally accepted technique for reducing time until the first window is shown?\n\nI'd like to avoid adding a splash screen for two reasons - one, I expect it won't help (the overhead is before Python code runs) and two, I just don't like splash screens :)\nIf I need to, I could probably edit the PyInstaller loader stub to create a window, but that's another route i'd rather not take.","AnswerCount":7,"Available Count":7,"Score":1.0,"is_accepted":false,"ViewCount":58999,"Q_Id":9469932,"Users Score":13,"Answer":"I agree with above answers. My Qt python program needed about 5 seconds to start up on a decent PC when using onefile mode. After I change to --onedir, it only took around one second to start; almost immediately after user double clicks the exe file. But the drawback is that there are  many files in that directory which is not so neat.","Q_Score":71,"Tags":"python,windows,performance,pyinstaller","A_Id":15892172,"CreationDate":"2012-02-27T18:08:00.000","Title":"App created with PyInstaller has a slow startup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application written in Python and 'compiled' with PyInstaller. It also uses PyQt for the GUI framework.\nRunning this application has a delay of about 10 seconds before the main window loads and is shown. As far as I can tell, this is not due to slowness in my code. Instead, I suspect this is due to the Python runtime initializing.\nThe problem is that this application is started with a custom laucncher \/ taskbar application. The user will click the button to launch the app, see nothing appear to happen, and click elsewhere on another application. When my application shows it's window, it cannot come to the foreground due to the rules for SetForegroundWindow.\nI have access to the source for the PyInstaller win32 loader, the Python code, and even the launcher code.\nMy questions are:\n\nHow can I make this application start faster?\nHow can I measure the time spend i the first few seconds of the process's lifetime?\nWhat is the generally accepted technique for reducing time until the first window is shown?\n\nI'd like to avoid adding a splash screen for two reasons - one, I expect it won't help (the overhead is before Python code runs) and two, I just don't like splash screens :)\nIf I need to, I could probably edit the PyInstaller loader stub to create a window, but that's another route i'd rather not take.","AnswerCount":7,"Available Count":7,"Score":1.0,"is_accepted":false,"ViewCount":58999,"Q_Id":9469932,"Users Score":66,"Answer":"I suspect that you're using pyinstaller's \"one file\" mode -- this mode means that it has to unpack all of the libraries to a temporary directory before the app can start. In the case of Qt, these libraries are quite large and take a few seconds to decompress. Try using the \"one directory\" mode and see if that helps?","Q_Score":71,"Tags":"python,windows,performance,pyinstaller","A_Id":9470393,"CreationDate":"2012-02-27T18:08:00.000","Title":"App created with PyInstaller has a slow startup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application written in Python and 'compiled' with PyInstaller. It also uses PyQt for the GUI framework.\nRunning this application has a delay of about 10 seconds before the main window loads and is shown. As far as I can tell, this is not due to slowness in my code. Instead, I suspect this is due to the Python runtime initializing.\nThe problem is that this application is started with a custom laucncher \/ taskbar application. The user will click the button to launch the app, see nothing appear to happen, and click elsewhere on another application. When my application shows it's window, it cannot come to the foreground due to the rules for SetForegroundWindow.\nI have access to the source for the PyInstaller win32 loader, the Python code, and even the launcher code.\nMy questions are:\n\nHow can I make this application start faster?\nHow can I measure the time spend i the first few seconds of the process's lifetime?\nWhat is the generally accepted technique for reducing time until the first window is shown?\n\nI'd like to avoid adding a splash screen for two reasons - one, I expect it won't help (the overhead is before Python code runs) and two, I just don't like splash screens :)\nIf I need to, I could probably edit the PyInstaller loader stub to create a window, but that's another route i'd rather not take.","AnswerCount":7,"Available Count":7,"Score":1.2,"is_accepted":true,"ViewCount":58999,"Q_Id":9469932,"Users Score":1,"Answer":"I have 'compiled' a few wxPython apps using py2exe and cx_Freeze, None of them take more than 4 seconds to start.\n\nAre you sure sure it's not your code ?\nmaybe some network or some I\/O  resource call holding your app ?\nHave you tried other machine than yours? Even the fastest hardware can be slow sometimes with the wrong software config, apps or OS, try it.\nTry timing it with timeit module.\n\nI never used pyQT, but with wxPython the startup speed is OK, and after the first initialize if I close and open again, it's faster than the first time.","Q_Score":71,"Tags":"python,windows,performance,pyinstaller","A_Id":9470332,"CreationDate":"2012-02-27T18:08:00.000","Title":"App created with PyInstaller has a slow startup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application written in Python and 'compiled' with PyInstaller. It also uses PyQt for the GUI framework.\nRunning this application has a delay of about 10 seconds before the main window loads and is shown. As far as I can tell, this is not due to slowness in my code. Instead, I suspect this is due to the Python runtime initializing.\nThe problem is that this application is started with a custom laucncher \/ taskbar application. The user will click the button to launch the app, see nothing appear to happen, and click elsewhere on another application. When my application shows it's window, it cannot come to the foreground due to the rules for SetForegroundWindow.\nI have access to the source for the PyInstaller win32 loader, the Python code, and even the launcher code.\nMy questions are:\n\nHow can I make this application start faster?\nHow can I measure the time spend i the first few seconds of the process's lifetime?\nWhat is the generally accepted technique for reducing time until the first window is shown?\n\nI'd like to avoid adding a splash screen for two reasons - one, I expect it won't help (the overhead is before Python code runs) and two, I just don't like splash screens :)\nIf I need to, I could probably edit the PyInstaller loader stub to create a window, but that's another route i'd rather not take.","AnswerCount":7,"Available Count":7,"Score":0.0855049882,"is_accepted":false,"ViewCount":58999,"Q_Id":9469932,"Users Score":3,"Answer":"For my application, the long startup time almost entirely was caused by the antivirus system. Switching it off reduced the startup in my case from 3 minutes to less than 10secs!\nTo bring these measurements into perspective: My application was bundled with extra data files (about 150 files with a payload of 250MB), besides carrying around Qt and numpy (that may depend on Intel MKL, which alone adds another 200MB to the bundle!) dependencies. It even didn't help much that the tested system was running with a solid state drive...\nIn conclusion: if you have a large application with lots of dependencies, the startup time may be affected strongly by the antivirus system!","Q_Score":71,"Tags":"python,windows,performance,pyinstaller","A_Id":49350571,"CreationDate":"2012-02-27T18:08:00.000","Title":"App created with PyInstaller has a slow startup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application written in Python and 'compiled' with PyInstaller. It also uses PyQt for the GUI framework.\nRunning this application has a delay of about 10 seconds before the main window loads and is shown. As far as I can tell, this is not due to slowness in my code. Instead, I suspect this is due to the Python runtime initializing.\nThe problem is that this application is started with a custom laucncher \/ taskbar application. The user will click the button to launch the app, see nothing appear to happen, and click elsewhere on another application. When my application shows it's window, it cannot come to the foreground due to the rules for SetForegroundWindow.\nI have access to the source for the PyInstaller win32 loader, the Python code, and even the launcher code.\nMy questions are:\n\nHow can I make this application start faster?\nHow can I measure the time spend i the first few seconds of the process's lifetime?\nWhat is the generally accepted technique for reducing time until the first window is shown?\n\nI'd like to avoid adding a splash screen for two reasons - one, I expect it won't help (the overhead is before Python code runs) and two, I just don't like splash screens :)\nIf I need to, I could probably edit the PyInstaller loader stub to create a window, but that's another route i'd rather not take.","AnswerCount":7,"Available Count":7,"Score":0.0855049882,"is_accepted":false,"ViewCount":58999,"Q_Id":9469932,"Users Score":3,"Answer":"In case anyone is still have this issue, I resolved mine by running the exe locally and not on any sharedrives. This took the startup time from over a minute to under 10 seconds.","Q_Score":71,"Tags":"python,windows,performance,pyinstaller","A_Id":57366288,"CreationDate":"2012-02-27T18:08:00.000","Title":"App created with PyInstaller has a slow startup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application written in Python and 'compiled' with PyInstaller. It also uses PyQt for the GUI framework.\nRunning this application has a delay of about 10 seconds before the main window loads and is shown. As far as I can tell, this is not due to slowness in my code. Instead, I suspect this is due to the Python runtime initializing.\nThe problem is that this application is started with a custom laucncher \/ taskbar application. The user will click the button to launch the app, see nothing appear to happen, and click elsewhere on another application. When my application shows it's window, it cannot come to the foreground due to the rules for SetForegroundWindow.\nI have access to the source for the PyInstaller win32 loader, the Python code, and even the launcher code.\nMy questions are:\n\nHow can I make this application start faster?\nHow can I measure the time spend i the first few seconds of the process's lifetime?\nWhat is the generally accepted technique for reducing time until the first window is shown?\n\nI'd like to avoid adding a splash screen for two reasons - one, I expect it won't help (the overhead is before Python code runs) and two, I just don't like splash screens :)\nIf I need to, I could probably edit the PyInstaller loader stub to create a window, but that's another route i'd rather not take.","AnswerCount":7,"Available Count":7,"Score":0.0285636566,"is_accepted":false,"ViewCount":58999,"Q_Id":9469932,"Users Score":1,"Answer":"I solved this by adding an exception to the anti-virus monitoring software (F-Secure). It removed the wait of several minutes before running.","Q_Score":71,"Tags":"python,windows,performance,pyinstaller","A_Id":68760139,"CreationDate":"2012-02-27T18:08:00.000","Title":"App created with PyInstaller has a slow startup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using QWebKit to render a a pdf-page. Untill now, I used setHtml(), to feed the html code to the QMainFrame and then render() to print the content or export it to pdf. So far so good, but I want to use setContent() to include inline-svg-images to the frame, which get not displayed, using setHtml().\nBut setContent() only accepts QByteArray, and the html-Code is in unicode. How do I feed the unicode string to setContent()?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":284,"Q_Id":9470170,"Users Score":1,"Answer":"The way to get a byte array out of a unicode is to encode it.","Q_Score":0,"Tags":"python,pyside,qwebpage","A_Id":9470209,"CreationDate":"2012-02-27T18:25:00.000","Title":"Using QWebFrame.setContent() with unicode (Python+PySide)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"To make it quick and dirty - I'm a newb programmer who's looking hard at Pyglet, it looks like a really clean and friendly module to use, unlike something like PyGame which is, even by looking with my own inexperienced eyes, a beast.\nHowever.  PyGame is constantly being used, updated, reused by lots of people and seems to have quite a following.  Pyglet hasn't been updated since January 2010.  Most works of art are never finished, only abandoned - but two years and it's still on v 1.1.4 seems troubling.\nSo while I might be specifically asking about Pyglet vs. PyGame, I'm also not, because it leads me wonder about other ghostly modules that might be lurking out there, that had promise once upon a time but, for some reason, got dropped or shoved in a corner and aren't really relevant.  Are such abandoned projects not worth the time and brain-space investment?","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":2144,"Q_Id":9472750,"Users Score":1,"Answer":"To paraphrase Monty Python\n\nNo no he's not stagnant, he's, he's restin'!\n\nOpen source maintainers move on or get busy with other things.  If you feel Pyglet is a good choice for your application create a clone of the repo, put your changes up on insert code hosting flavor of the month, and get some work done.  There are benefits to having a community to ask for help or fix bugs.\nHowever, if something is open source and a good fit for your project the lack of a maintainer should be seen as an opportunity and not a problem.","Q_Score":6,"Tags":"python,pyglet","A_Id":9473902,"CreationDate":"2012-02-27T21:42:00.000","Title":"Python - Is it worthwhile to invest time in apparently stagnant modules?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"To make it quick and dirty - I'm a newb programmer who's looking hard at Pyglet, it looks like a really clean and friendly module to use, unlike something like PyGame which is, even by looking with my own inexperienced eyes, a beast.\nHowever.  PyGame is constantly being used, updated, reused by lots of people and seems to have quite a following.  Pyglet hasn't been updated since January 2010.  Most works of art are never finished, only abandoned - but two years and it's still on v 1.1.4 seems troubling.\nSo while I might be specifically asking about Pyglet vs. PyGame, I'm also not, because it leads me wonder about other ghostly modules that might be lurking out there, that had promise once upon a time but, for some reason, got dropped or shoved in a corner and aren't really relevant.  Are such abandoned projects not worth the time and brain-space investment?","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2144,"Q_Id":9472750,"Users Score":10,"Answer":"as the owner of a \"dormant\" package, my own take is:\n\na more popular package is going to have better support from the community.  for many people i think this overrides any other consideration.  it's often better to have support for a mediocre package than battle with an awesome package no-one else is using.\nand it may well be popular because it's better.  obviously i am biased towards the underdog (see above) here, but it has to be said that if a package never gained many users, perhaps it wasn't a good match to the market.\n\nBUT\n\nif the package is mature and working, and it does what you want, why not use it?  especially when open source means you can fix bugs yourself, forking if necessary.\n\nso, it depends.  all other things being equal - use the popular choice.  if you need support - use the popular choice.  but if a package happens to exactly scratch an itch, and it's open source and out there, i would still consider it.\nimportant qualification: this is for personal projects - for work i have a responsibility to use popular projects so that others can support the code i have written.\npython specific rider:  one additional thing to worry about is python 3 support.  if a dormant package is stuck on python 2 i would think twice because long-term there's a real chance it will stop working on default python installs.","Q_Score":6,"Tags":"python,pyglet","A_Id":9472827,"CreationDate":"2012-02-27T21:42:00.000","Title":"Python - Is it worthwhile to invest time in apparently stagnant modules?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a python GUI in Tkinter for a time-clock system. The micro machine is wall mounted and the employees only have access to the touchscreen menu I programmed and a barcode swipe. I know how to get the script to start on startup, but how do I prevent them from exiting out or opening other menus? Basically the sole purpose of this console is to run the time-clock GUI.\nIf it cant be done in Ubuntu, is there another flavor of linux it can be done in?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":224,"Q_Id":9484724,"Users Score":1,"Answer":"Don't start a window manager. Only start your program, e.g. from xinitrc. Make the program full-screen","Q_Score":1,"Tags":"python,user-interface,ubuntu,tkinter,restriction","A_Id":9489644,"CreationDate":"2012-02-28T15:27:00.000","Title":"How do I limit a Ubuntu machine to a Python GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"This question isn't about how to grab the keypress, i'm using accelators for that(but fi thats the wrong way by all means correct me)\nOnce i start my program, i press ESC to hide it with window.hide_all().\nthe user may then do other things in other programs, etc, but I want to make it so whenever the user presses, for example, alt + backspace, my program comes back to visibility\nVery much like in unix system, pressing alt + f2 fires up the GUI launcher.\nbonus: plus what happens if the key combination i set (alt + backspace) is already a shortcut for something in the user's system?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":65,"Q_Id":9509958,"Users Score":3,"Answer":"You'll need to arrange that in the window manager. If the program doesn't have the input focus, it doesn't even receive keystrokes.","Q_Score":0,"Tags":"python,pygtk","A_Id":9511745,"CreationDate":"2012-03-01T02:52:00.000","Title":"How can I bring a pyGTK program to visibility, at any time, with a keypress?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have some C++ code that delivers events to Python objects. Observers are kept as weak_ptrs, so they don't have to deregister.\nThis works in C++, but bridging weak pointers and Python weak references is troublesome (I also want Python event handlers not being kept alive by subscriptions, same as in C++ code). In order to have a live observer, something needs to have a shared pointer to it while the object is alive, so it boils down to having an observer in Python land control the lifetime of a C++ observer object.\nThe approaches I've come up with so far involve a fair amount of boilerplate and intermediate objects (e.g. creating another PyTypeObject for a type that keeps a C++ observer and a weak reference to the Python observer and setting it as a member of Python observer, so it dies with it).\nThe question is, is there any obvious way to do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":107,"Q_Id":9577314,"Users Score":0,"Answer":"I would write a python wrapper over the C++ module and dispatch to python observers in the python wrapper. Would that be enough?\nWhen you mention that something needs to have a shared pointer, would it be enough if that shared pointer is on the stack until given observer returns?","Q_Score":4,"Tags":"c++,python,weak-references","A_Id":9737868,"CreationDate":"2012-03-06T02:59:00.000","Title":"Track the lifetime of a CPython object from C extension","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on an Desktop application built with wx Python. I would like the application to visualize maps(shapefiles) like a GIS software and provide interactions with the map. I was looking through arcpy and arcgisscripting but I am not sure if it help me render the shapefile on the Panel. Please do let me know if it is possible?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1086,"Q_Id":9628257,"Users Score":0,"Answer":"ArcGIS has it's own rendering engine.  You would need to create an ArcPy tool or script or add-in for something like ArcGIS Explorer or the paid version ArcMap.  You could also look into making an ArcPy tool, script, or add-in for their ArcGIS Runtime.","Q_Score":0,"Tags":"wxpython,arcgis,arcpy","A_Id":19055227,"CreationDate":"2012-03-09T02:44:00.000","Title":"wxPython and ARCGIS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to use twisted but when i try to run some of the example code provided with the twisted package, it seems to always crash when i use \"twistd\" instead of \"python\"\nfor example, using the example code given with twisted, \nif i run to command : twisted -ny echoserv.py\nUnhandled Error\nTraceback (most recent call last):\n  File \"\/usr\/lib\/python2.7\/site-packages\/twisted\/application\/app.py\", line 652, in run\n    runApp(config)\n  File \"\/usr\/lib\/python2.7\/site-packages\/twisted\/scripts\/twistd.py\", line 23, in runApp\n    _SomeApplicationRunner(config).run()\n  File \"\/usr\/lib\/python2.7\/site-packages\/twisted\/application\/app.py\", line 386, in run\n    self.application = self.createOrGetApplication()\n  File \"\/usr\/lib\/python2.7\/site-packages\/twisted\/application\/app.py\", line 451, in createOrGetApplication\n    application = getApplication(self.config, passphrase)\n---  ---\n  File \"\/usr\/lib\/python2.7\/site-packages\/twisted\/application\/app.py\", line 462, in getApplication\n    application = service.loadApplication(filename, style, passphrase)\n  File \"\/usr\/lib\/python2.7\/site-packages\/twisted\/application\/service.py\", line 405, in loadApplication\n    application = sob.loadValueFromFile(filename, 'application', passphrase)\n  File \"\/usr\/lib\/python2.7\/site-packages\/twisted\/persisted\/sob.py\", line 211, in loadValueFromFile\n    value = d[variable]\nexceptions.KeyError: 'application'\n\nFailed to load application: 'application'\nCould not find 'application' in the file. To use 'twistd -y', your .tac\nfile must create a suitable object (e.g., by calling service.Application())\nand store it in a variable named 'application'. twistd loads your .tac file\nand scans the global variables for one of this name.\n\nPlease read the 'Using Application' HOWTO for details.\n\n\n\nI was using Twisted version 11.0.0 but then i tried 12.0.0 but i have the same problem.\nThe version of python i am using is 2.7.2\nAny ideas on what to do would be helpful. I have been trying to deal with this problem for a few days now. thanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":528,"Q_Id":9649879,"Users Score":0,"Answer":"To use 'twistd -y', your .tac file must create a suitable object (e.g., by calling service.Application()) and store it in a variable named 'application'. twistd loads your .tac file and scans the global variables for one of this name.\nPlease read the 'Using Application' HOWTO for details.","Q_Score":0,"Tags":"python,twisted,twistd","A_Id":9650823,"CreationDate":"2012-03-10T20:24:00.000","Title":"stack dump in twisted app.py 'application' error when using twistd but works with python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"1: i create main window in QtCreator.\nhow i use this form in my python code in eclipse.\n2: can write python and build complete python application in QtCreator ? (How).\nthanks.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":238,"Q_Id":9657333,"Users Score":0,"Answer":"You need PyQt or PySide to use Qt in your Python script.\nTo generate python script from ui file run pyuic -x form.ui","Q_Score":0,"Tags":"python","A_Id":9657438,"CreationDate":"2012-03-11T17:51:00.000","Title":"How To Add .ui Files To Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a pathfinding visualizer in python and Pygame. I intend to write a visualizer that can simultaneously simulate multiple pathfinding algorithms. I have two possible approaches\n\nI write a server part of the application, that will calculate path and will send it to client part, that will use pygame to draw grid and render simulation.\nI write a master thread, that will do pathfinding and will send information to grid thread using pipes.\n\nWhich approach should I use?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":626,"Q_Id":9661063,"Users Score":2,"Answer":"You're overthinking this.  Either method is fine, but you probably don't want to use threads for CPU-bound operations.  Use the multiprocessing module instead if you're shooting for concurrency.\nBut really, the pygame code should be negligible in terms of processing.  Focus on making your pathfinding efficient (perhaps implemented in C?) instead.","Q_Score":0,"Tags":"python,pipe,pygame,path-finding","A_Id":9667720,"CreationDate":"2012-03-12T02:31:00.000","Title":"Pathfinding Visualizer in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Short version:\nHow can I get the address that a ctypes pointer points to?\nLong version:\nI have registered a python function as a callback with a C library. The C library expects function signature of void (*p_func)(char stat, char * buf, short buf_len) so I register an appropriate python function. When I get into the python function, I want to know the memory address pointed to by buf. How can I do this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":12060,"Q_Id":9687002,"Users Score":16,"Answer":"I have fixed this myself by reading the documentation.\nI wanted to know the memory location of a block of memory allocated by a library. I had the ctypes pointer that pointed to said block. To get the memory address of the block I used ctypes.addressof(p_block.contents).\nThe confusion arose around my understanding that p_block.contents != p_block.contents, but then I realised all p_block.contents objects have the same underlying buffer. The address of the underlying buffer is obtained with ctypes.addressof.","Q_Score":11,"Tags":"python,ctypes","A_Id":9784508,"CreationDate":"2012-03-13T15:26:00.000","Title":"Get the memory address pointed to by a ctypes pointer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am building a Titanium mobile project.\nI have some folders with some .JS files in the Resources folder. The problem I ran into is that I need to exclude some of the folder while building for iphone but those folder are needed in my android build.\nI looked into the python files in the SDK folder and found out that there are separate file i.e. builder.py for iphone and android.\nWhile building for android or ios all of my JS files gets build, which i dont want as it increases my app size.\nAs for now i have successfully edited the builder.py file so that it copies the selected folder into my iphone resources folder. It runs fine on simulator but when i tried running on the device i got error saying .js file missing.\nI know that my copied .Js files were not archived\nCan anyone help me in configuring that builder.py so that we can exclude some folders from getting build.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":332,"Q_Id":9700623,"Users Score":0,"Answer":"Ajeet, I believe you can create a directory for android and iphone inside the resources folder  that you can keep your platform-specific code\/assets in.  I think the compiler recognizes this.","Q_Score":1,"Tags":"python,build,titanium,titanium-mobile,appcelerator-mobile","A_Id":9706293,"CreationDate":"2012-03-14T11:00:00.000","Title":"Avoid folders in Resources folder from being build or compile","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"In Python using wxPython, how can I set the transparency and size of a window based on the proximity of the mouse relative to the application's window, or frame? \nEg. similar to a hyperbolic zoom, or The Dock in MAC OS X? I am trying to achieve this effect with a png with transparency and a shaped window. \nAny libraries or code snippets that do this would be great too. Thanks.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2043,"Q_Id":9705201,"Users Score":2,"Answer":"I don't think it can be done that easily if the mouse is outside the main frame. That said, you can always do the following:\n1) Start a timer in your main frame and poll it every 50 milliseconds (or whatever suits you);\n2) Once you poll it in your OnTimer event handler, check the mouse position via wx.GetMousePosition() (this will be in screen coordinates);\n3) In the same OnTimer method, get the screen position of your frame, via frame.GetScreenPosition();\n4) Compare the mouse position with the frame position (maybe using an euclidean distance calculation, or whatever suits you). Then you set your frame transparency accordingly to this distance (remember to put it fully opaque if the mouse is inside the frame rectangle).\nI did just it for the fun of it, it shouldn't take more than 5 minutes to implement.\nHope this helps.\nAndrea.","Q_Score":4,"Tags":"wxpython,mouseevent,proximity,shaped-window","A_Id":9716353,"CreationDate":"2012-03-14T15:45:00.000","Title":"Capturing mouse events outside wx.Frame in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to bind the wx.html2.WebView.New widget with wx.EVT_LEFT_UP  however it doesnt work (it doesnt get noticed, nothing happens).\nIs there anything i am missing?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":419,"Q_Id":9730769,"Users Score":0,"Answer":"I don't think you are missing anything, this hasn't yet been implemented. Mouse and keyboard events are high on my todo list though, I will update this question when they have been added.","Q_Score":2,"Tags":"python,wxpython,wxwidgets","A_Id":9742560,"CreationDate":"2012-03-16T01:49:00.000","Title":"Binding a wx.html2.WebView.New Widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have some big mysql databases with data for calculations and some parts where I need to get data from external websites.\nI used python to do the whole thing until now, but what shall I say: its not a speedster.\nNow I'm thinking about mixing Python with C++ using Boost::Python and Python C API.\nThe question I've got now is: what is the better way to get some speed. \nShall I extend python with some c++ code or shall I embedd python code into a c++ programm?\nI will get fore sure some speed increment using c++ code for the calculating parts and I think that calling the Python interpreter inside of an C-application will not be better, because the python interpreter will run the whole time. And I must wrap things python-libraries like mysqldb or urllib3 to have a nice way to work inside c++.\nSo what whould you suggest is the better way to go: extending or embedding?\n( I love the python language, but I'm also familiar with c++ and respect it for speed )\nUpdate:\nSo I switched some parts from python to c++ and used multi threading (real one) in my c modules and my programm now needs instead of 7 hours 30 minutes :))))","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2903,"Q_Id":9746586,"Users Score":2,"Answer":"In my opinion, in your case it makes no sense to embed Python in C++, while the reverse could be beneficial.\nIn most of programs, the performance problems are very localized, which means that you should rewrite the problematic code in C++ only where it makes sense, leaving Python for the rest.\nThis gives you the best of both world: the speed of C++ where you need it, the ease of use and flexibility of Python everywhere else. What is also great is that you can do this process step by step, replacing the slow code paths by the by, leaving you always with the whole application in an usable (and testable!) state.\nThe reverse wouldn't make sense: you'd have to rewrite almost all the code, sacrificing the flexibility of the Python structure.\nStill, as always when talking about performance, before acting measure: if your bottleneck is not CPU\/memory bound switching to C++ isn't likely to produce much advantages.","Q_Score":1,"Tags":"c++,python,embedding,extending","A_Id":9746618,"CreationDate":"2012-03-17T01:56:00.000","Title":"Speed - embedding python in c++ or extending python with c++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to bind two windows from seprate processes together using Python\/Pygame? By binding I mean in two possible ways:\n\nA large window that contains two smaller windows\nTwo separate windows which appear side to side (perhaps using OS environment variables?)","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":531,"Q_Id":9748915,"Users Score":3,"Answer":"You might try running two separate programs. I just ran two of my pygame programs separately, they work fine. Run one using the other, maybe? Or, if that doesn't work, put use two surfaces as screens, and draw one into the other.","Q_Score":2,"Tags":"python,user-interface,pygame","A_Id":9751549,"CreationDate":"2012-03-17T09:43:00.000","Title":"Possibility of binding multiple PyGame windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to bind two windows from seprate processes together using Python\/Pygame? By binding I mean in two possible ways:\n\nA large window that contains two smaller windows\nTwo separate windows which appear side to side (perhaps using OS environment variables?)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":531,"Q_Id":9748915,"Users Score":0,"Answer":"Interprocess communication is probably the simplest.  The issue though is that SDL is fundamentally not set up for multiple windows.\nProbably the best long-term solution is to set up with wxPython, and then use PyGame inside of it.  This will let you have all manner of windows with PyGame renderers.","Q_Score":2,"Tags":"python,user-interface,pygame","A_Id":9855904,"CreationDate":"2012-03-17T09:43:00.000","Title":"Possibility of binding multiple PyGame windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to get this program to print the contents of a .csv file onto a GUI.\nI've created in Tkinter. It mostly works, but I can't figure out a way to get each button to print the contents of the file it's linked to. \nAt the moment I've created a variable that links to just one of the files, which shows that it works. \nThe variable is \"loadFiles\", and the project it's set to open is \"a_P.csv\". Is there any way I can make the buttons link this variable to the relevant .csv file? \nThe code is in this pastebin link: http:\/\/pastebin.com\/ZP2pPvKA\nThe program searches for files ending in \"_P.csv\" in the same folder as it, so you may have to create a .csv with 7 objects in it.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2189,"Q_Id":9754056,"Users Score":1,"Answer":"you can use a lambda function in order to pass an argument to your load function. Unfortunately pastebin ist down right now so i cannot have a look at your code. The idea is something like this:\nfor filename in filenames:\n    ...Button(...,command=lambda i=filename:loadFile(i),...\nso in your loadFile function you have the filename as first parameter","Q_Score":3,"Tags":"python,user-interface,csv,tkinter","A_Id":9754842,"CreationDate":"2012-03-17T21:48:00.000","Title":"How to make a button open a specific .csv file using Python Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating python app using relatively big SQL database (250k rows). Application needs GUI where most important part of it would be to present results of SQL queries.\nSo I'm looking for a best way to quickly present data in tables in GUI.\nMost preferably I'd be using wx - as it has seamless connection to main application I'm working with. And what I need is least effort between SQL query a and populating GUI table. \nI used once wx.grid, but it seemed to be limited functionality. Also I know of wx.grid.pygridtablebase - what is the difference?\nWhat would be easiest way to do this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":420,"Q_Id":9762841,"Users Score":1,"Answer":"You could use wx.grid or one of the ListCtrls. There's an example of a grid with 100 million cells in the wxPython demo that you could use for guidance on projects with lots of information. For ListCtrls, you would want to use a Virtual ListCtrl using the wx.LC_VIRTUAL flag. There's an example of that in the demo as well.","Q_Score":1,"Tags":"python,sqlite,user-interface,wxpython,wxwidgets","A_Id":9771997,"CreationDate":"2012-03-18T22:22:00.000","Title":"Most seamless way to present data in gui","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing an application where I am coding all of my front-end and GUI with python library (wxpython specifically). For this application, I would like to write the model class with C and use python to use the compiled C code? How can this be implemented in python?\nI know this is little vague question but I am struggling with the starting point.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":894,"Q_Id":9776206,"Users Score":1,"Answer":"You could strictly seperate design(python part) and code(c++ part) like this:\nWrite a complete c++ programm that works in the terminal\/console and then make the python-application call these c++-terminal programm via os.Popen.\nSo if your programm is a calculator it does this:\n(python gui) 5 + 5 -> my_c_programm.exe \"5 + 5\" -> (returns) 10 -> (python gui) display\nthat way you can use your programm with and without gui.\nIts easier and faster than embedding Python in your c++ programm or extending Python with C++.\nI basically do the same thing on my current project, but like this:\nphp: my webinterface\npython: for structure and logic and easy operation\nc++: for heavy calculations and where I need speed\nso php -> python -> c++\nand it works very well for me :)","Q_Score":0,"Tags":"c++,python,c,wxpython","A_Id":9777740,"CreationDate":"2012-03-19T18:59:00.000","Title":"Using C compiled code from python GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a small question hoping someone will help me.\nIs there any way to hook into other applications WNDPROC?\nThe situation is that I want to insert a menu in the other app menubar and I want to define the commands for every menu item.\nI was able to insert the menu with menu items using some Win32 API\nfunctions (user32.dll), but I can't set the commands of that menu item so that it actually does something if clicked.\nWith some googling, I got some information about wndprocess, and I should intercept the ID Command sent and trigger some function, but I'm stuck.\nCan anyone help me?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1449,"Q_Id":9795645,"Users Score":2,"Answer":"You are going about this the wrong way. If you think about it, you'll realize that responding to menu events with your custom \"actions\" must require some code to run in the process that you're targeting. This means you'll need to inject code into the other process in order to achieve what you want.\nSince you're going to need to inject code anyway, I strongly suggest you look at DLL-injecting into the other process (search \"Dll Injection example\"). This will bootstrap your code into the other process, and you can construct your menu there.\nThis also has the advantage that the foreign app won't be reliant on your app being responsive - it'll all be in-process.","Q_Score":7,"Tags":"python,winapi,wndproc","A_Id":10608464,"CreationDate":"2012-03-20T21:58:00.000","Title":"hook into wndproc of another application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm trying to create a simple word processor for starters to learn Python a bit better.\nI'm using the Tkinter Text widget for the main editing program, the only problem is the height and width are defined by characters. \nThis creates a problem when I change fonts, for not all fonts are the same width.\nEvery time the font is changed, the Text widget re-sizes, although technically it is the same width and height. This looks ridiculous when trying to type up something, I'm trying to make the word processor as nice as possible.\nIs there a way to define the width and height in pixels?\nthe .grid_propagate(False) is not useful for the size is technically not changing, only the character width.\nI'm trying to stay away from wxPython for now, since everything I've done up to this point has been in Tkinter.\nI have done endless hours of extensive googling but have found no solutions.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":8150,"Q_Id":9833698,"Users Score":0,"Answer":"..tested this: this works on the frame size, but not on the (scrolled)text-widgets size.\nmy setup is a bit more complicated, with a masterframe for 2 sites, mainframes for each site and frames with various content, i.a. a scrolledtext widget.\nadding grid_propagate, *_row- and *_columnconfigure warded the masterframe from resizing, even with adding grid options to main- and contentframes, what results in warding the mainframe to resize.. when changing the font, the widgetsize also changes - and, in the last example, the scrolledtext-widget disappears behind the frame on its right side (containing other widgets)..","Q_Score":6,"Tags":"python,text,fonts,resize,tkinter","A_Id":56558354,"CreationDate":"2012-03-23T03:09:00.000","Title":"How to stop Tkinter Text widget resize on font change?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a simple word processor for starters to learn Python a bit better.\nI'm using the Tkinter Text widget for the main editing program, the only problem is the height and width are defined by characters. \nThis creates a problem when I change fonts, for not all fonts are the same width.\nEvery time the font is changed, the Text widget re-sizes, although technically it is the same width and height. This looks ridiculous when trying to type up something, I'm trying to make the word processor as nice as possible.\nIs there a way to define the width and height in pixels?\nthe .grid_propagate(False) is not useful for the size is technically not changing, only the character width.\nI'm trying to stay away from wxPython for now, since everything I've done up to this point has been in Tkinter.\nI have done endless hours of extensive googling but have found no solutions.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":8150,"Q_Id":9833698,"Users Score":0,"Answer":"Use the pack geometry manager to pack the widgets.\nI was creating a notepad and wanted the font sample area to display the font size.\nSo I created a label frame and added a label in it - i.e. AabYyZz\u00a0- to display the font sample.\u00a0\nWhen I increased the font size the size of the label frame also increased, so I've tried the .pack_propagate method and it worked.","Q_Score":6,"Tags":"python,text,fonts,resize,tkinter","A_Id":62726391,"CreationDate":"2012-03-23T03:09:00.000","Title":"How to stop Tkinter Text widget resize on font change?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Howdo,\n I've just started getting into Python and QT. I have a very simplistic question. I wanted to create a Qt window to display the output and accept input from a program that I am attempting.\nMy question is, in Qt Designer I have made said window, but I'm not sure if I have to set the signals and slots in designer or in python. For the output I had used a QtextBroswer widget and a QPlainTextEdit for the input. Are those the correct choices for my uses.\nAlso do I need to muck about with setting slots and signals in Designer, or no?\nAny and all help would be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":277,"Q_Id":9858228,"Users Score":2,"Answer":"Set the signals and slots in Python. When you export the ui to Python using pyuic4 or pyside-uic, the signals and slots are set using python anyways.","Q_Score":2,"Tags":"python,qt,pyqt","A_Id":9858246,"CreationDate":"2012-03-25T06:00:00.000","Title":"Qt and Python, where to configure signals and slots","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a Python GUI script with Tkinter, and now I want to convert it to a standalone .exe.\nI have already used py2exe on another pc with WinXP, but on my own pc, where I use Win7 32bit, I can't indtall it. I took the original installer from py2exe.org for 32bit, but when I start it, after half a minute or so it says \"py2exe doesn't work anymore\" and then the installer crashes.\nWhat did I do wrong?\nEDIT: I figured it out. I had to run the installer as Admin, not as normal user.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":426,"Q_Id":9860591,"Users Score":1,"Answer":"You can always try using Pyinstaller. It worked better than py2exe in my case to make a standalone .exe from Tkinter","Q_Score":1,"Tags":"python,crash,installation,py2exe","A_Id":9870016,"CreationDate":"2012-03-25T13:42:00.000","Title":"py2exe Installer crashes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Salut, community!\nBriefly.\nI wrote usual model over QAbstractTableModel and using it in usual way for QTableView. But I think I need to use some columns of this model for the few QListViews in QWizard to fill main table in the right way (for user).\nFor example: use the column2 as the QListView's model on the page1 of the wizard; column3 for page2 for its QListView etc.\nPlease, help me to understand just two things:\n\nAm I on the right way?\nIf yes then how can I make it simply and explicitly?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":371,"Q_Id":9864843,"Users Score":2,"Answer":"Set the QTableModel as the model for each QListView, and use QListView.setModelColumn to choose which column they each display.","Q_Score":2,"Tags":"python,qt,model,pyqt,pyqt4","A_Id":9864880,"CreationDate":"2012-03-25T23:01:00.000","Title":"QAbstractTableModel as a model for one QTableView and few QListViews","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can someone give me some direction as to the proper control to use to update the items in a combobox if a certain item is selected in another combobox? Thanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":119,"Q_Id":9872984,"Users Score":2,"Answer":"If you need to update a list in a combobox, use it's SetItems(myNewList) method. I would keep a dictionary of the various lists you need and use that to populate the second combobox based on the selection in the first.","Q_Score":0,"Tags":"combobox,wxpython","A_Id":9874476,"CreationDate":"2012-03-26T13:25:00.000","Title":"What is the proper control for updating a combobox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently developing a Android Application. I couldn't install the Android Python APKs like the sl4a.apk and the PythonInterpreter.apk on my Android x86 emulator. I read that it is possible to recompile the APKs with NDK but I have not found a closer decription, yet. Has anybody experience with this and could provide a small tutorial?\nBest Regards","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1441,"Q_Id":9892351,"Users Score":3,"Answer":"Try the official Android emulator. If the APKs include native libraries, chances are those are compiled for ARM only. Google's emulator emulates the ARM instruction set.\nTo make sure, rename the APK to ZIP and look inside. The structure of the lib folder, if any, will give you an idea.","Q_Score":0,"Tags":"android,python,sl4a","A_Id":9892477,"CreationDate":"2012-03-27T15:12:00.000","Title":"SL4A Android x86 installation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Quick to learn is pretty important, but I need just some basic GUI tools, for Ubuntu OS but would be nice to have multi-OS compatibility. Any suggestions?\nThe basic dynamics of the intended game just include a text input and some set reaction\nframes.\nThanks in advance.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1725,"Q_Id":9894979,"Users Score":0,"Answer":"For basic toolkit, I think tkinter which comes with python is okay. If you want to have graphical toolkit with more functionality, I would suggest you to take a look at wxpython which is cross-platform compatible.","Q_Score":1,"Tags":"python,user-interface,text-based","A_Id":9895140,"CreationDate":"2012-03-27T17:59:00.000","Title":"Python GUI Toolkit for Text-Based Game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hi in my application I have several gui developped with QT4.7, in some of them I use QToolButton for interaction, everything work nicely, except that when I click over each of the QToolButton, the slot linked to  his triggered signal is called twice,\nI  have no more Ideas about a olution to that, can you help me please, thanks in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":305,"Q_Id":9905587,"Users Score":0,"Answer":"Thank you, I solved, when clicked the QtoolButton send two different triggered signal, then my slot  ran twice, it was enough  to add decorator before the definition of the slot\n    @pyqtSignature(\"\")","Q_Score":0,"Tags":"python,qt4.7","A_Id":9910376,"CreationDate":"2012-03-28T10:26:00.000","Title":"trigger signal of QToolButton autorepeat the action","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two images (JPGs). Both are the same width but image2 is shorter than image1. I want to paste image2 on top of image1 (top aligned) and for each row in image2 I want to blend into image1 with a different alpha transparency value (to make it smoothly blend from bottom to top ).\nI'm using Python PIL and because I'm new to it can't figure out the best way to do this. Any suggestions?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2127,"Q_Id":9917327,"Users Score":2,"Answer":"Make a mask which is the same size as the image2, mode 'L'. Fill it with gray values from 0 to 255, representing the alpha transparency you want. Use paste to put image2 into image1, using the gray image as the mask parameter.","Q_Score":0,"Tags":"python,image-processing,python-imaging-library","A_Id":9917381,"CreationDate":"2012-03-28T23:54:00.000","Title":"Blending two images with PIL: Different sizes and different alpha transparency per row","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a copy of the game Pig. I have got a text based version of the game working. I am just updating it to pygame, adding graphics and sounds.\nI will eventually add in mouse toggles, but for now I am trying to update a score.\nI have display a 'player1 score', 'player2 score' out. I am trying to see how will it work to display text that is not constant.\ni got\nplayer1_text = font.render('player1 score', True,(0,0,0))\nsame for player2\nI am assuming maybe that the first parameter -->'player1 score'\nI can pass a variable and if I update the variable. When i call pygame.update() it should work as I think it should.\nJust want some conformation or a tip on actually doing it.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1013,"Q_Id":9917464,"Users Score":0,"Answer":"You're on the right track!\nUse a variable.","Q_Score":0,"Tags":"python,text,pygame","A_Id":9917557,"CreationDate":"2012-03-29T00:10:00.000","Title":"Pygame: How would I go about setting a text object, BUT the text is meant to keep changing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a copy of the game Pig. I have got a text based version of the game working. I am just updating it to pygame, adding graphics and sounds.\nI will eventually add in mouse toggles, but for now I am trying to update a score.\nI have display a 'player1 score', 'player2 score' out. I am trying to see how will it work to display text that is not constant.\ni got\nplayer1_text = font.render('player1 score', True,(0,0,0))\nsame for player2\nI am assuming maybe that the first parameter -->'player1 score'\nI can pass a variable and if I update the variable. When i call pygame.update() it should work as I think it should.\nJust want some conformation or a tip on actually doing it.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":1013,"Q_Id":9917464,"Users Score":2,"Answer":"Pygame Font objects are not meant to be updated and changed constantly.  You will need to call render(text) each time your text changes.  Render() will return a new surface, so you will need to blit that to your screen to make the change.","Q_Score":0,"Tags":"python,text,pygame","A_Id":10002172,"CreationDate":"2012-03-29T00:10:00.000","Title":"Pygame: How would I go about setting a text object, BUT the text is meant to keep changing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This might seem as silly question but I am thinking there might be the simple solution for this problem. I have a python script which does some mathematical calculation which is command-line-based. I don't want to make any major modification to the code which I have right now. What should be my approach now to create a GUI ( I use wxpython) which uses that script as its model while leaving model to function as stand-alone python script as it is right now. I know it is the question of inheritance and polymorphism but I am not clear about the approach I should take. Any guidelines will be greatly appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2037,"Q_Id":9928711,"Users Score":1,"Answer":"Let's say your command line executable is:\n% compute -flag1 -flag2 datafile outputfile\nIn WxPython you could use check boxes to choose whether flag1 and\/or flag2 are used, a file chooser widget for datafile, a text input field for outputfile and 'execute' button. When execute is clicked create a command line in a string and pass it to one of the methods in the subprocess module.","Q_Score":2,"Tags":"python,wxpython","A_Id":9931233,"CreationDate":"2012-03-29T15:36:00.000","Title":"Converting existing command-line script to GUI in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been toying with wxPython, but it seems mostly geared at 'standard' applications -- things with native looking file menu systems and toolbars and whatnot. \nMy needs are pretty simple. I just need to be able play some mp3s, show some images, and be able to package it down to an .exe and .dmg. Also, being able to play an small mp4 would be grand. \nUnfortunately, I realize that there is no definitive answer to this question, and therefore doesn't exacltly fit the stack overflow format, but a nudge in the right direction would be greatly appreciated!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":835,"Q_Id":9935224,"Users Score":3,"Answer":"Pyqt\/pyside\/Qt has the newer declarative QML which seems to have a application geared to a kiosk type interface. You can basically design something in Photoshop and use it as your custom UI","Q_Score":3,"Tags":"python,user-interface,wxpython","A_Id":9935305,"CreationDate":"2012-03-29T23:47:00.000","Title":"Is there a preferred framework for non-standard, non-native kiosk style GUI applications?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wish to emulate or most media players' sliders - where clicking anywhere on the slider widget skips the video to that position. How can I get the slider's value under the mouse click and set the value to that?\nBy default, when clicked on the slider, it only scrolls by a Pagesize at a time, not scrolls to the position user clicked.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1615,"Q_Id":9961456,"Users Score":0,"Answer":"Create a new control by inheritance from the slider.  The only change from the base slider control is that you override the method that handles mouse click events,  Your method needs to do two things: call the routine that you use to 'skip the video to the mouse click' and call the base slider control mouse click handler so it can look after the visual feedback details.","Q_Score":3,"Tags":"python,wxpython,wxwidgets","A_Id":9963895,"CreationDate":"2012-04-01T02:30:00.000","Title":"Get wxpython slider's value under mouse click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to  have a pygame window  check if the user right clicked (I can do) and then make a popup menu to display options using TKinter (?). Is this possible?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":338,"Q_Id":9963806,"Users Score":0,"Answer":"Import tkinter as you would usually do so, and create your popup.  It would be best to stay within pygame though, using tkinter and pygame would end up being pretty complicated.","Q_Score":0,"Tags":"python","A_Id":9965553,"CreationDate":"2012-04-01T10:51:00.000","Title":"Pygame using TKinter to make a popup menu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the most efficient way in terms of speed to access the pixel data of a PIL image from a C extension?  I only need read-only access to it, if that makes a difference.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":456,"Q_Id":9996105,"Users Score":0,"Answer":"C-level bindings for PIL are available, but there is very little documentation for them. You will need to consult the source for usage information.","Q_Score":4,"Tags":"python,python-imaging-library,python-c-extension","A_Id":9996422,"CreationDate":"2012-04-03T15:06:00.000","Title":"Accessing PIL image data from C extension","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing my own GUI with .NET (C#) and I want to use a python script to click buttons for me automatically and read from text boxes etc. I've tried the Google searches but nothing really helpful. Is there a library that I need to download for .NET or is there a module in python that will do what i\"m looking for. I'm sure it can be done, I just don't know where yo start","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":793,"Q_Id":9996435,"Users Score":1,"Answer":"It sounds like you might be looking for a test automation tool, to script GUI events.  I looked into using Ranorex for that a while back, and it looked very capable, but it was too expensive and overkill for my needs.","Q_Score":0,"Tags":"c#,.net,python,user-interface","A_Id":9999447,"CreationDate":"2012-04-03T15:23:00.000","Title":"Python script to control GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a GUI application written with python+tkinter.  In my workflow, I generally start the gui from the commandline, do some things in the gui and then I find myself navigating to other terminal windows to do some work.  Inevitably, I want to shut down the GUI at some point, and out of habit I often just navigate to the terminal that started the GUI and send a KeyboardInterrupt (Ctrl-c).  However, This interrupt is not recieved until I raise the GUI window in the Window manager.  Does anyone know why this happens?  If the gui is started in a single function, is there a simple workaround -- multiprocessing maybe?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2414,"Q_Id":9998274,"Users Score":5,"Answer":"from the newsgroups:\n\nI'm using Python 1.5 under Redhat Linux 5.0.  I'm trying to figure out\nthe best way to trap a SIGINT (or Ctrl-C) when using tkinter.  To\nillustrate the problem I have, do the following ...\n-- Build Python-1.5 with tkinter enabled.\n-- Go into the Demo\/tkinter\/guido directory under the Python-1.5    build tree.\n-- Type \"python imageview.py image-file\", where \"image-file\" is the    full pathname of a displayable image.\n-- Once the image pops up, make sure that the window focus is    held by the xterm window from which the \"python ...\" command    was just\nnow invoked.\n-- Hit Ctrl-C.\nAt this point, nothing happens.  The Ctrl-C seems to be ignored. But\nnow ...\n-- Without hitting any more keys on the keyboard, set the window    focus to the displayed image window.\nAs soon as that window gets the focus, the Ctrl-C takes effect.\nMy question is this: is there any way to restructure the\n\"imageview.py\" program so that it will respond to SIGINT (Ctrl-C)\nimmediately, without having to set the window focus to the displayed\nimage first?\nThanks in advance for any help you folks can give me.\n---- What you're seeing is caused by the way signal handlers are handled. You're stuck in the Tcl\/Tk main loop, and signal handlers are\nonly handled by the Python interpreter.  A quick workaround is to use\nafter() to schedule a dummy function to be called once a second or so\n-- this will make it appear that your signal is handled in a timely manner.\n--Guido van Rossum","Q_Score":6,"Tags":"python,tkinter,keyboardinterrupt","A_Id":10067034,"CreationDate":"2012-04-03T17:23:00.000","Title":"tkinter keyboard interrupt isn't handled until tkinter frame is raised","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having a problem with my (game) application, which is using Boost.Python, when it comes to the scripting part. I have a client thread and a server thread that runs in the same process if you do not connect to an external server.\nThis is where my problems arise: It seems like the Python interpreter can't execute scripts in the client thread parallel with scripts in the server thread, as it causes the application to crash.\nSo my question is: Is there any possibility to run two (or more) scripts parallel in the Python interpreter?\nI have been searching all day and found a lot of information regarding Py_NewInterpreter, but this does not solve my problem as it uses GIL, I don't want the interpreter to lock other scripts from executing as it will cause lag on the client and\/or the server side.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":624,"Q_Id":10000524,"Users Score":1,"Answer":"As of today, you cannot avoid GIL interactions when using python threads in the same process.\nYou may want to have a look at multiprocessing module which is meant to easily spawn Python processes, thus not interacting with GIL.\nAnother option is to explicitly release the GIL when its not needed in your wrapped C\/C++ functions. This can be done using PyEval_SaveThread and PyEval_RestoreThread functions.","Q_Score":2,"Tags":"c++,parallel-processing,boost-python,cpython","A_Id":10002004,"CreationDate":"2012-04-03T20:04:00.000","Title":"Running two python scripts parallel with boost::python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a GUI project which I am about to start. GUI requirement is simple ( though not as simple as tkinter will suffice). So I need to use a GUI toolkit for python (which will be wxpython if I have to go for GUI). Now I am thinking, why cannot I use simple web-framework such as cherrypy or bottlepy (sorry, if I am not thinking right. I am newbie to server-side programming) and create html pages as my graphical interface and use DOM ( again,I guess, I am speaking right) rather than using wxpython to create the overall GUI. I can then, write all of my business logic and leave the rest to simple html rendering where I have to spend less time in formatting tables, creating buttons and forms and worrying about the sizers. \nMy question is: Can somebody use web-server python package such as cherrypy or similar and get-away from using graphical toolkit? Is it really beneficial or am I thinking this thing upside down?\nThe benefit I am expecting:\nI can use jquery to have many features which might take lot of time to create with wxpython or other GUI toolkit. For example, if I want to have autocomplete feature as similar to jquery, it is whole lot of different story in GUI toolkit like wxpython. And also, lot of drag and drop features are easy in html.","AnswerCount":4,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":6264,"Q_Id":10013904,"Users Score":2,"Answer":"You think absolutely right. There are loads of python-based frameworks, just choose the right one: pyramid, pylons, django are the most popular and widely-used.\nI suggest you to outsource HTML\/CSS slicing to some professional instead of doing it by yourself. You can face up quite a lot of browser-specific things, which will waste your time, but obvious for an experienced person.","Q_Score":5,"Tags":"python,user-interface","A_Id":10014865,"CreationDate":"2012-04-04T15:06:00.000","Title":"Using web-server to substitute for GUI in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a GUI project which I am about to start. GUI requirement is simple ( though not as simple as tkinter will suffice). So I need to use a GUI toolkit for python (which will be wxpython if I have to go for GUI). Now I am thinking, why cannot I use simple web-framework such as cherrypy or bottlepy (sorry, if I am not thinking right. I am newbie to server-side programming) and create html pages as my graphical interface and use DOM ( again,I guess, I am speaking right) rather than using wxpython to create the overall GUI. I can then, write all of my business logic and leave the rest to simple html rendering where I have to spend less time in formatting tables, creating buttons and forms and worrying about the sizers. \nMy question is: Can somebody use web-server python package such as cherrypy or similar and get-away from using graphical toolkit? Is it really beneficial or am I thinking this thing upside down?\nThe benefit I am expecting:\nI can use jquery to have many features which might take lot of time to create with wxpython or other GUI toolkit. For example, if I want to have autocomplete feature as similar to jquery, it is whole lot of different story in GUI toolkit like wxpython. And also, lot of drag and drop features are easy in html.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":6264,"Q_Id":10013904,"Users Score":1,"Answer":"No, you are thinking of this correctly.  HTML\/CSS is very simple it can lend to rapid development.  Additionally python micro frameworks will make creating your business logic a breeze.  This is a very straight forward sipmle route to take.","Q_Score":5,"Tags":"python,user-interface","A_Id":10013987,"CreationDate":"2012-04-04T15:06:00.000","Title":"Using web-server to substitute for GUI in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What I'm wanting to do is create a selection tool (like what you see in most paint programs) using PyGtk.  I've seen a previous question that asked something similar, but they already seemed to know what they were doing to make the selection itself.  That user said he was using an eventbox, but I don't know how I would use that to accomplish what I am trying to do.  How would the eventbox work with a selection?\nThe algorithm for the rectangle isn't a problem at all, I just need to know what tools I should be using to actually select a part of a picture and be able to move it around.  This is my first time using PyGtk, and I'm also fairly new to python itself, so any help would be great.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":212,"Q_Id":10018767,"Users Score":0,"Answer":"If you want to display an image and allow the user to select and move parts of it, you best look for a ready-made image editing widget. GTK doesn't come with one.\nTo roll your own you can use an image widget for display, but it doesn't care about the mouse, so you can place it inside an event box and connect to button and movement events. You'll have to handle all the drawing of rectangle, walking ants and floating cutout yourself in the pixbuf backing the image.\nIt might be easier to start from scratch with an empty event box and draw even the image yourself.","Q_Score":0,"Tags":"python,pygtk","A_Id":10057082,"CreationDate":"2012-04-04T20:29:00.000","Title":"How do I create a canvas selection tool?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a large data set (log data) that is stored in a SQLite3 database. I created a Python GUI using Wx.listctrl that displays that data from a query. It works fine for small amounts of data but obviously hangs on larger sets.. therefore I would like to implement one of two things:\n-paging were the first 5000 records are shown in the listctrl and then if a user clicks a button the next 5000 are shown .. so on and so on.. \nOR\n-as the user scrolls down the listctrl its constantly populating with new data..\nHow would I implement one of these concepts?  Thanks in advance for the help!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1254,"Q_Id":10020528,"Users Score":0,"Answer":"In different scenarios, the strategies will be different. The assumption is that you just use wxPython for presentation purpose, and you have a separate module\/package dealing with the data. wxPython controls get data only from the data abstraction layer.\nScenario I: load all the log data into the memory and use wx.listctrl or wx.listview to display the lines. \nScenario II: fetch data from the database when the wx view is updated. \nIn Scenario I, you just need to setup an variable to remember the position the UI has read up to, or even you can simply use list sliding if you load the logs as list. Automatically updating the view by scrolling down\/up can be implemented in scenario I because all data has been loaded and no more sqlite db connection will be made. It will be a bad choice to implemented auto-updating by scrolling down\/up in scenario II since there would be too many db operations - imagine you scrolling down very quickly expecting to get the 5000th line?\nIn scenario II, you can setup a page size and use LIMIT\/OFFSET to get the data set you want. You keep another variable for the offset number. With the variables page_size and offset, you can simply fetch the data and update the wx view. This scenario is especially good for limiting the memory use. I don't know how big your log is, but after all it is not a good idea to load all of it into the memory because a log keeps growing and you may also need to load other relatively large dataset at the same time.","Q_Score":1,"Tags":"python,sqlite,wxpython,wxwidgets","A_Id":10021932,"CreationDate":"2012-04-04T23:08:00.000","Title":"Display large dataset from Sqlite database in Python wx","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm learning Python and want to make a small text editor that would allow the code collapsing like when def a Function, how you can collapse that to a single line.\nI'm thinking of using Tkinter but would be open to other environments.\nI mainly want to know what widget I should use, I'd like to think that I'd be able to figure out how to do it. (Although an example is always welcome.)\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":200,"Q_Id":10045312,"Users Score":1,"Answer":"You could consider the Scintilla text editing component, with bindings for Python (and other languages.) The Scintilla text editing widget is the basis for the SciTE text editor.\nSciTE supports code folding, so it is certainly doable - it may even be a built in part of Scintilla.\nFrom the SciTE website:\n\nScintilla is a free source code editing component. It comes with\n  complete source code and a license that permits use in any free\n  project or commercial product.\nAs well as features found in standard text editing components,\n  Scintilla includes features especially useful when editing and\n  debugging source code. These include support for syntax styling, error\n  indicators, code completion and call tips. The selection margin can\n  contain markers like those used in debuggers to indicate breakpoints\n  and the current line. Styling choices are more open than with many\n  editors, allowing the use of proportional fonts, bold and italics,\n  multiple foreground and background colours and multiple fonts.\nSciTE is a SCIntilla based Text Editor. Originally built to\n  demonstrate Scintilla, it has grown to be a generally useful editor\n  with facilities for building and running programs. It is best used for\n  jobs with simple configurations - I use it for building test and\n  demonstration programs as well as SciTE and Scintilla, themselves.","Q_Score":0,"Tags":"python","A_Id":10045462,"CreationDate":"2012-04-06T15:03:00.000","Title":"Python: How to program an IDE Code collapsing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm want to show in the GUI a small box (400x85) that shows in an HTML file over the web.\nThe QtWebKit class got his QWebView widget, but the whole QtWebKit class is VERY heavy, weights 16MB, and slows the init of the application in three seconds.\nIt's not really necessary to load the whole QtWebKit class just to show an HTML page.\nIt is possible to use IE's built in web engine? (Through an ActiveX Object or something?)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":326,"Q_Id":10053409,"Users Score":1,"Answer":"You can use Internet Explorer via ActiveQT. There is a c++ example in \"yourqtdir\\4.8.0\\examples\\activeqt\\webbrowser\".","Q_Score":0,"Tags":"python,windows,qt4,pyqt4","A_Id":10059458,"CreationDate":"2012-04-07T09:45:00.000","Title":"An Internet browser Qt4 widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to learn OpenGL, and I'm using PyOpenGL and GLUT.\nWhat really bugs me, is that I can't figure out how to change the\ntitle bar icon. Has anyone had any success in changing this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":248,"Q_Id":10054167,"Users Score":2,"Answer":"You don't.\nRemember: GLUT is primarily for test applications and demos. If your application is complex and platform-specific enough to need to change its icon, then you probably need to move beyond GLUT.","Q_Score":1,"Tags":"python,opengl,freeglut","A_Id":10055756,"CreationDate":"2012-04-07T11:45:00.000","Title":"How do I replace the GLUT title bar icon when using pyopengl?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a two years of experience in programming of enterprise application's  with Java and Visual Studio, and I'm new in Python and wxPython. So my question is: Can wxPython provide me enough rich GUI to create those same app's? My reason if using Python is in it's diversity, simplicity and fast development of app's. Thank you!","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3812,"Q_Id":10093879,"Users Score":0,"Answer":"I would certainly suggest using Python and its GUI libraries, but only you can really make the decision as to wether you think its better than visual studio or Java. The syntax of Python is very basic and I think many people can agree its a plesure to use when you get your head around it (no curly brackets etc). Python Tkinter is quite a simple GUI library and its ideal for making a basic application. WxPython on the other hand is far more advanced than Tkinter hence a richer user experience. The only problem I have had while using Wx is not being able to find suitable examples on the web to demonstarte how some things are done. Good luck, hope you find what your looking for. Karl","Q_Score":4,"Tags":"python,wxpython","A_Id":10094083,"CreationDate":"2012-04-10T17:54:00.000","Title":"wxPython GUI - can it be compared to Java GUI or Visual Studio GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a two years of experience in programming of enterprise application's  with Java and Visual Studio, and I'm new in Python and wxPython. So my question is: Can wxPython provide me enough rich GUI to create those same app's? My reason if using Python is in it's diversity, simplicity and fast development of app's. Thank you!","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":3812,"Q_Id":10093879,"Users Score":1,"Answer":"wxGlade will give you the GUI skeleton. You will still need a separate text editor (I recommend Geany) to fill in the handlers.","Q_Score":4,"Tags":"python,wxpython","A_Id":10093925,"CreationDate":"2012-04-10T17:54:00.000","Title":"wxPython GUI - can it be compared to Java GUI or Visual Studio GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've decided to start working on a personal project, attempting to develop a cross platform, MSPaint like app.  Oddly enough, I find mspaint is one of the applications I miss the most on Linux or OS X, so I want to try to make something similar.  Tuxpaint, mtpaint, gpaint, etc. are all old and inactive and ugly.  I don't want to make GIMP, just the basics, similar in features to MS Paint.\nI'm thinking of doing it in python with the pygtk toolkit, but I was interested to hear your suggestions.  Would C\/C++ be a better choice, or even C# (gasp!) with mono?  How about using Qt as opposed to GTK, or maybe some other fancy library I don't know about (Please, not FLTK!).  I'd be curious to hear your thoughts.\nThanks!","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":810,"Q_Id":10104261,"Users Score":0,"Answer":"Short: You can use both, no third party library is guaranteed to be distributed with all major distributions.\nLong:\nGtk+ vs. Qt\n\nWhat do you want incorporate into your application. If it is just selecting a brush, selecting color you could pretty much use any gui toolkit.\nIf you are going to run it as a web-based tool, Gtk+ has an html5 backend renderer (I don't know about Qt)\n\nA sidenote:\nI recommend to use the toolkit's native programming language (gtk+ C, Qt C++) - if you don't, you will suffer from delays with bugfixes, generally more bugs and delayed releases, though for that case it shouldn't really matter.\nEverything else boils down to personal preferences and there already exist some questions to tackling that issue.","Q_Score":1,"Tags":"python,linux,qt,gtk","A_Id":10106439,"CreationDate":"2012-04-11T10:33:00.000","Title":"Framework for paint program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've decided to start working on a personal project, attempting to develop a cross platform, MSPaint like app.  Oddly enough, I find mspaint is one of the applications I miss the most on Linux or OS X, so I want to try to make something similar.  Tuxpaint, mtpaint, gpaint, etc. are all old and inactive and ugly.  I don't want to make GIMP, just the basics, similar in features to MS Paint.\nI'm thinking of doing it in python with the pygtk toolkit, but I was interested to hear your suggestions.  Would C\/C++ be a better choice, or even C# (gasp!) with mono?  How about using Qt as opposed to GTK, or maybe some other fancy library I don't know about (Please, not FLTK!).  I'd be curious to hear your thoughts.\nThanks!","AnswerCount":4,"Available Count":2,"Score":0.1488850336,"is_accepted":false,"ViewCount":810,"Q_Id":10104261,"Users Score":3,"Answer":"Qt's canvas object (or its newer replacement QGraphicsView) can do pretty cool things. Whether you choose C++ or python is a matter of personal choice, as Qt is supported in both languages. For a simple project like this I'd choose python because killer performance is not much of an issue, and it will be much easier to write.\nAnother thing to look into is making this app web based with HTML5's canvas object and Javascript. It can be surprisingly robust, and anything that can be put on the cloud is a win in most cases.","Q_Score":1,"Tags":"python,linux,qt,gtk","A_Id":10104320,"CreationDate":"2012-04-11T10:33:00.000","Title":"Framework for paint program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I'm using pyqt and I'm trying to populate my List with items that contain an icon and some text beside it.  My icons gets shrunk down when inserted to the List and my font size is super small.  How do I increase size of everything  (i.e size of icon and text)?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":748,"Q_Id":10115481,"Users Score":0,"Answer":"The icon size and the font can be set on the view widget with setIconSize and setFont.","Q_Score":1,"Tags":"python,qt","A_Id":10115583,"CreationDate":"2012-04-11T23:38:00.000","Title":"Resizing row height of list widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to develop in Qt, and I already know Python. I am learning C++, so what are the advantages of programming Qt in C++ over Python? C++ seems more complicated, and seems like there is not much gain.","AnswerCount":4,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":17063,"Q_Id":10132427,"Users Score":22,"Answer":"What is the advantage of using the native C++ Qt over PyQt\n\nSpeed\/power\/control.\nPyQt application will still require python. C++\/Qt Application compiles to native exe. By using C++ you'll get access to 3rd party libraries that won't be available in python, plus you'll exterminate \"middle man\" - layer that sits between your program and qt dlls and potentially you can get better performance. For example, I would not write an archiver or mp3 decompressor in python, although it certainly can be done.\nHowever that comes at a cost - c++ does not have a garbage collector, is much more complex, has \"slower\" development (compilation time), requires years to master and you'll get better performance only if your bottleneck is in within interpreter (i.e. scripted language overhead). I.e. C++ gives more power at a cost of greater responsibility and longer development time. If you don't need that, then you don't have a reason to stick with C++.\nChoice of language depends on your application\/situation and your personal preferences. If you need to make application SOON or make a mockup, then it'll be reasonable to use language you're familiar with. If you have serious performance problems, then it'll be reasonable to hire skilled C++ programmer to do the job - make native application, profile it, optimize, etc. \nPlease note that language is a tool. If you want to use your language for everything simply because you like the language, you're not working efficiently. \n--EDIT--\nPersonally, I would not use python for a larger application I'm expected to maintain for a long time. However, this is because the language is not exactly compatible with my mindset (reliance on Murphy's Law) and (as a result) I'm not comfortable with it. Person that thinks differently will be probably much more comfortable with Python and might even think that C++ is too restrictive. \nAnother thing is that judging from my experience of writing Blender plugins and various python scripts, there's some serious performance overheads that appears because language is scripted, and very heavy list\/map\/array manipulation that can be performed FAST for free in C++ might take 5x..10x times longer in python. Some people might insist that this can be fixed, however, cost of this \"fixing\" might overcome benefits you get from using scripted language. Regardless of my preference, I still use Python for making utility scripts that need to run several utilities, split\/splice\/parse their text output and do something with it (C++ isn't very good at this situations), and I'd still provide Python bindings (assuming Lua is no good) in a program  that must be extensible.\nIn the end it comes down to selection of most suitable tool - if C++ will not give you any benefit compared to Python, then there's no reason to switch.","Q_Score":14,"Tags":"c++,python,qt,qt4,pyqt","A_Id":10132617,"CreationDate":"2012-04-12T21:53:00.000","Title":"What is the advantage of using the native C++ Qt over PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to develop in Qt, and I already know Python. I am learning C++, so what are the advantages of programming Qt in C++ over Python? C++ seems more complicated, and seems like there is not much gain.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":17063,"Q_Id":10132427,"Users Score":1,"Answer":"In short, I believe that unless you have strong performance requirements, you should stick with Python. Also, as Greg mention, your program will be more portable with Python than with C++.\nI love C++ but these days, for most project, I mostly turn to Python if not Java. However, if I'm writing a game or a graphics application, I might consider C++.","Q_Score":14,"Tags":"c++,python,qt,qt4,pyqt","A_Id":10132490,"CreationDate":"2012-04-12T21:53:00.000","Title":"What is the advantage of using the native C++ Qt over PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to develop in Qt, and I already know Python. I am learning C++, so what are the advantages of programming Qt in C++ over Python? C++ seems more complicated, and seems like there is not much gain.","AnswerCount":4,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":17063,"Q_Id":10132427,"Users Score":6,"Answer":"If you're planning on distributing your app, it's much easier to deliver a self-contained compiled executable than relying on your end users to install Python and PyQt first. But that may or may not be a consideration for you.","Q_Score":14,"Tags":"c++,python,qt,qt4,pyqt","A_Id":10132451,"CreationDate":"2012-04-12T21:53:00.000","Title":"What is the advantage of using the native C++ Qt over PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to define a class with  a __getitem__ that takes a tuple argument using the Python C-API?\nThe sq_item member of the tp_as_sequence member of a PyTypeObject\nmust be a ssizeargfunc, so I don't see how to do it.\n(But I assume that the NumPy ndarray does it.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":853,"Q_Id":10151806,"Users Score":5,"Answer":"Yes, use tp_as_mapping instead.\nIts mp_subscript takes a PyObject * so you can use anything as index\/key.\nTo understand how they relate, you could have a look at the source of PyObject_GetItem() which (as the doc says) is the equivalent of Python o[key] expression. You will see that it first tries tp_as_mapping and if that's not there and key is int, it tries tp_as_sequence.","Q_Score":3,"Tags":"python,python-c-api","A_Id":10152614,"CreationDate":"2012-04-14T07:16:00.000","Title":"__getitem__ method with tuple argument using Python C-API","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anybody know if it's possible to put two lines of text in a single row using grid in TKinter?\nIf I make the font small enough, can I distribute the text in two lines?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1178,"Q_Id":10171249,"Users Score":1,"Answer":"You can put multiple items in one cell but it is highly unusual, may have surprising behavior, and there are better ways to accomplish the same effect.\nFor example, the grid is invisible so you can have as many rows as you want to achieve any look you can imagine. Also, the definition of \"item\" is pretty loose -- you can create a frame, and in that frame put two labels, and that frame can go in a single row using grid to give the appearance of two lines of text in a single grid row. You can also use a text widget which lets you put as many lines of text that you want.","Q_Score":0,"Tags":"python,text,grid,tkinter,row","A_Id":10172879,"CreationDate":"2012-04-16T09:00:00.000","Title":"Two lines of text in a single grid row","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to make a small desktop editor to take notes, that uses markdowns to format text quickly. The application should transcribe markdowns instantaneously or after clicking on a button.\nFor this I'd like to use Qt4 and Python.\nWhat, in your opinion, is the most efficient way to proceed?\nIn the case the rich text is rendered after pressing a button, I suppose I could use QTextEdit widget for the edit-mode, but what to use to display the rich text? I want this to look good. Should I render the text in HTML? Or something else?\nPlease advise.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1474,"Q_Id":10178875,"Users Score":0,"Answer":"I came here because I'm looking for a solution for the same task.\nHere is what I would (or hopefully will) try:\n\nSubclass QTextEdit, which can display both plain and rich text.\nsupply two string properties, one containing Markdown source, the other generated HTML.\nFor entering \"edit mode\" (however your UI will handle this)\n\nself.setText(self.markdown) \nself.setReadOnly(False)\n\nFor leaving \"edit mode\":\n\nself.markdown = self.toPlainText()\nself.toHtml() # convert self.markdown to self.html\n#               don't know yet how to achieve that\nself.setHtml(self.html) \nself.setReadOnly(True)\n\n\nFor displaying the HTML one can use a CSS stylesheet.\nAs UI interface I could imagine: clicking on the readonly display mode switches to edit mode, [Ctrl]-[Enter] triggers HTML generation.","Q_Score":0,"Tags":"python,qt4,pyqt4,markdown,rtf","A_Id":24965112,"CreationDate":"2012-04-16T17:36:00.000","Title":"How to make an editor using markdowns with Qt4 and Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On OS X, ttk.Style().configure('TLabelframe.label', font='helvetica 14 bold') works to change the font used by the ttk.LabelFrame widget.  On Windows, ttk.Style().configure('TLabelframe.label', font='arial 14 bold') has no effect other than returning the same font info to ttk.Style().lookup('TLabelframe.label','font').  \nI've tried different font names and formats, creating a derived style, using TkDefaultFont and just changing the size, and different widgets (TButton.label, TCheckbutton.label).  So far, no matter what I've tried, it always appears to use TkDefaultFont in the default size.\nChanging the font setting in python27\/tcl\/tk8.5\/ttk\/xpTheme.tcl (the default theme on windows) does change the font being displayed.  Removing the -font TkDefaultFont setting from the theme settings does not change what is displayed.\nAny suggestions as to how this actually works?\nEdit: I hadn't tried changing the font for the Label widget before, and that one actually works.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1687,"Q_Id":10196305,"Users Score":0,"Answer":"I believe the code in this area is buggy and will open a ticket.  Using 'TLableframe.Label' (note uppercase 'L' in 'Label' works.  'TButton.label' and 'TButton.Label' don't work, but just 'TButton' does; 'TCheckbutton' is the same.  I was unable to change the fonts for 'TEntry' with any combination, including adding 'textarea.'","Q_Score":1,"Tags":"python,fonts,styles,widget,ttk","A_Id":10249969,"CreationDate":"2012-04-17T17:47:00.000","Title":"How to changes fonts using ttk themed widgets in windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am inserting some data in qtablewidget after some time interval. For this i am clearing all content of qtable and then inserting data. But the table showing data from first row, I want that the table always show last row. This will feel like real updation of table. how to do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":303,"Q_Id":10196716,"Users Score":0,"Answer":"After inserting the row, call QTableWidget.scrollToBottom() to show that last row.","Q_Score":0,"Tags":"python,pyqt4","A_Id":10201627,"CreationDate":"2012-04-17T18:16:00.000","Title":"Pyqt table widget updation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a design of an application. The Core should be written in C# but i also want to use some already finished CPython modules (un-managed).\nSo I am interested in the interoperability (Call CPython method from C# and Call C# from CPython). And if there are problems, because C# runs within the .NET runtime (managed) and CPython directly un-managed.\nI already investigated this issue with Google and came out to these solutions:\n\nUse IronPython via DLR + \"CPython extension\" + maybe \"IronClad\" and call from IronPython the CPython modules and vice versa -> are these modules executed managed or unmanaged ? Are There any problems if i want to use C# classes and methods from CPython ?\nUse \"Python for .NET\" -> the same question as above.\n\nWhat do you think, which way would be better ? or do you have another solution ? \nAnd the last but maybe most important question, did I understand the above mentioned points right, or do I mess up ?\nMany thanks in advance !!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1191,"Q_Id":10208960,"Users Score":2,"Answer":"I think you misunderstand Python. It's an interpreted1 language. You just provide the text source files and the interpreter will execute them.\nThere is a difference between the language Python and the implementations CPython, IronPython, Jython, PyPy, what have you. Each of them attempts to implement the language Python as accurately as possible, while also adding implementation-specific functionality. This is just like how, say, the C# compiler was written in C++.\nFor example, any (pure) Python file can be executed by the IronPython interpreter. But if you know that you're going to use IronPython, you can use the special IronPython features that let you into the .NET library. \nNow, most Python doesn't use any of the implementation-specific functionality, so it doesn't matter what you use to run it. Some Python does, though.\n1Well, it's compiled into .pyc files... but then \"compile\" isn't really a well-defined term anyway.\n\nWhy does this matter to you? Well, you have a bunch of Python source code that you want to use with the .NET framework. If that code doesn't use any of the CPython-specific features -- such as using C extension modules -- then you can just run it in IronPython.","Q_Score":3,"Tags":"c#,.net,python,interop,ironpython","A_Id":10210229,"CreationDate":"2012-04-18T12:02:00.000","Title":"C# .NET interoperabillity with managed Python (CPython) -> any problems?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a design of an application. The Core should be written in C# but i also want to use some already finished CPython modules (un-managed).\nSo I am interested in the interoperability (Call CPython method from C# and Call C# from CPython). And if there are problems, because C# runs within the .NET runtime (managed) and CPython directly un-managed.\nI already investigated this issue with Google and came out to these solutions:\n\nUse IronPython via DLR + \"CPython extension\" + maybe \"IronClad\" and call from IronPython the CPython modules and vice versa -> are these modules executed managed or unmanaged ? Are There any problems if i want to use C# classes and methods from CPython ?\nUse \"Python for .NET\" -> the same question as above.\n\nWhat do you think, which way would be better ? or do you have another solution ? \nAnd the last but maybe most important question, did I understand the above mentioned points right, or do I mess up ?\nMany thanks in advance !!","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1191,"Q_Id":10208960,"Users Score":1,"Answer":"Expose your Python code via COM and call that from C#. Used this avenue (both ways) many times.","Q_Score":3,"Tags":"c#,.net,python,interop,ironpython","A_Id":14318714,"CreationDate":"2012-04-18T12:02:00.000","Title":"C# .NET interoperabillity with managed Python (CPython) -> any problems?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing an application which should be able to run on Linux, Mac OS X, Windows and BSD (not necessarily as a single executable, so it doesn't have to be Java) and be extensible using simple plugins.\nThe way I want my plugins to be implemented is as a simple Python program which must implement a certain function and simply return a dictionary to the main program.\nPlugin installation should just be a matter of copying the plugin script file into the .\/plugins directory relative to the main executable.\nThe main program should be a stand-alone executable with shared code amongst all of the above platforms, but with platform specific front-ends (so the Linux and BSD versions would just be CLI tools, the Windows version have C++ and MFC front-end, and the Mac OS X version would have a Objecive-C and Cocoa front-end).\nSo I guess it's really two questions:\n\nWhat's the simplest way to share common controller code between multiple front ends from:\na. Objective-C on a Mac?\nb. C++ on Windows?\nc. C\/Python from Linux\/BSD?\nWhat's the simplest way to implement plugins from my common controller to execute custom plugins?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1296,"Q_Id":10244713,"Users Score":0,"Answer":"The simplest way to share the cross-platform Python component of your application would probably be to implement it as a command-line program, and then invoke it using the relevant system calls in each of the front-ends. It's not the most robust way, but it could be sufficient.\nIf you want plugins to just be a file containing Python code, I would recommend that they at least conform to a convention, e.g. by extending a class, and then have your code load them into the Python runtime using \"import plugin_name\". This would be better than having the plugins exist as separate programs because you would be able to access the output as Python types, rather than needing to parse text from standard input.","Q_Score":0,"Tags":"c++,python,objective-c,plugins,cross-platform","A_Id":10245373,"CreationDate":"2012-04-20T10:44:00.000","Title":"Simplest way to write cross-platform application with Python plugin extensibility?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"In order to develop an Android app using Python, I need to install Python for Android and SL4A on my computer to be used with the Android emulator. My question is, when I distribute this app to actual users\/phones, do the phones need to get Python for Android and SL4A explicitly? Or is the supporting infrastructure built into Android devices? Or is there a way to package the Python application where the users do not have to get SL4A and Python for Android in order to run the application?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1128,"Q_Id":10258703,"Users Score":2,"Answer":"Your users have to install SL4A and the language plugin (python?) on their phones, this is not a built-in functionality.\nSince the source code is available, it's possible to create combined application, which includes your scripts and SL4A\/python code, but in my opinion this defies the purpose of scripting in the first place.","Q_Score":6,"Tags":"android,python","A_Id":10258955,"CreationDate":"2012-04-21T12:01:00.000","Title":"Running a Python app on real Android phone","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am trying to create a roguelike using the Text widget.\nI have figured out a few things, namely that I can set the size of the widget using width and height options and that I can find the pixel height or width of said widget. However, what I want to do is have the widget resizable (pack(expand=\"yes\", fill=\"both\")) but be able to refresh the displayed text on a resize. Is there a way to get the character dimensions when the widget is running without resorting to winfo_width() and math based on pixel dimensions of characters?","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":1580,"Q_Id":10288554,"Users Score":2,"Answer":"I've run into that exact same problem a couple times jaccarmac, and to my knowledge there is no way to find the width of a string of characters. Really the only way is to use the winfo_ commands: width, height, geometry. However, it kind of sounds like you just want to make sure that all of the text is displayed if you change the label and add more text. If that is the case, you don't have to worry about it. That should all be taken care of by the widgets themselves. If you don't see them expanding to show all of your label, that usually means one of the widgets containing that label is not set to expand (either using expand=YES with .pack, or columnconfigure(i, weight=1) for .grid). \nA final thought; in the pack arguments make sure it's YES, and not \"yes\". That uppercase YES is not a string, but a variable name defined by Tkinter.","Q_Score":1,"Tags":"python,python-3.x,tkinter","A_Id":10289415,"CreationDate":"2012-04-23T21:24:00.000","Title":"Finding The Current Size Of A tkinter.Text Widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to create a roguelike using the Text widget.\nI have figured out a few things, namely that I can set the size of the widget using width and height options and that I can find the pixel height or width of said widget. However, what I want to do is have the widget resizable (pack(expand=\"yes\", fill=\"both\")) but be able to refresh the displayed text on a resize. Is there a way to get the character dimensions when the widget is running without resorting to winfo_width() and math based on pixel dimensions of characters?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1580,"Q_Id":10288554,"Users Score":0,"Answer":"There is no way to automatically get the width in characters, but it's easy to calculate, assuming you're using a fixed width font. One way to do this is to use the font_measure method of a font object. Use font_measure to get the width of a '0' (or any other character for that matter; I think tk users zero internally, not that it matters with a fixed width font), then use this in your calculations.","Q_Score":1,"Tags":"python,python-3.x,tkinter","A_Id":10290058,"CreationDate":"2012-04-23T21:24:00.000","Title":"Finding The Current Size Of A tkinter.Text Widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating message boxes in Tkinter using tkMessageBox.showwarning. \nDoes Tkinter let you insert a sort of checkbox with the message that says, for example, \"do not show again\" so when selected the message won't appear the next time?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":410,"Q_Id":10295384,"Users Score":1,"Answer":"No, the standard dialogs don't support that.\nIf you want such a feature you'll have to build your own dialog out of a Toplevel window and other widgets.","Q_Score":2,"Tags":"python,checkbox,tkinter,message","A_Id":10296668,"CreationDate":"2012-04-24T09:41:00.000","Title":"\"do not show message again\" checkbox in Tkinter warning message","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"From what I can tell, the difference between PyList_SetItem and PyList_SETITEM is that PyList_SetItem will lower the reference count of the list item it overwrites and PyList_SETITEM does not. \nIs there any reason why I shouldn't just use PyList_SetItem all the time? Or would I get into trouble if I used PyList_SetItem to initialize an index position in a list?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2163,"Q_Id":10305327,"Users Score":8,"Answer":"PyList_SET_ITEM is an unsafe macro that basically sticks an object into the list's internal pointer array without any bound checks. If anything non-NULL is in the ith position of the list, a reference leak will occur. PyList_SET_ITEM steals the reference to the object you put in the list. PyList_SetItem also steals the reference, but it checks bounds and decrefs anything which may be in the ith position. The rule-of-thumb is use PyList_SET_ITEM to initialize lists you've just created and PyList_SetItem otherwise. It's also completely safe to use PyList_SetItem everywhere; PyList_SET_ITEM is basically a speed hack.","Q_Score":8,"Tags":"python,python-c-extension","A_Id":10305714,"CreationDate":"2012-04-24T20:12:00.000","Title":"PyList_SetItem vs. PyList_SETITEM","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting to work on a 2D scrolling shoot-em-up game, and I was wondering if pygame is suitable.  I would like to hit close to 60 fps while animating a scrolling background with hundreds of sprites (mostly bullets, of course); is this feasible with pygame?  From what I've read, I'm leaning toward no, but I'd like another opinion from someone with more experience with pygame.\nI'm also looking at using PyOpenGL with pygame, but I have absolutely no experience with OpenGL.  Will OpenGL work better in this case than native pygame graphics, and are there any good tutorials for OpenGL\/PyOpenGL\/using PyOpenGL with pygame?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1238,"Q_Id":10310068,"Users Score":0,"Answer":"Pygame is as good as they get for 2D CPU graphics.  All the graphics is implemented in C, (PyGame wraps SDL) so the code is nearly as fast as an equivalent C software renderer.\nThat said, it's still (basically) a software renderer, and there's this interesting device in every modern computer called a GPU which is designed to do that.  PyOpenGL\/OpenGL will take advantage of it, so yes, absolutely PyOpenGL will render faster than PyGame.\nBottom line:\nPyGame is fast, but not as fast as PyOpenGL.  For hundreds of onscreen sprites, that will mainly be a logic problem (Python logic is slow, even by interpreted language standards).  Rewriting it in SDL would make it faster (because C\/C++ is faster than Python).  You could also use PyOpenGL, which I predict in this case would improve performance significantly, though not dramatically (but it's much harder to use).\nLike I said, though, it will be primarily a logic issue, I think.  There is something to be said for using PyOpenGL, but as they say, the greatest optimization you will ever make is when your code works for the first time.","Q_Score":0,"Tags":"python,pygame","A_Id":10647216,"CreationDate":"2012-04-25T05:53:00.000","Title":"Using Pygame to make scrolling shoot-em-up","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting to work on a 2D scrolling shoot-em-up game, and I was wondering if pygame is suitable.  I would like to hit close to 60 fps while animating a scrolling background with hundreds of sprites (mostly bullets, of course); is this feasible with pygame?  From what I've read, I'm leaning toward no, but I'd like another opinion from someone with more experience with pygame.\nI'm also looking at using PyOpenGL with pygame, but I have absolutely no experience with OpenGL.  Will OpenGL work better in this case than native pygame graphics, and are there any good tutorials for OpenGL\/PyOpenGL\/using PyOpenGL with pygame?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1238,"Q_Id":10310068,"Users Score":0,"Answer":"Pygame is the best solution for 2D games in python according to me. You can save Surfaces uses its optimized Sprites animation, so I think it's the fastest solution : as for development process than for code execution.","Q_Score":0,"Tags":"python,pygame","A_Id":10315791,"CreationDate":"2012-04-25T05:53:00.000","Title":"Using Pygame to make scrolling shoot-em-up","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to implement a Mario type plat-former in pyGame.  I have Collision detection working with Polygons no problem.  I am curious how I can get the player to be able to jump through the floor above him, which is a polygon floating in air.  \nWhat is the theory on how to handle that?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":228,"Q_Id":10325418,"Users Score":1,"Answer":"you could make it so that when your character hits a block, they move up at the current speed until they are no longer colliding with the polygon. That way, when you hit the ground from above,you don't go downward through it, but when you hit the bottom, you do. I would recommend a while loop set to the collide function.","Q_Score":0,"Tags":"python,collision-detection,pygame","A_Id":11217539,"CreationDate":"2012-04-25T23:52:00.000","Title":"Jump Through Polygon\/Floor Collision Detection","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So when I try to run a file in PyWin, it opens an edit window instead. The first could times that it did this, I assumed it was due to some syntax errors in the file, but after I fixed them, it continued to open an edit window each time. This particular file has a lot of defined functions in it if that helps at all.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":118,"Q_Id":10325600,"Users Score":0,"Answer":"Does this problem occurred with every Python you run? Based on your problem description it is not certain if this problem is specific to the script you are trying to run or it is a general issue.\nWhat I will do is that try running builtin demo script first to test & verify that you do have full set of libraries installed and runs fine. Once you verified demo script does run  as expected then you can look at your test file to see what is wrong. If you could not run demo script successfully then you would need to re-install PyWin completely to have it fully functional.","Q_Score":0,"Tags":"python,pywin32,robot","A_Id":10326072,"CreationDate":"2012-04-26T00:15:00.000","Title":"Trouble Running a File in PyWin","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Python3 on Windows 7. I want to grab all the attributes like color intensity, color etc. Of all the pixels of the screen area that I select with mouse. The selection can be of any shape but right now rectangular and square will do.\nI want to do it in any area of the screen. \nCan you guys please guide me how to do that in Python?\nPS: If the method can work across all the platforms that would be much more appreciated.\nThanks,\nAashiq","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":185,"Q_Id":10328943,"Users Score":0,"Answer":"You need to use some sort of cross-platform GUI toolkit, such as GTK or KDE, maybe Tk or wx will work as well, I don't know.\nHow you then do it depends on what toolkit you choose.","Q_Score":1,"Tags":"python-3.x,pixels","A_Id":10331335,"CreationDate":"2012-04-26T07:24:00.000","Title":"Grabbing pixel attributes in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My game is a platform game. I want the player to move when it is X pixels away from the center, moving left or right.\nI understand pygame doesn't have anything that would make a camera move.\nWhen the player has reached the point where it is X pixels away from the center, stop the player movement and have the terrain move in the opposite direction to display the illusion of a movable terrain, acting like camera motion.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2011,"Q_Id":10343052,"Users Score":0,"Answer":"You could just make something called xscroll that is added to everything that is supposed to scroll across the screen. Then, when you reach a certain distance from the center, instead of adding your players movespeed to his position, you add or subtract the movespeed from xscroll. This makes everything move very smoothly back at the same speed your character would move. I use this in all of my games and I have never had a problem with it.","Q_Score":1,"Tags":"python,animation,pygame","A_Id":11236094,"CreationDate":"2012-04-27T00:01:00.000","Title":"How would I go about making a camera like movement in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What event is called when the caret inside a TextCtrl \/ Styled TextCtrl has its position changed? I need to bind the event to show in the status bar, the current position of the caret.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1551,"Q_Id":10364900,"Users Score":0,"Answer":"I don't think there is such an event, but you can try wx.EVT_SET_CURSOR. Alternatively, you can catch wx.EVT_CHAR or one of the EVT_KEY_* events and use the TextCtrl's GetInsertionPoint() method to know where the cursor is. You may need to call the method when you click around in the text control using mouse events as well.","Q_Score":1,"Tags":"python,events,wxpython,wxwidgets","A_Id":10385658,"CreationDate":"2012-04-28T15:25:00.000","Title":"wxPython caret move event","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to create a Gtk.StatusIcon with custom text. Ideally I'd like to append this to an existing image, but text-only is ok, too. How can I achieve this?\nI've seen some posts about getting a Gtk.Label's pixbuf but those methods seem to be removed from Gtk3 (pixbuf_get_from_drawable)","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":377,"Q_Id":10369496,"Users Score":1,"Answer":"I don't think that is possible. The status icon is not a widget and the icon is going to be scaled by the window manager. Even if you used Cairo or PIL to generate an image on the fly to use as the icon pixbuf, it wouldn't have the effect of an embedded label in the system tray. It would instead be tiny, unreadable text smushed into the size of the other icons.","Q_Score":6,"Tags":"python,gtk,gtk3,pygobject","A_Id":11075153,"CreationDate":"2012-04-29T03:36:00.000","Title":"How do I set a Gtk.StatusIcon as Text","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am testing kivy and I want to create a BoxLayout so to stack some buttons. My problem is that the children that are added to the layout follow a bottom-top logic while I want the opposite. Do you know how can I reverse the order? Thanks!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2021,"Q_Id":10421194,"Users Score":1,"Answer":"There is a tricky way to do that. \nUse a gridlayout and set cols to 1","Q_Score":3,"Tags":"python,layout,python-2.7,boxlayout,kivy","A_Id":22755884,"CreationDate":"2012-05-02T20:29:00.000","Title":"How can I change the order of the BoxLayout in kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem where it is beneficial for me to be able to mix python code and C++ code, and I think that the task is simple enough that it could be done by simply initializing the C++ program from python, and then having the C++ program \"wait\" for python to give it some input via std in, and then have python \"wait\" for the C++ program do its computation and return it via std out etc. \nI feel like this is either trivial or extremely extremely hard. My main problem is that each time I initialize the C++ code it takes an extremely long time, but that would only need to be done once if I can get this idea implemented. Any thoughts?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":314,"Q_Id":10453841,"Users Score":0,"Answer":"Sounds like SWIG might be what you're looking for. Use it to generate an extension module for Python, then call your C++ methods from a Python script.","Q_Score":0,"Tags":"c++,python,stdout,stdin","A_Id":10453984,"CreationDate":"2012-05-04T17:58:00.000","Title":"Mixing python and C++ via std in and std out","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem where it is beneficial for me to be able to mix python code and C++ code, and I think that the task is simple enough that it could be done by simply initializing the C++ program from python, and then having the C++ program \"wait\" for python to give it some input via std in, and then have python \"wait\" for the C++ program do its computation and return it via std out etc. \nI feel like this is either trivial or extremely extremely hard. My main problem is that each time I initialize the C++ code it takes an extremely long time, but that would only need to be done once if I can get this idea implemented. Any thoughts?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":314,"Q_Id":10453841,"Users Score":0,"Answer":"Look at the the Submodule library.  You can use Submodule.popen() to create a process from python, using stdin=PIPE and stdout=PIPE. You can then read from the C++ program's stdout and write to its stdin.","Q_Score":0,"Tags":"c++,python,stdout,stdin","A_Id":10454012,"CreationDate":"2012-05-04T17:58:00.000","Title":"Mixing python and C++ via std in and std out","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a Project Manager using wxPython it has a splitter window. On one side is a tree that shows the names of and opens the files and on the other size is a textctrl that is used to edit the file.\nOne problem I am having is that I would like it to go back 4 spaces when SHIFT and TAB are pressed, I have code working that add's 4 spaces when TAB is pressed.\nI am also have a problem that when I add a file that is in a different folder to my programs cwd the tree adds a new node and the file appears under this node and I am struggling to get the tree to save to a file. \nAlso I would like to know how to add an icon to an item in the tree from an external png file.\nI would appreciate any help that could be given with either of these problems.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1518,"Q_Id":10463702,"Users Score":1,"Answer":"I don't know use WxPython and so don't have much idea about it. But in general what you can do is whenever a key is pressed, call a callback function and you could get the time when the key was pressed. save it somewhere. And when the next key is pressed, get the time. compare both times, if there's not much significant delay (you can decide the delay), it means that both the keys were pressed simultaneously (although they were not).","Q_Score":0,"Tags":"python,tree,wxpython","A_Id":10464339,"CreationDate":"2012-05-05T16:19:00.000","Title":"Multiple key press detection wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Having a pygame.display window open, I call pygame.display.quit() upon it in order to destroy the window.\nBecause I need to open the window again, I call pygame.display.init() and pygame.display.set_mode(), but after these two functions are called, nothing happens.\nCan anyone point me to the root of this problem?","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":2849,"Q_Id":10466411,"Users Score":-1,"Answer":"Have you tried calling just pygame.quit() or pygame.init()? I don't believe there is a pygame.display.quit().","Q_Score":3,"Tags":"python,pygame","A_Id":10779855,"CreationDate":"2012-05-05T22:12:00.000","Title":"Pygame display module init and quit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to hide the screen of 'pygame.display' and to make it visible afterwards without calling 'pygame.display.quit()'?","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":7611,"Q_Id":10466590,"Users Score":5,"Answer":"No there isn't. All you can do is minimize the window using pygame.display.iconify().","Q_Score":6,"Tags":"python,pygame","A_Id":10466840,"CreationDate":"2012-05-05T22:44:00.000","Title":"Hiding pygame display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a quick question about WxPython. I would like to have frames inside of my main frame in a program. The user should not be able to move the frame. Any ideas you guys?\nThanks","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1726,"Q_Id":10467224,"Users Score":0,"Answer":"I'm guessing the OP is talking about an MDI frame, which Microsoft created and has since decided to abandon. I think the OP should check out the wx.agw.aui widget set versus the wx.aui stuff since the former has been updated a lot and wx.aui has not. Plus the agw package is pure Python and thus much more hackable.","Q_Score":1,"Tags":"python,wxpython","A_Id":10483810,"CreationDate":"2012-05-06T00:54:00.000","Title":"Frame Inside a Frame WxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there some simple way in PyQt to store data from QTableWidget to some file, and use that content again? It's not a critical task for me, so i don't want to invent some custom xml rules or somethin else.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1493,"Q_Id":10496168,"Users Score":0,"Answer":"Qt provides a (modified) Model->View framework and so the data in a table, or any other GUI widget, is stored in a data model. It's the data in the model that you want to persist. The GUI widgets themselves don't provide any facilities to do this.\nThere's no standard data persistence method implemented in the Qt data model components. Qt does provide fatures to persist data structures to disc in binary (QDataStream), text (QTextStream) and XML (QDomDocument) formats. However if you're using PyQt you're probably better off using Python's built-in data persistence libraries such as Pickle or Shelve, or it's JSON or XML libraries.","Q_Score":1,"Tags":"python,pyqt4,qtablewidget","A_Id":10537246,"CreationDate":"2012-05-08T09:40:00.000","Title":"How to import\/export QTableWidget to some file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was recently told that I should keep my code in separate files; like main.py, engine.py, settings.py and so on. Although this surely does have benefits, like easier management, scalability and others, to me it seems like it has too many drawbacks...\nFor example, if I have a script called settings.py, where some things like sizes of onscreen objects, speed of the simulation and color of various objects are defined, what do I do if those variables are needed both in my engine.py script and my main.py script? Do I import it two times, in both scripts? It seems rather messy. What if some of my classes, that are in the engine.py script, require code from main.py?\nLet me show you the exact situation...\nMy main.py script imports Pygame in itself, initializes it, and so on. It used to have a class which represented an onscreen object, and that class had a method draw, which just called a Pygame draw function. Now, when I put the class inside my engine.py script, things no longer work, because Pygame doesn't exist there! I ended up importing both settings.py and Pygame in the engine.py, and then importing the engine into main.py, but then it's more like an initializer than an engine... Is there a way to deal with things like these, like general guide lines?","AnswerCount":6,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":9182,"Q_Id":10499419,"Users Score":0,"Answer":"You can import symbols from settings.py in any module they are needed. That's the concept. An actual problem is when you have circular imports. e.g. What if you had some symbols inside engine.py that were needed in main.py and vice versa. In that situation a common pattern is to break these dependencies in a third module, where main.py and engine.py could import from, without any problem.","Q_Score":6,"Tags":"python,class,design-patterns","A_Id":10499592,"CreationDate":"2012-05-08T13:17:00.000","Title":"How to organize my Python code into multiple classes?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"After creating a simple window\/widget layout with Page (page.sourceforge.net)\nI found that the listbox curselection() call returns the proper index when releasing Button-1.\nWhen hit, it returns the previous index (the item which we just leave).\nBecasue of some timer activities I'd like to get the clicked index at click-time, instead of release-time. Can somebody help me how could I do that? Thank you","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":875,"Q_Id":10560041,"Users Score":1,"Answer":"Bind to the event <<ListboxSelect>> instead of <1>, this event will fire after the current selection has been updated. \nIf you genuinely need for the binding to work literally on a press of the mouse button you will have to rearrange the order of the bind tags for the widget.","Q_Score":1,"Tags":"python,listbox,tkinter","A_Id":10560466,"CreationDate":"2012-05-12T00:18:00.000","Title":"Getting Tkinter listbox item when hit Button-1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to import a sprite sheet and select one sprite. How would I do this in Python\/pygame?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":13966,"Q_Id":10560446,"Users Score":0,"Answer":"The above code posted by aquasheep is brilliant! Although in lines:\nfor i in range(0,sheet_rect.height-len_sprt_y,size[1]):#rows\nfor i in range(0,sheet_rect.width-len_sprt_x,size[0]):#columns\nI had to remove -len_sprt_y and -len_sprt_x  it just would not load the last sprites on the x and y axis. It may vary depending on the sprite sheet x, y size and the actual sprite size too.","Q_Score":9,"Tags":"python,pygame","A_Id":33223021,"CreationDate":"2012-05-12T01:58:00.000","Title":"How do you select a sprite image from a sprite sheet in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am quite new in Python programming. While googling I found some of the Python related words. I just wanted to know what is the difference among Python, Jython, IronPython, and wxPython.\nI know wxPython is for GUI programming. But what are Jython and IronPython?\nPlease help me.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":37688,"Q_Id":10579824,"Users Score":72,"Answer":"Jython and IronPython are different python implementations, both of which run on different virtual machines. Jython runs on the JVM (Java virtual machine) and IronPython runs on the CLR (common language runtime). This means that programs using these implementations can take advantage of the libraries and ecosystem of the virtual machines. For example, using Jython, I can write a plugin for a Java application, and using IronPython I can use the .NET standard library. The downside to using a different implementation to CPython is that CPython is the most used python, and therefore has the best support from libraries and developers. For example, a popular library like NumPy will only work on CPython, as it relies on CPython's C api, which neither Jython or IronPython can provide.","Q_Score":41,"Tags":"python,wxpython,jython,ironpython","A_Id":10579887,"CreationDate":"2012-05-14T08:29:00.000","Title":"What is the difference between Python vs Jython vs IronPython vs wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to track elements properties in Tkinter canvas?\nSpecifically, I want to know if at a certain coordinates set I have already created an element or not. \nI believe I can do this with tracking sets of elements in a dictinoary but I was hoping for something more elegant.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":153,"Q_Id":10585184,"Users Score":1,"Answer":"The canvas has many methods for finding objects. You could, for example, call find_closest to find the element closest to the coordinate you are wanting to check. Then, for the element it finds, you can use the coords method to find out if all of the coordinates of the element are identical.","Q_Score":0,"Tags":"python,canvas,tkinter","A_Id":10585691,"CreationDate":"2012-05-14T14:20:00.000","Title":"Tracking list on elements on canvas (tkinter)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Basically, I want the body of a Text widget to change when a StringVar does.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5546,"Q_Id":10593027,"Users Score":10,"Answer":"Short version is, you can't. At least, not without doing extra work. The text widget doesn't directly support a variable option.\nIf you want to do all the work yourself it's possible to set up a trace on a variable so that it keeps the text widget up to date, and you can add bindings to the text widget to keep the variable up to date, but there's nothing built directly into Tkinter to do that automatically.\nThe main reason this isn't directly supported is that the text widget can have more than just ascii text -- it can have different fonts and colors, embedded widgets and images, and tags.","Q_Score":5,"Tags":"python,tkinter","A_Id":10593117,"CreationDate":"2012-05-15T01:19:00.000","Title":"How can I connect a StringVar to a Text widget in Python\/Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a little game for fun, and there is an event where you can take control of the enemies (muhahaha I can take over their little programmed minds)\nI want to convert part of the image from red to blue.\n\nShould I either use the surface.set to change to colour value,\nOr should I just load a new image into the surface, for example load \"red_man.png\" originally then when he changes sides load \"blue_man.png\"? \n\nWhich is more efficient to do?\nThanks in advance :)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":106,"Q_Id":10642331,"Users Score":0,"Answer":"So Ian Mallett was correct:\n\nEfficient how? .set_at will be more space efficient, but obviously\n  you're setting individual pixels every time you want to change.\n  Loading an entirely new image at startup will be faster, but you'll\n  use more space. I'd guess you're wanting the second, but . . .\n\nI wanted the second one, faster (even at the cost of more space).\nSo its better to load the entire 'blue' image as well as the 'red' one, then switch between them as necessary.\nThanks Ian!","Q_Score":0,"Tags":"python-3.x,pygame,pixels","A_Id":10856777,"CreationDate":"2012-05-17T19:32:00.000","Title":"Python Pygame Changing Surfaces efficiently","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to get Glade, or any similar software, to work with Tkinter? I'm unable to install WxPython or any other libraries, so I need something compatible with what's installed on OSX.6 by default.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1825,"Q_Id":10661041,"Users Score":1,"Answer":"No, there is no way to get glade or other not-designed-for-tkinter GUI tools to work with tkinter. At least, not without a tremendous amount of effort.","Q_Score":2,"Tags":"python,macos,tkinter,glade","A_Id":21465072,"CreationDate":"2012-05-18T23:41:00.000","Title":"Glade with Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been searching the web and reading about GUI development in Python and have read that Tkinter is one of the best GUI toolkits for Python. But I also know that Pygame is a library that can be used for GUI. As i'm fairly new to programming, could somebody please explain the differences between Pygame and Tkinter, and which should be used in what occasion. Which would be a better choice for a chess engine GUI. \nThank you very much in advance.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":26041,"Q_Id":10668116,"Users Score":0,"Answer":"I actually recommend Tkinter for simple python game development tho.","Q_Score":12,"Tags":"python,tkinter,pygame","A_Id":72318955,"CreationDate":"2012-05-19T19:14:00.000","Title":"pygame vs tkinter.","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been searching the web and reading about GUI development in Python and have read that Tkinter is one of the best GUI toolkits for Python. But I also know that Pygame is a library that can be used for GUI. As i'm fairly new to programming, could somebody please explain the differences between Pygame and Tkinter, and which should be used in what occasion. Which would be a better choice for a chess engine GUI. \nThank you very much in advance.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":26041,"Q_Id":10668116,"Users Score":1,"Answer":"Pygame is normally used to create games though I would recommend using the arcade library instead. Pygame does not help you to create GUIs. instead you should use tkinter which is specifically designed for GUIs. For your project I would recommend using tkinter. Tkinter helps you create labels, buttons and stuff pygame helps you make graphics and stuff","Q_Score":12,"Tags":"python,tkinter,pygame","A_Id":64797294,"CreationDate":"2012-05-19T19:14:00.000","Title":"pygame vs tkinter.","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyGObject but I think this is a question that could be adapted to all GTK, so if someone know how to do it using C or anything should work in python also.\nI have two treeview, Active and Inactive, I load data from a Sqlite database and I can swap and drag & drop items from one to other. \nThis is just an aestetic thing, if I click on one item on one treeview I want that a previous selected item on the other be deselected.\nIt appears that nobody had to do something similar because I didn't found anything about it on the net.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1990,"Q_Id":10681740,"Users Score":2,"Answer":"At the risk of being too basic (perhaps I misunderstand the problem), to manipulate treeview selections, you use the GtkTreeSelection object returned from GtkTreeView.get_selection.  You can attach to signals on this object, change the current selection,etc.","Q_Score":3,"Tags":"python,c,gtk,pygobject,gtktreeview","A_Id":10690046,"CreationDate":"2012-05-21T08:23:00.000","Title":"Gtk.Treeview deselect row via signals and code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a diff and merge program in Python using the Tkinter UI framework.\nRunning it on OS-X there are two problems:\n\nwhen starting it the window does not get displayed unless switching back and forth with other running apps. There has been a thread here recommending\ntop.call('wm', 'attributes', '.', '-topmost', '1')\nwhich is no solution since it keeps the window on top of all - always.\nOther say that when packaging with py2app this behavior goes away - I tried and it does not!\nThere is no way to change the Menu - The first entry is dictated by TK, so the first \n\"About xxx\" does bring up the TCL credits and can not be replaced with my own apps about info.\n\nSo my Idea was to make a cocoa app window wich displays on start and on top and I can define what is in the menu - and integrate the Tk frame with my Python code somehow.\nIs that possible?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":382,"Q_Id":10690416,"Users Score":0,"Answer":"Try some variant of this command: \nself.createcommand('tkAboutDialog', self.aboutProgram)\nand put your app \"about\" dialog code in the aboutProgram() function.","Q_Score":1,"Tags":"python,macos,cocoa,tkinter,tk","A_Id":11246589,"CreationDate":"2012-05-21T18:14:00.000","Title":"use a Tkinter frame in a Mac Cocoa app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have TextView with pages of text, but I want to be able to highlight (change the background color) of specific strings in different colors. Is this possible? If so, can anybody point me in the right direction? Thanks","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":411,"Q_Id":10707815,"Users Score":0,"Answer":"If the specific strings are always the same, as in a programming language, then use GtkSourceView instead.","Q_Score":1,"Tags":"python,pygtk","A_Id":10715877,"CreationDate":"2012-05-22T18:22:00.000","Title":"Highlight certain text in a PyGTK TextView","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using customtreectrl in wxpython with checkboxes. Once I submit I would like to save the state of the checkboxes in the customtreectrl. How can I save the checked state of a customtreectrl with checkboxes.Please help me.\nSushma","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":101,"Q_Id":10732171,"Users Score":1,"Answer":"try and use the \"persist\" library in the AGW package. This will allow you to save the state of  (almost) any wxPython widget across sessions. See the PersistentControls demo in the AGW library.","Q_Score":0,"Tags":"wxpython","A_Id":10733286,"CreationDate":"2012-05-24T06:20:00.000","Title":"preserving the state of check boxex in customtreectrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a simple pygtk\/glade window with a menu and a 3x3 grid. Each row of the grid consists on: two labels and a button.\nWhen the Window is resized, the labels holds the same font size, but the buttons get resized, and they could become HUGE if the windows gets very big.\nHow could I manage to keep my buttons with the same size always (the \"standar\" size of a button, just like they are when the interface is just opened) no matter if the Window is resized?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":787,"Q_Id":10742317,"Users Score":2,"Answer":"You just have to set the fill and expand parameters of the Buttons to False (uncheck them in the Glade interface).\nYou would also want to put each button at the center of a 3x3 GtkTable, so it will appear centered and not aligned at the top of the cell","Q_Score":0,"Tags":"python,pygtk,glade","A_Id":10743355,"CreationDate":"2012-05-24T17:20:00.000","Title":"PyGTK\/Glade keep button size standard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem with python to C code translation and further compilation.\nFirst, I installed MinGW, wrote `setup.py? script and translated python code (simplest helloworld) to C with Cython:\n\npython setup.py build_ext --inplace\n\nThen I tried to compile generated .c file:\n\ngcc.exe helloworld.c -mdll -IC:\\Python27\\include -IC:\\Python27\\PC -LC:\\Python27\\libs -LC:\\Python27\\PCbuild -lpython27 -lmsvcr90\n\nNo error occurred during compilation, but when I tried to launch generated a.exe file, I got the following error: \n\na.exe is not a valid Win32 application\n\nI have no idea how to fix this problem.\nI'm running 32-bit Vista. \nP.S. Sorry for my poor English.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1230,"Q_Id":10759765,"Users Score":2,"Answer":"The compiled file isn't an executable, it's a library (dll).\npython modules on windows usually have a .pyd extension, so either rename your file to helloworld.pyd or use -o helloworld.pyd as argument for the compiler.\nthen you should be able to import helloworld from python.","Q_Score":1,"Tags":"python,c,gcc,mingw,cython","A_Id":10760117,"CreationDate":"2012-05-25T18:40:00.000","Title":"Cython and gcc: can't run compiled program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I googled and search stackoverflow before asking this question\nAnswers that I don't expect:\nwxWidgets is the best Python GUIUse TkInter (BIM) for GUI development.\nQ. How to make a GUI without using any module\/library? i.e make a GUI from scratch. Modules like tkinter not allowed.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2003,"Q_Id":10763814,"Users Score":1,"Answer":"The easiest GUI to make without \"module\/library\" is a web-based one. I.e. generate HTML with Javascript from your Python code, and let the Javascript interact via AJAX with your Python app. This can be implemented without too much effort with just the standard Python library (and some JS code, of course), or with modules that don't require \"heavy\" installation of platform-specific extensions.","Q_Score":1,"Tags":"python,user-interface","A_Id":10763834,"CreationDate":"2012-05-26T05:24:00.000","Title":"Python custom GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've added support for mods for my game. Any Python module put in a specific folder is automatically imported on startup. All is fine, except now I've written an official mod which allows mod makers to easily add GUI settings of their mods to a single toggable GUI frame. They are not forced to use it, but it greatly simplifies adding GUI settings with helper functions and makes things more organized and simpler for the players.\nThe problem is since its a mod itself, its imported on startup with the rest of the mods (Python modules), so if there is another mod which has a name which comes before it, it cannot use my mod. I know I could add \"0_\" or something to my module's name, but that wouldn't be very clean and you can't be very sure someone won't name his own mod's modules like that.\nSo I'm wondering if there's any way to tell Python to import a module first, by specifying it inside the module itself? I'm pretty sure there isn't, but who knows?\nOne solution I thought of is to make a subfolder which would be searched for modules first.\nAnother one might be merging the mod's code with the game's. Don't want to do that as to not give the impression that it's the only way to add mod settings.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":68,"Q_Id":10781201,"Users Score":2,"Answer":"Why not have a list of all \"system\" modules that you need to have loaded which will be imported first, before then looking in sub-folders for all your mods and importing those ?\nThat way you still maintain your base system and only afterwards do you load up subsequent user mods.","Q_Score":0,"Tags":"python,import,module","A_Id":10781228,"CreationDate":"2012-05-28T07:57:00.000","Title":"Telling a module to be imported first by the module itself?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to fit some text in a label. I almost managed to do it: when I enlarge the window, I add some <big> tags to the label and the text enlarges with the window. But if I try to shrink the window, the size-request of the label doesn't let me do it.\nThe label is updated many times a second, so if I try to set a custom size request every time I apply a new label, the window will shrink and enlarge if i try to shrink it.\nWhat I want to do is removing the size request, without word wrapping and other things like this: I just want let the label go out of the window.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":291,"Q_Id":10788211,"Users Score":1,"Answer":"Put the label in a container like GtkScrolledWindow.","Q_Score":0,"Tags":"python,gtk3","A_Id":11008840,"CreationDate":"2012-05-28T17:09:00.000","Title":"Remove the size request of a widget (Python, Gtk3)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to fit some text in a label. I almost managed to do it: when I enlarge the window, I add some <big> tags to the label and the text enlarges with the window. But if I try to shrink the window, the size-request of the label doesn't let me do it.\nThe label is updated many times a second, so if I try to set a custom size request every time I apply a new label, the window will shrink and enlarge if i try to shrink it.\nWhat I want to do is removing the size request, without word wrapping and other things like this: I just want let the label go out of the window.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":291,"Q_Id":10788211,"Users Score":1,"Answer":"Set the \"ellipsize\" property of label to True.","Q_Score":0,"Tags":"python,gtk3","A_Id":33259216,"CreationDate":"2012-05-28T17:09:00.000","Title":"Remove the size request of a widget (Python, Gtk3)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been working on a Gui-based program using Tkinter. It needs data to display and there are a lot of different data. I tried to do it, but it did not show the right result. I mean, it cannot display other datasets and it just displays the first dataset.\nSimply, its procedure is as following:\n\nLoad 1st data\nDisplay on canvas\nLoad another data\nDisplay on canvas, but it shows the first data.\n\nPlease give me some hints, comments, and help.\nThank you, guys.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":583,"Q_Id":10805751,"Users Score":0,"Answer":"Assuming your code to display the data is correct, the only conclusion I can draw is that either you \"load another data\" function isn't actually loading anything, or your \"display on canvas\" code is not being given tne newly loaded data. \nThe other possibility is that there is an error in your drawing code that is getting ignored.","Q_Score":0,"Tags":"python,canvas,tkinter","A_Id":10807933,"CreationDate":"2012-05-29T19:52:00.000","Title":"How to apply to new data on tkinter's canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to using pygame and I was wondering if someone could explain the use of alpha values?  I don't quite understand the difference between that and colorkey.\nFor my current situation I think I want to use alpha values but am not quite clear how.  \nIn my game I have two sprites with .png files loaded to each surface.  Upon collision I would like both images to disappear (go completely transparent).\nI would really appreciate it if someone could explain the basics of alpha value and how to specifically use them in pygame and if it is possible to use these alpha values to solve my problem.\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":399,"Q_Id":10823285,"Users Score":3,"Answer":"Colorkey lets you pick one color in a sprite (surface); any pixel of that color will be completely transparent. (If you remember .gif transparency, it's the same idea.)\n'alpha' is a measure of opacity - 0 for completely transparent, 255 for completely opaque - and can be applied to an entire sprite (as an alpha plane) or per pixel (slower, but gives much more control).\nTo make the sprites disappear, I would just set them to non-visible, rather than playing around with alpha values.","Q_Score":1,"Tags":"python,pygame","A_Id":10823436,"CreationDate":"2012-05-30T19:52:00.000","Title":"Pygame alpha values","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to using pygame and I was wondering if someone could explain the use of alpha values?  I don't quite understand the difference between that and colorkey.\nFor my current situation I think I want to use alpha values but am not quite clear how.  \nIn my game I have two sprites with .png files loaded to each surface.  Upon collision I would like both images to disappear (go completely transparent).\nI would really appreciate it if someone could explain the basics of alpha value and how to specifically use them in pygame and if it is possible to use these alpha values to solve my problem.\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":399,"Q_Id":10823285,"Users Score":0,"Answer":"Although if you want the sprites to fade until they've vanished, gradually reduce the alpha value after they've collided. When alpha reaches 0, use   del sprite   if you don't need the sprites anymore.","Q_Score":1,"Tags":"python,pygame","A_Id":51940966,"CreationDate":"2012-05-30T19:52:00.000","Title":"Pygame alpha values","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the best drag and drop GUI builder for wxPython? \nI've tried wxGLade, but I strongly dislike it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1452,"Q_Id":10824112,"Users Score":0,"Answer":"If you are just starting out on GUI programming in Python I'll strongly recommend ditching wxPython for PySide\/PyQt4. It has a simpler API and Qt-Designer is one of the best drag 'n' drop GUI designer I've used. Plus PySide\/PyQt4 is well documented.","Q_Score":2,"Tags":"user-interface,wxpython","A_Id":10824301,"CreationDate":"2012-05-30T20:54:00.000","Title":"Best drag and drop GUI builder for wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I currently have a ScrolledPanel that contains a number of TextCtrls that are placed in a vertical BoxSizer programmatically. The reason I'm doing this instead of just appending lines to one big scrolled TextCtrl is so that I can also add other controls in between the TextCtrl, such as images or stylized expand\/contract folding stuff.\nHowever, this particular implementation is causing a problem - namely that it is impossible for the user to select text across multiple TextCtrls. Is there a way to do this that will be fast, clean, idiomatic, and not especially kludgy? Is my best bet to write a pointer-location text selection algorithm that essentially reinvents the wheel for the text selection stuff of the underlying native libraries, or is there an easier way to embed other controls inside a multiline scrollable TextCtrl, or even select text across multiple TextCtrls natively?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":431,"Q_Id":10825597,"Users Score":1,"Answer":"I would stay away from trying to reimplement text selection controls if at all possible, since that is bound to turn very messy very fast. Another way you could tackle this issue would be to use a single multi-line textctrl widget with the other widgets tacked on over it. This is also messy, but less so. \nYou can place the other widgets over the textctrl simply by placing them directly over the same position as the textctrl, so long as the other widgets have the same parent as the textctrl. This should work, so long as you don't overlap with the vscrollbar (or, better yet, remove it entirely with style=wx.TE_NO_VSCROLLBAR).\nThe next thing you'll need to do is pre-fill and space your textctrl so that the user has control of text only right after the position of each widget. You should have each line of text with a different spacing setting, set with the spacing options of wx.TextAttr (the more generic versions of double-spacing, etc), which you calculate based on the particular widget spacing you've given your app. This is necessary to force the user to type only exactly where you want them to. \nNext, you'll need to set up a binding to the textctrl newline character that recalculates the spacing needed for each line. Once you've figured out how to handle spacing, this shouldn't be too difficult. \nFinally, after you select the text, just reset everything to the same spacing, or whatever else suits your fancy, so that you don't get awkward linebreaks when you paste it back in elsewhere. \nI know this is a complicated answer, but it's a complicated issue you raised. This is, I believe, the most efficient way to solve it, and avoids all the bugs that would arise from completely overhauling the textctrl, but it does involve messing around with auto-correcting linebreaks and spacings, which can be a little tricky at first.","Q_Score":2,"Tags":"python,wxpython,wx.textctrl","A_Id":16593067,"CreationDate":"2012-05-30T23:16:00.000","Title":"Select text over multiple TextCtrls in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"With wxPython a password field could be created as:  \nwx.TextCtrl(frm, -1, '', style=wx.TE_PASSWORD )\nI'm wondering if there is a way to dynamically change this password field into a normal textctrl, such that user could see what the password is.","AnswerCount":3,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":5172,"Q_Id":10836062,"Users Score":3,"Answer":"I'm not aware of a way to dynamically change the style flags on the text control widget after creation. Some widgets allow this sort of thing on some OSes and some do not. You could just create two text controls with the second one in normal mode and hide it. Then when you want to toggle, you grab the password-protected version's value and hide it, give the value to the normal one and show it. You'll probably need to call Layout() at the end as well.","Q_Score":4,"Tags":"python,user-interface,wxpython","A_Id":10837325,"CreationDate":"2012-05-31T14:56:00.000","Title":"how to make wxpython password textctrl show chars?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"With wxPython a password field could be created as:  \nwx.TextCtrl(frm, -1, '', style=wx.TE_PASSWORD )\nI'm wondering if there is a way to dynamically change this password field into a normal textctrl, such that user could see what the password is.","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":5172,"Q_Id":10836062,"Users Score":-1,"Answer":"then it would not be a password entry, but you can use style=wx.TE_MULTILINE or TE_RICH. if that is what you are asking.\nHope this helps","Q_Score":4,"Tags":"python,user-interface,wxpython","A_Id":10836512,"CreationDate":"2012-05-31T14:56:00.000","Title":"how to make wxpython password textctrl show chars?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My simple question is how can I use pygame.MOUSEBUTTONDOWN on a sprite or item to trigger an event?\ne.g. I have item_A and want music to start when I press the object with my mouse.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":18074,"Q_Id":10838959,"Users Score":0,"Answer":"You will need to poll for events in your main loop, and when you detect a MOUSEBUTTONDOWN event you will need to check if it's on the sprite you want, and if it is then start the music.","Q_Score":2,"Tags":"python,pygame,mouseevent,mouse","A_Id":10839038,"CreationDate":"2012-05-31T18:12:00.000","Title":"How to use pygame.MOUSEBUTTONDOWN?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know there is a PyGTK class for a single-line entry, but what about \nmulti-line entries (like entering a description of an item)?\nI've searched through the web, but didn't find anything.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3074,"Q_Id":10840917,"Users Score":12,"Answer":"TextView is the widget used to edit multi-line text.","Q_Score":7,"Tags":"python,gtk,pygtk","A_Id":10843649,"CreationDate":"2012-05-31T20:37:00.000","Title":"multiline gtk entry in pygtk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying really REALLY hard to install py2app, but whenever I run the install command on the source code, I get half way through and then I get a permission denied error. Does anyone have an idea about how I could fix this? I do have admin rights on the machine I am using. I am using the admin's profile to do the installation...so I am really stumped. Any help would be awesome.\nI am running Mac OS X 10.6.8\nI am using Python 2.7 (64 bit, but running with the 32 bit preferences)\nI am using wxPython (32 bit because that is all that wxPython has to offer on a Mac)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":586,"Q_Id":10842167,"Users Score":0,"Answer":"I had this problem for a long time. Try running it as admin.","Q_Score":0,"Tags":"python,py2app","A_Id":23563762,"CreationDate":"2012-05-31T22:31:00.000","Title":"py2app installation error--Permission Denied","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I want to impliment some kind of UI for my Python programs (some simple operations, nothing advanced).\nSo I looked around and considered ncurses and tkinter for python. Yet I am not sure which of these two would suit best my needs for a simple interface (in the sense of easy to learn to program) with the best output possibilies. It does not have to be fancy or anything, just help me visualise my code (lets say a text based chess game).\nintuitively i would take tkinter, but could you probably just summarise for me the advantages of the two UIs? (in addition ncurses does not seem to have a good tutorial for python...)\nThank you in advance!","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1422,"Q_Id":10859023,"Users Score":4,"Answer":"I would like to suggest tkinter as it comes with python and compare to other GUI packages it has good tutorials. And also it will help you to improve your OOP concept for python","Q_Score":4,"Tags":"python-3.x,tkinter,ncurses","A_Id":10861849,"CreationDate":"2012-06-02T01:02:00.000","Title":"python3 tkinter or ncurses","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to PyQt and I have to work on an application which use it. For the moment, I don't have any problem, but I'm stuck on something. I have to create a \"ComboBox with its items checkable, like a CheckBox\". This ComboBox should contain many image format, like \"jpg\", \"exr\" or \"tga\", and I will have to pick up the text of the checked option and put it in a variable. The problem is that I can't find a thing about making items checkable using a ComboBox (if you know how to, It would gladly help me !)\nSince I can't do it with a ComboBox, maybe I can do it with a QList I thought, but I can't find anything either which is understandable for a beginner like me. I have read stuff about flags and \"Qt.ItemIsUserCheckable\" but I don't know how to use it in a easy way :(\nCan you help me ? Thanks !\nPyQt version : 4.4.3\nPython version : 2.6","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1527,"Q_Id":10929285,"Users Score":0,"Answer":"You can do this using the model->view framework, but it means implementing a custom model to support checkable data.\nYou create a custom model by subclassing QAbstractItemModel. This presents an API to the QComboBox for accessing the underlying data. Off the top of my head I think you'll need to implement the flags method to indicate that you support ItemIsUserCheckable for the indexes you want to be able to check. You'll also need to implement data() which reports back the data state from your underlying data, and setData() which accept input from the QComboBox and changes the underlying data.\nYou then set this as the model for the QComboBox using setModel().\nThis isn't really beginner stuff, but the model->view framework in Qt is one of it's most important and valuable features and well worth getting to grips with.","Q_Score":0,"Tags":"python,qt,checkbox,combobox,pyqt","A_Id":10930835,"CreationDate":"2012-06-07T09:39:00.000","Title":"How to simply create a list of CheckBox which has a dropdown list like a ComboBox with PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using PyGtk's IconView, I can set the icons to be reorderable by calling gtk.IconView.set_reorderable(True).  My question is what is the best way to retrieve the new order?  That is, how should I access a property of each of the elements in the new order?  An iterator of sorts?\nI am using gtk.ListStore to store the data.\nI know this might sound trivial but I have virtually no experience in Python or PyGtk (or GTK in general) so I'd like to know the right way!  Thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":135,"Q_Id":10972821,"Users Score":0,"Answer":"So, I understand now: it turns out that when items are reordered in IconView, gtk.ListStore.reorder or something similar is called.  What that means is that all I needed to do was to use gtk.ListStore.get_iter() or gtk.ListStore.get_iter_first() and all the problems are solved.\nHow trivial!  All I needed to do was eat over it it seems.","Q_Score":0,"Tags":"python,pygtk","A_Id":10973513,"CreationDate":"2012-06-10T22:25:00.000","Title":"Reordering in IconView (PyGtk)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I use wx python to create a button with a file name as the button label, I lose the & character that is inside of the file names. \nIf a file were named: hello&goodbye.txt, the button would read: hellogoodbye.txt\nI have no idea where the & character goes and would love a little help here.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":203,"Q_Id":10984263,"Users Score":5,"Answer":"The & character is a special symbol for those kinds of buttons. It defines what key you press to use a keyboard shortcut.\n&x - [Alt]+[x] hotkey shortcut. You can escape it by using a second: && -> '&' char","Q_Score":3,"Tags":"python,wxpython","A_Id":10984306,"CreationDate":"2012-06-11T16:46:00.000","Title":"Python '&' Character is missing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have only started learning python recently. I would still be considered a beginner. Does anyone know any simple games I could make using only python or python turtle. I have no experience with pygame or tkinter yet. The game does not need to use graphics. For example one of my recent games was trying to guess the letters of a random word. Simple game. Kind of like hangman. I will consider all answers. Thank you :)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":665,"Q_Id":10997651,"Users Score":3,"Answer":"Two that come to mind for me are Tic-Tac-Toe and Higher or Lower","Q_Score":1,"Tags":"python,graphics","A_Id":10997736,"CreationDate":"2012-06-12T13:24:00.000","Title":"simple game to make only using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So, here I'm happy that I wrote the whole code for a awesome looking GUI using wxPython in a day but it evaporated when I found that the panels are getting out of the way leaving a lot of empty space on the sides or getting congested (you know how!) on a different screen resolution. \nWhat I want to ask is that what all properties of a GUI should I adjust or care about if I want to see that the GUI's aspect ratio, frame alignment, panel alignments, sizer ratios etc. should remain intact or if there're any methods to do so, suggest me.\nThanks in advance. :)","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":284,"Q_Id":11027366,"Users Score":2,"Answer":"Sizers automatically adjust your application widgets for screen resolution, resize, etc. If they aren't doing this automatically, then there's probably something buggy in your code. Since I don't have your code to look at, try going over the wxPython tutorials on sizers very carefully. I found the book wxPython In Action very useful on this topic.","Q_Score":0,"Tags":"python,user-interface,wxpython,alignment,screen-resolution","A_Id":11036132,"CreationDate":"2012-06-14T05:49:00.000","Title":"wxPython : Adjusting the panels and sizers for different screen resolutions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying to find a way to implement MVVM with PySide but haven't been able to. I think that there should be a way to create Views from ViewModels with QItemEditorFactory, and to do data binding I think I can use QDataWidgetMapper.\nDo you have any ideas on how MVVM may be implemented with Qt and PySide? Even if there are some resources in C++ I'll try to translate them to python.\nThanks.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":4531,"Q_Id":11042172,"Users Score":0,"Answer":"I don't know how far do you want to take MVVM, but at a basic level it comes with Qt, and I've been using it for a long time. You have a business-specific model, say tied to a database. Then you create view-specific viewmodel as a proxy model. You can stack a few layers of those, depending on what you need. Then you show that using a view. As long as everything is set up right, it will \"just work\". Now if you want to use a model to configure a view, Qt doesn't provide anything directly for you. You'd need to write a factory class that can use viewmodel data to instantiate and set up the view for you. Everything depends on how far do you want to take it, and what architectural benefits does it give you.","Q_Score":16,"Tags":"python,qt,mvvm,pyside,architectural-patterns","A_Id":18681903,"CreationDate":"2012-06-14T22:22:00.000","Title":"MVVM pattern with PySide","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying to find a way to implement MVVM with PySide but haven't been able to. I think that there should be a way to create Views from ViewModels with QItemEditorFactory, and to do data binding I think I can use QDataWidgetMapper.\nDo you have any ideas on how MVVM may be implemented with Qt and PySide? Even if there are some resources in C++ I'll try to translate them to python.\nThanks.","AnswerCount":3,"Available Count":2,"Score":-0.1325487884,"is_accepted":false,"ViewCount":4531,"Q_Id":11042172,"Users Score":-2,"Answer":"An obvious answer for me is that MVVM is suitable for WPF and some other techs that welcome this pattern, and so you have to find out whether it's possible to apply this pattern on other technologies. Please, read on MVVM in wiki.","Q_Score":16,"Tags":"python,qt,mvvm,pyside,architectural-patterns","A_Id":17227321,"CreationDate":"2012-06-14T22:22:00.000","Title":"MVVM pattern with PySide","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My application consists of looking into a live feed from a spectroscope (optical instrument) and extracting frames from it. Clicking a point in the feed launches a new Frame where the image is analysed. Each frame handles a single panel.\nThe action of creating  a new frame is very easy for a programmer to do (immediate showing and focus capture, discrete objects, no complex layout management, easy meaning for close button). \nI now want a design that works in a single window. What is the easiest design pattern that replaces the practice of creating new frames? It should offer the same advantages (see previous paragraph) as far as possible. I am thinking of using tabs to manage the panels as they can capture focus, hide\/show panels, destroy themselves elegantly etc.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":69,"Q_Id":11046283,"Users Score":0,"Answer":"I would put your feed inside a sizer with space for two elements. Have the feed expand to fill your window unless the second space in the sizer is available. Then, when you click the feed, add a panel with the detailed information to the empty part of the sizer.\nYou can add a close button which would simply close and remove the panel in the same way as your currently do.","Q_Score":0,"Tags":"python,wxpython","A_Id":11046421,"CreationDate":"2012-06-15T07:22:00.000","Title":"Design substitute to popping up new frames on each click in WxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My application consists of looking into a live feed from a spectroscope (optical instrument) and extracting frames from it. Clicking a point in the feed launches a new Frame where the image is analysed. Each frame handles a single panel.\nThe action of creating  a new frame is very easy for a programmer to do (immediate showing and focus capture, discrete objects, no complex layout management, easy meaning for close button). \nI now want a design that works in a single window. What is the easiest design pattern that replaces the practice of creating new frames? It should offer the same advantages (see previous paragraph) as far as possible. I am thinking of using tabs to manage the panels as they can capture focus, hide\/show panels, destroy themselves elegantly etc.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":69,"Q_Id":11046283,"Users Score":0,"Answer":"Create a frame with two main elements:\n\nYour current feed\nA navigation control such as a wx.ListBox, wx.ListCtrl, or wx.TreeCtrl to allow you to scroll through and click on the feed you want displayed in element (1).","Q_Score":0,"Tags":"python,wxpython","A_Id":11052052,"CreationDate":"2012-06-15T07:22:00.000","Title":"Design substitute to popping up new frames on each click in WxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a physics simulating program, and found after() useful.\nI once would like to create a thread for physics calculation and simulation. But when I finally noticed that function, I used it instead.\nSo, I'm curious about how Tkinter implements that function. Is it multi-threading?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":718,"Q_Id":11046836,"Users Score":5,"Answer":"It is not multithreaded. \nTkinter works by pulling objects off of a queue and processing them. Usually what is on this queue are events generated by the user (mouse movements, button clicks, etc).\nThis queue can contain other things, such as job created with after. So, to Tkinter, something submitted with after is just another event to be processed at a particular point in time.","Q_Score":1,"Tags":"python,tkinter,python-multithreading","A_Id":11049545,"CreationDate":"2012-06-15T08:03:00.000","Title":"Python: Does after() in Tkinter have a multi-threading approach?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application whose GUI is to be remade for ergonomic reasons.\nIt was written in PyGTK and I am wondering if I should switch to PyQt to ease future developments or not.\nThis application has a mostly classical UI with buttons, toolbars, dialogs etc. but also has some specific requirements : I will certainly need to create a custom widget based on treeview\/tableview (to make a spreadsheet-like widget) and this application has a lot of worker threads which update the GUI.\nI am seeking advice on these two points :\n\nAs regards the creation custom widgets, does PyQt provide better mechanisms than PyGTK, especially to slightly modify existing widgets.\nI had problems with (even when properly using threads_init() and threads_enter()) the updating of the GUI by worker threads while using PyGTK. Is PyQt any better on that point ?","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":8254,"Q_Id":11047821,"Users Score":1,"Answer":"I also have no experience with GTK, but can offer some answers nevertheless:\n\nQt is designed from the ground up to be object-oriented; almost everything in it has excellent support for subclassing. PyQt likewise.\nQt explicitly does NOT support modification of the GUI by any threads other than the main GUI thread. You're likely to cause crashes this way. As BlaXpirit mentioned, though, there are a variety of very easy inter-thread communication mechanisms such as signal passing.","Q_Score":12,"Tags":"python,user-interface,pygtk,pyqt4","A_Id":11803878,"CreationDate":"2012-06-15T09:16:00.000","Title":"What are the advantages of PyQt over PyGTK and vice-versa?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application whose GUI is to be remade for ergonomic reasons.\nIt was written in PyGTK and I am wondering if I should switch to PyQt to ease future developments or not.\nThis application has a mostly classical UI with buttons, toolbars, dialogs etc. but also has some specific requirements : I will certainly need to create a custom widget based on treeview\/tableview (to make a spreadsheet-like widget) and this application has a lot of worker threads which update the GUI.\nI am seeking advice on these two points :\n\nAs regards the creation custom widgets, does PyQt provide better mechanisms than PyGTK, especially to slightly modify existing widgets.\nI had problems with (even when properly using threads_init() and threads_enter()) the updating of the GUI by worker threads while using PyGTK. Is PyQt any better on that point ?","AnswerCount":5,"Available Count":4,"Score":0.1194272985,"is_accepted":false,"ViewCount":8254,"Q_Id":11047821,"Users Score":3,"Answer":"I like GTK+ best, since (at least to me) it looks nicer. PyQt and variants (e.g. PySide), however, do have an immensely large set of extras, including a WebKit engine, an XML parser, SQL support, and more.\nIf you just want looks, I'd say GTK+\/PyGObject. If you are plannning on using anything PyQt has, use PyQt.\nAs a side note, if you stick with GTK+, I'd advise you to upgrade to PyGObject and GTK+ 3.0, since PyGtk+ is no longer maintained.","Q_Score":12,"Tags":"python,user-interface,pygtk,pyqt4","A_Id":15823008,"CreationDate":"2012-06-15T09:16:00.000","Title":"What are the advantages of PyQt over PyGTK and vice-versa?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application whose GUI is to be remade for ergonomic reasons.\nIt was written in PyGTK and I am wondering if I should switch to PyQt to ease future developments or not.\nThis application has a mostly classical UI with buttons, toolbars, dialogs etc. but also has some specific requirements : I will certainly need to create a custom widget based on treeview\/tableview (to make a spreadsheet-like widget) and this application has a lot of worker threads which update the GUI.\nI am seeking advice on these two points :\n\nAs regards the creation custom widgets, does PyQt provide better mechanisms than PyGTK, especially to slightly modify existing widgets.\nI had problems with (even when properly using threads_init() and threads_enter()) the updating of the GUI by worker threads while using PyGTK. Is PyQt any better on that point ?","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":8254,"Q_Id":11047821,"Users Score":1,"Answer":"I can't compare, because I don't use GTK, but I'd suggest Qt.\nQt definitely has \"treeview\/tableview\" you're talking about and you can make the \"cells\" your custom widgets (I'm just studying this topic right now). Qt was made with a lot of thought about threads, so worker threads can use the signal\/slot mechanism with ease. And yes, you can modify the existing widgets by applying stylesheets or subclassing.\nNow about PyQt, I wouldn't recommend it because of licensing issues. PySide seems like a better Qt\u2192Python binding to me: it can be used in commercial applications freely and has a few tiny advantages in the API (but otherwise it's fully compatible with PyQt).\nQt is cross-platform and deployment of PySide applications is very easy with cx_Freeze; users of your application won't have to install anything at all.","Q_Score":12,"Tags":"python,user-interface,pygtk,pyqt4","A_Id":11050753,"CreationDate":"2012-06-15T09:16:00.000","Title":"What are the advantages of PyQt over PyGTK and vice-versa?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application whose GUI is to be remade for ergonomic reasons.\nIt was written in PyGTK and I am wondering if I should switch to PyQt to ease future developments or not.\nThis application has a mostly classical UI with buttons, toolbars, dialogs etc. but also has some specific requirements : I will certainly need to create a custom widget based on treeview\/tableview (to make a spreadsheet-like widget) and this application has a lot of worker threads which update the GUI.\nI am seeking advice on these two points :\n\nAs regards the creation custom widgets, does PyQt provide better mechanisms than PyGTK, especially to slightly modify existing widgets.\nI had problems with (even when properly using threads_init() and threads_enter()) the updating of the GUI by worker threads while using PyGTK. Is PyQt any better on that point ?","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":8254,"Q_Id":11047821,"Users Score":1,"Answer":"Definitely PyQt... There are a lot of advanced applications using it... Personally, I'm using KDE, so, even my system's GUI uses Qt! I'm also creating a spreadsheet application and I find that it's far easier that what I thought at first... But, BiaXpirit is also right: except if you're developing an open-source app, maybe you should use PySide or something else...","Q_Score":12,"Tags":"python,user-interface,pygtk,pyqt4","A_Id":11899802,"CreationDate":"2012-06-15T09:16:00.000","Title":"What are the advantages of PyQt over PyGTK and vice-versa?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a small GTK python application that imports a package (Twisted) that may not be loaded twice.\nIf I run my application in emacs with python-mode.el and press C-c C-c, the application gets executed in a python shell window.\nIf I now close the application, the python shell stays up and running. If I now press C-c C-c again, emacs \"reuses\" the old python process and thus I run into problems because I'm installing a Twisted reactor twice.\nIs it possible to have python-mode.el open a new shell window each time I execute a buffer?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1178,"Q_Id":11066684,"Users Score":2,"Answer":"python-mode.el comes with a command py-execute-buffer-dedicated,\n opening a new and reserved process for it","Q_Score":1,"Tags":"emacs,python-mode","A_Id":11602461,"CreationDate":"2012-06-16T20:11:00.000","Title":"Open new python shell on C-c C-c in python-mode.el","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Is it possible to write an application using the pyjamas widgets, together with the tornado server model? What I have in mind is to provide a desktop-like frontend for my web application with pyjamas, and do server side logic with tornado.\nSpecifically, I want to trigger events in the web application generated in the server side, and be able to display those events using the pyjamas widgets.\nDoes somebody have a working example of this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":178,"Q_Id":11071287,"Users Score":0,"Answer":"The route I have chosen is to combine pyjs (old pyjamas) with web2py, via JSONRPC. So far it is working fine.","Q_Score":0,"Tags":"python,tornado,pyjamas","A_Id":11453702,"CreationDate":"2012-06-17T12:28:00.000","Title":"Integration of pyjamas and tornado","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"So basically I want to create a GUI app using PySide and the Qt Framework. I am using the QT designer to make the initial UI design. The first version of the app will run on Mac and I want it to be like other Mac applications where the name of the app is in bold and all the way to the left with an \"About\", \"Preferences\", and \"Quit\". \nThe problem is that whenever I add these types of strings the drop down stops working.\nAny tips on this would be helpful this is my first GUI using PySide, QT Framework, andd QT Designer.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":419,"Q_Id":11076018,"Users Score":1,"Answer":"I don't know about Python; but on the Mac you create About, Preferences or Quit menu items and Qt will automatically shift them into the application menu on the left (the one with the bold text).\nI'm guessing that you are trying to create your own application menu and Qt is getting confused. You don't need to create it. Put your About, Preferences or Quit menu items under File or some other menu heading and they will get shifted.","Q_Score":5,"Tags":"python,qt,pyside,qt-designer","A_Id":11092105,"CreationDate":"2012-06-18T01:09:00.000","Title":"Qt not letting me create a menu item named after my app with the strings \"About\", \"Preferences\", or \"Quit? Any tips?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am fairly new to Python programming and Threads isn't my area of expertise. I have a problem for which i would hope that people here can help me out with.\nTask: as a part of my master thesis, i need to make a mixed reality game which involves multiplayer capability. in my game design, each player can set a bunch of traps, each of which is active for a specific time period e.g. 30 secs. In order to maintain a consistent game state across all the players, all the time check needs to be done on the server side, which is implemented in Python. \nI decided to start a python thread, everytime a new trap is laid by a player and run a timer on the thread. All this part is fine, but the real problem arises when i need to notify the main thread that the time is up for this particular trap, so that i can communicate the same to the client (android device). \ni tried creating a queue and inserting information into the queue when the task is done, but i cant do a queue.join() since it will put the main thread on hold till the task is done and this is not what i need nor is it ideal in my case, since the main thread is constantly communicating with the client and if it is halted, then all the communication with the players will come to a standstill.\nI need the secondary thread, which is running a timer, to tell the main thread, as soon as the time runs out that the time has run out and send the ID of the trap, so that i can pass this information to the android client to remove it. How can i achieve this ??\nAny other suggestions on how this task can be achieved without starting a gazillion threads, are also welcome.. :) :)\nThanks in advance for the help..\nCheers","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2489,"Q_Id":11079785,"Users Score":0,"Answer":"The main thread creates a queue and a bunch of worker threads that are\npulling tasks from the queue. As long as the queue is empty all worker\nthreads block and do nothing. When a task is put into the queue a random\nworker thread acquires the task, does it job and sleeps as soon as its\nready. That way you can reuse a thread over and over again without\ncreating a new worker threads.\nWhen you need to stop the threads you put a kill object into the queue\nthat tells the thread to shut down instead of blocking on the queue.","Q_Score":1,"Tags":"python,multithreading","A_Id":11080491,"CreationDate":"2012-06-18T09:08:00.000","Title":"Notify the main thread when a thread is done","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a Matplotlib canvas (FigureCanvasWxAgg) that I'm displaying inside of a wx.ScrolledWindow. The problem is that I'd like to have the default zooming and panning functionality of Matplotlib work in conjunction with the ScrolledWindow, so that when the user zooms the image within the canvas, the ScrolledWindow should become larger to accommodate for the zooming (scrollbars become smaller). Similarly for panning, I'd like the default matplotlib panning tool to work in conjunction with our ScrolledWindow, so that when the user pans the image on the canvas, the ScrolledWindow's scrollbars should move accordingly.\nI've been searching for a while now and have not seen anyone even mention if this is possible. Could anyone point me in the right direction?\nThank you for any help\/tips.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":448,"Q_Id":11108160,"Users Score":0,"Answer":"The problem is that the default Zoom and Pan don't resize the figure, they just change the limits and redraw the plot.\nWhat you want is the Zoom to resize (keeping the same limits) and the Pan to work as in a normal Scrolled window. I have never tried this, fig.set_size_inches(w,h) should do the trick.","Q_Score":4,"Tags":"python,image,matplotlib,scrolledwindow","A_Id":24759361,"CreationDate":"2012-06-19T19:38:00.000","Title":"Matplotlib zooming work in conjunction with wxPython ScrolledWindow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've spent some time looking over the various threads here on stackoverflow and while I saw a lot of posts and threads regarding various engines that could be used in game development, I haven't seen very much discussion regarding the various platforms that they can be used on.\nIn particular, I'm talking about browser games vs. desktop games.\nI want to develop a simple 3D networked multiplayer game - roughly on the graphics level of Paper Mario and gameplay with roughly the same level of interaction as a hack & slash action\/adventure game - and I'm having a hard time deciding what platform I want to target with it. I have some experience with using C++\/Ogre3D and Python\/Panda3D, but I'm wondering if it's worth it to spend the extra time to learn another language and another engine\/toolkit just so that the game can be played in a browser window (I'm looking at jMonkeyEngine right now).\nFor simple & short games the newgrounds approach (go to the site, click \"play now\", instant gratification) seems to work well. What about for more complex games? Is there a point where the complexity of a game is enough for people to say \"ok, I'm going to download and play that\"? Is it worth it to go with engines that are less-mature, have less documentation, have fewer features, and smaller communities* just so that a (possibly?) larger audience can be reached? Does anyone have any experiences with decisions like this?\nThanks!\n(* With the exception of flash-based engines it seems like most of the other approaches have these downsides when compared to what is available for desktop-based environments. I'd go with flash, but I'm worried that flash's 3D capabilities aren't mature enough right now to do what I want easily).","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":277,"Q_Id":11110902,"Users Score":1,"Answer":"Download and install is a harder sell.  People are more reluctant to do it, and once they have done it, you own the problem of platform compatibility, and you have installed code to update or avoid as your game evolves.\nJava applets eliminate all that mess.   Presumably also flash or html5.","Q_Score":0,"Tags":"java,python,flash","A_Id":11113116,"CreationDate":"2012-06-19T23:27:00.000","Title":"Game development: \"Play Now\" via website vs. download & install","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I would like to draw border for each row in a wxPython grid different (e.g. bold or broken line) based on data in the respective row. How can I achieve this result? \nI am using python 2.6 and what I need is some pointers and\/or suggestions.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":585,"Q_Id":11118465,"Users Score":2,"Answer":"Take a look at the wxPython demo. I think the demos that you'll find the most helpful are the following:\n\nwx.Grid showing Editors and Renderers\nGridLabelRenderer which is from wx.lib.mixins.gridlabelrenderer\n\nThose will probably get you started. When you get stuck, ask on the wxPython mailing list. They'll be able to help you out.","Q_Score":2,"Tags":"wxpython","A_Id":11120703,"CreationDate":"2012-06-20T11:24:00.000","Title":"How to draw border differently for each row in a Grid of wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The other day I came across a Python implementation called Jython.\nWith Jython you can write Java applications with Python and compile them to pure Java.  \nI was wondering: Android programming is done with Java.\nSo, is it possible to make Android apps with Jython?","AnswerCount":7,"Available Count":6,"Score":1.2,"is_accepted":true,"ViewCount":34891,"Q_Id":11120130,"Users Score":44,"Answer":"Jython doesn't compile to \"pure java\", it compiles to java bytecode - ie, to *.class files. To develop for Android, one further compiles java bytecode to Dalvik bytecode. This means that, yes, Jython can let you use Python for developing Android, subject to you getting it to play nice with the Android SDK (I haven't personally tried this, so I don't know how hard it actually is) - you do need to make sure you don't depend on any Java APIs that Android doesn't provide, and might need to have some of the Android API .class files around when you run jython. Aside from these niggles, your core idea should work - Jython does, indeed, let write code in Python that interacts with anything else that runs on the JVM.","Q_Score":64,"Tags":"android,python,jython","A_Id":11122066,"CreationDate":"2012-06-20T12:58:00.000","Title":"Programming Android apps in jython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"The other day I came across a Python implementation called Jython.\nWith Jython you can write Java applications with Python and compile them to pure Java.  \nI was wondering: Android programming is done with Java.\nSo, is it possible to make Android apps with Jython?","AnswerCount":7,"Available Count":6,"Score":-1.0,"is_accepted":false,"ViewCount":34891,"Q_Id":11120130,"Users Score":-6,"Answer":"sadly No.\nMobile phones only have Java ME (Micro Edition) but Jython requires Java SE (Standard Edition). There is no Jython port to ME, and there is not enough interest to make it worth the effort.","Q_Score":64,"Tags":"android,python,jython","A_Id":26718708,"CreationDate":"2012-06-20T12:58:00.000","Title":"Programming Android apps in jython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"The other day I came across a Python implementation called Jython.\nWith Jython you can write Java applications with Python and compile them to pure Java.  \nI was wondering: Android programming is done with Java.\nSo, is it possible to make Android apps with Jython?","AnswerCount":7,"Available Count":6,"Score":0.1418931938,"is_accepted":false,"ViewCount":34891,"Q_Id":11120130,"Users Score":5,"Answer":"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. \nYou also have to take care of application size - that is serious constraint for mobile developement.","Q_Score":64,"Tags":"android,python,jython","A_Id":11120423,"CreationDate":"2012-06-20T12:58:00.000","Title":"Programming Android apps in jython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"The other day I came across a Python implementation called Jython.\nWith Jython you can write Java applications with Python and compile them to pure Java.  \nI was wondering: Android programming is done with Java.\nSo, is it possible to make Android apps with Jython?","AnswerCount":7,"Available Count":6,"Score":0.0855049882,"is_accepted":false,"ViewCount":34891,"Q_Id":11120130,"Users Score":3,"Answer":"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.","Q_Score":64,"Tags":"android,python,jython","A_Id":23649506,"CreationDate":"2012-06-20T12:58:00.000","Title":"Programming Android apps in jython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"The other day I came across a Python implementation called Jython.\nWith Jython you can write Java applications with Python and compile them to pure Java.  \nI was wondering: Android programming is done with Java.\nSo, is it possible to make Android apps with Jython?","AnswerCount":7,"Available Count":6,"Score":0.0285636566,"is_accepted":false,"ViewCount":34891,"Q_Id":11120130,"Users Score":1,"Answer":"Yes, you can.\nTest your python code on your computer and, when it is ok, copy to your Android device.\nInstall Pydroid from Google Play Store and compile your code again inside the application and you will get your App ready and running.\nUse pip inside Pydroid to install any dependencies.\nPS: You will need to configure your Android device to install APKs from outside Play Store.","Q_Score":64,"Tags":"android,python,jython","A_Id":53232363,"CreationDate":"2012-06-20T12:58:00.000","Title":"Programming Android apps in jython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"The other day I came across a Python implementation called Jython.\nWith Jython you can write Java applications with Python and compile them to pure Java.  \nI was wondering: Android programming is done with Java.\nSo, is it possible to make Android apps with Jython?","AnswerCount":7,"Available Count":6,"Score":-0.057080742,"is_accepted":false,"ViewCount":34891,"Q_Id":11120130,"Users Score":-2,"Answer":"It's not possible. You can't use jython with android because the DVM doesn't understand it. DVM is not JVM.","Q_Score":64,"Tags":"android,python,jython","A_Id":13966835,"CreationDate":"2012-06-20T12:58:00.000","Title":"Programming Android apps in jython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"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.\nWho is responsible for it? Layout, items container or tab order?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":706,"Q_Id":11120427,"Users Score":1,"Answer":"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.","Q_Score":0,"Tags":"python,qt,pyqt,grid-layout","A_Id":11120871,"CreationDate":"2012-06-20T13:15:00.000","Title":"Custom QGridLayout items selection behaviour","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Mac OS X 10.6.8, wxPython 2.9.3.1 and 64 Bit Python v2.7.2:\nMy problem is not that easy to describe in a few key words, thats why I probably did not find a solution yet. \nI just just create a very simple wx.frame with some objects and arrange them with a sizer. If I then \nshow the frame all elements are displayed at top of each other for a second. Then everything jumps into place and is displayed correctly.\nI tried to call all kinds of funktions before showing my frame like Refresh, wx.Yield, Update etc. but nothing helped.\nIs 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?\nThank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":218,"Q_Id":11134169,"Users Score":1,"Answer":"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.","Q_Score":0,"Tags":"python,wxpython,sizer","A_Id":11139906,"CreationDate":"2012-06-21T08:19:00.000","Title":"wx Python frame elements not displayed correctly right after show using sizers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":139,"Q_Id":11140710,"Users Score":4,"Answer":"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","Q_Score":0,"Tags":"python,oracle,graphics,2d,simulation","A_Id":11140908,"CreationDate":"2012-06-21T14:46:00.000","Title":"python 2d graphics that works with Oracle","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to store typed values (e.g., float, integer) in HBase and access these values from different clients? \nThe 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. \nIn 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.\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":477,"Q_Id":11143979,"Users Score":0,"Answer":"No; HBase stores bytes, nothing more. Any further encoding or decoding must be done by you.","Q_Score":1,"Tags":"python,types,hbase,thrift","A_Id":11144332,"CreationDate":"2012-06-21T17:56:00.000","Title":"Storing typed values in HBase","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to invoke  PySocketModule_ImportModuleAndAPI function defined in socketmodule.h in my Python C-extension.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":142,"Q_Id":11172215,"Users Score":0,"Answer":"I had a similar problem and resolved it by:\n\nAdding the Modules\\ directory (from your Python source) to the C\/C++ Additional Include Directories.\n#include \"socketmodule.h\"\n\nDon't know if this is the best solution, but it worked for me!","Q_Score":1,"Tags":"python-c-extension,python-extensions","A_Id":20085116,"CreationDate":"2012-06-23T19:07:00.000","Title":"Is it possible to include socketmodule.h in Python C extensions?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Just a quick question..\nFollowing 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).\nAs 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.\nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":72,"Q_Id":11258057,"Users Score":1,"Answer":"I figured it out.\nI used frame_table.grid_size() and have the columns and rows (7, 3).\nSorry for the dull question!","Q_Score":0,"Tags":"python,class,tkinter","A_Id":11258706,"CreationDate":"2012-06-29T07:52:00.000","Title":"Obtaining number of rows Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":176,"Q_Id":11282099,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"python,wxwidgets","A_Id":14640674,"CreationDate":"2012-07-01T12:51:00.000","Title":"How do I center a wx.MessageDialog to the frame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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:\n\n    import pygame, time\n    pygame.init()\n    screen = pygame.display.set_mode((400, 300))\n    loop = \"yes\"\n    while loop==\"yes\":\n        screen.fill((0, 0, 0), (0, 0, 400, 300))\n        font = pygame.font.SysFont(\"calibri\",40)\n        text = font.render(\"TextA\", True,(255,255,255))\n        screen.blit(text,(0,0))\n        pygame.display.update()\n\n        font = pygame.font.SysFont(\"calibri\",20)\n        text = font.render(\"Begin\", True,(255,255,255))\n        screen.blit(text,(50,50))\n        pygame.display.update()\n        time.sleep(0.1)\n\nThe \"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!","AnswerCount":4,"Available Count":1,"Score":0.1488850336,"is_accepted":false,"ViewCount":5741,"Q_Id":11300745,"Users Score":3,"Answer":"You're updating your screen 2 times in a loop, one for drawing first text(TextA) and one for second text(Begin).\nAfter your first update, only first text appears, so you can't see begin text between first update and second update. This causes flickering.\nUpdate your screen after drawing everything. In your case, remove first pygame.display.update().","Q_Score":2,"Tags":"python,pygame","A_Id":11300894,"CreationDate":"2012-07-02T20:31:00.000","Title":"Update display all at one time PyGame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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).\nI 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).\nShould 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)?\nI 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.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":534,"Q_Id":11314253,"Users Score":0,"Answer":"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.\nHere are some suggestions...\n\nIt 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.\nFor a cross platform build, see if you can implement a standardized build system such as CMake or SCons.\nI 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.\nAs 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.","Q_Score":2,"Tags":"c++,python,windows,linux,porting","A_Id":11347955,"CreationDate":"2012-07-03T15:29:00.000","Title":"compiling+distributing Linux code on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"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...\nAnyone any idea how this is done?\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":134,"Q_Id":11342620,"Users Score":0,"Answer":"I solved this by getting the width of the parent widget inside the scrolledpanel, instead of the width of the scrolledpanel itself.\nSometimes the answer is so obvious :)","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":11382239,"CreationDate":"2012-07-05T10:38:00.000","Title":"Check if wx.lib.scrolledpanel.ScrolledPanel is currently scrolling","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?\nThanks","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":346,"Q_Id":11357611,"Users Score":1,"Answer":"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.\n\nUpdate\nI 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.\nTry 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.","Q_Score":0,"Tags":"python,button,windows-xp,wxpython","A_Id":11357674,"CreationDate":"2012-07-06T07:22:00.000","Title":"wxPython, button design","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?\nThanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":346,"Q_Id":11357611,"Users Score":0,"Answer":"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.\nThis also has a method SetUseFocusIndicator to turn off the dotted focus indicator","Q_Score":0,"Tags":"python,button,windows-xp,wxpython","A_Id":11361156,"CreationDate":"2012-07-06T07:22:00.000","Title":"wxPython, button design","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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)\nThe only way I am able to do this currently is by copying each image to power point.\nIs this possible with python (or any other language, but preferably python)?\nAs 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)\nEDIT: 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","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3192,"Q_Id":11368143,"Users Score":0,"Answer":"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.","Q_Score":2,"Tags":"python,image,python-3.x,scaling,pixel","A_Id":16485248,"CreationDate":"2012-07-06T18:59:00.000","Title":"Python: Import multiple images from a folder and scale\/combine them into one image?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?\nBasically, 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.","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":365,"Q_Id":11399489,"Users Score":1,"Answer":"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.","Q_Score":0,"Tags":"python,events,wxpython,wxwidgets","A_Id":11401507,"CreationDate":"2012-07-09T16:43:00.000","Title":"event handling in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?\nBasically, 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.","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":365,"Q_Id":11399489,"Users Score":2,"Answer":"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.\nRavenspoint 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.","Q_Score":0,"Tags":"python,events,wxpython,wxwidgets","A_Id":11399885,"CreationDate":"2012-07-09T16:43:00.000","Title":"event handling in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?\nBasically, 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.","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":365,"Q_Id":11399489,"Users Score":2,"Answer":"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.","Q_Score":0,"Tags":"python,events,wxpython,wxwidgets","A_Id":11399632,"CreationDate":"2012-07-09T16:43:00.000","Title":"event handling in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a way to embed an .exe into a frame.  (MDI)\nI am not sure how this can be done.\nI am using wxpython 2.9 and there is nothing online about this (until now).","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":389,"Q_Id":11404994,"Users Score":0,"Answer":"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.\nIf 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.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":11411866,"CreationDate":"2012-07-10T00:11:00.000","Title":"Embed .exe in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nWhat 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?\nthanks","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":634,"Q_Id":11420053,"Users Score":2,"Answer":"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.\nNote 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.\nAlso 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.","Q_Score":2,"Tags":"python,c","A_Id":11420313,"CreationDate":"2012-07-10T18:59:00.000","Title":"executing c program from a python program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":41,"Q_Id":11427168,"Users Score":1,"Answer":"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.\nThe 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.","Q_Score":0,"Tags":"javascript,python","A_Id":11427225,"CreationDate":"2012-07-11T06:57:00.000","Title":"how to darw the image faster in canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"By easier i mean - can i define a style or something and apply it to all labels in my program?\nI have a lot of labels in it and I don't want to type so much.\nI heard about \"Pango Style\" but can I apply it to all label widgets at once?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":929,"Q_Id":11437350,"Users Score":0,"Answer":"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.\nA 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. \nI don't know Python only C and some C++ but you could do something like this:\n1) create a enum for all your labels starting with label0. (namedtuple in python I think)\nThe 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.\n2) create an array of pointers to GtkWidget, one for each label.\n3) create your labels using the pointers to GtkWidget with the enum as the index.\n(here's where the enum is really needed)\n4) 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.\nI 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.","Q_Score":0,"Tags":"python,label,border,gtk3","A_Id":11618562,"CreationDate":"2012-07-11T16:39:00.000","Title":"Is there a easier way of creating a bordered Label in python Gtk3 than putting it in Frame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nWhen 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.\nIs there a reason why the text entry widget is not respective the row\/col\/weighting? Thanks in advance!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2171,"Q_Id":11464608,"Users Score":0,"Answer":"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. \nOne 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.","Q_Score":0,"Tags":"python,tkinter","A_Id":11473405,"CreationDate":"2012-07-13T05:25:00.000","Title":"Tkinter - text widget distorting column sizes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nWhen 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.\nIs there a reason why the text entry widget is not respective the row\/col\/weighting? Thanks in advance!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2171,"Q_Id":11464608,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"python,tkinter","A_Id":11470343,"CreationDate":"2012-07-13T05:25:00.000","Title":"Tkinter - text widget distorting column sizes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":345,"Q_Id":11475925,"Users Score":5,"Answer":"There are a few reason why IronPython is slow to startup.\nFirst, 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.\nSecond, 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.\nFinally, 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.\nIronPython'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.\nIronPython'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.","Q_Score":2,"Tags":"python,ironpython","A_Id":11476423,"CreationDate":"2012-07-13T18:06:00.000","Title":"IronPython launching very slowly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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. \nI'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!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3600,"Q_Id":11477308,"Users Score":0,"Answer":"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. \nBut 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. \nThere is also tool called Qt Designer which is very handy to creat GUIs for PyQt ( & Qt) programs by drag & drop tools.","Q_Score":0,"Tags":"python,user-interface,pyqt4","A_Id":11477562,"CreationDate":"2012-07-13T19:43:00.000","Title":"Displaying text in a window with PyQT4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":463,"Q_Id":11488487,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"python,tkinter","A_Id":11491757,"CreationDate":"2012-07-15T00:35:00.000","Title":"Tkinter toplevel communication","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nSo, my question(s):\nIs there any other way to stream video (youtube, justin tv) using python and gtk?\nIf 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?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":551,"Q_Id":11502928,"Users Score":0,"Answer":"ALright, I've come up with an answer.\nInstead 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.\nIt's open source, and supports flash on windows(and linux, I believe).","Q_Score":2,"Tags":"python,windows","A_Id":11557820,"CreationDate":"2012-07-16T11:01:00.000","Title":"Embeding flash in WebKit for pygtk on windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nSo 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'\nNow for something like this would I need (or be greatly helped by) a framework?  If so which one(s)?\nWould this need a database on a server, or could all data be stored on the user's computers?\nWould I be dealing with CGI or Sockets or both in creating something like this?\nWould 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)\nI 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 =)\nThank you all for you time, I greatly appreciate everything.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1912,"Q_Id":11534826,"Users Score":2,"Answer":"General Response\nEspecially 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.\nSpecific Answers\n\nNow for something like this would I need (or be greatly helped by) a framework? If so which one(s)?\n\nThere 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.\n\nWould this need a database on a server, or could all data be stored on the user's computers?\n\nHaving 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.\n\nWould I be dealing with CGI or Sockets or both in creating something like this?\n\nRead more about what CGI and sockets are and think about this one.\n\nWould 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)\n\nThere 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. \nConclusion\nWell, I hope that was helpful in some way. Best of luck!","Q_Score":0,"Tags":"php,python,network-programming","A_Id":11535406,"CreationDate":"2012-07-18T05:32:00.000","Title":"Wanting to make a turn-based python game. Where do I go from here?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":1178,"Q_Id":11565271,"Users Score":2,"Answer":"For clarity to anyone who comes across this old question.\nPythonWin's interactive shell window can be cleared by highlighting all the text and then pressing delete just like it were a text editor.","Q_Score":1,"Tags":"python","A_Id":36500008,"CreationDate":"2012-07-19T16:30:00.000","Title":"Clearing screen in Python (when using Pythonwin)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":4459,"Q_Id":11570786,"Users Score":6,"Answer":"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)","Q_Score":5,"Tags":"python,tkinter","A_Id":11580799,"CreationDate":"2012-07-19T23:28:00.000","Title":"tkinter treeview - drag and drop?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":3,"Available Count":2,"Score":0.2605204458,"is_accepted":false,"ViewCount":4459,"Q_Id":11570786,"Users Score":4,"Answer":"Could not leave comment on solution so added my 50c here:\nto resolve the issue dragging via multilevel tree up and down, you need to specify the parent ID when moving, as per line below:\ntv.move(s, tv.identify_row(event.y), moveto)\nthis might be usefull for someone...","Q_Score":5,"Tags":"python,tkinter","A_Id":41599442,"CreationDate":"2012-07-19T23:28:00.000","Title":"tkinter treeview - drag and drop?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":58,"Q_Id":11594044,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"python,wxpython","A_Id":11613711,"CreationDate":"2012-07-21T16:47:00.000","Title":"how to select next item of wxlistbox in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":118,"Q_Id":11599942,"Users Score":0,"Answer":"Change the color and use wxTimerEvent to set the delay until you change it back in the event handler.","Q_Score":0,"Tags":"python,wxpython","A_Id":11603933,"CreationDate":"2012-07-22T11:35:00.000","Title":"How to let a cell blink for a configurable time in wx.grid when the value changes?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nI'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++.\nWhat would you suggest as the better option (for a newbie)?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":259,"Q_Id":11606873,"Users Score":1,"Answer":"Take a look at MonoDevelop. Allows you to develop in C# and deploy to both Linux and Windows.","Q_Score":0,"Tags":"java,c++,python,user-interface","A_Id":11606887,"CreationDate":"2012-07-23T05:24:00.000","Title":"Better language for developing GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nI'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.\nAm I doing something wrong(or missing something), or is it just Linux\/Fedora\/Gnome 3?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":76,"Q_Id":11607571,"Users Score":1,"Answer":"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.","Q_Score":0,"Tags":"linux,wxpython,fedora,gnome-3,gdi","A_Id":11617941,"CreationDate":"2012-07-23T06:42:00.000","Title":"ClientDC and WindowDC do not draw under Fedora 16 Gnome 3, only PaintDC","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"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.\nI have no clue how to proceed, please help.\nI have seen that splitter window can be of some help, can someone provide a sample code.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":751,"Q_Id":11628835,"Users Score":0,"Answer":"wx.FreezeTo(row,col)\n0 to unfreeze, otherwise any other number will freeze the first rows or columns","Q_Score":2,"Tags":"wxpython","A_Id":64290241,"CreationDate":"2012-07-24T10:24:00.000","Title":"Freeze few column in wxgrid","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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 .","AnswerCount":8,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30098,"Q_Id":11643221,"Users Score":0,"Answer":"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.","Q_Score":28,"Tags":"python,user-interface,icons,pyqt,pyside","A_Id":11693002,"CreationDate":"2012-07-25T05:21:00.000","Title":"Are there default icons in PyQt\/PySide?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can anybody explain me difference between wxpython and tkinter?\nWhich one is the best for development?\nI want to develop a media player using python.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1691,"Q_Id":11684796,"Users Score":1,"Answer":"these are two different widget libraries. \nTkInter 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.\nwxpython is NOT built-in, therefore you have to distribute it with your code to all platforms, albeit it 'blends in' a bit more perhaps.\nIt depends on your needs of course.\nI'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.\nDepends on which platforms do you want to support...","Q_Score":0,"Tags":"python","A_Id":11684911,"CreationDate":"2012-07-27T09:10:00.000","Title":"Difference between wxpython and tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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...\nMaybe wxPython is not the best solution for it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":111,"Q_Id":11694213,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"wxpython","A_Id":11722723,"CreationDate":"2012-07-27T19:11:00.000","Title":"wxPython: Create multicolored text widget for ASCII game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nThe 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?\nI 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...?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":330,"Q_Id":11695649,"Users Score":1,"Answer":"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.  \nDo not wait in GUI event handlers!","Q_Score":1,"Tags":"python,pyqt4,qthread,python-multithreading","A_Id":11695734,"CreationDate":"2012-07-27T21:06:00.000","Title":"How do I tell my main GUI to wait on a worker thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nThe 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?\nI 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...?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":330,"Q_Id":11695649,"Users Score":0,"Answer":"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.\nThe solution you describe using signal and slots seems to make plenty of sense to me. Or you could just use a boolean.","Q_Score":1,"Tags":"python,pyqt4,qthread,python-multithreading","A_Id":11695743,"CreationDate":"2012-07-27T21:06:00.000","Title":"How do I tell my main GUI to wait on a worker thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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\u2013simple\u2013programs 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.\nI'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).\nThanks","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":79860,"Q_Id":11729368,"Users Score":2,"Answer":"windows(install minigw, python2.7 and added to the system path)\ncpp:  \n\nbuild: ctrl+b\nrun: ctrl+shift+b\n\npython:  \n\nbuild and run: ctrl+b\n\nyou may try to learn the the .sublime-build files in your Tools -> Build system -> New build system","Q_Score":25,"Tags":"c++,python,build,sublimetext2","A_Id":14229213,"CreationDate":"2012-07-30T20:51:00.000","Title":"Build systems in Sublime Text","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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. \nHowever, 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? \nThanks in advance!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":293,"Q_Id":11740489,"Users Score":0,"Answer":"Telling the program to request input from the console at the end via raw_input() should cause it to pause before closing the console.","Q_Score":3,"Tags":"python,user-interface,vim,command-line-interface","A_Id":11740644,"CreationDate":"2012-07-31T12:50:00.000","Title":"Python GUI creation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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. \nHowever, 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? \nThanks in advance!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":293,"Q_Id":11740489,"Users Score":1,"Answer":"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.\nOr you can write the program in vim and run it through IDLE.","Q_Score":3,"Tags":"python,user-interface,vim,command-line-interface","A_Id":11741077,"CreationDate":"2012-07-31T12:50:00.000","Title":"Python GUI creation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?\nI'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?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":734,"Q_Id":11769445,"Users Score":0,"Answer":"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.","Q_Score":1,"Tags":"c#,python,xbox360","A_Id":11769529,"CreationDate":"2012-08-02T00:26:00.000","Title":"Using C# to write an Xbox 360 Indie game with Python Scripting","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPanel. How can I make it resizable by the user? With a drag-and-drop resize bar?\nI wonder what the widgets I need are.\nThank you.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2621,"Q_Id":11780084,"Users Score":1,"Answer":"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.\nIn 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.\nWhat have you tried so far?","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":11780276,"CreationDate":"2012-08-02T14:50:00.000","Title":"Make a wxPanel resizable by the user","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nWhat 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.\nThe 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.\nOr is there a faster canvas that I can integrate into wxPython that I'm not aware of?\nThoughts? Thanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":528,"Q_Id":11820258,"Users Score":0,"Answer":"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...\nAnyway, 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.","Q_Score":1,"Tags":"python,opencv,wxpython,pygame","A_Id":11833097,"CreationDate":"2012-08-05T21:34:00.000","Title":"wxPython, or PyGame canvas within wxPython -> which is faster?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":973,"Q_Id":11868963,"Users Score":0,"Answer":"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.\nFinal solution?  I couldn't hook my code into PIL.  I had to use PIL.Image.fromarray() to using my decompressed images.","Q_Score":1,"Tags":"python,python-imaging-library,tiff","A_Id":11877012,"CreationDate":"2012-08-08T16:27:00.000","Title":"Using TIFF G4 image in PIL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"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. \nAs 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. \nMy 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?\nEDIT:\nI 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?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":151,"Q_Id":11906505,"Users Score":1,"Answer":"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.","Q_Score":0,"Tags":"python,tkinter,py2app","A_Id":11906589,"CreationDate":"2012-08-10T17:28:00.000","Title":"Saving space in tkinter application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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).\nWhat 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...\nIt has to be easy to do http request and en-\/decoding JSON - and please no C\/C++.\nMaybe python + wxwidgets?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":3021,"Q_Id":11907027,"Users Score":3,"Answer":"You could use Python for this easily with just the standard library (python 2.7.3).\nFor 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.\nFor the http request you can use httplib.\nFor the Json related things you can use the json library.","Q_Score":3,"Tags":"python,user-interface,raspberry-pi","A_Id":11907139,"CreationDate":"2012-08-10T18:09:00.000","Title":"fast gui on raspberry","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing an application in Qt that I want to extend with plugins.\nMy 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.\nRight 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.\nUp to this point I believe that everything is clear, a standard plugin interface. However, there are 3 main problems, or subtasks:\n\nHow to use the library from other languages?\nI 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.\nHow 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.\nI didn't try this yet, but I suppose there are generators for other languages.\nHow 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.\nBased 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.\n\nIt 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.\nPlease 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.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":308,"Q_Id":11914614,"Users Score":1,"Answer":"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.\nHowever, 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.\nWhile 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.\n\nEvery language has support for opening shared object (SO or DLL) files. Use that.\nYour 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.\nDifferent 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.)\n\nKeep 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.\nIf 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.","Q_Score":3,"Tags":"java,c++,python,qt,plugins","A_Id":13563225,"CreationDate":"2012-08-11T12:15:00.000","Title":"How to write Qt plugin system with bindings in other languages?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nI 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.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":14012,"Q_Id":11945183,"Users Score":0,"Answer":"Emitting signals instead of synchronic UI control was the key to avoid problems for me during implementation of logic circuit simulator","Q_Score":39,"Tags":"python,pyqt,pyqt4","A_Id":66418264,"CreationDate":"2012-08-14T02:56:00.000","Title":"What are good practices for avoiding crashes \/ hangs in PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am thinking of writing a python program that runs in the background and can inspect user's GUI events.\nMy requirements is very simple:\n1) When user right click the mouse, it can show an option; and when this option is chosen, my program should know this event.\n2) When user select a file and click some predefined key combination, my program should know this event.\nWhat 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.\nThanks.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":367,"Q_Id":11970246,"Users Score":2,"Answer":"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.","Q_Score":0,"Tags":"python,wxpython","A_Id":11975689,"CreationDate":"2012-08-15T13:35:00.000","Title":"Background python program inspect GUI events","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":874,"Q_Id":11983110,"Users Score":1,"Answer":"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).","Q_Score":1,"Tags":"python,testing,qwidget,pywinauto","A_Id":12048666,"CreationDate":"2012-08-16T08:14:00.000","Title":"find qwidget object text by using pywinauto","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nThe 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.\n   Thanks in advance for your help.","AnswerCount":7,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":20715,"Q_Id":11993290,"Users Score":7,"Answer":"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.","Q_Score":22,"Tags":"python,fonts,tkinter","A_Id":11995850,"CreationDate":"2012-08-16T18:30:00.000","Title":"Truly custom font in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nPlease help...\nThanks in advance..","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1303,"Q_Id":12006741,"Users Score":2,"Answer":"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\nI 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.","Q_Score":1,"Tags":"python,user-interface,python-3.x,wxpython","A_Id":12008375,"CreationDate":"2012-08-17T13:26:00.000","Title":"Wxpython How to change the colour of Gauge Progress bar in windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":45627,"Q_Id":12014210,"Users Score":0,"Answer":"Important Caveat:\n(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.\nAs 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.","Q_Score":31,"Tags":"python,user-interface,tkinter,contextmenu","A_Id":69902726,"CreationDate":"2012-08-17T23:04:00.000","Title":"tkinter app adding a right click context menu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nCan 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?\nHonestly 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?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":6320,"Q_Id":12016443,"Users Score":1,"Answer":"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?","Q_Score":1,"Tags":"python,pygame,game-engine,pyglet","A_Id":12016497,"CreationDate":"2012-08-18T06:32:00.000","Title":"Making a 2d game in Python - which library should be used?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I convert a file with 158 pixel to pdf file, I just got a pdf file with 121 pixel in 100% zoom.\nwkhtmltopdf --dpi 100 c:\\1.svg c:\\2.pdf\nwhen I change the DPI, I find't it doesn't work. --dpi 100 is the same as --dpi 1000.\nwkhtmltopdf version is 0.11, test under windows and linux.","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":1365,"Q_Id":12027081,"Users Score":4,"Answer":"Try with the --disable-smart-shrinking option","Q_Score":1,"Tags":"php,python,wkhtmltopdf","A_Id":12590770,"CreationDate":"2012-08-19T14:03:00.000","Title":"using wkhtmltopdf convert a file to pdf is smaller in size than the real file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there anyway to assign priorities to specific wxPython event?\nI 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?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":264,"Q_Id":12054994,"Users Score":1,"Answer":"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.","Q_Score":2,"Tags":"python,wxpython,wxwidgets","A_Id":12056334,"CreationDate":"2012-08-21T12:37:00.000","Title":"Assigning priorities to wxPython events","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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. \nExample: 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\nHow can I do that? Thx","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3498,"Q_Id":12060442,"Users Score":0,"Answer":"have you tried using subprocess?\nyou can assign button event to subprocess to launch another py script.","Q_Score":1,"Tags":"python,wxpython","A_Id":12060487,"CreationDate":"2012-08-21T17:59:00.000","Title":"Open a py file from pressing a button on another py file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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. \nExample: 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\nHow can I do that? Thx","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3498,"Q_Id":12060442,"Users Score":0,"Answer":"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 \nuse os.system('script_name.py') < in windows\nor os.system('python script.py') < in Linux after giving it the permission","Q_Score":1,"Tags":"python,wxpython","A_Id":12060881,"CreationDate":"2012-08-21T17:59:00.000","Title":"Open a py file from pressing a button on another py file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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'","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":258,"Q_Id":12066923,"Users Score":2,"Answer":"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).\nAlso, 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.","Q_Score":0,"Tags":"python,plone","A_Id":12079431,"CreationDate":"2012-08-22T05:42:00.000","Title":"Is there an add-on to auto compress files while uploading into Plone?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"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. \nHowever, I'm having issues with this approach.\n\nIn 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.\nI don't know how to set the PyTypeObject fields dynamically because the first field is always a macro: PyObject_VAR_HEAD. \n\nHope 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.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":461,"Q_Id":12098554,"Users Score":0,"Answer":"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.\nFor 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.\nIf 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.","Q_Score":0,"Tags":"python,c,api","A_Id":12098669,"CreationDate":"2012-08-23T19:17:00.000","Title":"Static factory for PyTypeObject","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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!","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":315,"Q_Id":12105775,"Users Score":3,"Answer":"The only way to do that in C++ is to unload the DLL with the code to be\nmodified, modify the sources, invoke the compiler to regenerate the DLL,\nand reload the DLL.  It's very, very heavy weight, and it only works if\nthe compiler is present on the machines where the code is to be run.\n(Usually the case under Unix, rarely the case with Windows.)\nInterpreted languages like Python are considerably more dynamic; Python\nhas a built-in function to execute a string as Python code, for example.\nIf you need dynamically modifiable code, I'd suggest embedding Python in\nyour application, and using it for the dynamic parts.","Q_Score":2,"Tags":"c++,python,compilation","A_Id":12105989,"CreationDate":"2012-08-24T08:32:00.000","Title":"Using scripting language in C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just started to use Sublime Text 2.\nI use Sublime for python, but when I use CTRL+B it does not run my wxPython GUI app. It can run a Tkinter app.\nWhy is this? What do I need to do to run a wxPython app from Sublime?","AnswerCount":3,"Available Count":1,"Score":0.2605204458,"is_accepted":false,"ViewCount":3053,"Q_Id":12122980,"Users Score":4,"Answer":"Find the file named python.sublime-build under C:\\Users[USER NAME]\\AppData\\Roaming\\Sublime Text 2\\Packages\\Python\\\nAdd the following value \"shell\":\"true\"\nSave the file and run your How to run a wxPython GUI app in Sublime Text 2!","Q_Score":8,"Tags":"python,wxpython,sublimetext2","A_Id":21536926,"CreationDate":"2012-08-25T14:51:00.000","Title":"How to run a wxPython GUI app in Sublime Text 2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking about Python and C\/C++ combination to replace the original concept about OSGi + Java + JNI + C\/C++ in our SW architecture.\nI definitely don't need to replace all features of such OSGi frameworks as Felix or Equinox.\nWhat I really will need in my Python code:\n\nEnabler of modularity for the application layer\nComponent-based framework for applications\nCentral registry of services\/components \nVery lightweight framework, it will run on embedded devices (though pretty enough of RAM)\n\nCan you please advise on such Python framework?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":2706,"Q_Id":12163104,"Users Score":1,"Answer":"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.\nIn 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. \nLooking at your requirements I thinks Celix and Native-OSGi might be a good fit.","Q_Score":3,"Tags":"java,c++,python,osgi,modularity","A_Id":12191011,"CreationDate":"2012-08-28T15:57:00.000","Title":"Python framework as an alternative for \"Java + OSGi\" combination","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm thinking about Python and C\/C++ combination to replace the original concept about OSGi + Java + JNI + C\/C++ in our SW architecture.\nI definitely don't need to replace all features of such OSGi frameworks as Felix or Equinox.\nWhat I really will need in my Python code:\n\nEnabler of modularity for the application layer\nComponent-based framework for applications\nCentral registry of services\/components \nVery lightweight framework, it will run on embedded devices (though pretty enough of RAM)\n\nCan you please advise on such Python framework?","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":2706,"Q_Id":12163104,"Users Score":3,"Answer":"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.\nA 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.","Q_Score":3,"Tags":"java,c++,python,osgi,modularity","A_Id":12172339,"CreationDate":"2012-08-28T15:57:00.000","Title":"Python framework as an alternative for \"Java + OSGi\" combination","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I add extra data to wx.TextCtrl widgets? \nAt the moment I'm using the GetToolTipString() method to add the extra data but this is obviously wrong.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":112,"Q_Id":12167396,"Users Score":0,"Answer":"ummmm  my_text_control.SetValue(\"some value to set\")  ??\nIf you clarify your question ill clarify my answer","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":12167427,"CreationDate":"2012-08-28T20:55:00.000","Title":"How to add extra data to a wx.TextCtrl?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":236,"Q_Id":12184739,"Users Score":2,"Answer":"Solution: When creating the entry widgets in the popup, set their exportselection property to 0. Then selecting them won't affect any other selections.","Q_Score":1,"Tags":"python,tkinter","A_Id":12184877,"CreationDate":"2012-08-29T18:56:00.000","Title":"Widgets in a Tkinter popup taking Tab focus from widgets in another window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Or is there any? I would be happy to know if any.\nThank you.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":233,"Q_Id":12188758,"Users Score":1,"Answer":"ISAPI on Windows\/IIS. NSAPI is supported by a number of vendors.","Q_Score":0,"Tags":"c++,python,c,web-applications,wsgi","A_Id":12188910,"CreationDate":"2012-08-30T01:34:00.000","Title":"Why there is no any standard Gateway Interface for languages C and\/or C++ as WSGI for Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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? \nI 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.\nIf it's not possible, is there a way to make a terminal widget on wxPython in Windows?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3832,"Q_Id":12199998,"Users Score":0,"Answer":"I think, the best way is installing python and gtk3 with msys2.\nfirstly install msys2 and install python and gtk3 using msys2. search on Google \"how to install python gobject to msys2\"","Q_Score":4,"Tags":"python,windows,terminal,wxwidgets,gtk3","A_Id":46878690,"CreationDate":"2012-08-30T15:07:00.000","Title":"python + gtk3 on windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?\nI know that you can't block ctrl + alt + del, but is it possible to detect when it is pressed?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":876,"Q_Id":12210976,"Users Score":0,"Answer":"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.","Q_Score":1,"Tags":"python,windows,wxpython","A_Id":12216343,"CreationDate":"2012-08-31T07:46:00.000","Title":"Block windows key wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nIf, however, I press ctrl+shift+9, then event.unicode == u''. How do I get u'(' back from that?\n(similarly, for ctrl+shift+a, I get '\\x01')","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1924,"Q_Id":12213780,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"python,pygame","A_Id":12273411,"CreationDate":"2012-08-31T10:46:00.000","Title":"How do I turn the key combination, ctrl+shift+9, into the string \"ctrl+(\" in PyGame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nIs 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?\nAny help or suggestions are greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":294,"Q_Id":12234623,"Users Score":0,"Answer":"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.\nIf 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.","Q_Score":0,"Tags":"python,user-interface,wxpython,cross-platform","A_Id":12235213,"CreationDate":"2012-09-02T08:57:00.000","Title":"Multiple GUI Kits in a single Python app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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). \nCurrently 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.\nWhat is the fastest way to control and retrieve data from a windows application, that is feasible for a beginner in Python?\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":974,"Q_Id":12238541,"Users Score":1,"Answer":"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.\nThe 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.\nGood luck. This is a really tough problem.","Q_Score":1,"Tags":"python,pywinauto","A_Id":12282267,"CreationDate":"2012-09-02T18:19:00.000","Title":"Python: communicating with window application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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). \nCurrently 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.\nWhat is the fastest way to control and retrieve data from a windows application, that is feasible for a beginner in Python?\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":974,"Q_Id":12238541,"Users Score":1,"Answer":"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.\nOfcource some actions can take a long tome (seconds), but as a rule it is a high weith actions, such as count children, etc.\nPlease be sure you do not call findwindows method when it is not realy need.","Q_Score":1,"Tags":"python,pywinauto","A_Id":12903265,"CreationDate":"2012-09-02T18:19:00.000","Title":"Python: communicating with window application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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 '+'.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":111,"Q_Id":12243454,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"python,wxpython","A_Id":12266400,"CreationDate":"2012-09-03T07:13:00.000","Title":"wxPython adding Flag","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":180,"Q_Id":12252492,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"python,user-interface,wxpython,wxglade","A_Id":12266335,"CreationDate":"2012-09-03T18:18:00.000","Title":"wxpython horizontal listctrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.","AnswerCount":3,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":2283,"Q_Id":12254516,"Users Score":3,"Answer":"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.","Q_Score":5,"Tags":"python,pygame","A_Id":12255531,"CreationDate":"2012-09-03T22:05:00.000","Title":"Difference between pygame.draw and pygame.gfxdraw","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2283,"Q_Id":12254516,"Users Score":7,"Answer":"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.","Q_Score":5,"Tags":"python,pygame","A_Id":12273374,"CreationDate":"2012-09-03T22:05:00.000","Title":"Difference between pygame.draw and pygame.gfxdraw","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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).\nCan 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?","AnswerCount":5,"Available Count":1,"Score":-0.0798297691,"is_accepted":false,"ViewCount":23774,"Q_Id":12351786,"Users Score":-2,"Answer":"The function which normally prints to stdout should instead put the text into text widget.","Q_Score":18,"Tags":"python,tkinter","A_Id":12351926,"CreationDate":"2012-09-10T12:30:00.000","Title":"How to redirect print statements to Tkinter text widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a list of tkinter widgets that I want to change dynamically. \nHow to delete the widgets from the window?","AnswerCount":8,"Available Count":1,"Score":0.024994793,"is_accepted":false,"ViewCount":201947,"Q_Id":12364981,"Users Score":1,"Answer":"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.\nIf 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.\nIf you do not intend to reuse the widgets, you can destroy them with a straight destroy() call, like widget.destroy(), to free up resources.","Q_Score":61,"Tags":"python,tkinter","A_Id":60425005,"CreationDate":"2012-09-11T07:41:00.000","Title":"How to delete Tkinter widgets from a window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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:\n\"You can't open the application because the classic environment is no longer supported.\"\nI'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?\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":643,"Q_Id":12453675,"Users Score":1,"Answer":"To pull this back from the void.\nI 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.","Q_Score":1,"Tags":"python,numpy,tkinter,py2app","A_Id":17708863,"CreationDate":"2012-09-17T05:42:00.000","Title":"py2app\/Tkinter application error: \"classic environment is no longer supported\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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:\n\"You can't open the application because the classic environment is no longer supported.\"\nI'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?\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":643,"Q_Id":12453675,"Users Score":1,"Answer":"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.\npy2app supports command-line arguments for building executables to support different architectures, look closer at --arch parameter of py2app.","Q_Score":1,"Tags":"python,numpy,tkinter,py2app","A_Id":12457682,"CreationDate":"2012-09-17T05:42:00.000","Title":"py2app\/Tkinter application error: \"classic environment is no longer supported\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":846,"Q_Id":12462796,"Users Score":0,"Answer":"Run a VNC server on the machine; it will start an instance of Xfb, a in-memory version of an X server.","Q_Score":0,"Tags":"python,qt4,pyqt4","A_Id":12462897,"CreationDate":"2012-09-17T15:48:00.000","Title":"Running a PyQt4 script without a display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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. \nI 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.\nI 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.\nIs 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?\nI 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.\nThanks in advance for the help!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":193,"Q_Id":12468644,"Users Score":1,"Answer":"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.\nThere 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.","Q_Score":2,"Tags":"python,wxpython","A_Id":12470183,"CreationDate":"2012-09-17T23:53:00.000","Title":"wxPython app frozen during the execution","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nI 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.\nEDIT:\nIn answer to Ian Mallett\nI 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.\nAlso 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","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1710,"Q_Id":12470417,"Users Score":1,"Answer":"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)?\nIn 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:\n\nMake 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).\nDraw 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).\nIn 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.\nYou can also try doing all of the above several times with different scrolling constants to give the illusion of depth (with multiple layers).\n\n]\nIn 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.","Q_Score":2,"Tags":"python,opengl,pyglet","A_Id":12471143,"CreationDate":"2012-09-18T04:33:00.000","Title":"Scrolling starfield with gl_points in pyglet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":694,"Q_Id":12490468,"Users Score":0,"Answer":"Yes, it is possible to use a toast and a notification at the same time.\nAlthough it may be not the best user experience in my opinion. \nToast 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.\nNotification 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.\nIn 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 ?","Q_Score":0,"Tags":"android,python,sl4a","A_Id":12490713,"CreationDate":"2012-09-19T07:45:00.000","Title":"Toast, notification simultaneously in Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I recently have become interested in GUI programming in Python.\nI 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.\nHowever, 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)\nWhere can I find a nice tutorial? (That only assumes knowledge of Python, and hopefully no knowledge of Tk)","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":8495,"Q_Id":12499465,"Users Score":0,"Answer":"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.","Q_Score":6,"Tags":"python-2.7,tkinter,tix","A_Id":38350158,"CreationDate":"2012-09-19T17:00:00.000","Title":"Tix Tutorials in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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:\nbindingDictkeyCode\nWhere keyCode is stored as an integer. \nThis works, but it seems to be taking a lot of time and I am having trouble thinking of ways I could optimize.\nDoes 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).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":280,"Q_Id":12557562,"Users Score":0,"Answer":"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. \nBtw, 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.\nSo, 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)","Q_Score":0,"Tags":"python,algorithm,optimization,pygame,key-bindings","A_Id":12557972,"CreationDate":"2012-09-24T00:47:00.000","Title":"Dynamic key binding in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"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) ?\nAny help would be much appreciated!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":760,"Q_Id":12580198,"Users Score":2,"Answer":"In the end i decided to create a buffer for the pixels using: \nself.pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,0,8,1280,1024)\nI then set the image from the pixel buffer:\nself.liveImage.set_from_pixbuf(self.pixbuf)","Q_Score":2,"Tags":"python,arrays,numpy,gtk,glade","A_Id":12638921,"CreationDate":"2012-09-25T09:37:00.000","Title":"How do you display a 2D numpy array in glade-3 ?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a dialog that uses two GUI elements: KDEUI KActionSelector and QTExtEdit.\nI 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.\nUnder 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.\nIf 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;)\nI'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...\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":97,"Q_Id":12591456,"Users Score":0,"Answer":"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.\nUpon the button click I'm removing selected element from current list and add it to the list on the other side.\nClick 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.","Q_Score":1,"Tags":"python,pyqt,kde-plasma","A_Id":12647323,"CreationDate":"2012-09-25T21:40:00.000","Title":"KDEUI KAactionSelector widget additional signals (PyQt)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My app use QT for the gui layer, and many other lib I made. \nOne of this other lib is quite complex (it's a type system) and full of asserts to make it as solid as possible. \nBut when an assert is triggered in this lib, the Qt mainloop simply continue.\nI have a qt_debug() that works well (with pyqtRemoveInputHook) for the Qt part but nothing for the rest of python libraries.\nAnd, obviously I would avoid to change code in the library as it should useable without Qt.\nThe best solution would be an assert hook, but despite googling around I didn't any obvious way to do it. Any idea ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":275,"Q_Id":12605139,"Users Score":4,"Answer":"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.\nAs 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.","Q_Score":0,"Tags":"python,debugging,pyqt","A_Id":12605679,"CreationDate":"2012-09-26T15:23:00.000","Title":"How to globally overload assert so I don't have to change lib code in my PyQT app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.\nThe 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).\nIs there any way to explicitly know when a button is pressed and released but also preserve its default appearance behavior?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":76,"Q_Id":12607326,"Users Score":0,"Answer":"So I found a solution for this.\nIf 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.","Q_Score":0,"Tags":"wxpython","A_Id":12607701,"CreationDate":"2012-09-26T17:38:00.000","Title":"How to preserve the default button appearance behavior when binding EVT_LEFT_DOWN","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"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.","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1228,"Q_Id":12632323,"Users Score":0,"Answer":"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.","Q_Score":0,"Tags":"python,windows,ide,pyglet","A_Id":62126569,"CreationDate":"2012-09-28T01:17:00.000","Title":"IDE for pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"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?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1492,"Q_Id":12633100,"Users Score":5,"Answer":"Be sure to use Py2app, and make sure the .plist is filled out correctly, IE CFBundleName and CFBundleDisplayName.","Q_Score":3,"Tags":"python,wxpython,.app","A_Id":12755571,"CreationDate":"2012-09-28T03:09:00.000","Title":"Changing WxPython app Mac menu bar title?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have heard of Python's GIL problem, which states that there can only be one Python thread executing the Python bytecode at one time in a multicore machine. So a multithreaded Python program is not a good idea.\nI am wondering if I can write a C extension that uses pthread to potentially boost the performance of my program. I'd like to create a thread in my C extension and make it runs in parallel with Python's main thread.\nMy assumption is that the Python main thread will do things more related to IO, while the pthread in my C extension will spend most of its time doing computation. The Python main thread communicates with the thread in the C extension using a queue (like a producer consumer model).\nIs there any difference between multithread with Python and C extension?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1191,"Q_Id":12635762,"Users Score":1,"Answer":"The Python interpreter is not aware of C launched threads in any way, so they can happily churn their own CPU time.\nHowever I doubt this is a correct solution for your performance problems. First try using multiple processes with multiprocess module. If interprocess IO is too much after that you can result trickery like C threads. This would make your program an order of magnitude more complex so avoid it if possible.","Q_Score":7,"Tags":"python,multithreading,gil","A_Id":12636228,"CreationDate":"2012-09-28T07:45:00.000","Title":"Could a C extension for multithreaded Python boost performance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have heard of Python's GIL problem, which states that there can only be one Python thread executing the Python bytecode at one time in a multicore machine. So a multithreaded Python program is not a good idea.\nI am wondering if I can write a C extension that uses pthread to potentially boost the performance of my program. I'd like to create a thread in my C extension and make it runs in parallel with Python's main thread.\nMy assumption is that the Python main thread will do things more related to IO, while the pthread in my C extension will spend most of its time doing computation. The Python main thread communicates with the thread in the C extension using a queue (like a producer consumer model).\nIs there any difference between multithread with Python and C extension?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1191,"Q_Id":12635762,"Users Score":2,"Answer":"To answer your original question:\nYes, C extensions can be immune from the GIL, provided they do not call any Python API functions without the GIL held. So, if you need to communicate with the Python app, you'd need to acquire the GIL to do so. If you don't want to get your hands too dirty with the C API, you can use ctypes to call a C library (which can just use pthreads as usual), or Cython to write your C extension in a Python-like syntax.","Q_Score":7,"Tags":"python,multithreading,gil","A_Id":12636279,"CreationDate":"2012-09-28T07:45:00.000","Title":"Could a C extension for multithreaded Python boost performance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have heard of Python's GIL problem, which states that there can only be one Python thread executing the Python bytecode at one time in a multicore machine. So a multithreaded Python program is not a good idea.\nI am wondering if I can write a C extension that uses pthread to potentially boost the performance of my program. I'd like to create a thread in my C extension and make it runs in parallel with Python's main thread.\nMy assumption is that the Python main thread will do things more related to IO, while the pthread in my C extension will spend most of its time doing computation. The Python main thread communicates with the thread in the C extension using a queue (like a producer consumer model).\nIs there any difference between multithread with Python and C extension?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1191,"Q_Id":12635762,"Users Score":0,"Answer":"Provided one thread runs CPU bound while the other runs IO bound, I don't see a problem.\nThe IO bound thread will call IO routines which usually release the GIL while doing their stuff, effectively allowing the other thread to run.\nSo give the \"simple\" solution a try and switch only if it really doesn't work the way you want it to.","Q_Score":7,"Tags":"python,multithreading,gil","A_Id":12636431,"CreationDate":"2012-09-28T07:45:00.000","Title":"Could a C extension for multithreaded Python boost performance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am designing a Copy\/Paste Application for Windows os using Python.Now I want to a Register my application with hotkey for \"Ctrl+V\" So that when any one press \"Ctrl+V\" Paste is done through my application and not through windows default Copy\/Paste application.But I don't know how to get the list of files path which are to be copied and also the path of Target window where paste is to be done.So I want to know what actually happens when someone presses Ctrl+C key in windows explorer","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":339,"Q_Id":12659719,"Users Score":4,"Answer":"When someone presses the Ctrl+C key in Explorer, Explorer calls OleSetClipboard() with an IDataObject containing various formats, which may include CF_FILES, CFSTR_FILECONTENTS and CFSTR_SHELLIDLIST.","Q_Score":1,"Tags":"python,windows,winapi,python-2.7,pywin32","A_Id":12659846,"CreationDate":"2012-09-30T08:08:00.000","Title":"Windows:What actually happens when Ctrl+C is pressed in windows explorer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My question is about the easiness of distributing the GUI app across the platforms (Mac\/Linux\/Windows), and I want to know the one that makes the user's job easiest.\nMy current understanding is that Tkinter app is the easiest for the users (to install) because as long as the user has installed a Python in her box, my application should be ready to run on that box.\nFor GUI app written in wxPython or pyQT, the user needs to install wxWidget or QT in her box first, which is an extra step, and then install my GUI app. (But my Ubuntu box seems to have the wxWidget libraries and QT libraries installed by default, is that a norm or just Ubuntu distro is more friendly to users? I guess Windows and Mac probably does not provide them by defualt, ie. the users need to download and install them as an extra step)","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":4379,"Q_Id":12666278,"Users Score":8,"Answer":"If you're running Ubuntu, PyQt will be installed by default. Most linux distros will have one of  PyGtk or PyQt installed by default. WxPython was most likely installed in your Ubuntu box as a dependency for some other package in your system. \nIf your target market is Linux, you can just create a deb or rpm package and that'll take care of the dependencies for your application.\nFor Windows and Mac(and even Linux if you're so inclined) you could bundle the python interpreter with your application and its libraries into a native executable format such\nas .exe, .dmg or .elf using libraries like cx_freeze, py2exe and py2app. Once this is done, your user will not have to install python or any of your libraries.","Q_Score":8,"Tags":"python,user-interface,wxpython,pyqt,tkinter","A_Id":12667986,"CreationDate":"2012-10-01T00:22:00.000","Title":"Python GUI App Distribution: written in wxPython, TKinter or QT","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My question is about the easiness of distributing the GUI app across the platforms (Mac\/Linux\/Windows), and I want to know the one that makes the user's job easiest.\nMy current understanding is that Tkinter app is the easiest for the users (to install) because as long as the user has installed a Python in her box, my application should be ready to run on that box.\nFor GUI app written in wxPython or pyQT, the user needs to install wxWidget or QT in her box first, which is an extra step, and then install my GUI app. (But my Ubuntu box seems to have the wxWidget libraries and QT libraries installed by default, is that a norm or just Ubuntu distro is more friendly to users? I guess Windows and Mac probably does not provide them by defualt, ie. the users need to download and install them as an extra step)","AnswerCount":3,"Available Count":2,"Score":0.2605204458,"is_accepted":false,"ViewCount":4379,"Q_Id":12666278,"Users Score":4,"Answer":"Tkinter is the only one that's included with Python. wxPython and pyQT need both the wxWindows or QT libraries and the wxPython or pyQT libraries to be installed on the system.\nHowever, Tk does not look very nice. If you're already making the user install Python, you could just as well have them install the libraries too. (Or maybe include an installer or something.)","Q_Score":8,"Tags":"python,user-interface,wxpython,pyqt,tkinter","A_Id":12666368,"CreationDate":"2012-10-01T00:22:00.000","Title":"Python GUI App Distribution: written in wxPython, TKinter or QT","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Simple question. I'd like to use F2 or Enter for rename, and double click to open a file.\nUsing self.treeView.doubleClicked.connect(self.doubleclick) I can do things in my self.doubleClick method, but the renaming is still triggered.\nThe model is not read-only (model.setReadOnly(False)).","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":3516,"Q_Id":12670874,"Users Score":9,"Answer":"I don't know if you have this in python versions, but in C++ Qt you just set the edit triggers in the QAbstractItemView:\nvoid   setEditTriggers ( EditTriggers triggers )","Q_Score":4,"Tags":"python,pyqt,double-click,qtreeview,qfilesystemmodel","A_Id":15352784,"CreationDate":"2012-10-01T09:45:00.000","Title":"How to disable the double click file renaming behavior on QTreeView and QFileSystemModel in PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Ok, I am new to python and my code calls some library (which is  wrapping some C++ code) and I pass it a callback function on my side (as library needs to). The strange thing is that if I insert a breakpoint in my other part of the code, it will hit and deugger stops in eclipse but none of my breakpoints in the callback hit. The callback is sure called but the breakpoint is somehow ignored by PyDev. What I am doing wrong? The callback is obviously coming on a different thread. I am using Python 2.7","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":736,"Q_Id":12718216,"Users Score":1,"Answer":"Try importing pdb and just manually setting breakpoints in the code with pdb.set_trace(). This won't work in all multi-threaded cases, but I find that it works in many of them and is a big improvement over the native Eclipse\/PyDev debugger.","Q_Score":1,"Tags":"python","A_Id":12727999,"CreationDate":"2012-10-03T23:16:00.000","Title":"In Pydev setting a breakpoint, but breakpoint not hit on callbacks only","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use ironpython inside my C# App, but I am afraid that it will cause a security issue, I don't want the end user to use all the available DLLs of my App, instead I want to provide custom classes that user can use in python.\nMy question is how to secure my dlls from being used in ironpython.\nthe end user may addReference of the dll, I want to secure most of the classes from being used.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":97,"Q_Id":12721998,"Users Score":0,"Answer":"The trick is to run IronPython in its own AppDomain and only provide the assemblies you want the user to be able to call to that AppDomain, and then set the security policy to prevent them from referencing more.","Q_Score":0,"Tags":"c#,security,ironpython","A_Id":12730482,"CreationDate":"2012-10-04T07:09:00.000","Title":"Secure and protect classes or DLLs in .NET from being used in IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I see that all tutorials about the pyopengl implements pygame, is posible use PyOpengl without pygame?. and if is so, then, is most faster without pygame or not?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1388,"Q_Id":12737366,"Users Score":0,"Answer":"PyGame's only relation to PyOpenGL is that PyGame can provide a window for PyOpenGL to render on.\nYour question now is whether PyGame's windowing environment is faster than another.\nIn my experience, GLUT can be very slightly faster than PyGame for windowing (by comparing GLUT and SDL).  wxWidgets I think is a bit slower.  PyGlet isn't PyOpenGL (although it is a Python OpenGL implementation).\nMy recommendation: PyGame is easiest to use and provides helpful utilities besides.  Use it instead of anything else; any performance differences are negligible.\nWhen you need better windowing support, go for Qt or wxWidgets, in that order.","Q_Score":3,"Tags":"python-3.x,pygame,pyopengl","A_Id":12755970,"CreationDate":"2012-10-04T23:17:00.000","Title":"PyOpengl without PyGame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make a android apps using Dojo toolkit and GeoDjango. Its a project based on GPS work. Can anyone help in this issue? I want to have the staring steps? I have some source code and SDK installed in my computer. But still confused about the staring. can Anyone help?\nHow I will make it possible to create the apps. Steps plz?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":197,"Q_Id":12750731,"Users Score":0,"Answer":"I suggest to take a look at PhoneGap. I use it to embed JQuery mobile inside a Android application. PhoneGap makes it easy to embed javascript inside an Android application. Just try the PhoneGap tutorial.\nEdit: PhoneGap let u use the GPS sensor through javascript","Q_Score":1,"Tags":"android,python,django,dojo","A_Id":12750812,"CreationDate":"2012-10-05T16:53:00.000","Title":"Android apps with Dojo and geodjango","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm writing a 2D Elite-style game in Python+Pygame, and I need to move the starmap about so the player can look at the whole thing.\nThe way I've done this sort of thing before is to just add the coordinates of the 'camera' to the coordinates of everything else when drawing. However, I notice Pygame has a function to move the entirety of a surface some amount. Would this be a quicker, easier way to implement this functionality?\nThe starmap is about 100,000 pixels square, if it depends on the size of the image.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":676,"Q_Id":12767315,"Users Score":0,"Answer":"Well for starters, one huge bitmap is not really good, since it eats away resources. \nWhat I do, is divide the map into size of camera, and end up with having 9 tiles displayed at a time, moving the camera shifts the map, and draws only the ones that are seen. \nThere isn't a huge improvement though.\nYou can always try the easier approach, and if you feel that the game is too slow, you can try another.\nThere is no point of optimizing if you can't see the difference.","Q_Score":2,"Tags":"python,optimization,graphics,pygame","A_Id":12767902,"CreationDate":"2012-10-07T08:39:00.000","Title":"Is Surface.scroll() the right way to implement a movable 2D viewpoint in Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a poorly designed and big (> 300 public functions, >200 numeric constants defined with #define in the header file) that I have to wrap in Python. I have the dll and the h file. The library is updated yearly, till now in a backwards compatible way (i.e. just functions were added, a constant keep their numerical values, etc). But I have no guarantees as I do not control the library.\nUsing ctypes, I see two ways of wrapping this in Python:\n\n\nMapping every constant and function to python, 1 to 1\nRedefining the API in Python and making calls to the library.\n\n\nThe first can be done in a (roughly) automatic way from the header file and therefore is easier to maintain and upgrade, the second requires a lot of python code but it will be easier to use.\nI would appreciate some opinions based on your experience with this type of problem and some examples.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":249,"Q_Id":12770077,"Users Score":0,"Answer":"Maintaining a Python library with a ctypes backend isn't an unmanageable approach. Obviously the initial investment is larger than using automated tools, but the API you are left with should be much better.\nIf you do take that route, aim to separate the Python API entirely from the C library though. Supporting multiple ctypes backends with one Python front end api isn't too bad - just query at runtime and dynamically load the correct ctypes wrapper module. I've done that to wrap different dll files and .so files for windows and linux but it would work for versions of a library as well.","Q_Score":7,"Tags":"python,dll,wrapper,ctypes","A_Id":12996919,"CreationDate":"2012-10-07T15:21:00.000","Title":"Maintainability of a python wrapping of a C library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I recently discovered how easy and convenient using wxPython is for writing GUI applications. Unfortunately installing wxPython is a giant throbbing pain in the neck. I consider myself pretty tech-savvy but it took me almost an hour to get a working setup of wxPython on a Pythonbrew install on an Ubuntu machine. On my OSX machine at home I still haven't figured it out.\nSo my question is; is it possible, somehow, to install a portable version of wxPython and place it in my project directory where it will work on all platforms, saving users the pain of having to manually install it to run my application? If yes, how would I go about it?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":298,"Q_Id":12788394,"Users Score":1,"Answer":"wx has to be compiled for each target plattform. Binaries are always OS dependent, so no, there cannot be a portable wx version.","Q_Score":1,"Tags":"python,wxpython","A_Id":12788472,"CreationDate":"2012-10-08T19:44:00.000","Title":"Can I embed wxPython in my project, saving users the trouble of installing it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to disable the editing of specific cells by the user when using ListCtrl with TextEditMixin?\nI guess there's some way that Vetos the editing event, however I can't find it.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":2303,"Q_Id":12806542,"Users Score":1,"Answer":"As I recall, you have to bind to EVT_LIST_BEGIN_LABEL_EDIT. Then in your event handler you just check what column you're in and if you're in a column that you want to be editable, then you do \"event.Allow()\", otherwise you veto.","Q_Score":7,"Tags":"python,listview,wxpython","A_Id":12807804,"CreationDate":"2012-10-09T18:53:00.000","Title":"wx.ListCtrl with TextEditMixin - Disable Editing of Selected Cells","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to disable the editing of specific cells by the user when using ListCtrl with TextEditMixin?\nI guess there's some way that Vetos the editing event, however I can't find it.","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":2303,"Q_Id":12806542,"Users Score":2,"Answer":"In wxPython version 4.0.0 the line:\nif event.m_col == 1 \ndoes not work. Use\nif event.GetColumn() == 1\ninstead.","Q_Score":7,"Tags":"python,listview,wxpython","A_Id":45455459,"CreationDate":"2012-10-09T18:53:00.000","Title":"wx.ListCtrl with TextEditMixin - Disable Editing of Selected Cells","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using GtkMenuToolButton and it has a button and a menu. When you click on the arrow the menu is opened. I'd like to make the button open that same menu as well. Simply emitting \"show-menu\" in the \"clicked\" callback did not work. Please help how to make this work.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":213,"Q_Id":12818397,"Users Score":1,"Answer":"I have currently ended up doing this:\n\nInstead of GtkMenuToolButton I have GtkToolItem with custom content\nIn custom content I have GtkMenuButton\nInside that one, I delete the default GtkArrow and replace it with 1x2 GtkGrid which has a Label + GtkArrow\n\nAs a whole it does what I want =)","Q_Score":1,"Tags":"python,gtk","A_Id":12827853,"CreationDate":"2012-10-10T11:35:00.000","Title":"How to make GtkMenuToolButton open the same menu when 'clicked' signal is emitted?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having some issues making 'bigger than simple scripts and stuff' applications in Python. I have a class called WinMain, a class called Engine, one called State and another called Element. It's laid out like this:\nWinMain is the main class of the program, it has a mainLoop function and various other things. \nEngine is an object that contains data like images and rendering code. \nState is an object held by Engine that has its update method called each time Engine's step function is called. \nElements are objects held by State that are things like gui buttons and pictures to render. \nSince my rendering functions are in Engine, how will I get my Elements (held by state) to render things? I suppose I could give each Element the instance of Engine, but that seems to be kind of hacky, because I'd have to do stuff like this: \npicture = Element(engine, (0, 0), 'gui_image') (not good) \nI'd rather do picture = Element((0, 0), 'gui_image') and still some how let the Element render things using Engine.\nThis seems to be a major structural problem I have with most projects I start, and I can't seem to find a way around it (other than passing a honkload of variables through the arguments of classes and functions). How might I do this?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":467,"Q_Id":12848684,"Users Score":4,"Answer":"Engine is an object that contains data like images and rendering code\n\nThis sounds like a God class: they're common in GUI code, and the problem you're having is a common effect of that. \nWhat is the conceptual relationship between different stuff in Engine? Does it need to be tightly coupled, or could the Engine just coordinate between the State, a Renderer and some other stuff?\nHowever that bit breaks down, passing the Engine (or Renderer, or whatever) down through the state machine is the only way to avoid a global (or singleton) with your current architecture.\n\nThe usual way to break this dependency is to use something like an MVC (Model\/View\/Controller) pattern. Specifically, it sounds like the Engine is already roughly a Controller, and the State and Elements have the Model part covered. However, the Engine, State and Elements are also handling the rendering\/presentation part: this introduces the coupling.\nIf you can find a way to publish the State changes to some observer (deliberately leaving that vague, because we don't want the State logic to depend too much on the details of the observer), you can make a Renderer listen to State (model) updates and draw them. Now, the observer can be anything you want, so it's easy to mock, and it's also decoupled from the Engine.","Q_Score":3,"Tags":"python,oop,structure","A_Id":12849650,"CreationDate":"2012-10-11T21:19:00.000","Title":"Python structural issue: Giving an 'engine' class to everything","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a simple read\/write application for a fairly simple USB device, but it's turning out to be not so simple at all.\nI'm using WinUSB and SetupAPI DLLs and working from scratch since I can't seem to find anything that actually works for what I need. PyWinUSB and PyUSB and so on and so forth came close, but when I tried actually writing to the device with them they failed.\nAnyway, right now I'm still at about ground zero. Following the instructions, I'm calling the SetupDiGetClassDevsExW function from the SetupAPI.dll. The function executes correctly as indicated by a call to the kernel32.lasterror function returning zero, but the only thing I'm getting back from the call is an integer value. Is that correct? Is this even the correct function? (There are 4 that are similar, and there is no just plain SetupDiGetClassDevs function. The 4 functions are SetupGetClassDevsExW, SetupGetCLassDevsExA, SetupGetClassDevsA, and SetupGetClassDevsW.) Do I need to create a class to work with this? I ask because calling the next function, SetupDiEnumDeviceInterfaces, has only been returning a fail with code 259, which means ERROR_NO_MORE_ITEMS according to a quick google search.\nI've made some headway in that someone has showed me the correct class structure method for creating a structure for holding some information, but being that I've never actually worked with programming for a USB device before, let alone in Python, I'm still kind of stuck. I'll provide any more information that is needed for an answer, but right now I don't want to bog this Q\/A down with needless information.\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1154,"Q_Id":12852084,"Users Score":0,"Answer":"There is a SetupDiGetClassDevsA and SetupDiGetClassDevsW.  The Ex versions allow connecting to a remote machine.  The A version takes a byte string for the second parameter, while the W version takes a Unicode string.  The return value is a handle to a device information set.\nThe device information set has to be iterated with either SetupDiEnumDeviceInfo or SetupDiEnumDeviceInterfaces.  The second function only works if you pass DIGCF_DEVICEINTERFACE as a flag to SetupDiGetClassDevs and pass an interface GUID for the ClassGuid parameter; otherwise, you pass a device class GUID and only SetupDiEnumDeviceInfo will return anything.","Q_Score":0,"Tags":"python-2.7,ctypes,windows-7-x64,setupapi,pywinusb","A_Id":12862740,"CreationDate":"2012-10-12T04:06:00.000","Title":"Calling SetupDiGetClassDevs from Python only returns an integer value","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for a framework to write a GUI in python, the GUI will also include 3D graphics. I would like the development time to be really short, and the framework easy to get started with.\nWhat do you recommend?\nI'm considering PyQt but it doesn't seems to have good 3D support.\nAnother alternative would be a browser GUI, with WebGL, and have python on the backend. I think this will be really slow because I'm working with a lot of big photos.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1682,"Q_Id":12853267,"Users Score":1,"Answer":"In our company we have been working with the combination, Python, PyQt and OpenGL. It has not been super easy to integrate, but it was the best solution we found around 4 years ago.","Q_Score":0,"Tags":"python,user-interface,3d","A_Id":12854078,"CreationDate":"2012-10-12T06:13:00.000","Title":"3D & GUI for python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a Tkinter App which does some long running operation. In order to prevent Tkinter window from hanging, i am introducing threading :- one thread for performing long running operation, second thread will be for updating GUI based on the QUEUE which will be filled by long running operation. Now I am thinking of running Tkinter mainloop in a separate thread instead of main thread, reason being is I want to update the state of GUI (Configure some buttons), only once the long running thread is complete. If I run the Tkinter mainloop in main thread, it won't wait for long running thread to complete and will update the GUI before it. So is it safe if i run Tkinter main loop in separate thread and in main loop wait for long running thread to complete before other updates? Any other ideas for this problem?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":688,"Q_Id":12861495,"Users Score":1,"Answer":"It is my understanding that tk needs to be run in the main thread.","Q_Score":0,"Tags":"python,tkinter","A_Id":12863076,"CreationDate":"2012-10-12T14:43:00.000","Title":"Python Tkinter in thread or in main app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am attempting to teach myself python and have hit a rough spot once it has come to recursion. I have done the classic recursive functions (factorial, fibonacci numbers...) but I am going back over old code and trying to convert most of my iterative functions to recursive functions for practice.\nThis is the wall that I have hit:\nI made a dungeon crawler a while back and I am trying to replace a for loop I used to reveal the squares near my sprite. So when the sprite is placed, he\/she sees the tile he\/she is on as well as the adjacent and diagonal squares (9 in total including the one the avatar is on).The other tiles making up the room are hidden. This I deemed view radius 1. For view radius 2, I wanted the char to see radius 1 squares plus all the tiles adjacent to those tiles. At the time I could not figure out how to do it with a for loop so I just implemented a simpler scheme.\nI feel this visibility function could be written recursively but I am having a hard time coming up with a base case and what my recursive step would be. My for loop just took avatar pos and iterated over a range to avatar pos + radius and I did that for the x,y coordinates.\nAs far as translating this over to a recursive function I am really confused. I have done many searches trying to get a lead but only come up with complicated subjects such as: FOV using recursive shadowcasting which is way beyond me.\nAny help would be greatly appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":241,"Q_Id":12867465,"Users Score":1,"Answer":"I find it helps a LOT to express recursions in words. What the algorithm says is basically \"what's visible at radius N is what's visible from radius N-1\". Like, uh, the edge gets bigger.","Q_Score":0,"Tags":"python,recursion","A_Id":12869565,"CreationDate":"2012-10-12T21:38:00.000","Title":"Recursive Function To Help Clear Tiles (Field Of View)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know FUSE has bindings for C, C++, Python etc. Which effectively means that I can develop FUSE filesystems using those languages.\nI wish to use Cython, as it offers much faster speeds as compared to pure Python. That is stressed in a filesystem. Is it possible to produce a FUSE filesystem by coding in Cython?\nAs far as I understand, Python documentation is all that I require to write Cython code for FUSE. But (if it is indeed possible) should I be using Cython as a Python FUSE system or C system??","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":173,"Q_Id":12875660,"Users Score":0,"Answer":"You should use it as a Python Fuse System, then you can write your cython stuff in it's own module and just import that module in your python code. Usually file system related operations are IO bound and not CPU bound so I'm not sure how much of a speedup you would get with cython, but I guess try out and compare the results.","Q_Score":0,"Tags":"python,c,cython,fuse","A_Id":12875850,"CreationDate":"2012-10-13T18:18:00.000","Title":"can I use FUSE with Cython bindings","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"Is it possible to control the position of elements in a wx.MenuBar()? I can't find it in the docs, but it seems like it should be an option. By default, menu elements, like file, view, edit, etc.. are at the left most position, and then each additional element extends to the right. I have a very simple gui, and thus only have one menu element called help. I'd like to position it RIGHT, instead of the default LEFT.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":231,"Q_Id":12878695,"Users Score":2,"Answer":"Really you have methods to place menu to position that you want:\n\nAppend(menu, title)\n\nAdd menu to the end of MenuBar (i.e. place it as most right element). title is a title of a new menu. If succed returns True, otherwise - False.\n\nInsert(pos, menu, title)\n\nInsert menu in pos position (after that GetMenu(pos)==menu will be True). All menu in position after that will be shifted right. pos=0 is firts (left) position. if pos=GetMenuCount(), the result will be like by using Append(). title is a title of a new menu. If succed returns True, otherwise - False.\n\nRemove(pos)\n\nRemove menu from position pos, all menu in position after that are shifted to the left. Returns deleted menu.\n\nReplace(pos, menu, title)\n\nReplace menu in position pos and don't affect to other menus in MenuBar. Returns menu that was in that position.\nSorry for my English)","Q_Score":0,"Tags":"python,wxpython","A_Id":12884118,"CreationDate":"2012-10-14T02:02:00.000","Title":"Is there a position the menu elements of a wx MenuBar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote my program to spawn a process of the main application. When I run the pyinstaller packaged exe it says no Module name pygame.base. But if I keep the app in the main thread it doesn't do that. \nI need the process to detect closure, because GLUT doesn't have an event for the upper right hand exit button and I can't remove it unless I use full-screen. The program's threads hang and the app never closes. So the main thread checks to see if the process is running. If not, it closes the entire application. But all closure will hang if I only use the main thread.\nI can soft exit from in-game events just fine. But I need a way to catch the X button. OR fix pyinstaller.\nI've looked up a bunch of things getting pyinstaller to include everything. I used the OneDir option so I can see the files. I copied all dependencies from one that worked to the one that didn't without replacing the exe. It still had the import error.\nAny insight would be nice. For now the X button is a hazard. I'm guessing multiprocessing doesn't work with pyinstaller all too well.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":751,"Q_Id":12880380,"Users Score":0,"Answer":"The [x] button fires for me, when event.type == pygame.QUIT on windows.","Q_Score":2,"Tags":"python,opengl,multiprocessing,pygame,pyinstaller","A_Id":12885990,"CreationDate":"2012-10-14T08:05:00.000","Title":"No Module name pygame.base","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm considering creating a wxPython application that I'll deploy for Windows and OSX. I want to include Flash objects like YouTube embeds and Twitch.tv embeds in the application. Is that possible? Are there any resources out there that addresses the issue?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":146,"Q_Id":12892263,"Users Score":1,"Answer":"You can try the WebView widget that was mentioned or download the separate webkit port and try that (search the wxPython mailing list for a link to that). Otherwise, the only truly supported wxPython widget that does this is \"ActiveX_FlashWindow\" and I'm pretty sure that's Windows-only.","Q_Score":0,"Tags":"python,flash,wxpython","A_Id":12896608,"CreationDate":"2012-10-15T08:59:00.000","Title":"Can I create a cross-platform wxPython application that uses Flash embeds?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i'm using IronPython and i want to create some windows form, \ni want to create a windows form with some button, and i want to do this in visual studio with iron python,\ni'm using visual studio 2012 integrated edition,\neach time i create an \"ironpython windows form\" project, when i want to run it, it says:\n\nThe project is currently set to use the .NET debugger for IronPython\n  debugging but the project is configured to start with a CPython\n  interpreter. To fix this change the debugger type in project\n  properties->Debug->Launch mode\n\nwhen i change debugger to Standard Python Launcher, it says:\n\nImportError: No module named clr\n\nwhat should i do?","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":4656,"Q_Id":12906249,"Users Score":6,"Answer":"I got the same error and resolved it with these steps:\nI changed the project properties\nGeneral>Interpreter to IronPython 2.7\nDebug>Launch mode to IronPython(.NET) launcher\nAt first I didn't see IronPython as an interpreter option to select from. I added the path to IronPython installation to my Path System variable, restarted Visual Studio and it worked.","Q_Score":5,"Tags":"python,clr,visual-studio-2012,ironpython","A_Id":13183325,"CreationDate":"2012-10-16T01:15:00.000","Title":"Cpython interpretter \/ IronPython interpretter No module named clr","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a simple piano keyboard for my programming class. I've made it in pygame because it's nice and simple to use. I've managed to get it working by making a mouse rect and individual rects for each note on the piano and having the note play by linking it to a mousebuttondown event. So it's working pretty good but I'll be demonstrating it on a smartboard and I was wondering if I could make it multiplayer. The problem is I can't work out a way that two people can play at the same time because obviously there's only one mouse (which is detected by the player tapping on screen) and therefore one mouse.get_pos() for the rect collision detection. If anyone can suggest a work around that'd be cool!\nThanks for the help\n-Laura","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":880,"Q_Id":12939379,"Users Score":1,"Answer":"The MOUSEBUTTONDOWN event has two attributes:\n\npos\nbutton\n\nIf you use event.pos instead of mouse.get_pos() you should be able to pick up the coordinates where the click occurred even if you have more than one mouse.","Q_Score":0,"Tags":"python,mouse,pygame","A_Id":12940103,"CreationDate":"2012-10-17T16:53:00.000","Title":"Multiple mouse position","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating CFUNCTYPE objects in my script and passing them as callbacks to c.\nIf I make them local they are destroyed immediately and I am getting access violaton errors\nTried to gc.disable(), it doesnt help.\nToday Im making global lists and putting\/removing FUNCTYPE objects when needed.\nIs there better solution?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":265,"Q_Id":12995925,"Users Score":1,"Answer":"The easiest way is to attach the CFUNCTYPE objects to a module or class. I've found it useful to have a Python wrapper module - in essence a separate file that keeps everything at the ctypes level in one namespace. \nYou could add and remove your callbacks from there as necessary.","Q_Score":1,"Tags":"python,ctypes","A_Id":12996825,"CreationDate":"2012-10-21T07:40:00.000","Title":"How to prevent FUNCTYPE from being collected","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the class-name in which I should use to style a TreeView's rows?\nI've tried GtkCellRendererText, but it doesn't work.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":467,"Q_Id":13036605,"Users Score":0,"Answer":"Silly me, just use GtkTreeView:Hover or GtkTreeView:Selected","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":13037240,"CreationDate":"2012-10-23T18:12:00.000","Title":"Styling TreeView's row using CSS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to get a wxPython app working as an exe. I've heard that PyInstaller is now superior to py2exe. I'd like to include my .ico and two .png files that the script requires to run. What would the spec file for this look like? I can't seem to find a decent example anywhere. I have PyInstaller installed, but I can't find this \"makespec\" anywhere.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":2693,"Q_Id":13059316,"Users Score":1,"Answer":"Checking for sys.frozen is a really good approach.  You can also look into img2py which will let you load the binary data for images into a .py file.  Later, instead of having to open files, they can be imported.","Q_Score":2,"Tags":"python,wxpython,exe,pyinstaller","A_Id":13059522,"CreationDate":"2012-10-24T23:18:00.000","Title":"wxPython to exe with PyInstaller?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm coding a game where the viewport follows the player's ship in a finite game world, and I am trying to make it so that the background \"wraps\" around in all directions (you could think of it as a 2D surface wrapped around a sphere - no matter what direction you travel in, you will end up back where you started).\nI have no trouble getting the ship and objects to wrap, but the background doesn't show up until the viewport itself passes an edge of the gameworld. Is it possible to make the background surface \"wrap\" around?\nI'm sorry if I'm not being very articulate. It seems like a simple problem and tons of games do it, but I haven't had any luck finding an answer. I have some idea about how to do it by tiling the background, but it would be nice if I could just tell the surface to wrap.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1379,"Q_Id":13059891,"Users Score":0,"Answer":"I don't think so, I have an idea though. I'm guessing your background wraps horizontally and always to the right, then you could attach part of the beginning to the end of the background.\nExample, if you have a 10,000px background and your viewport is 1000px, attach the first 1000px to the end of the background, so you'll have a 11,000px background. Then when the vieport reaches the end of the background, you just move it to the 0px position and continue moving right.","Q_Score":2,"Tags":"python,scroll,pygame,geometry-surface","A_Id":13068085,"CreationDate":"2012-10-25T00:26:00.000","Title":"Wrapping a pygame surface around a viewport","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm coding a game where the viewport follows the player's ship in a finite game world, and I am trying to make it so that the background \"wraps\" around in all directions (you could think of it as a 2D surface wrapped around a sphere - no matter what direction you travel in, you will end up back where you started).\nI have no trouble getting the ship and objects to wrap, but the background doesn't show up until the viewport itself passes an edge of the gameworld. Is it possible to make the background surface \"wrap\" around?\nI'm sorry if I'm not being very articulate. It seems like a simple problem and tons of games do it, but I haven't had any luck finding an answer. I have some idea about how to do it by tiling the background, but it would be nice if I could just tell the surface to wrap.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1379,"Q_Id":13059891,"Users Score":0,"Answer":"I was monkeying around with something similar to what you described that may be of use. I decided to try using a single map class which contained all of my Tiles, and I wanted only part of it loaded into memory at once so I broke it up into Sectors (32x32 tiles). I limited it to only having 3x3 Sectors loaded at once. As my map scrolled to an edge, it would unload the Sectors on the other side and load in new ones.\nMy Map class would have a Rect of all loaded Sectors, and my camera would have a Rect of where it was located. Each tick I would use those two Rects to find what part of the Map I should blit, and if I should load in new Sectors. Once you start to change what Sectors are loaded, you have to shift \nEach sector had the following attributes:\n 1. Its Coordinate, with (0, 0) being the topleft most possible Sector in the world.\n 2. Its Relative Sector Coordinate, with (0, 0) being the topleft most loaded sector, and (2,2) the bottom right most if 3x3 were loaded.\n 3. A Rect that held the area of the Sector\n 4. A bool to indicate of the Sector was fully loaded\nEach game tick would check if the bool to see if Sector was fully loaded, and if not, call next on a generator that would blit X tiles onto the Map surface. I\n\nThe entire Surface \nEach update would unload, load, or update and existing Sector\nWhen an existing Sector was updated, it would shift \n\nIt would unload Sectors on update, and then create the new ones required. After being created, each Sector would start a generator that would blit X amount of tiles per update","Q_Score":2,"Tags":"python,scroll,pygame,geometry-surface","A_Id":13096965,"CreationDate":"2012-10-25T00:26:00.000","Title":"Wrapping a pygame surface around a viewport","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm coding a game where the viewport follows the player's ship in a finite game world, and I am trying to make it so that the background \"wraps\" around in all directions (you could think of it as a 2D surface wrapped around a sphere - no matter what direction you travel in, you will end up back where you started).\nI have no trouble getting the ship and objects to wrap, but the background doesn't show up until the viewport itself passes an edge of the gameworld. Is it possible to make the background surface \"wrap\" around?\nI'm sorry if I'm not being very articulate. It seems like a simple problem and tons of games do it, but I haven't had any luck finding an answer. I have some idea about how to do it by tiling the background, but it would be nice if I could just tell the surface to wrap.","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1379,"Q_Id":13059891,"Users Score":0,"Answer":"Thanks everyone for the suggestions. I ended up doing something a little different from the answers provided. Essentially, I made subsurfaces of the main surface and used them as buffers, displaying them as appropriate whenever the viewport included coordinates outside the world. Because the scrolling is omnidirectional, I needed to use 8 buffers, one for each side and all four corners. My solution may not be the most elegant, but it seems to work well, with no noticeable performance drop.","Q_Score":2,"Tags":"python,scroll,pygame,geometry-surface","A_Id":13131429,"CreationDate":"2012-10-25T00:26:00.000","Title":"Wrapping a pygame surface around a viewport","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My question is not specific to Python\/PyQt4 but it's the language and api I'm currently using. I want to know if there is a library to automatically generate GUI forms from public parameters of an object. It would be very useful for automatic settings generation.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":70,"Q_Id":13090222,"Users Score":0,"Answer":"There is no need for searching fully suited library. Also, i think, it is unnecessary and waste of time. There are lots of frustrating issue, such as localization settings, number format settings, validation issue etc.\nI recommend, use Qt designer form layout to create quickly a form. \nThen use pyqt4\/QValidation and u can use some regular expression(python new regex module better than QRegExp).\nAt the and of, manage custom objects via jsonpickle or just python pickle.","Q_Score":1,"Tags":"python,user-interface,pyqt4","A_Id":14197531,"CreationDate":"2012-10-26T15:51:00.000","Title":"Best practice to generate the settings view of an UI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I current am making a GUI using tk, I have implemented a ttk notebook to have two separate tabs, each of these tabs hold data but call the same functions to interact with this data, is that a sane way to do this? Or should I just make more functions to call them separately? They need to know which tab is currently selected.\nThanks.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1005,"Q_Id":13090227,"Users Score":1,"Answer":"okay, this might not be the best way, but for each widget in the tabs, pass through a variable in the functions which will then be used in an if statement to check which tab is currently selected, as you're only using two this could be Boolean? if more is needed more complex step will be needed, but that is a simple way to do this, but not pretty :p\nxx","Q_Score":4,"Tags":"python,user-interface,tkinter,ttk","A_Id":13090292,"CreationDate":"2012-10-26T15:52:00.000","Title":"Two tabs using ttk notebook, but separate functions for the two?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on an astronomy project, making one of those gravity simulator programs. I have a Uni class, which represents a universe filled with celestial bodies (instances of the Body class).\nThis Uni class is capable of updating itself, adding new bodies, and removing bodies by their id. It's completely math-based, and should work alone.\nAround it, I'm planning to build the program that uses PyGame to optionally display the simulation in real time and MatPlotLib to analyze the results. However, I am a bit confused over how to keep my computation (Uni) and rendering (Renderer) decoupled!\nI envisioned it like this:\nThe main program:\n\nImports PyGame, initializes it, and creates a screen.\nInstantiates a universe, fills it with bodies, etc (actually done by a FileManager, which reads JSON specs for a uni).\nCreates a Renderer\nEnters a while run: loop:\n\nuni.update(dt)\n#Listen to PyGame events, respond\nr.render(screen, uni, ui) #The UI class has a list of UI elements.\n\n\nHowever, the renderer needs to keep a persistent list of PyGame surfaces and images that need to be drawn, and there's the problem. Neither the Uni nor Body instances must be aware of PyGame, so they can't keep those themselves.\nThe renderer, on the other hand, is only there for its render method, which can't just create and destroy PyGame surfaces as needed (I guess that would be performance-heavy).\n\nOne possible solution would be to have the renderer have a dictionary of PyGame objects, all identified by body ids. Then, it would iterate over it, remove any gone bodies, and add any new ones each frame.\nIs this the right way to go?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":396,"Q_Id":13099963,"Users Score":1,"Answer":"Instead of body ID's why not add the Bodys themselves to the dictionary of pygame objects instead of an ID? After all, a Python variable is just a label, so the renderer wouldn't need to know about what the variable represents. And it might save you having to look-up IDs.\nA related option is to add one or multiple viewport objects to your universe. Because no matter what the implementation of the viewing mechanism, you typically don't want to show the whole universe, so a viewport would be a proper attribute of the universe. With that viewport would go a couple of methods (except from creating and sizing). First a method to get all Bodys in the viewport (that could just return a list you'd keep in the viewport object). Second a method to get a tuple containing two lists; one of Bodys that have appeared in the viewport, and second a list of Bodys that gone out of the viewport since the last update. The viewport should also have an update method that is called by the universe's update method.","Q_Score":1,"Tags":"python,oop,class,decoupling,astronomy","A_Id":13100096,"CreationDate":"2012-10-27T11:56:00.000","Title":"How to properly decouple computation from rendering","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Widget that is huge (80,000 px long maybe? 800 elements at 100px each) because it lays out many smaller widgets. I've put the huge widget into a QScrollArea. But the scroll area still renders the entire widget. This causes manipulation of the widget to be choppy, and I want things to be smoother.\nInstead I want the QScrollAea to be intelligent enough to only render the elements that I know will be displayed. (The elements are ordered and are all the same fixed size, so this computation should be fast)\nWhat's the best approach to go about this? Should QScrollArea already be doing this?\nDoes QListView already implement this functionality? (But I want my own custom widget in there it has buttons that interact with the user, QListWiget doesn't cut it.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":194,"Q_Id":13101486,"Users Score":1,"Answer":"Have you considered using a QGraphicsView?  This allows scrolling in addition to efficient rendering of only the visible objects (and plenty of other benefits such as hit testing).","Q_Score":0,"Tags":"python,pyqt","A_Id":13101822,"CreationDate":"2012-10-27T15:25:00.000","Title":"How can I limit the rendering done by QScrollArea?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying for over a week now to make a .exe of a wxPython script. I still have a number of questions, and the process of creating an exe is still quite unclear.\n\nWhich utility should be used? I've heard to use py2exe, pyinstaller, gui2exe, some combination of gui2exe and some shady .bat file, etc. Which is best for a wxPython app?\nWhat's the deal with .dlls? What do they do, do I need to \"bundle\" them, and why wouldn't they be on the user's computer?\nCan you bundle things into the .exe, or do they need to be in the directory the .exe is in?\n\nThese things have not been made particularly clear, as I've been trying to find out exactly how to make my program into an exe for a while.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2794,"Q_Id":13111899,"Users Score":1,"Answer":"I use pyinstaller as it is very easy to use and the applications run without any problems\nSome Windows DDLs are needed for the included Python Compiler and for the maybe win32    api calls\nWith Pyinstaller you can bundle everything needed (except config files and dbs of course) using the -F flag.","Q_Score":0,"Tags":"python,wxpython,exe","A_Id":13111965,"CreationDate":"2012-10-28T18:50:00.000","Title":"Creating wxPython GUI .exe?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I cannot get emacs to evaluate my buffer. I put it into python mode and started the interpreter but C-c C-c does not seem to do anything. I also tried C-c C-l to load the file but after selecting the file nothing happens. Typing directly into the python shell does work.\nI tried it out in linux and everything worked fine so I know I am using the correct commands and there is no problem with my code.\nI am running GNU Emacs 24.2.1 and Python 3.3 on Windows 7. I am new to emacs and I like it so far, but unless I can get the shell working I will need to switch to a different editor.\nUpdate: I am trying to run an application developed with the Pyglet library which creates its own window to display graphics in.\nUpdate #2: So if I try to evaluate the buffer and then go to the python buffer and stop compilation and then evaluate it again then it works. This is obviously not ideal.\nAlso maybe related, any errors or exceptions will not show up in the shell unless I go into the shell and hit enter.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":201,"Q_Id":13112473,"Users Score":0,"Answer":"here output arrives in a buffer *Python*, which is not displayed by default unfortunately. M-x list-buffers should mention it.","Q_Score":1,"Tags":"python,windows,windows-7,emacs,python-3.3","A_Id":13112953,"CreationDate":"2012-10-28T20:00:00.000","Title":"Python Pyglet application not working in Windows Emacs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am just getting started with pymunk, and I have a problem that I wasn't able to find a solution to in the documentation.\nI have a character body that changes shape during a specific animation.  I know how to attach shapes to a physics body, but how do I change them?  Specifically, I need to change the box to a smaller one temporarily.\nIs that possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":898,"Q_Id":13127381,"Users Score":1,"Answer":"There are a couple of unsafe methods to modify a shape. Right now (v3.0) pymunk only supports updates of the Circle shape and the Segment shapes. However, I just committed a method to update the Poly shape as well, available in latest trunk of pymunk. \nIf you dont want to run latest trunk I suggest you instead just replace the shape instead of modifying it. The end result will be the same anyway.\n(The reason why modification of shapes is discouraged is that its very hard to do a good simulation, the resize happen magically in one instant. For example, how should a collision between of a small object that after a resize would lie inside a large object be resolved?)","Q_Score":1,"Tags":"python,chipmunk,pymunk","A_Id":13130409,"CreationDate":"2012-10-29T18:16:00.000","Title":"Changing the shape of a pymunk\/Chipmunk physics body","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have looked at similar questions that may answer my question but I am still very unclear on how to go about the following:\nI can create programs to run in the Python Shell in Idle and I can also set up windows with widgets in Tkinter, but whatever I create in Tkinter is pointless because I cannot figure out how to take my Python Shell code and \"wrap\" it in the Tkinter GUI.  \nI have assumed that it cannot be done, and that entirely new code must be written to assist the language that is specific to Tkinter. I am very confused on how to create a well-rounded program without being left with just a GUI \"skeleton\" with random buttons, labels, entries, etc. and a Python program that is very unappealing and can only run in the ugly little Shell.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1228,"Q_Id":13128466,"Users Score":0,"Answer":"What you create with Tkinter is not pointless. It sounds to me like you're trying to compile a stand-alone program in Python, using the Tkinter library to provide the GUI. Once you have a script working, you can use a program to compile into a standalone program. Look into using py2app on a mac, or py2exe on Windows. Google them and see if that's what you're looking for.","Q_Score":0,"Tags":"python,tkinter","A_Id":13129010,"CreationDate":"2012-10-29T19:41:00.000","Title":"Porting a Python Shell Program to a Tkinter GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to use android.py module without installing SL4A?\nI mean I have Python running on android successfully from Terminal Emulator.\nCan I use that module without installing that layer (or if I can't install it anymore)?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1256,"Q_Id":13137341,"Users Score":2,"Answer":"No, because the SL4A package provides the facade to make device API calls, acting as a middleman. Without it you might be able to import it, but you could not be able to make any API calls.","Q_Score":2,"Tags":"android,python,sl4a,android-scripting","A_Id":13215655,"CreationDate":"2012-10-30T10:46:00.000","Title":"Using Python android.py module without SL4A","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When trying to install Shapely on my Windows 64bit computer, I cannot get the GEOS library to work. \nSo far, I have run the OSGeo4W installer from which I installed GDAL (I believe the geos library is included in that package). After that, I checked and I have geos_c.dll on my C:\\OSGeo4W\\bin directory, but either I have missed some configuration steps or the library does not work.\nI need Shapely to work, so I also ran pip install shapely after  installing GDAL, and it apparently worked (although it could not find the C library for GEOS). \nIn my code, I can import Shapely, but when I try to use it, I get an error telling me \"geos.dll\" is not found.\nAny help with this will be very appreciated. Thanks!","AnswerCount":6,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":49925,"Q_Id":13144158,"Users Score":2,"Answer":"I tried the method of @jozef but failed even I imported the folder to the path.\nA straightforward solution: add geos_c.dll, geos.dll to the library folder of your python environment. Then it works.","Q_Score":23,"Tags":"python,gis,geospatial,shapely","A_Id":63239049,"CreationDate":"2012-10-30T17:05:00.000","Title":"Python, GEOS and Shapely on Windows 64","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When trying to install Shapely on my Windows 64bit computer, I cannot get the GEOS library to work. \nSo far, I have run the OSGeo4W installer from which I installed GDAL (I believe the geos library is included in that package). After that, I checked and I have geos_c.dll on my C:\\OSGeo4W\\bin directory, but either I have missed some configuration steps or the library does not work.\nI need Shapely to work, so I also ran pip install shapely after  installing GDAL, and it apparently worked (although it could not find the C library for GEOS). \nIn my code, I can import Shapely, but when I try to use it, I get an error telling me \"geos.dll\" is not found.\nAny help with this will be very appreciated. Thanks!","AnswerCount":6,"Available Count":2,"Score":0.0333209931,"is_accepted":false,"ViewCount":49925,"Q_Id":13144158,"Users Score":1,"Answer":"I used the command below and it did work;\npip install Shapely==1.3.0","Q_Score":23,"Tags":"python,gis,geospatial,shapely","A_Id":59217091,"CreationDate":"2012-10-30T17:05:00.000","Title":"Python, GEOS and Shapely on Windows 64","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A part of a small project I am working on involves 'calibrating' the coordinates of the screen of which to take a screen capture of.\nBy the 'screen', I refer to the entire desktop, not my GUI window.\nThe coordinates are calibrated when a QDialog window appears (which I've subclassed).\nThe user is prompted to click several locations on the screen.\nI need the program to record the locations of all mouse clicks occuring anywhere on the screen - ones that don't natively trigger a QDialog mouseEvent, since they are outside this window.\nObviously overwriting the mouseEvent method does not work, since the QDialog doesn't recieve the clicks.\nHow can I capture global mouse clicks, so that an event is triggered and sent to the QDialog when any part of the screen is clicked?\n(I'd prefer a Qt based solution, but am open to other libraries if need be).\nThanks!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2065,"Q_Id":13150497,"Users Score":0,"Answer":"I've assumed this isn't possible and am instead using pyHook,\nletting Qt pump the messages.","Q_Score":0,"Tags":"python,user-interface,mouseevent,pyqt4,global","A_Id":13151661,"CreationDate":"2012-10-31T02:39:00.000","Title":"PyQt4 - detect global mouse click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My friend has an application written in C that comes with a GUI made using GTK under Linux. Now we want to rewrite the GUI in python (wxpython or PyQT).\nI don't have experience with Python and don't know how to make Python communicate with C. I'd like to know if this is possible and if yes, how should I go about implementing it?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4672,"Q_Id":13173029,"Users Score":0,"Answer":"If you have an option between C or C#(Sharp) then go with C# and use visual studio, you can build the GUI by dragging and dropping components easy. If you want to do something in python look up wxPython. Java has a built in GUI builder known as swing. You'll need some tutorials, but unless this program doesn't need to be portable just go with C# and build it in 10 minutes .\nAlso, you can write your code in C and export it as a python module which you can load from python. It`s not very complicated to set up some C functions and have a python GUI which calls them. To achieve this you can use SWIG, Pyrex, BOOST.","Q_Score":6,"Tags":"python,c,wxpython,pyqt","A_Id":13175997,"CreationDate":"2012-11-01T07:52:00.000","Title":"Can C programs have Python GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a project in pharo that will extend it and make it more visual for also further extending the 3d application Blender. Blender uses mainly python for extensions called \"Addons\" , to be precise python 3.2. So what I want is to make a bridge between pharo (smalltalk) and blender (python). \nFor now I have focused on sockets and XMLRPC but I was wondering if there are tools out there and choices to further help on my saga. \nI dont have high demands, for now a simple access to class attributes and call of python methods should be enough, but if I can add additional power to my bridge later it will so much better. Ideally the bridge later one could be used for making pharo use libraries from other language like Java , C# etc","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":415,"Q_Id":13208657,"Users Score":1,"Answer":"I remember a ruby->dotNet bridge which was ported to some smalltalk as far as I remember.\n(Ruby\/.Net Bridge \/ 2004 Benjamin Schroeder and John R. Pierce). It covered passing of exceptions, callbacks etc. May make a good starting point for your work. Don't know where and how to get it, though.","Q_Score":3,"Tags":"python,sockets,smalltalk","A_Id":13605902,"CreationDate":"2012-11-03T11:19:00.000","Title":"Making a bridge for communication between python and smalltalk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a project in pharo that will extend it and make it more visual for also further extending the 3d application Blender. Blender uses mainly python for extensions called \"Addons\" , to be precise python 3.2. So what I want is to make a bridge between pharo (smalltalk) and blender (python). \nFor now I have focused on sockets and XMLRPC but I was wondering if there are tools out there and choices to further help on my saga. \nI dont have high demands, for now a simple access to class attributes and call of python methods should be enough, but if I can add additional power to my bridge later it will so much better. Ideally the bridge later one could be used for making pharo use libraries from other language like Java , C# etc","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":415,"Q_Id":13208657,"Users Score":2,"Answer":"WebSockets sending JSON messages between Smalltalk and Python could be the bleeding edge yet long-term quite a promising way to go. Smalltalk has quite good WebSockets support, I suppose Python as well.","Q_Score":3,"Tags":"python,sockets,smalltalk","A_Id":13210746,"CreationDate":"2012-11-03T11:19:00.000","Title":"Making a bridge for communication between python and smalltalk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to write a tool in Python that will help me create isometric tiles from 3D-models. You see, I'm not a very proficient artist and free 3D-models are plentisome, and creating something like a table or chair is much easer in 3D than in painting.\nThis script will load a 3D model in orthographic projection and take pictures from four directions so it can be used in a game. I've tried this in Blender, but the results are inconsistent, very difficult to control and take very long time to create simple sprites.\nRolling my own script will probably let me do neat things too, especially batch-genetration, maybe on texture changes, shading, etc. The game itself will probably be made in Python tpp, so maybe I could generate on the fly. (Edit: and automatically creat cut out see-through walls for when they face camera)\nNow my question, what Python libraries can do something like this? I've checked both Pyglet and Panda3D, but I haven't even been able to load a model, let alone set it to orthographic projection.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1835,"Q_Id":13208743,"Users Score":1,"Answer":"I found this code:\nwww.pygame.org\/wiki\/OBJFileLoader\nIt let me load and display an .obj file of a cube from Blender with ease. It runs PyOpenGL so it should let me do everything OpenGL can. Never knew OpenGL was so low-level, didn't realize I'd have to write my own loaders and everything.\nAnyway, I'm pretty sure I can modify this to project isometrically, rotate the object and grab shots and combine them into sprites. Thanks you guys!","Q_Score":0,"Tags":"python,3d,isometric","A_Id":13214374,"CreationDate":"2012-11-03T11:32:00.000","Title":"Render 3D model orthographically in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for version (custom\/beta?) of portable python that is python 3.x and includes pygame.  I know pygame hasn't been fully converted to 3.x yet, but for what I need it for it works perfectly.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2264,"Q_Id":13219237,"Users Score":1,"Answer":"Install Pygame, then take your entire Python folder and put it where you want it to go.\nIf you mean you want to be able to use python (filename).py on the terminal, then you will have to change the PATH variable in the terminal, or add the shebang line #!usr\\bin\\python onto your programs.","Q_Score":0,"Tags":"python,python-3.x,pygame,portable-executable","A_Id":13242922,"CreationDate":"2012-11-04T14:06:00.000","Title":"portable python 3.x and pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a program that takes pictures with your webcam.\nI used Pygame and VideoCapture. It all works fine as .pyw file, but after it is compiled with py2exe it is just doesn't work. \nFrom my research, the error is coming from trying to compile the VideoCapture module.\nPLEEASSEE HELP ME!!!\n(The Same error occurs for Pyinstaller)","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":165,"Q_Id":13219380,"Users Score":1,"Answer":"have you tried compiling with cx_freeze?","Q_Score":4,"Tags":"python,pygame,py2exe","A_Id":13646270,"CreationDate":"2012-11-04T14:25:00.000","Title":"py2exe not compiling VideoCapture correctly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hello fellow python users, I bring forth a question that I have been wondering for a while. I love python, and have made many programs with it.  Now what I want to do is (or know how to do) make a python program, but run it in a window with buttons that you click on instead of typing in numbers to elect things.  I would like to just know weather or not I can do this, and if I can, please tell me where to go to learn how. Ok, it's not for the iPhone, sorry that I wasn't clear on that, and I didn't realize that iPhone was one of the tags.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":336,"Q_Id":13222607,"Users Score":0,"Answer":"You can do this, the library is called tkinter.","Q_Score":0,"Tags":"python,user-interface,window","A_Id":13222646,"CreationDate":"2012-11-04T20:33:00.000","Title":"Can you run python as a windowed program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hello fellow python users, I bring forth a question that I have been wondering for a while. I love python, and have made many programs with it.  Now what I want to do is (or know how to do) make a python program, but run it in a window with buttons that you click on instead of typing in numbers to elect things.  I would like to just know weather or not I can do this, and if I can, please tell me where to go to learn how. Ok, it's not for the iPhone, sorry that I wasn't clear on that, and I didn't realize that iPhone was one of the tags.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":336,"Q_Id":13222607,"Users Score":0,"Answer":"There are many GUI libraries to choose from, but I like Tkinter because it's easy and there's nothing to install (it comes with Python).\nBut some people prefer wxPython or others, such as PyQT. You'll have to decide which you like, or just go with Tkinter if you don't want to go through the trouble of installing libraries just to try them out.","Q_Score":0,"Tags":"python,user-interface,window","A_Id":13222783,"CreationDate":"2012-11-04T20:33:00.000","Title":"Can you run python as a windowed program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If this is possible, can you show some code example? Thanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":203,"Q_Id":13248848,"Users Score":1,"Answer":"ObjectListView is just a nice wrapper around the ListCtrl. To my knowledge, the ListCtrl does not support the embedding of other widgets. You could create a popup dialog when double-clicking a cell and do it that way. Otherwise, you would have to use the UltimateListCtrl. That widget DOES allow widget embedding because it's a custom widget rather than a native one.","Q_Score":0,"Tags":"python-2.7,wxpython,wxwidgets","A_Id":13254838,"CreationDate":"2012-11-06T10:15:00.000","Title":"Can we embedd a ComboBox or a TextCtrl on the ObjectListView of wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Where would be a good place start learning to program a clipboard manager in python. i want to be able to copy selected text with a keyboard macro and set it to a slot identified ny the key combo \"ctrl+alt+c+1\", \"ctrl+alt+c+2\" storing more than one thing, also so would be got to be able to contaminate on to what is in a slot, if one would want. Any way that is the project i want to write, i write in python 3.2, python 2.7, and java 7. what libraries should i start learning i guess is what i am asking.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":964,"Q_Id":13258448,"Users Score":0,"Answer":"Clipboards are framework specific. So a good place would be to select a GUI framework, and look at it's documentation for how to deal with cut and paste.","Q_Score":0,"Tags":"python-3.x,clipboardmanager","A_Id":13261057,"CreationDate":"2012-11-06T19:59:00.000","Title":"Python clipboard manager?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Where does boost python register from python converters for builtin types such as from PyLong_Type to double?\nI want to define a converter that can take a numpy.float128 from python and returns a long double for functions in C++. I already did it the other way round, the to_python converter. For that I tweaked builtin_converters.hpp but I didn't find how boost python does the from python conversion.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":300,"Q_Id":13267912,"Users Score":1,"Answer":"The from python conversion is in fact done in builtin_converters.cpp and not in the header part of the library. I Copied this file and deleted everything except the converter for long double, which I was then able to modify.","Q_Score":2,"Tags":"c++,python,boost-python","A_Id":13363934,"CreationDate":"2012-11-07T10:36:00.000","Title":"From python converter for builtin types","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project in Python using tkinter that will allow for geolocation of IP addresses.  I have the raw conversions down, and I can take an IP address and know city, state, country, longitude, latitude, etc.  I'm wondering if there's any way to embed Google Maps or something similar into my program to offer a visual representation.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":7845,"Q_Id":13295331,"Users Score":1,"Answer":"Most GUI Frameworks have a way to embed a web browser frame, with a way to execute javascript from the python code. If this is available to you, you could use the Google Maps JavaScript API v3 to display a map.\nIf you let us know which GUI framework you're using, we might be able to help more.","Q_Score":5,"Tags":"python,google-maps,tkinter","A_Id":13311950,"CreationDate":"2012-11-08T18:25:00.000","Title":"How can I embed google maps into my Python program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a QTreeWidget and set animation to true (setAnimated(true)).\nWhen I'm clicking on a mark (triangle) at the left of item it expands smoothly, but when I'm double clicking on the item it expands too fast (almost like there is no \"animated\" flag set).\nI want smooth animation on double click too. How can I solve this problem?\nQTreeView calls QTreeViewPrivate::expandOrCollapseItemAtPos on mark click and QTreeViewPrivate::expand on double click, so I have no access to these methods.\nI'm using PySide for creating Qt application (but I've tried C++ and the problem is the same).","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1404,"Q_Id":13304136,"Users Score":1,"Answer":"You need to override the click behaviour. Check the event if it's a double click or not and then you can redirect the event to the appropriate call. You should check the state if it's already clicked or not to prevent a second animation which might happen.","Q_Score":4,"Tags":"python,qt4,python-2.7,pyside,qtreewidget","A_Id":15232509,"CreationDate":"2012-11-09T07:49:00.000","Title":"QTreeWidget expand animation on double click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am doing an application with GUI using WPF\/XAML with Ironpython and SharpDevelop, until now it works fine, when I'm in the development environment I can see the errors in console and know what is wrong. \nBut when I build and deploy the app for us on other system  or I ran it outside of the development environment and there is no longer the console when there is some error or  crashes, it fails silently, and I cannot know what went wrong.\nHow can I alert or log to see what fails?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":240,"Q_Id":13347378,"Users Score":1,"Answer":"You could put in some code to catch the error and log it to a file.\nSomething possibly simpler is to compile your application as a Console Application. This can be done via Project Options - Application - Output type. Then you will get a console window when you run your WPF application and any exception that happens at startup will be logged to this window.","Q_Score":0,"Tags":"wpf,xaml,ironpython,sharpdevelop","A_Id":13352605,"CreationDate":"2012-11-12T16:22:00.000","Title":"Ironpython: How to see when a WPF application fails?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am new to Mac, have always used windows and I am confused on how to install wxPython. I downloaded the .dmg file from the website, and it contained three files:\na pkg file, a readme, and an uninstall.py\nI opened the pkg file, went through the steps, and Im not sure where it installed after it said \"Installation Complete\"\nAlso, I did the import wx in idle, which caused a stacktrace error.\nThanks.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":363,"Q_Id":13354317,"Users Score":2,"Answer":"At least for development, I would suggest to install (python and) wx using homebrew. It will install version 2.9 and you're ensured that Apple-provided system libraries remain untouched.","Q_Score":0,"Tags":"macos,installation,wxpython","A_Id":13357833,"CreationDate":"2012-11-13T01:22:00.000","Title":"Install wxpython on mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This might be a bit foolish but I'm trying to use ctypes to call a function that receives a complex vector as a paramter. But in ctypes there isn't a class c_complex. \nDoes anybody know how to solve this?\nedit: I'm refering to python's ctypes, in case there are others....","AnswerCount":5,"Available Count":1,"Score":-0.0399786803,"is_accepted":false,"ViewCount":2911,"Q_Id":13373291,"Users Score":-1,"Answer":"If c_complex is a C struct and you have the definition of in documentation or a header file you could utilize ctypes to compose a compatible type.  It is also possible, although less likely, that c_complex is a typdef for a type that ctypes already supports.\nMore information would be needed to provide a better answer...","Q_Score":4,"Tags":"python,ctypes,complex-numbers","A_Id":13373641,"CreationDate":"2012-11-14T04:59:00.000","Title":"Complex number in ctypes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a multi-threaded application that utilizes QThreads. I know that, in order to start a thread, I need to override the run() method and call that method using the thread.start() somewhere (in my case in my GUI thread).\nI was wondering, however, is it required to call the .wait() method anywhere and also am I supposed to call the .quit() once the thread finishes, or is this done automatically?\nI am using PySide.\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":438,"Q_Id":13376448,"Users Score":1,"Answer":"Both answers depend on what your code is doing and what you expect from the thread.\nIf your logic which uses the thread needs to wait synchronously for the moment QThread finishes, then yes, you need to call wait(). However such requirement is a sign of sloppy threading model, except very specific situations like application startup and shutdown. Usage of QThread::wait() suggests creeping sequential operation, which means that you are effectively not using threads concurrently.\nquit() exits QThread-internal event loop, which is not mandatory to use. A long-running thread (as opposed to one-task worker) must have an event loop of some sort - this is a generic statement, not specific to QThread. You either do it yourself (in form of some while(keepRunning) { } cycle) or use Qt-provided event loop, which you fire off by calling exec() in your run() method. The former implementation is finishable by you, because you did provide the keepRunning condition. The Qt-provided implementation is hidden from you and here goes the quit() call - which internally does nothing more than setting some sort of similar flag inside Qt.","Q_Score":1,"Tags":"python,multithreading,qt,thread-safety,qthread","A_Id":13381623,"CreationDate":"2012-11-14T09:52:00.000","Title":"Do I need to manually call .quit() method when QThread() stops running (Python)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have got a python function that takes a few parameters and executes a few tasks (let's call it theFunc). While theFunc runs, internal variable resultingMessage is getting more and more lines, and I show it on GUI at the end of the execution. Ideally, I would like resultingMessage to be shown and updated on GUI as the execution of theFunc happens, not after it has finished, and to do it without polluting theFunc with GUI stuff (it is complicated enough already). What would be the best way to do it?\nTwo possible ways I could think of (both are quite far-fetch):\n\nHave two threads: one executed theFunc and writes resultingMessage in a variable\/file, the other checks this variable\/file and updates GUI;\nInstead of appending lines to resultingMessage, attach some \"stream\" to GUI element; adding lines to the \"stream\" would update GUI.\n\nI guess there should be a conventional way to do it.\nEnvironment: CPython 2.7, Win XP, WXPython","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":487,"Q_Id":13417553,"Users Score":1,"Answer":"You would want to use threads. wxPython provides several thread-safe methods such as wx.CallAfter, wx.CallLater and wx.PostEvent. You can combine those with pubsub to send messages too! In your case, I think passing a wx method to wx.CallAfter with whatever text you wish to display would work just fine.","Q_Score":1,"Tags":"python,user-interface,wxpython,auto-update","A_Id":13418479,"CreationDate":"2012-11-16T13:26:00.000","Title":"Updating GUI while execution a python function while keeping this function GUI-independent","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"In Pygame, how can I get graphical input(e.g. clicking exit button) and also get input from the a terminal window simultaneously? \nTo give you context, my game has a GUI but gets its game commands from a \"input()\" command. How can I look for input from the command line while also handling graphics?\nI'm not sure if this is possible, but if not, what other options do I have for getting text input from the user?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":906,"Q_Id":13450878,"Users Score":1,"Answer":"You can't do that, unless you use the input command in a different thread, but then you have to deal with syncronization (which might be what you want or don't want to do).\nThe way I'd implement this is to create a kind of in-game console. When a special key (e.g. '\\') is pressed you make the console appear, and when your application is in that state you interpreter key pressing not as in-game commands but... well, as text. You can print them in the console (using fonts). When a key (e.g \"return\") is pressed you can make the console disappear and the keys take back their primary functionality.\nI did this for my pet-project and it works as a charm. Plus, since you are developing in python you can accept python instructions and use exec to execute them and edit your game \"on fhe fly\"","Q_Score":2,"Tags":"python,input,pygame","A_Id":13451666,"CreationDate":"2012-11-19T09:28:00.000","Title":"Pygame: Graphical Input + Text Input","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created a main app with a mdiArea for loading map graphics with Qt Designer *.ui and coded with pyQt4 using uic.loadUi() in python.\nI also created a separate *.ui file and tested the dockWidget successfully in a separate python script file.\nI wish to combine these 2 UI so that the main_app window will have the mdiArea widget on the left, while the dockWidget as the info_panel on the right.\nI tried to load the *.ui file in the main app python, but ended up the dockWidget as a separate window when show().\nAny advice to resolve this?\nI hope I need not have to use Qt Designer to combine the mdiArea main_app UI with the dockWidget info_panel and load them as a single UI. ;P\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":719,"Q_Id":13466072,"Users Score":0,"Answer":"I've worked on some software where every different pane is done as a separate. Ui file, so that they can be changed independently without requiring merges. It worked fine. Can you turn the map and dock parts into widgets, and then make a new \"main window\" ui, and then give that a layout and add the other two as child widgets to it?","Q_Score":1,"Tags":"python,pyqt4","A_Id":13470421,"CreationDate":"2012-11-20T03:15:00.000","Title":"Combining 2 UI as one main app window in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use Python 3 and unofficial PIL module. My code works fine. But after using cx_freeze I get exception \"_imaging c module is not installed\".\nWhat can I do with this problem? All solutions that I found were about Python 2.X and Linux OS. I need the solution for Windows and Python 3.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":348,"Q_Id":13470611,"Users Score":0,"Answer":"The only reason i know of that that can happen is if the _imagingtk.pyd is not for your python version.\nOh, could you post the link to the unofficial version? I've been searching for it for awhile.","Q_Score":1,"Tags":"windows,python-3.x,cx-freeze","A_Id":13814960,"CreationDate":"2012-11-20T09:55:00.000","Title":"After using cx_freeze I get exception _imaging c module is not installed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a title (\"cadeau check 50 \u20ac\") in a form value that I want to write to a background image with arial.ttf. My text is correct but for the euro sign. I have 2 [] in place. I don't know where the problem is coming from. Is this an encoding problem in PIL, or have I a problem with the font?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":785,"Q_Id":13476383,"Users Score":0,"Answer":"Maybe use Unicode strings?? Like u'cadeau check 50 \u20ac' ... Now, does also your font have the corresponding glyphs?","Q_Score":2,"Tags":"python,python-imaging-library,python-unicode","A_Id":13476705,"CreationDate":"2012-11-20T15:23:00.000","Title":"PIL: how to draw \u20ac on an image with draw.text?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I got a tkMEssagebox.showerror showing up in a python tkinter application,\nwhen somebody failed to login with the application.\nIs it possible to have a url link in the tkMessageBox.showerror?\nie.\n\ntkMessageBox.showerror(\"Error\",\"An error occured please visit\n  www.blahblubbbb.com\")\n\nand I want the www.blahblubbbb.com to be clickable?!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2245,"Q_Id":13508043,"Users Score":3,"Answer":"Short answer: \"No!\" message is a simple string, no interpretation like in some widgets of other frameworks is done. \nLonger answer: You could e.g. subclass+monkeypatch, to provide such feature.","Q_Score":6,"Tags":"python,python-2.7,tkinter,tkmessagebox","A_Id":13508222,"CreationDate":"2012-11-22T07:51:00.000","Title":"tkinter tkMessageBox html link","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to change the width of the block which is moving on gtk.ProgressBar.pulse()?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":216,"Q_Id":13525032,"Users Score":0,"Answer":"Not on PyGTK. If you are using GTK 3 then there is a CSS class, GtkProgressBar:pulse, but I can't find any documentation on how to change the width. It might be possible if you do some digging.","Q_Score":1,"Tags":"python,pygtk","A_Id":13541432,"CreationDate":"2012-11-23T07:57:00.000","Title":"ProgressBar: set the width of the pulse block","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing Ubuntu app using the Unity tools (PyGTK + Python). I can change label font-size with no problem, but I cannot find same thing for button. How can I change button font-size?\nThe purpose of this is, i am developing an on-screen keypad, so the numerical text needs to be bigger so that it is easier to be seen.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2417,"Q_Id":13538069,"Users Score":1,"Answer":"The button contains a label, which you can access with get_child() and related functions. You can change the label's font size using the normal method.","Q_Score":1,"Tags":"python,pygtk","A_Id":13541300,"CreationDate":"2012-11-24T03:50:00.000","Title":"Glade + PyGTK Change Button Font Size","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I read few Boost.Python tutorials and I know how to call C++ function from Python. But what I want to do is create C++ application which will be running in the background all the time and Python script that will be able to call C++ function from that instance of C++ application. The C++ application will be a game server and it has to run all the time. I know I could use sockets\/shared memory etc. for this kind of communication but is it possible to make it with Boost.Python?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":426,"Q_Id":13553174,"Users Score":2,"Answer":"Boost python is useful for exposing C++ objects to python. \nSince you're talking about interacting with an already running application from python, and the lifetime of the script is shorter than the lifetime of the game server, I don't think boost python is what you're looking for, but rather some form of interprocess communication.\nWhilst you could create your IPC mechanism in C++, and then expose it to python using boost python, I doubt this is what you want to do.","Q_Score":1,"Tags":"c++,python,boost,boost-python","A_Id":13558179,"CreationDate":"2012-11-25T16:51:00.000","Title":"Boost.Python - communication with running C++ program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create an application that is capable of loading plugins. The twist is that I want to be able to create plugins in both C\/C++ and Python.\nSo I've started thinking about this and have a few questions that I'm hoping people can help me with.\nMy first question is whether I need to use C\/C++ for the \"core\" of the application (the part that actually does the loading of the plugins)? This is my feeling at least, I would think that implementing the core in Python would result in a nasty performance hit, but it would probably simplify loading the plugins dynamically.\nSecond question is how would I go about defining the plugin interface for C\/C++ on one hand and Python on the other? The plugin interface would be rather simple, just a single method that accepts a list of image as a parameter and returns a list of images as a return value. I will probably use the OpenCV image type within the plugins which exists for both C\/C++ and Python.\nFinally, I would like the application to dynamically discover plugins. So if you place either a .py file or a shared library file (.so\/.dll) in this directory, the application would be able to produce a list of available plugins at runtime.\nI found something in the Boost library called Boost.Extension (http:\/\/boost-extension.redshoelace.com\/docs\/boost\/extension\/index.html) but unfortunately it doesn't seem to be a part of the official Boost library and it also seems to be a bit stale now. On top of that, I don't know how well it would work with Python, that is, how easy it would be to create Python plugins that fit into this mechanism.\nAs a side note, I imagine the application split into two \"parts\". One part is a stripped down core (loading and invoking plugin instances from a \"recipe\"). The other part is the core plus a GUI that I plan on writing in Python (using PySide). This GUI will enable the user to define the aforementioned \"recipes\". This GUI part would require the core to be able to provide a list of available plugins.\nSorry for the long winded \"question\". I guess I'm hoping for more of a discussion and of course if anybody knows of something similar that would help me I would very much appreciate a pointer. I would also appreciate any concise and to the point reading material about something similar (such as integrating C\/C++ and Python etc).","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":648,"Q_Id":13555278,"Users Score":1,"Answer":"Write your application in Python, then you can have a folder for your plugins. \nYour application searches for them by checking the directory\/traversing the plugin tree.\nThen import them via \"import\" or use ctypes for a .so\/.dll, or even easier: you can use boost::python for creating a .so\/.dll that you can 'import' like a normal python module.\nDon't use C++ and try to do scripting in Python - that really sucks, you will regret it. ;)","Q_Score":0,"Tags":"c++,python,c,plugins,shared-libraries","A_Id":13555348,"CreationDate":"2012-11-25T20:40:00.000","Title":"Application that can load both C\/C++ and Python plugins","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"PyOpenGL docs say:\n\nBecause of the way OpenGL and ctypes handle, for instance, pointers, to array data, it is often necessary to ensure that a Python data-structure is retained (i.e. not garbage collected).  This is done by storing the data in an array of data-values that are indexed by a context-specific key.  The functions to provide this functionality are provided by the OpenGL.contextdata module.\n\nWhen exactly is it the case?\nOne situation I've got in my mind is client-side vertex arrays back from OpenGL 1, but they have been replaced by buffer objects for years. A client side array isn't required any more after a buffer object is filled (= right after glBufferData returns, I pressume).\nAre there any scenarios I'm missing?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":176,"Q_Id":13584900,"Users Score":1,"Answer":"Are there any scenarios I'm missing?\n\nBuffer mappings obtained through glMapBuffer","Q_Score":1,"Tags":"python,opengl,ctypes,pyopengl","A_Id":13585375,"CreationDate":"2012-11-27T13:04:00.000","Title":"What is PyOpenGL's \"context specific data\"?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a simple tkinter window. It consists of a small window, a timer, and a button to set timer. I don't want to go in details with the code.\nI want to change the background of all the widgets in my window(buttons, label, Etc.).\nMy first thought is to use a global variable which I will set to \"red\" for example, and associate all the widgets background option with the global variable. Then, on button press I will change the global variable to \"green\" (so that the background of all widgets change) but nothing happens.\nMy understanding was the .mainloop() sort of updated the window. How can I have the widgets to change background color when my variable change without restarting my application?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":21940,"Q_Id":13588908,"Users Score":3,"Answer":"The background colors will not automatically change. Tkinter has the ability to do such a thing with fonts but not with colors.\nYou will have to write some code to iterate over all of the widgets and change their background colors.","Q_Score":9,"Tags":"python,tkinter","A_Id":13590474,"CreationDate":"2012-11-27T16:41:00.000","Title":"Dynamically change widget background color in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can I set application icon using clean Python 3?\nI have .ico file in same directory and want to add into application.\n(Without tkinter)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":156,"Q_Id":13632479,"Users Score":1,"Answer":"Short answer: No, you can not. The application icon is set in completely different ways in different environments. Usually it is a setting on the shortcut.\nLonger answer: It also depends on what you mean with \"Application Icon\".\nIf you mean the icon for the menu entry in the Applcartions\/Start\/Whatever menu, then you can probably set it with Python, when you are creating the shortcut in whatever menu system you are using, but it will be specific for your system and not portable.\nThere may be some library out there to help you create installers for different systems that can help you, but it's definitely no longer \"clean Python 3\" in any meaningful sense. :-)","Q_Score":0,"Tags":"python-3.x,icons","A_Id":13632646,"CreationDate":"2012-11-29T18:39:00.000","Title":"Application Icon in Python 3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is for a computer science assignment using Python, does anybody know where I would begin to create an algorithm to create a square or box that rolls across the screen? And I do indeed mean roll, not slide. It does not necessarily have to be using python, I just need a general idea as to how the coordinates would work and a general algorithm.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":244,"Q_Id":13639219,"Users Score":2,"Answer":"If a unit square starts out with one side resting on the x-axis, and the lower right corner at (xs, 0), then after a quarter turn clockwise it will again have one side resting on the x-axis, and the lower right corner now at (xs+1, 0).  Before it turns, label the lower left corner a; the upper left, b; and the upper right, c.  Corners a and c move along arcs of a unit circle as the square turns.  Corner b moves with radius d = sqrt(2).\nThis leads to the following method:  Step angle t from 0 to pi\/2 (ie 90\u00b0), letting\n\u2022 xa = xs - cos t\n\u2022 ya = sin t\n\u2022 xb = xs - d*cos(t+pi\/4)\n\u2022 yb = d*sin(t+pi\/4)\n\u2022 xc = xs + sin t\n\u2022 yc = cos t  \nAt each time step, erase the old square by drawing background-colored lines, compute new (xa,ya,xb,yb,xc,yc) from equations, draw new square with lines from (xs,0) to (xa,yb) to (xc,yc) to (xd,yd) to (xs,0), and then delay appropriate amount.  Each time t gets up to pi\/2, set t back to 0 and add 1 to xs.  Note, instead of erasing the whole square and then drawing the new, one might try erasing one old line and drawing one new line in turn for the four sides.","Q_Score":0,"Tags":"python,algorithm,graphics","A_Id":13639414,"CreationDate":"2012-11-30T04:52:00.000","Title":"Create a square that rolls across the screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is for a computer science assignment using Python, does anybody know where I would begin to create an algorithm to create a square or box that rolls across the screen? And I do indeed mean roll, not slide. It does not necessarily have to be using python, I just need a general idea as to how the coordinates would work and a general algorithm.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":244,"Q_Id":13639219,"Users Score":0,"Answer":"You could alternatively completely break the spirit of the assignment by using pybox2d, pymunk or another physics engine to do all the calculations for you.  Then you could have lots of boxes rolling around and bouncing off each other :D","Q_Score":0,"Tags":"python,algorithm,graphics","A_Id":13639761,"CreationDate":"2012-11-30T04:52:00.000","Title":"Create a square that rolls across the screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a document based application in wxPython, by which I mean that the user can have open multiple documents at once in multiple windows or tabs. There are multiple kinds of documents, and the documents can all be in different \"states\", meaning that there should be different menu options available in the main menu.\nI know how to disable and enable menu items using the wx.EVT_UPDATE_UI event, but I can't figure out how to pull off a main menu that changes structure and content drastically based on which document that currently has focus. One of my main issues is that the main menu is created in the top level window, and it has to invoke methods in grand children and great grand children that haven't even been created yet.\n\nContrived example; when a document of type \"JPEG\" is open, the main menu should look like:\nFile      Edit      Compression     Help\nAnd when the user switches focus (CTRL+Tab) to a document of type \"PDF\", the main menu should change to:\nFile      Edit      PDF     Publish     Help\nAnd the \"Edit\" menu should contain some different options from when the \"JPEG\" document was in focus.\n\nCurrent I'm just creating the menu in a function called create_main_menu in the top level window, and the document panels have no control over it. What would be necessary to pull off the kind of main menu scheme I describe above, specifically in wxPython?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2119,"Q_Id":13655152,"Users Score":0,"Answer":"Probably the only way to do it with the standard wx.Menu is to destroy and recreate the entire menubar. You might be able to Hide it though. Either way, I think it would be easiest to just put together a set of methods that creates each menubar on demand. Then you can destroy one and create the other.\nYou might also take a look at FlatMenu since it is pure Python and easier to hack.","Q_Score":1,"Tags":"python,wxpython","A_Id":13687868,"CreationDate":"2012-12-01T00:34:00.000","Title":"How do I manage a dynamic, changing main menu in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Basically I want to do this:\nwhen the user presses a button, the application should open a dialog with a spinner inside of it, while some tasks are executed in background. When this tasks are finished, this dialog should be destroyed, and a new dialog should be opened.\nI'm working with python and gtk\nHow can I do it?\nthanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":340,"Q_Id":13672316,"Users Score":2,"Answer":"Basically there are two ways. The difference is who is the \"main\" program. If you want gtk to be in charge, you just create your dialog, and set up an callback for use when idle (gobject.idle_add). This job should make sure that it doesn't take long every step, so gtk can update the gui (you probably want gobject.timeout_add for your spinner).\nThe other way is that your \"background\" job is in control. It can just do what it wants, it should just call gtk every now and then (while gtk.events_pending (): gtk.main_iteration (False)) to make sure gtk can update the gui.","Q_Score":0,"Tags":"python,gtk","A_Id":13672419,"CreationDate":"2012-12-02T18:24:00.000","Title":"gtk loading dialog while performing task","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to find a way to rapidly develop (or rather eventually reach a point where I can rapidly develop) very nice looking cross platform GUI desktop apps that have a very small footprint on disk and in memory, launch very fast (much faster, for example, than even a bare bones wxPython window) (for a good example, look at how fast TextEdit launches under OSX.  That's the kind of launch speed I want for my GUI apps), deploy easily, and interact very well with the operating system (Gimp and Gedit and various other open source, cross platform apps exhibit various behaviors that I really hate, depending on the platform, but especially on OSX) without spending any money.  (Hey, stop laughing! =P)\nI'm dissatisfied with wxWidgets, Qt, SDL, and everything else I've tried so far, so I'm down to writing native GUI code (especially the part that interacts with the OS's windowing system) on each platform, using native tools (XCode\/ObjC\/Cocoa\/OpenGL, MSVC\/Win32\/DirectX, gcc\/GTK\/OpenGL), and then trying to come up with some way of writing as much as possible of the rest of the program in Python.\nI've thought about maybe writing a set of shared libraries \/ dll's to deal with matters GUI, and then wrapping them with a set of Python C extensions, but there are some technical challenges involved in doing that when it comes to packaging (menus, the app icon, certain OS-specific application manifests, etc), and I'm not sure that launch speed and performance in general will be acceptable, depending on the particular program I'm writing.\nSo I've thought about maybe creating a sort of a \"shell\" program on each platform, and embedding python, kind of in a similar way to the way Sublime Text 2 does.\nI don't like the startup slowness that occurs when launching any python program for the first time.  I was hoping this was a result of compiling to byte code, and that I could just include precompiled versions of python modules with my apps, but from experimenting, it seems this is not the case.. it seems that the first time anything python runs (since the last system reboot), a shared library \/ dll is loaded or something.  So that's one reason I think of maybe embedding Python - I wonder if there are some options available when imbedding\/calling python that could help reduce that launch delay.  Or if worst comes to worst, in the imbedded case I can launch without Python, then launch Python if\/when I need to, asynchronously (not in the main thread), after the app has already launched.\nIs there a way to reduce the first-time launch delay for deployed python programs (ie., programs who's packages include a version of the intepreter.. maybe the interpreter can be compiled with switches I haven't tried)?\nIs there any way to reduce the interpreter load\/initialize delay when embedding python?\nIs it completely unrealistic to expect any python gui program to launch as fast or have as small a footprint as TextEdit?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":722,"Q_Id":13681305,"Users Score":0,"Answer":"You can take the openoffice way on windows platform and write a launcher that simply tries to access the file needed by your software, so that they will end up in the memory cache, speeding up the startup time (but creating useless things in the cache, in case the user doesn't want to open your program).","Q_Score":2,"Tags":"python,c,user-interface,cross-platform","A_Id":13681502,"CreationDate":"2012-12-03T10:27:00.000","Title":"Should I embed or extend python to create high quality, high speed GUI programs?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating guis with wxPython then compiling them using pyInstaller and finally using inno to set them up.\nseeing as i am new to all of this i would like to know, do i need to use UPX to compress just the final compiled exe? or all of the stuff the exe needs to run aswell?\nthanks, sorry for being a noob.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":325,"Q_Id":13688815,"Users Score":0,"Answer":"I don't think you can compress the files before the exe or you'll run into issues of Python not being able to read the zip files. You might be able to use eggs here, but I don't believe eggs are compressed. I would just try compressing the exe with UPX and see how it goes.\nI personally don't worry about it. The exe's usually are 20-40 MB and hard disk space is cheap and plentiful.","Q_Score":0,"Tags":"python,wxpython,inno-setup,pyinstaller,upx","A_Id":13690799,"CreationDate":"2012-12-03T17:45:00.000","Title":"Compressing a compiled wxPython program with UPX","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I cannot get my code to run on my win8 laptop. I am working with a combination of:\n\nStackless Python 2.7.2\nQt 4.8.4\nPySide 1.1.2\nEclipse\/Pydev and WingIDE\n\nThis works well on my Win7 PC, but now i have bought a demo laptop with windows 8. As far as I know all is installed the same way as on my PC.\nWhen i run my program (same code) now, i get  a warning:\n\"Qt: Untested Windows version 6.2 detected!\"\nOk, so that could be the source of my problem, but also i get errors:\n\nsome times the program just quits after the warning above (i think only eclipse)\nsometimes i get an APPCRASH (i think only eclipse)\nsometimes i get the exception: TypeError: Error when calling the metaclass bases: mro() returned base with unsuitable layout ('')\nsometimes i get the exception: TypeError: Error when calling the metaclass bases: multiple bases have instance lay-out conflict\n\nEspecially the last two don't seem like a windows problem, but i don't see any other difference with my PC win7 install. Does anyone have any idea what is going on or how to fix this? Did i miss a step in the installation or is it some incompatibility maybe?\nCheers, Lars\nDoes anyone have some input on this?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":2146,"Q_Id":13702106,"Users Score":1,"Answer":"I had the same problem with Pyside 1.1.2 and Qt 4.8.4. The solution for me was to set the compatibility mode of the Python executable to Windows 7 via right click on the executable -> Properties -> Compatiblity -> Run this program in compatibility mode for: Windows 7\nHope that helps.","Q_Score":2,"Tags":"python,qt,windows-8,pyside,stackless","A_Id":16126325,"CreationDate":"2012-12-04T11:42:00.000","Title":"windows 8 incompatibility?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I cannot get my code to run on my win8 laptop. I am working with a combination of:\n\nStackless Python 2.7.2\nQt 4.8.4\nPySide 1.1.2\nEclipse\/Pydev and WingIDE\n\nThis works well on my Win7 PC, but now i have bought a demo laptop with windows 8. As far as I know all is installed the same way as on my PC.\nWhen i run my program (same code) now, i get  a warning:\n\"Qt: Untested Windows version 6.2 detected!\"\nOk, so that could be the source of my problem, but also i get errors:\n\nsome times the program just quits after the warning above (i think only eclipse)\nsometimes i get an APPCRASH (i think only eclipse)\nsometimes i get the exception: TypeError: Error when calling the metaclass bases: mro() returned base with unsuitable layout ('')\nsometimes i get the exception: TypeError: Error when calling the metaclass bases: multiple bases have instance lay-out conflict\n\nEspecially the last two don't seem like a windows problem, but i don't see any other difference with my PC win7 install. Does anyone have any idea what is going on or how to fix this? Did i miss a step in the installation or is it some incompatibility maybe?\nCheers, Lars\nDoes anyone have some input on this?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2146,"Q_Id":13702106,"Users Score":0,"Answer":"try using Hyper-V however Hyper-V is not installed by default in Windows 8. You need to go \"Turn Windows features on or off.\"","Q_Score":2,"Tags":"python,qt,windows-8,pyside,stackless","A_Id":13881726,"CreationDate":"2012-12-04T11:42:00.000","Title":"windows 8 incompatibility?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Am working on a pyqt app, done the ui via qt-designer 4.8.1, and generated the corresponding py file using pykdeuic4 (available on OpenSuse 12.2), but  can't find an equivalent for pyrcc4 to hadle the *.qrc files.\nwhat's the equivalent tool\/command?\nEdit:\nMost of the documentation on using QtDesigner with PyQt, indicates using pyuic4 \/ pyuic (which      on my platform is pykdeuic4), but as for the other tool pyrcc4 \/ pyrcc, I can't find an equivalent. \nAm wondering, where can I even get the original tool from (pyrcc4)?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":452,"Q_Id":13727279,"Users Score":0,"Answer":"Well, turns out all I needed was to install the extra package python-qt4-utils ontop of the existing python-qt4. Now, I have the sought after utilities in place.","Q_Score":1,"Tags":"python,pyqt4,opensuse,kde-plasma,pyrcc","A_Id":13730501,"CreationDate":"2012-12-05T15:58:00.000","Title":"Equivalent of pyrcc4 on KDE","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a single command to clean the screen of the Python Interpreter every time one runs a code in PyScripter?\nthanks,","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2810,"Q_Id":13738301,"Users Score":6,"Answer":"Goto pyscripter menus and check the box for clear output before run.\nTools>Options > IDE options > Python interpreter > Clear output before run.\nVery useful in interactive sessions.","Q_Score":3,"Tags":"python,pyscripter","A_Id":15842157,"CreationDate":"2012-12-06T06:44:00.000","Title":"Command to clean screen in PyScripter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a GUI with PyQt.  The GUI has a qListWidget, a qTableWidget, and a plot implemented with Mayavi.  The list refers to shapes that are plotted (cylinders and cones for example).  When a shape is selected in the list, I want the shape's properties to be loaded into the table (from a dictionary variable) and the shape to be highlighted in the plot.  I've got the Mayavi plotting working fine.  Also, if the table is edited, I need the shape to be re-plotted, to reflect the new property value (like for a cylinder, if the radius is changed).\nSo, when a list item is selected -> update the table with the item's properties (from a dictionary variable), highlight the item on the plot\nWhen the table is edited -> update the dictionary variable and re-plot the item\nThe Problem: when I select a list item and load data into the table, the qTableWidget ItemChanged signal fires every time a cell is updated, which triggers re-plotting the shape numerous times with incomplete data.\nIs there a typical means of disabling the GUI event loop while the table is being programmatically updated? (I have experience with Excel VBA, in that context setting Application.EnableEvents=False will prevent triggering a WorksheetChange event every time a cell is programmatically updated.)\nShould I have a \"table update in progress\" variable to prevent action from being taken while the table is being updated?\nIs there a way to update the Table Widget all at once instead of item by item? (I'll admit I'm intentionally avoiding Model-View framework for the moment, hence the qListWIdget and qTableWidget).\nAny suggestions?\nI'm a first time poster, but a long time user of StackOverflow, so I just want to say thanks in advance for being such an awesome community!","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":13515,"Q_Id":13771694,"Users Score":0,"Answer":"If you disable the entire event loop, the app becomes unresponsive. And, even if the user doesn't notice, the OS might, and put up some kind of \"hang\" notification (like OS X's brightly-colored spinning beachball, which no user will ever miss).\nYou might want to disable repaints without disabling the event loop entirely. But even that's probably too drastic.\nAll you're really trying to do is make sure the table stops redrawing itself (without changing the way you've implemented your table view, which you admit isn't ideal, but you have reasons for).\nSo, just disable the ItemChanged updates. The easiest way to do this, in almost every case, is to call blockSignals(True) on the widget.\nIn the rare cases where this won't work (or when you're dealing with ancient code that's meant to be used in both Qt4-based and earlier projects), you can still get the handler(s) for the signal, stash them away, and remove them, then do your work, then restore the previous handler(s).\nYou could instead create a flag that the handlers can access, and change them so they do nothing if the flag is set. This is the traditional C way of doing things, but it's usually not what you want to do in Python.","Q_Score":9,"Tags":"python,pyqt,pyqt4,qtablewidget","A_Id":13772005,"CreationDate":"2012-12-07T22:01:00.000","Title":"Turn off PyQt Event Loop While Editing Table","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have installed Qt designer 4.8.2, Pyside, and Python 3.3.   When I create a form with Qt designer I am not able to see the code when clicking on view code.  The error message is:\"Unable to launch C:\\Qt\\4.8.2\\bin\\uic\".\nI have the pyuic under C:\\Python33\\Lib\\site-packages\\PyQt4\\uic.  Please help.","AnswerCount":7,"Available Count":1,"Score":0.1418931938,"is_accepted":false,"ViewCount":22091,"Q_Id":13792502,"Users Score":5,"Answer":"Just create a directory where it search for uic.exe file  and copy existing  uic.exe file to that directory.\nMy example :\nWhen I clicked View Code it shows Error asking for file uic.exe in path\nC:\\python374\\Lib\\site-packages\\pyqt5_tools\\Qt\\bin\\bin\nBut I found uicexe file is in C:\\python374\\Lib\\site-packages\\pyqt5_tools\\Qt\\bin folder\nSo I created another bin folder and copied uic.exe into that folder . That solved my problem.","Q_Score":6,"Tags":"python-3.x,qt4,pyside","A_Id":57644204,"CreationDate":"2012-12-09T22:25:00.000","Title":"Unable to Launch Qt uic","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I want to practice python on my Android. Is there a way I can get the interpreter or an interpreter emulator on my device?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28974,"Q_Id":13793158,"Users Score":0,"Answer":"Download PyDroid 3 from Playstore and if you like it buy the pro version. It costs around 2$ but you have all you need to do Python 3 programming","Q_Score":7,"Tags":"android,python","A_Id":54814139,"CreationDate":"2012-12-09T23:49:00.000","Title":"Python Interpreter on Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In one of my software, I use AuiManager to manage all the different parts of the UI. Now, I start to use FoldPanelBar in one of the AuiPane. At first, I changed part of the Panel to use FoldPanelBar, and the bar is layout with others using BoxSizer. But it doesn't function correctly as the window is resized. Then I moved all the different controls in the Panel into the FoldPanelBar and make the bar the only control of the panel (No sizers anymore). But the FoldPanelBar still don't resize. Do you know why? Thanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":109,"Q_Id":13815107,"Users Score":0,"Answer":"After some investigation, I have solved this problem by myself. Though FoldPanelBar doesn't play well with others in a Sizer, if it's the only one in a sizer, it works. weird.","Q_Score":0,"Tags":"wxpython","A_Id":13878574,"CreationDate":"2012-12-11T06:55:00.000","Title":"Resize FoldPanelBar in AuiManager","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My wx GUI shows thumbnails, but they're slow to generate, so:\n\nThe program should remain usable while the thumbnails are generating.\nSwitching to a new folder should stop generating thumbnails for the old folder.\nIf possible, thumbnail generation should make use of multiple processors.\n\nWhat is the best way to do this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":155,"Q_Id":13830557,"Users Score":4,"Answer":"Putting the thumbnail generation in a background thread with threading.Thread will solve your first problem, making the program usable.\nIf you want a way to interrupt it, the usual way is to add a \"stop\" variable which the background thread checks every so often (e.g., once per thumbnail), and the GUI thread sets when it wants to stop it. Ideally you should protect this with a threading.Condition. (The condition isn't actually necessary in most cases\u2014the same GIL that prevents your code from parallelizing well also protects you from certain kinds of race conditions. But you shouldn't rely on that.)\nFor the third problem, the first question is: Is thumbnail generation actually CPU-bound? If you're spending more time reading and writing images from disk, it probably isn't, so there's no point trying to parallelize it. But, let's assume that it is.\nFirst, if you have N cores, you want a pool of N threads, or N-1 if the main thread has a lot of work to do too, or maybe something like 2N or 2N-1 to trade off a bit of best-case performance for a bit of worst-case performance.\nHowever, if that CPU work is done in Python, or in a C extension that nevertheless holds the Python GIL, this won't help, because most of the time, only one of those threads will actually be running.\nOne solution to this is to switch from threads to processes, ideally using the standard multiprocessing module. It has built-in APIs to create a pool of processes, and to submit jobs to the pool with simple load-balancing.\nThe problem with using processes is that you no longer get automatic sharing of data, so that \"stop flag\" won't work. You need to explicitly create a flag in shared memory, or use a pipe or some other mechanism for communication instead. The multiprocessing docs explain the various ways to do this.\nYou can actually just kill the subprocesses. However, you may not want to do this. First, unless you've written your code carefully, it may leave your thumbnail cache in an inconsistent state that will confuse the rest of your code. Also, if you want this to be efficient on Windows, creating the subprocesses takes some time (not as in \"30 minutes\" or anything, but enough to affect the perceived responsiveness of your code if you recreate the pool every time a user clicks a new folder), so you probably want to create the pool before you need it, and keep it for the entire life of the program.\nOther than that, all you have to get right is the job size. Hopefully creating one thumbnail isn't too big of a job\u2014but if it's too small of a job, you can batch multiple thumbnails up into a single job\u2014or, more simply, look at the multiprocessing API and change the way it batches jobs when load-balancing.\nMeanwhile, if you go with a pool solution (whether threads or processes), if your jobs are small enough, you may not really need to cancel. Just drain the job queue\u2014each worker will finish whichever job it's working on now, but then sleep until you feed in more jobs. Remember to also drain the queue (and then maybe join the pool) when it's time to quit.\nOne last thing to keep in mind is that if you successfully generate thumbnails as fast as your computer is capable of generating them, you may actually cause the whole computer\u2014and therefore your GUI\u2014to become sluggish and unresponsive. This usually comes up when your code is actually I\/O bound and you're using most of the disk bandwidth, or when you use lots of memory and trigger swap thrash, but if your code really is CPU-bound, and you're having problems because you're using all the CPU, you may want to either use 1 fewer core, or look into setting thread\/process priorities.","Q_Score":0,"Tags":"python,multithreading,user-interface,wxpython","A_Id":13830881,"CreationDate":"2012-12-11T23:57:00.000","Title":"Python: Interruptable threading in wx","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I got curious and have been reading about GUI development using Python for the past hour. After reading documentation of wxPython, PyQt, Nokia's Python bindings for Qt along with Tkinter a question came to my mind.\nWhen I create a console application with Python, it runs using the embedded Python interpreter (which I assume is usually if not always in my case cpython).\nSo I was wondering, what's the case with these \"widget toolkits\"?\n\nHow is the Python code executed and what interprets it (or executed it)?\n\nWhich part of my Python code is interpreted using the Python\ninterpreter?\n\nOr does the Python code get lexically analysed and then parsed by the widget's\ntoolkit which then interpretes and executes (or compile during build)?\n\n\nI am looking forward to understanding what goes on in the background in comparison with Python applications' (a bit simpler to understand) interpretation with the Python interpreter.\nThank you.\nPS. To whichever genius thinks that this question deserves to be closed;\nA lot of people wonder the internals of external libraries and systems. Especially those which are not as simple as they look. There currently is not any question explaining this on SE.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1387,"Q_Id":13867475,"Users Score":8,"Answer":"This is just a really generalized high-level explanation about \"GUI toolkits\"...\nLets say you decide to use the Qt framework. This framework is written in C++. There are two different python bindings that can be used, allowing one to write a GUI application in python against the same API as the C++ version.\nThe python bindings provide a wrapping around calls into the C++ code. PyQt4 for instance uses sip, while PySide uses shiboken. These are just language wrapping tools that take specifications for how to map between the C++ objects and their intended python interface.\nOk, so you start using PyQt... All of the code you write has to pass through the python interpreter. Some of it may be pure python. Some of it will call into C++ libs to create things like your widgets. In Qt, there will be a C++ pointer associated with the python instance counterpart. \nIt is the C++ layer that is then communicating with the window manager of your platform, to turn platform-independent API calls into something platform specific, like how to exactly draw a button or menu. \nWhether you create a console only or GUI based python application, it all goes through the python interpreter to interpret your python code. Something must interpret the python language for you.","Q_Score":3,"Tags":"python,user-interface,wxpython,tkinter,pyside","A_Id":13867619,"CreationDate":"2012-12-13T19:58:00.000","Title":"How is Python interpreted with wxPython, PyQt, PySide or Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to write a program that asks the user a series of questions in different dialog boxes. Each box shows up one at a time, and goes to the next box if the button next is clicked. My question is do I create a class for each Dialog and just call the next class once the button next is clicked? Or is there a more elegant solution to this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1732,"Q_Id":13873190,"Users Score":0,"Answer":"Are you sure you have to create a class for a Dialog? Isn't Tkinter built-in dialog class ok?\nYou could provide an iterator of Dialogs to a next() function, which every Next button would call when clicked. Did you mean something like that?","Q_Score":2,"Tags":"python,user-interface,python-2.7,tkinter,gui-designer","A_Id":13875940,"CreationDate":"2012-12-14T05:27:00.000","Title":"How to design GUI sequence in Tkinter with Python 2.7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Windows 7 (32bit).\nAs a programming exercise, I have to make a reminder using tkinter.\nTo be more specified :\nMy main project is to help people who suffer from alzheimer disease.\nSo, one of my targets is to make a reminder for helping them do the necessary activities\/things.\nFor example,\nAt 14:00 o'clock, create a messagebox (and if it possible play a sound)..saying \"It's time to eat\".\nThen at 18:00 o'clock, create a messagebox (and if it possible play a sound)..saying \"It's time for a walk\".\netc...\nHow I can do this?\nIs there a special module or some tools in python(or in tkinter) that can help me?\nBefore, coding in Visual Basic as remember I used something like \"Timer\"..But I can't remember more about this.. :P\nThanks in advance.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":292,"Q_Id":13875641,"Users Score":0,"Answer":"At first thought you can have a tk config dialog, where you can add new rules, edit messagebox strings etc. Then you will have in which you will use the time module. From there you can access the system time. \nIf you want to display windows messageboxes, you can find them in the ctypes libary.","Q_Score":3,"Tags":"python,time,tkinter","A_Id":13875712,"CreationDate":"2012-12-14T09:13:00.000","Title":"Reminder Using Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to run my program inside Tkinter?\nI have a program which fits the curves. I want to make it GUI and looking for the ways to insert it into Tkinter.\nI want my program to run after clicking a BUTTON widget.  Is there a option in Tkinter to run another file.py?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2372,"Q_Id":13877727,"Users Score":0,"Answer":"To run another file, you can import it, or load the data with\n\nfile = open(\"filename.txt\", \"r\")\n\nthen use \n\nexec(string) \n\nto run the program inside it.","Q_Score":2,"Tags":"python,tkinter","A_Id":13877837,"CreationDate":"2012-12-14T11:23:00.000","Title":"Run my program inside Tkinter program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I have the wxPython notebooks tabs be center on the top?\nEXTRA TEXT TO MAKE IT LOOK LONGER EVER THOUGH IT IS A SIMPLE QUESTION.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":106,"Q_Id":13898391,"Users Score":1,"Answer":"Notebook tabs always start off in the top left for the native widget. The only thing you can change is which side the tabs appear on (i.e. top, left, bottom or right). You cannot control where on the side they appear.\nYou might be able to take FlatNotebook and hack it a bit to add this functionality since it is written in pure Python versus wx.Notebook which is wrapped C++.","Q_Score":0,"Tags":"wxpython","A_Id":13918810,"CreationDate":"2012-12-16T03:38:00.000","Title":"wxPython notebook have tabs be center top?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to get the content of DataWindow from PBL (PowerBuilder Library) file and edit it in place. The idea is to read the pbl file, and access individual DataWindows to modify source code. Somehow, I have managed to do the first part with PblReader .NET library using IronPython. It allows me to read PBL files, and access DataWindow source code. However it doesn't support modifications. I would like to know if anyone have an idea for editing PBL files?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3599,"Q_Id":13920682,"Users Score":1,"Answer":"A PowerBuilder application can load a DataWindow from a PBL (doesn't have to be in the library path), modify it, and save it back to the PBL. I've written a couple of tools that do that. PowerBuilder will allow you to modify the DataWindow according to its object model using the modify method. I don't know why anyone would want to reinvent all of this. I recall seeing Python bindings for PB somewhere. You could get the DW syntax from PB, call out to Python, then save it back in PB. But you'd have to do all the parsing in Python, whereas PB already understands the DW. Finally I'm surprised Terry didn't plug PBL Peeper. You could use PBL Peeper to export the DataWindows, massage them to your hearts's content in Python. then import them back into PB.","Q_Score":1,"Tags":"python,.net,powerbuilder","A_Id":13943263,"CreationDate":"2012-12-17T19:19:00.000","Title":"idea\/solution how to edit PBL (PowerBuilder Library) files?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is my first question ever so bear with me!\nCurrently in my program, I have a parent widget which acts as a canvas. The user can add or remove widgets to the parent at run-time. Those widgets are then given an absolute position, that is, they are not positioned by a layout. Once added, a widget can be moved around arbitrarily by the user.\nI want the user to be able to select a group of widgets by dragging a box around them. I have already coded the part that displays the rectangle while the user is dragging. Now, I want to be able to retrieve all the widgets within that rectangle (region).\nI am aware of the findChild() and findChildren() functions, and they indeed do return the children as they are supposed to. But what I'd really need is a way to limit the search to the boundaries of the region since there will most-likely be quite a lot of widgets within the 'canvas'. (There could be thousands of widgets spread over a very large area due to the nature of what I'm doing!)\nHere is my question: What would be my best option? Should I just go ahead and use findChildren() and loop through the list to find the children within the region manually. Or should I loop through all the pixels within the region using findChild(x, y)? Or perhaps there is an even simpler solution that would speed up the process? Something along the lines of findChildren(x, y, width, height)?\nHopefully my question made sense. I tried to explain things as best as I could. Thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":493,"Q_Id":13924980,"Users Score":3,"Answer":"If you had used QGraphicsScene instead of rolling your own, you could have used the items(..) methods to very efficiently find your children in a particular area.\nIt's only possible in QGraphicsScene because it uses a BSP spatial acceleration structure, so if you cannot migrate to QGraphicsScene in a  reasonable amount of time - you are going to have write your own.  It's not as hard as it sounds, I've written numerous bounding volume hierarchy structures and they're quite straightforward.","Q_Score":3,"Tags":"python,qt,pyqt","A_Id":13928629,"CreationDate":"2012-12-18T01:26:00.000","Title":"Qt: get all children within region of the parent","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I`m using pyPdf to crop pdf pages. \nAnd the only thing i miss, is GUI for this script.\nI picked up tkinter  module to do the GUI, but i cannot find whether it is possible to display pdf pages with GUI created with tkinter. \nAny thoughts ?\nThank you.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2722,"Q_Id":13934268,"Users Score":1,"Answer":"Tkinter has no support for displaying pdf.","Q_Score":1,"Tags":"python,python-2.7,tkinter,pypdf","A_Id":13934811,"CreationDate":"2012-12-18T13:39:00.000","Title":"display pdf pages with GUI on tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've wrapped a C++ class using Boost.Python. These Objects have strong references (boost::shared_ptr) on the C++-side, and there may be intermittent strong references in Python as well. So far, everything works well. However, if I create a python weak reference from one of the strong references, this weak reference is deleted as soon as the last python strong reference disappears. I'd like the weak reference to stay alive until the last strong reference on the C++ side disappears as well. Is it possible to achieve that?\nPhrased another way: Is there a way to find out from python if a particular C++ object (wrapped by Boost.Python) still exists?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":241,"Q_Id":13956055,"Users Score":1,"Answer":"How are you holding a \"C++ strong reference\" to the wrapped class ?\nI'm quite rusty on boost python, but I believe it's the boost::shared_ptr's deleter presence which ensures lifetime management.\nIf that isn't the problem, you probably need to hold the instance in C++ in a boost::python::object.","Q_Score":6,"Tags":"c++,python,boost-python","A_Id":13989547,"CreationDate":"2012-12-19T15:49:00.000","Title":"Boost.Python: Getting a python weak reference to a wrapped C++ object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a beginning programmer in Python and I have a strange problem with my computer. When I have a .py file on my computer (containing a script that works), and I double click on it to open, the following happens: the program opens (it's the black screen view), but it shuts itself down within a second, and the program isn't executed. However, when I right click and choose \"edit with IDLE\", everything works as normal. \nI didn't have this problem from the beginning on, but then I installed some other versions of Python and I think that's the moment when scripts didn't want to open anymore.","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":218,"Q_Id":13959257,"Users Score":2,"Answer":"but it shuts itself down within a second, and the program isn't executed.\n\nYes, the program is being executed. It is being executed so quickly that you don't have a chance to see what is happening.\nPut raw_input() at the end of your code so that the console window doesn't close instantly.","Q_Score":1,"Tags":"python,windows","A_Id":13959312,"CreationDate":"2012-12-19T19:00:00.000","Title":"computer (windows XP) doesn't want to open .py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a beginning programmer in Python and I have a strange problem with my computer. When I have a .py file on my computer (containing a script that works), and I double click on it to open, the following happens: the program opens (it's the black screen view), but it shuts itself down within a second, and the program isn't executed. However, when I right click and choose \"edit with IDLE\", everything works as normal. \nI didn't have this problem from the beginning on, but then I installed some other versions of Python and I think that's the moment when scripts didn't want to open anymore.","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":218,"Q_Id":13959257,"Users Score":2,"Answer":"Austin is right, you made a console app, and once its finished(in microseconds), it closes itself.\nCreate a mainloop or use Austin's trick, to force app not to close itself.","Q_Score":1,"Tags":"python,windows","A_Id":13959538,"CreationDate":"2012-12-19T19:00:00.000","Title":"computer (windows XP) doesn't want to open .py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a cross-platform application (Ubuntu and Android) with a notification icon. Is there a standard way to create such an app using Kivy?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":641,"Q_Id":13962888,"Users Score":5,"Answer":"Short answer, no\u2026 if you want to define such an API and implement it using platform-specific libs (libnotify on Ubuntu, and pyjnius on Android), that would be welcomed though. Others will help make it work on other platforms.","Q_Score":5,"Tags":"android,python,linux,notifications,kivy","A_Id":14005492,"CreationDate":"2012-12-19T23:20:00.000","Title":"Kivy: crossplatform notification icon","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have my game running in a while True loop and I would like to be able to ask the user to \"Play again?\" I already have the code for a rect to pop up with the text but I need a way for the user to click on the rect or hit y for yes and the code run its self again.","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":25890,"Q_Id":13984066,"Users Score":1,"Answer":"To tell if the user clicked on the rect, just set a 1 by 1 rect at the mouse position then when they click, check if the rects are colliding. Then, just call the loop again by having it be its own function, like DeadChex said.","Q_Score":4,"Tags":"python,user-controls,while-loop,pygame","A_Id":14188676,"CreationDate":"2012-12-21T03:58:00.000","Title":"Pygame restart?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have my game running in a while True loop and I would like to be able to ask the user to \"Play again?\" I already have the code for a rect to pop up with the text but I need a way for the user to click on the rect or hit y for yes and the code run its self again.","AnswerCount":5,"Available Count":2,"Score":0.0798297691,"is_accepted":false,"ViewCount":25890,"Q_Id":13984066,"Users Score":2,"Answer":"Have the loop it's own method, call it from a main() run, when the game is over and ends, have main() ask the user if they want to play again, and if so recall the main loop after setting everything as its default\nor\nJust have the part that asks again clear and reinitialize all variables as there defaults and let the loop  if the user wants to play again","Q_Score":4,"Tags":"python,user-controls,while-loop,pygame","A_Id":13984092,"CreationDate":"2012-12-21T03:58:00.000","Title":"Pygame restart?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"By default, the built-in views in PyQt can auto-refresh itself when its model has been updated. I wrote my own chart view, but I don't know how to do it, I have to manually update it for many times. \nWhich signal should I use?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5032,"Q_Id":13999970,"Users Score":0,"Answer":"You need to connect your view to the dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) signal of the model:\n\nThis signal is emitted whenever the data in an existing item changes.\nIf the items are of the same parent, the affected ones are those\n  between topLeft and bottomRight inclusive. If the items do not have\n  the same parent, the behavior is undefined.\nWhen reimplementing the setData() function, this signal must be\n  emitted explicitly.","Q_Score":3,"Tags":"python,qt,user-interface,qt4,pyqt","A_Id":14000161,"CreationDate":"2012-12-22T04:07:00.000","Title":"PyQt - Automatically refresh a custom view when the model is updated?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I've written a curses program in python. It runs fine. However, when I use nodelay(), the program exits straight away after starting in the terminal, with nothing shown at all (just a new prompt).\nEDIT\nThis code will reproduce the bug: \n\nsc = curses.initscr()\n\nsc.nodelay(1) # But removing this line allows the program to run properly\n\nfor angry in range(20):\n        sc.addstr(angry, 1, \"hi\")\n\n\nHere's my full code\n\nimport curses, time, sys, random\n\ndef paint(x, y, i):\n        #...\ndef string(s, y):\n        #...\n\ndef feed():\n        #...\n\nsc = curses.initscr()\ncurses.start_color()\ncurses.curs_set(0)\nsc.nodelay(1) #########################################\n\n # vars + colors inited\n\nfor angry in range(20):\n        try:\n                dir = chr(sc.getch())\n\n                sc.clear()\n\n                feed()\n\n                #lots of ifs\n\n                body.append([x, y])\n                body.pop(0)\n\n                for point in body:\n                        paint(*point, i=2)\n\n                sc.move(height-1, 1)\n                sc.refresh()\n                time.sleep(wait)\n\n        except Exception as e:\n                print sys.exc_info()[0], e\n\nsc.getch()\ncurses.beep()\n\ncurses.endwin()\n\nWhy is this happenning, and how can I use nodelay() safely?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":5827,"Q_Id":14004835,"Users Score":1,"Answer":"While I didn't use curses in python, I am currently working with it in C99, compiled using clang on Mac OS Catalina. It seems that nodelay()` does not work unless you slow down the program step at least to 1\/10 of a second, eg. usleep(100000). I suppose that buffering\/buffer reading is not fast enough, and getch() or wgetch(win*) simply doesn't manage to get the keyboard input, which somehow causes it to fail (no message whatsoever, even a \"Segmentation fault\").\nFor this reason, it's better to use halfdelay(1), which equals nodelay(win*, true) combined with usleep(100000).\nI know this is a very old thread (2012), but the problem is still present in 2022, so I decided to reply.","Q_Score":7,"Tags":"python,ncurses,curses","A_Id":72080593,"CreationDate":"2012-12-22T17:13:00.000","Title":"nodelay() causes python curses program to exit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I've written a curses program in python. It runs fine. However, when I use nodelay(), the program exits straight away after starting in the terminal, with nothing shown at all (just a new prompt).\nEDIT\nThis code will reproduce the bug: \n\nsc = curses.initscr()\n\nsc.nodelay(1) # But removing this line allows the program to run properly\n\nfor angry in range(20):\n        sc.addstr(angry, 1, \"hi\")\n\n\nHere's my full code\n\nimport curses, time, sys, random\n\ndef paint(x, y, i):\n        #...\ndef string(s, y):\n        #...\n\ndef feed():\n        #...\n\nsc = curses.initscr()\ncurses.start_color()\ncurses.curs_set(0)\nsc.nodelay(1) #########################################\n\n # vars + colors inited\n\nfor angry in range(20):\n        try:\n                dir = chr(sc.getch())\n\n                sc.clear()\n\n                feed()\n\n                #lots of ifs\n\n                body.append([x, y])\n                body.pop(0)\n\n                for point in body:\n                        paint(*point, i=2)\n\n                sc.move(height-1, 1)\n                sc.refresh()\n                time.sleep(wait)\n\n        except Exception as e:\n                print sys.exc_info()[0], e\n\nsc.getch()\ncurses.beep()\n\ncurses.endwin()\n\nWhy is this happenning, and how can I use nodelay() safely?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":5827,"Q_Id":14004835,"Users Score":0,"Answer":"I see no difference when running your small test program with or without the sc.nodelay() line. \nNeither case prints anything on the screen...","Q_Score":7,"Tags":"python,ncurses,curses","A_Id":14006585,"CreationDate":"2012-12-22T17:13:00.000","Title":"nodelay() causes python curses program to exit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I need to store cookies persistently in an application that uses QWebKit. I understand that I have to create a subclass of QNetworkCookieJar and attach it to a QNetworkAccessManager. But how do I attach this QNetworkAccessManager to my QWebView or get the QNetworkAccessManager used by it?\nI use Python 3 and PyQt if that is important.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1268,"Q_Id":14034401,"Users Score":4,"Answer":"You can get\/set the cookie jar through QWebView.page().networkAccessManager().cookieJar()\/setCookieJar().\nThe Browser demo included with Qt (in C++) shows how to read and write cookies to disk.","Q_Score":3,"Tags":"python,qt,cookies,qwebkit","A_Id":14039648,"CreationDate":"2012-12-25T22:21:00.000","Title":"Permanent cookies with QWebKit -- where to get the QNetworkAccessManager?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using DataViewListCtrl and i add itemswith \n\nAppendItem([\"test123\"])\n\nHow can i add data associated with each item?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1889,"Q_Id":14043470,"Users Score":2,"Answer":"Old question, I know, but there should be an answer.\nAppendItem([\"test123\", \"data for second column\", \"third column\", \"etc...\"])","Q_Score":1,"Tags":"wxpython","A_Id":36878217,"CreationDate":"2012-12-26T16:44:00.000","Title":"WxPython DataViewListCtrl item data","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm designing a \"settings\" frame for a Python\/Tkinter app that lets the user specify an IP address, port number, and a couple other configurable options.  I want to validate the user entries before letting the user close the frame to apply them.\nBased on what I've read up on (and tried) so far with the Entry widget's validate and validatecommand options, the only choices they offer are \"heavy-handed\" validations.  The kind where the user is blocked from leaving the Entry widget (or even typing any more keystrokes) until the entry is valid.  This is exactly the behavior I avoid when designing a GUI because it's annoying as all get-out for the user.\nI'm planning on switching over to using .trace methods to keep watch on the values, and just disabling the \"OK\/Apply\" button until all of the entries in the frame are valid.  Before I do that though, I wanted to know whether I'm missing anything with regards to the built-in validation options.  Is there an option I missed that's less heavy-handed?","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":471,"Q_Id":14055551,"Users Score":2,"Answer":"You can use the validation feature without the \"heavy-handedness\". Have your validation always return True after setting the state of the ok\/apply button.","Q_Score":0,"Tags":"python,tkinter","A_Id":14056624,"CreationDate":"2012-12-27T13:32:00.000","Title":"Does Tkinter validation have to be heavy-handed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm designing a \"settings\" frame for a Python\/Tkinter app that lets the user specify an IP address, port number, and a couple other configurable options.  I want to validate the user entries before letting the user close the frame to apply them.\nBased on what I've read up on (and tried) so far with the Entry widget's validate and validatecommand options, the only choices they offer are \"heavy-handed\" validations.  The kind where the user is blocked from leaving the Entry widget (or even typing any more keystrokes) until the entry is valid.  This is exactly the behavior I avoid when designing a GUI because it's annoying as all get-out for the user.\nI'm planning on switching over to using .trace methods to keep watch on the values, and just disabling the \"OK\/Apply\" button until all of the entries in the frame are valid.  Before I do that though, I wanted to know whether I'm missing anything with regards to the built-in validation options.  Is there an option I missed that's less heavy-handed?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":471,"Q_Id":14055551,"Users Score":1,"Answer":"If you use trace, then you have what you want without needing to use Tkinter's validation at all. Make all traces go to the same function, where you test and validate all your values as you wish, and according to that enable or disable the ok button.","Q_Score":0,"Tags":"python,tkinter","A_Id":14055762,"CreationDate":"2012-12-27T13:32:00.000","Title":"Does Tkinter validation have to be heavy-handed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So my App needs to be able to open a single webpage(and it must be from the internet and not saved) in it, and specifically I'd like to use the Tkinter GUI toolkit since it's the one i'm most comfortable with. On top of that though, I'd like to be able to generate events in the window(say a mouse click) but without actually using the mouse. What's a good method to go about this?\nEDIT: I suppose to clarify this a bit, I need a way to load a webpage, or maybe even a specific java applet into a tkinter widget or window. Or if not that perhaps another method to do this where I can generate mouse and keyboard events without using either the mouse of the keyboard.","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":8422,"Q_Id":14076674,"Users Score":2,"Answer":"Tkinter does not have a widget that can render a web page.","Q_Score":4,"Tags":"python,tkinter","A_Id":14077404,"CreationDate":"2012-12-28T22:38:00.000","Title":"Using Tkinter to open a webpage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using python webkit.WebView and gtk to crawl a web page. However, the web page is kind of dynamically loaded by javascript. \nThe WebView \"load-finished\" event is not sufficient to handle this. Is there any indicator\/event to let me know that the page is really fully loaded even the content produced by javascript?\nThanks,","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":218,"Q_Id":14093870,"Users Score":4,"Answer":"There is no real way to determine if that page is fully loaded.\nOne method is to determine the amount of time since the last request.  However, some pages will make repeated requests continually.  This is common with tracking scripts and some ad scripts.\nWhat I would do is use a set amount of time after the web view has said it finished loading... 5 seconds or so.  It isn't perfect, but is the best you got, as there is no way to determine what \"fully loaded\" is for an arbitrary page.","Q_Score":6,"Tags":"javascript,python,webview,webkit,web-crawler","A_Id":14094212,"CreationDate":"2012-12-30T19:26:00.000","Title":"How do I know a page is really fully loaded?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I was working with GUI automation for visual studio C# desktop application.\nThere I have DataGridView and inside the grid I have combo box and check boxes.\nI tried to automate these using pywinauto, I can get only grid layout control only\nand internal things I cant able to get the controls\n(I tried with print _control_identifiers() , Swapy, AutoIT Window Info and winspy also..)\nanyone plz tell me how to automate visual studio C#  DataGridView  and its sub controls using pywinauto for desktop application??","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":1878,"Q_Id":14101063,"Users Score":3,"Answer":"The short answer is that there's no good way to automate sub-controls of a DataGridView using PyWinAuto.\nIf you want to read data out of a DataGridView (e.g. read the text contents of a cell, or determine whether a checkbox is checked), you are completely out of luck.  If you want to control a DataGridView, there are two approaches that you can try:\n\nclicking at various coordinate offsets.  \nsending keypresses to it to mimic keyboard navigation.  \n\nThese may work if your DataGridView has a small amount of data in it, but once the DataGridView starts needing scrollbars you're out of luck.  Furthermore, clicking at offsets is sensitive to the sizes of the rows and columns, and if the columns can be resized then this approach will never be reliable.","Q_Score":0,"Tags":"c#,python,ui-automation,pywinauto","A_Id":14104632,"CreationDate":"2012-12-31T11:36:00.000","Title":"C# GUI automation using PyWinAuto","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found some many Python GUI toolkits. \nThe ones I like are:\n\nwxPython\npyGTK\nTkinter\npyQt\npySide\n\nWhich one is the best and easiest to use? \nAnd by the way what is the difference in pyQt and pySide? They both seem to be alike :\/.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":8808,"Q_Id":14106229,"Users Score":4,"Answer":"There is no \"best\" nor \"easiest\". All of the toolkits you mention have strengths and weaknesses. I've had significant experience with wxPython and Tkinter, and both are nice. I would say Tkinter is a little easier, wxPython is a little more full-featured. \nWhen someone asks me this question I tell them just to pick one. Once you learn one -- any one -- you'll be in a better position to decide for yourself which one is better than the others. \nI recommend Tkinter just because you probably already have it, but if you're not afraid of installing other GUI toolkits, pick any of them and start coding.","Q_Score":6,"Tags":"python,python-2.7,user-interface","A_Id":14106272,"CreationDate":"2012-12-31T21:35:00.000","Title":"Which is the best and easiest Python GUI toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have question and want to see if it can be realized in wxpython.\n   I would like to plot data on wxpython, and then use the mouse to select some points which are plotted, using the mouse.\nAt the moment i am using wx.lib.plot and using the PlotMarker\nIs there a way of doing this with wx.lib.plot or do i have to use another graph library \nRegards!","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":944,"Q_Id":14138946,"Users Score":0,"Answer":"You can use matplotlib or pygal. Something similar with your describing technique is used in PyQtGraph.","Q_Score":0,"Tags":"python","A_Id":14139047,"CreationDate":"2013-01-03T12:27:00.000","Title":"interactive graph python wx.lib.plot. selecting some points","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made an app with PySide. When ever I run the app the GUI shows up but the CMD window is still there too. How do I hide it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":228,"Q_Id":14139190,"Users Score":1,"Answer":"Run the app using pythonw it will hide the window","Q_Score":1,"Tags":"python,qt,python-2.7,pyside","A_Id":14139249,"CreationDate":"2013-01-03T12:43:00.000","Title":"How to hide the CMD window in PySide app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i'm looking for a solution, either in linux or in windows, that allows me to\n\nrecord video (+audio) from my webcam & microphone, simultaneously.\nsave it as a file.AVI (or mpg or whatever)\ndisplay the video on the screen while recording it\n\nCompression is NOT an issue in my case, and i actually prefer to capture RAW and compress it later.\nSo far i've done it with an ActiveX component in VB which took care of everything, and i'd like to progress with python (the VB solution is unstable, unreliable).\nso far i've seen code that captures VIDEO only, or individual frames... \nI've looked so far at\n\nOpenCV - couldn't find audio capture there\nPyGame - no simultaneous audio capture (AFAIK)\nVideoCapture - provide only single frames.\nSimpleCV - no audio\nVLC - binding to VideoLAN program into wxPthon - hopefully it will do (still investigating this option)\nkivy - just heard about it, didn't manage to get it working under windows SO FAR.\n\nThe question - is there a video & audio capture library for python?\nor - what are the other options if any?","AnswerCount":7,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":75201,"Q_Id":14140495,"Users Score":0,"Answer":"You can do offline html,js code to do video with audio recording. Using python lib python webview open that page. It should work fine.","Q_Score":29,"Tags":"python,video-capture","A_Id":68495610,"CreationDate":"2013-01-03T14:08:00.000","Title":"How to capture a video (AND audio) in python, from a camera (or webcam)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anyone know of a GUI design app that lets you choose\/drag\/drop the widgets, and then turn that layout into Python code with the appropriate Tkinter calls & arrangement using the grid geometry manager?  So far I've turned up a couple of pretty nice options that I may end up using, but they generate code using either pack or place instead.\n=========\nEDIT:  Please note this is not to seek a \"recommendation\" per se, but rather it is a factual inquiry.  I was asking whether or not such an app exists.\n=====\nBefore you say it:  Yes, I know Tkinter is easy to learn, and Yes, I've found multiple online sources to help me do so, and I'm already on my way with that.  This isn't about avoiding the effort of learning, it's about using the right tool for the job.  I found out a long time ago that those drag-and-drop widget environments for coding program logic, are just too klunky and unmanageable when the project gets beyond a certain size -- for bigger stuff, it's just easier to build and maintain the logic when it's in plain text.  More recently I've found out that the reverse is true for designing a GUI.  Writing text works up to a point, but when you have a main window with 30 or 40 widgets, plus a couple of side windows each with similar complexity, it goes much faster and easier if you can design it graphically rather than typing it all out.","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":150823,"Q_Id":14142194,"Users Score":30,"Answer":"The best tool for doing layouts using grid, IMHO, is graph paper and a pencil. I know you're asking for some type of program, but it really does work. I've been doing Tk programming for a couple of decades so layout comes quite easily for me, yet I still break out graph paper when I have a complex GUI. \nAnother thing to think about is this: The real power of Tkinter geometry managers comes from using them together*. If you set out to use only grid, or only pack, you're doing it wrong. Instead, design your GUI on paper first, then look for patterns that are best solved by one or the other. Pack is the right choice for certain types of layouts, and grid is the right choice for others. For a very small set of problems, place is the right choice. Don't limit your thinking to using only one of the geometry managers. \n* The only caveat to using both geometry managers is that you should only use one per container (a container can be any widget, but typically it will be a frame).","Q_Score":59,"Tags":"python,grid,tkinter","A_Id":14144121,"CreationDate":"2013-01-03T15:44:00.000","Title":"Is there a GUI design app for the Tkinter \/ grid geometry?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My PyGTK application creates a secondary popup window for displaying a preview of results. This window is fairly elaborate, with Table widgets nested three deep and populated by HBoxes containing one Label each at the lowest level. The number of Labels total can be in the thousands. I am noticing that when I close this window, GTK becomes extremely busy processing something (functions added with gobject.idle_add don't resolve for >10 seconds) and the main window of my application becomes unresponsive in this time. Even with this many widgets, it seems strange to me that the window should take so long to close, longer even than it takes to set up and display. Is there any way to mitigate this? (I tried creating and showing the window in another thread, but apparently with GTK this is a no-no)","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":88,"Q_Id":14147434,"Users Score":0,"Answer":"Apparently it was being caused by my attempt to change the background color of the tables--I was setting the background color of every HBox (and Label), which was responsible for nearly all of the excessive teardown time. All I had to do was set the background color of the Viewports the Tables are contained in.","Q_Score":0,"Tags":"python,gtk","A_Id":14160390,"CreationDate":"2013-01-03T21:20:00.000","Title":"Excessive hang time when destroying a PyGTK window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My PyGTK application creates a secondary popup window for displaying a preview of results. This window is fairly elaborate, with Table widgets nested three deep and populated by HBoxes containing one Label each at the lowest level. The number of Labels total can be in the thousands. I am noticing that when I close this window, GTK becomes extremely busy processing something (functions added with gobject.idle_add don't resolve for >10 seconds) and the main window of my application becomes unresponsive in this time. Even with this many widgets, it seems strange to me that the window should take so long to close, longer even than it takes to set up and display. Is there any way to mitigate this? (I tried creating and showing the window in another thread, but apparently with GTK this is a no-no)","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":88,"Q_Id":14147434,"Users Score":1,"Answer":"How long takes that window to show up? Are all the widgets created at once when it is displayed? \nYour problem might be caused by the destruction of your thousands of widgets, all at the same time. Or by a lengthy action perform on on of those widgets destruction. But without some code to look at, there could be thousands of reasons, so a ptomato says, use a profiler...","Q_Score":0,"Tags":"python,gtk","A_Id":14156870,"CreationDate":"2013-01-03T21:20:00.000","Title":"Excessive hang time when destroying a PyGTK window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I have an assignment in Computer Science that requires that I put an interactive menu into my python turtle graphics projects. I run on python 2.7.3 and would like some help on what modules to import and a basic outline of how to put an interactive menu into python turtle graphics. Thank you for your answers!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1224,"Q_Id":14177297,"Users Score":0,"Answer":"In 3.x, look at Lib\/turtledemo\/main.py for how to put a turtle canvas into a tkinter window with other stuff.  In 2.x, the turtledemo main code is in Demo\/turtle\/turtleDemo.py in the source repository, but the Demo directory is not installed on Windows.","Q_Score":1,"Tags":"menu,python-2.7,python-idle,turtle-graphics,cheeseshop","A_Id":26772106,"CreationDate":"2013-01-05T22:53:00.000","Title":"How to Insert an Interactive Menu into Python Turtle Graphics","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I call foreign c library in my program using ctypes, I don't know how to assign a POINTER(c_char) variant to a string.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":149,"Q_Id":14191462,"Users Score":0,"Answer":"The question is vague, but I guess you should use c_char_p instead of POINTER(c_char).","Q_Score":0,"Tags":"python,python-2.7","A_Id":14193534,"CreationDate":"2013-01-07T07:12:00.000","Title":"How can I assign a variant of POINTER(c_char) type to a string?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking at a way to take screenshot of DirectX games in Python. I already tried to use PIL and other stuff but I only end up with black screenshots. I saw that the project directpython11 provided a Python binding to some DirectX stuff but I didn't find anything related to screenshot of external DirectX applications.\nI'm kinda lost and any help will be much appreciated ;).\nPS: I'm coding using Python 2.7.3 32 bits on Windows 7.\nThanks","AnswerCount":1,"Available Count":1,"Score":0.761594156,"is_accepted":false,"ViewCount":2931,"Q_Id":14205113,"Users Score":5,"Answer":"This is a rather complicated topic.\nActually taking a screenshot, in the most simplistic way, involves grabbing the backbuffer and writing that to a file. Your Python DirectX bindings should provide support for making a texture and filling it with data, from the back or front buffer; after that the image writing is up to you.\nUnfortunately, getting to the backbuffer requires hooking DirectX and intercepting the render context before the application gets ahold of it. While simple, this is not terribly well-documented and takes a decent bit of (C++) code to implement. You have to force the application to use an alternate render context which you control, then take the screenshot yourself.\nThe basics of this interception cannot, so far as I know, be done in pure Python. You may be able to find a method using the display codec (grabbing the screen after it's been delivered to the compositor), or you could use an existing DirectX hook and implement minimal IPC to grab the data and feed it into Python for processing and writing to a file.\nEdit: If you are interested in doing this, I can add more detail and some links to code that may be helpful. I'm still not sure it's possible in just Python, but don't let that stop you from trying.","Q_Score":2,"Tags":"python,directx,screenshot","A_Id":14205237,"CreationDate":"2013-01-07T22:21:00.000","Title":"Take a screenshot of a DirectX game in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I manage a number of Windows PCs which are used to control equipment. Each computer has a specific program installed which is what people launch to use that equipment. We want to require people to log in before they can access this program.\nCurrently, I have a wxpython app which just launches that executable when people log in with the correct credentials. However, you can just run the program directly and bypass logging on. I'd like to make a mock logon screen, ie, fullscreen and modal, which only goes away when you log in. Also it should not be able to be bypassed by alt-tab, windows key, etc. How might I accomplish this with wxpython?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":95,"Q_Id":14206982,"Users Score":1,"Answer":"There is no full proof way to do this on Windows. You can show a wx.Frame modally using its MakeModal() method. And you can catch EVT_CLOSE and basically veto it it they try to close the frame. However, if they have access to the Task Manager or even Run, they can probably get around the screen. Most users won't be that smart though. You can delete the shortcuts to the apps you want to launch with wx and that will force most normal users to use your login screen. It's only the smart ones who like to troll through the file system who will go around it.","Q_Score":0,"Tags":"windows,authentication,wxpython,modal-dialog","A_Id":14217396,"CreationDate":"2013-01-08T01:35:00.000","Title":"Logon-type wxpython app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is one of those just-making-sure-I-didn't-miss-anything posts.\nI have a TKinter GUI in Python 2.7.3 that includes a listbox, and there are circumstances where I'd like to directly modify the text of a specific item at a known index.  I've scoured the documents and there's no lb.itemset() method or anything like it.  As best I can tell I have two options, either of which would work but just seem kind of klunky to me:\n\nlb.delete() the old item and lb.insert() the new value for it at the same index (including a step to re-select the new value if the old deleted one happened to be selected).\nCreate a listvariable for the listbox, then use get() and set() on it -- with a pile of replace\/split\/join acrobatics in between to handle the differing string formats involved.\n\nIs there some simpler, more direct way to do it that I'm missing?  Or have I turned up all the available options?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1274,"Q_Id":14222670,"Users Score":2,"Answer":"Assuming from silence that there's nothing I missed.  I went with option 2 -- the acrobatics weren't quite as complex as I'd thought.  I just created a behind-the-scenes list wrapped up in a class; every time I update the list, the class syncs up the content of the listbox by doing a ' '.join on the list then setting the listbox's listvariable to the resulting string.","Q_Score":3,"Tags":"listbox,python-2.7,tkinter","A_Id":14251259,"CreationDate":"2013-01-08T19:34:00.000","Title":"Directly modify a specific item in a TKinter listbox?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a library, example or similar that allows me to loads a set of 2D projections of an object and then converts it into a 3D volume.\nFor example, I could have 6 pictures of a small toy and the program should allow me to view it as a 3D volume and eventually save it.\nThe object I need to convert is very similar to a cylinder (so the program doesn't have to 'understand' what type of object it is).","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1288,"Q_Id":14232451,"Users Score":2,"Answer":"There are several things you can mean, I think none of which currently exists in free software (but I may be wrong about that), and they differ in how hard they are to implement:\nFirst of all, \"a 3D volume\" is not a clear definition of what you want. There is not one way to store this information. A usual way (for computer games and animations) is to store it as a mesh with textures. Getting the textures is easy: you have the photographs. Creating the mesh can be really hard, depending on what exactly you want.\nYou say your object looks like a cylinder. If you want to just stitch your images together and paste them as a texture over a cylindrical mesh, that should be possible. If you know the angles at which the images are taken, the stitching will be even easier.\nHowever, the really cool thing that most people would want is to create any mesh, not just a cylinder, based on the stitching \"errors\" (which originate from the parallax effect, and therefore contain information about the depth of the pictures). I know Autodesk (the makers of AutoCAD) have a web-based tool for this (named 123-something), but they don't let you put it into your own program; you have to use their interface. So it's fine for getting a result, but not as a basis for a program of your own.\nOnce you have the mesh, you'll need a viewer (not view first, save later; it's the other way around). You should be able to use any 3D drawing program, for example Blender can view (and edit) many file types.","Q_Score":0,"Tags":"python,image-processing,3d,2d","A_Id":14233016,"CreationDate":"2013-01-09T09:53:00.000","Title":"2D image projections to 3D Volume","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a notebook window. I want to change dynamically size. I did expand dynamically, but I couldn't shrink it. I used win.set_size_request(w,h) for expand. How can I shrink dynamically?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":329,"Q_Id":14236918,"Users Score":0,"Answer":"You likely have widgets on your pages that are stopping them from shrinking. You may need to put the content of your pages in a ViewPort or ScrolledWindow to get the effect you are looking.","Q_Score":0,"Tags":"python,gtk","A_Id":14327100,"CreationDate":"2013-01-09T14:00:00.000","Title":"Gtk Notebook size dynamically change","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I haven't seen an example of this but I wanted to know if any knows how to implement a colorbar with an adjustable slider using wxpython.  Basically the slider should change the levels of the colorbar and as such adjust the colormap.\nIf anyone has an idea of how to do and possible some example code it would be much appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":386,"Q_Id":14244195,"Users Score":1,"Answer":"I think you're looking for one of the following widgets:\nColourDialog, ColourSelect, PyColourChooser or CubeColourDialog\nThey all let you choose colors in different ways and they have a slider to help adjust the colours too.\nYou can see each of them in action in the wxPython demo (downloadable from the wxPython web page)","Q_Score":0,"Tags":"python,slider,wxpython,color-mapping","A_Id":14260324,"CreationDate":"2013-01-09T18:41:00.000","Title":"colorbar with a slider using wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a text widget with dark background and I can't see the cursor's position. Is there any way to change the (blinking) text cursor's color?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":12336,"Q_Id":14284492,"Users Score":30,"Answer":"You can change the insertbackground option of the text widget to whatever you want.","Q_Score":21,"Tags":"python,tkinter,colors,text-cursor","A_Id":14284594,"CreationDate":"2013-01-11T18:32:00.000","Title":"How to change text cursor color in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a Python guy building a Linux-based web service for a client who wants me to interface with a small C++ library that they're currently using with a bunch of Windows based VB applications.\nThey have assured me that the library is fairly simple (as far as they go I guess), and that they just need to know how best to compile and deliver it to me so that I can use it in Python under Linux.\nI've read a bit about the ctypes library and other options (SWIG, etc), but for some reason I haven't really been able to wrap my head around the concept and still don't know how to tell them what I need.\nI'm pretty sure having them re-write it with Python.h, etc is out, so I'm hoping there's a way I can simply have them compile it on Linux as a .so and just import it into Python. Is such a thing possible? How does one accomplish this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":201,"Q_Id":14289656,"Users Score":0,"Answer":"Due to complexities of the C++ ABI (such as name mangling), it's generally difficult and platform-specific to load a C++ library directly from Python using ctypes.\nI'd recommend you either create a simple C API which can be easily wrapped with ctypes, or use SWIG to generate wrapper types and a proper extension module for Python.","Q_Score":0,"Tags":"c++,python","A_Id":14289688,"CreationDate":"2013-01-12T02:41:00.000","Title":"How does one get a C++ library loaded into Python as a shared object file (.so)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was using PIL to do image processing, and I tried to convert a color image into a grayscale one, so I wrote a Python function to do that, meanwhile I know PIL already provides a convert function to this.\nBut the version I wrote in Python takes about 2 seconds to finish the grayscaling, while PIL's convert almost instantly. So I read the PIL code, figured out that the algorithm I wrote is pretty much the same, but\nPIL's convert is written in C or C++.\nSo is this the problem making the performance's different?","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":318,"Q_Id":14289657,"Users Score":3,"Answer":"Yes, coding the same algorithm in Python and in C, the C implementation will be faster.  This is definitely true for the usual Python interpreter, known as CPython.  Another implementation, PyPy, uses a JIT, and so can achieve impressive speeds, sometimes as fast as a C implementation.  But running under CPython, the Python will be slower.","Q_Score":0,"Tags":"python,c,python-imaging-library","A_Id":14289791,"CreationDate":"2013-01-12T02:41:00.000","Title":"performance concern, Python vs C","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was using PIL to do image processing, and I tried to convert a color image into a grayscale one, so I wrote a Python function to do that, meanwhile I know PIL already provides a convert function to this.\nBut the version I wrote in Python takes about 2 seconds to finish the grayscaling, while PIL's convert almost instantly. So I read the PIL code, figured out that the algorithm I wrote is pretty much the same, but\nPIL's convert is written in C or C++.\nSo is this the problem making the performance's different?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":318,"Q_Id":14289657,"Users Score":2,"Answer":"If you want to do image processing, you can use \nOpenCV(cv2), SimpleCV, NumPy, SciPy, Cython, Numba ...\nOpenCV, SimpleCV SciPy have many image processing routines already.\nNumPy can do operations on arrays in c speed.\nIf you want loops in Python, you can use Cython to compile your python code with static declaration into an external module. \nOr you can use Numba to do JIT convert, it can convert your python code into machine binary code, and will give you near c speed.","Q_Score":0,"Tags":"python,c,python-imaging-library","A_Id":14290456,"CreationDate":"2013-01-12T02:41:00.000","Title":"performance concern, Python vs C","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a method to add python pygame with images to PHP and display it in a local browser? What are the necessary requirements to do something like this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":71,"Q_Id":14296401,"Users Score":0,"Answer":"If I got you right, then answer is: no, it's impossible. I think \u2014 Flash is most acceptable choice for you, or Unity3D with browser plugin.","Q_Score":0,"Tags":"php,python,pygame","A_Id":14296430,"CreationDate":"2013-01-12T18:12:00.000","Title":"Is there a way to add Pygame into a local PHP file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can anybody tell me how I can return the dimensions of a video (pixel height\/width) using Qt (or any other Python route to that information).  I have googled the hell out of it and cannot find a straight answer.\nI assumed it would either be mediaobject.metadata() or os.stat() but neither appear to return the required info.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":305,"Q_Id":14323390,"Users Score":0,"Answer":"OK - for others out there looking for the same info, I found Hachoir-metadata and Hachoir-parser (https:\/\/bitbucket.org\/haypo\/hachoir\/wiki\/Home).\nThey provide the correct info but there is a serious lack of docs for it and not that many examples that I can find.  Therefore, while I have parsed a video file and returned the metadata for it, I'm now struggling to 'get' that information in a usable format.  However, I will not be defeated!","Q_Score":0,"Tags":"python,qt,video,pyside,phonon","A_Id":14509771,"CreationDate":"2013-01-14T17:21:00.000","Title":"qt phonon - returning video dimensions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want disable dragging the wx.Dialog. I noticed when I remove the caption the user can not drag the dialog, but I want to keep the caption. Any suggestions would be helpful? Thank you.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":139,"Q_Id":14362863,"Users Score":0,"Answer":"The only way to do it is to remove the caption as you've already found. You might be able to use a wx.Timer or catch a dragging event of some sort and center the dialog that way, but otherwise, removing the caption is the way to go.","Q_Score":2,"Tags":"wxpython,wxwidgets","A_Id":14363626,"CreationDate":"2013-01-16T16:18:00.000","Title":"How to disable dragging wx.DIalog from the user","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"EDIT: Can someone explain why this is \"Off Topic\"?  I think it very clearly follows the guidelines laid out in the FAQ.  Is there something I'm missing?\nI've been creating a windows desktop application in PyQt (python 2.7, PyQt 4.9.5), and I'm getting close to releasing the software for sale.  It's time for me to add some sort of system for licensing\/serial number based software activation.  The software is a business to business product with a retail price of around $250.\nI've been looking at going with Fastspring and they offer integration with:\n\nAquaticPrime\nCocoaFOB\nGameShield and Software Passport\nYummy Interactive's SoftwareShield\nSoraco's Quick License Manager\nSoftwrap\nConcept Software's SoftwareKey System\n\nWhat are some good options for providing this functionality?  Some things I've run into is that none of them seem to provide a python API, so I'd have to figure out how to integrate their stuff with my python code.  I've never had to do that, so ease of integration with Python would be a strong factor, as would cost.  I don't feel a strong need to prevent anyone from pirating my software, I just want to keep businesses honest so that they buy the correct number of seats.  A final thing to consider is that in the future I might want to make it cross platform and ideally I wouldn't be locking myself to just windows.\nThanks for your help.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":3211,"Q_Id":14388482,"Users Score":2,"Answer":"One thing to note is that it is relatively easy to decompile and reverse engineer Python bytecode and remove any protection you put into it, so it's usually not worth it to spend too much effort and time on implementing a crack-proof protection. You just want to put enough to keep people honest.\nIf your concern is that businesses buy the correct number of seats, one basic protection mechanism is to use a public key mechanism to put a digital signature to a message using a private key on your licensing server. The message is just a random string and some uniquely identifying information that restricts the machine that the license key is valid for (e.g. MAC address, etc), and perhaps a timestamp if you want to expire the key. This message and the signature is then encoded in a string that your customers put into your program, which validate the license key by verifying that signature matches the message and the message matches the machine.\nThere are simpler schemes if all you care is that the user has a key (not that they have a different key for different machines); you can simply use a totally random string for the message.\nThis scheme is secure as long as the user does not reverse engineer your code. It can be bypassed by reverse engineering the public key in your program with their own public key. It can also be bypassed by tampering the information used to identify the computer, e.g. MAC address; tampering these informations may allow multiple installations using the same key.","Q_Score":4,"Tags":"python,licensing","A_Id":14420183,"CreationDate":"2013-01-17T21:30:00.000","Title":"What serial number licensing solution should I use for a Python application with Fastspring?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im a newbie to Wxpython programming and I have a general on how to make my application more program.\nAssume, I have a tree with the list of employees being listed in the tree.  When I click a employee the information is retrieved in the db and the information is diplayed on the right side of the panel.\nNow, when I edit information of one of the employee and save it again the data the current row in the table needs to be end dated and the new row will be created in the db and also refreshing the tree.\nSo, Basically if something is saved the tree should be refreshed automatically.  How do I accomplish this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":115,"Q_Id":14430915,"Users Score":0,"Answer":"I don't believe the default TreeCtrl has database interaction builtin. You would have to add that. If you want it to check for updates periodically, you could use a wx.Timer. If you'll be updating the database with your wxPython GUI, then there shouldn't be a problem as you'll have to update the display anyway.\nYou might also want to look at the DVC_DataViewModel in the wxPython demo. I think it may make this sort of thing easier as it has the concept of data objects, which I think implies that you could create a database object to feed your GUI.","Q_Score":0,"Tags":"wxpython","A_Id":14460784,"CreationDate":"2013-01-21T00:23:00.000","Title":"Wxpython dynamic programming","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using the QComboBox to let the user select a very large quantity of choices. For the moment the user can type a character and the QComboBox selects the first row with this character, but I feel that it's just not enough.\nIs there any thing already done for the user to search directly the item by entering a text?\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":568,"Q_Id":14437549,"Users Score":2,"Answer":"You can use void QComboBox::setCompleter(QCompleter *completer)","Q_Score":0,"Tags":"python,qt,pyqt,qcombobox","A_Id":14437632,"CreationDate":"2013-01-21T11:21:00.000","Title":"Quick find item with QComboBox in Qt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need some help, I am coding a Zip password Cracker.I am trying to create a gui interface for  my cracker.\nI want to show a message box for right password if founded in password file..\nBut, showinfo message box is not executing after clicking on crack button, while if i am printing password using print it is working..\nSo, help me why showinfo message box is not executing.\nHere,","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":150,"Q_Id":14439001,"Users Score":0,"Answer":"You cannot call Tkinter commands from any thread other than the main thread. Tkinter is not thread safe.","Q_Score":0,"Tags":"python,python-2.7,tkinter","A_Id":14441255,"CreationDate":"2013-01-21T12:48:00.000","Title":"Python-Help in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like a Python-accessible function show_image(...) that launches a fairly simple image viewer, where the image is specified as (for example) a NumPy array. Importantly, I'd like for this function not to block, but for the script to continue execution while maintaining interactivity of the window.\nI realize that the giant design flaw and all around pain-in-the-ass known as the Global Interpreter Lock will thwart any Python-based GUI running in parallel with Python code in the main thread, so I'd obviously need to launch a thread that releases the GIL and does everything in C\/C++.\nI'm comfortable wrapping such a thing with Cython (or in a handwritten C extension module) but I'm looking for the right GUI solution. It should be cross-platform and easy to build in conjunction with a Cython extension (the latter of which seemingly rules out Qt\/qmake\/etc.)\nImportantly, I'd like to be able to launch multiple windows this way, on demand. It seems that most GUI toolkits have some run()-like function that needs to be called at the end of the main thread program's main(), making it not terribly clear to me how I'd go about launching a window more than once. I guess I could launch a separate GUI event loop every time, but that seems like a recipe for disaster (as I recall, it is explicitly unsupported by GTK+, at least).\nI'll also say that fork()'ing is not an option.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":864,"Q_Id":14446488,"Users Score":0,"Answer":"Personally I use os.system(\"xv foo.png &\"), or any small image viewer.  Depending on the details, you may also do g = os.popen(\"xv - &\", \"w\") and write the image data to the file g.  Again depending on the details, I sometimes make my program a web server (a few dozen lines of code, e.g. with Twisted), serve images from there, and view them in my web browser.  My point is that you don't need any GUI or multithreading at all.","Q_Score":1,"Tags":"python,image,user-interface","A_Id":14446771,"CreationDate":"2013-01-21T20:16:00.000","Title":"Non-blocking image viewer function from Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have populated a combobox with an QSqlQueryModel. It's all working fine as it is, but I would like to add an extra item to the combobox that could say \"ALL_RECORDS\". This way I could use the combobox as a filtering device. \nI obviously don't want to add this extra item in the database, how can I add it to the combobox after it's been populated by a model?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":243,"Q_Id":14455871,"Users Score":1,"Answer":"You could use a proxy model that takes gets it's data from two models, one for your default values, the other for your database, and use it to populate your QComboBox.","Q_Score":1,"Tags":"python,qt,pyqt,pyqt4,pyside","A_Id":14540595,"CreationDate":"2013-01-22T10:02:00.000","Title":"Adding an item to an already populated combobox","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a program and I need to inform the user about some changes with a popup message, but not a popup window. Something like the rectangle informing about new message in Kadu - no window, just a bitmap drawn directly on the screen for a few seconds. \nI wonder if there is a simple way to do that with win32 package or Tkinter, and handle the event when the user clicks on the rectangle. \nActually the message would be constant, so the bitmap might be loaded from a file, but I still don't know how to start.\nAny ideas, please?\nRegards, mopsiok","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1969,"Q_Id":14490753,"Users Score":0,"Answer":"I am using wxPython and looking for a way to have a popup message. Now I am using a popupmenu in which I append each item of the menu with one line of the message.","Q_Score":0,"Tags":"python,popup,screen,draw","A_Id":15838631,"CreationDate":"2013-01-23T22:42:00.000","Title":"Python - popup message drawn on the screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Someone know if it's possible to change the color of a pixel in a canvas without using un object, so without using something like canvas.create_oval or canvas.create_rectangle ?","AnswerCount":2,"Available Count":2,"Score":0.3799489623,"is_accepted":false,"ViewCount":3101,"Q_Id":14491092,"Users Score":4,"Answer":"There is no way to color a pixel other than to create a 1x1 pixel object of some sort. And yes, at some point you will experience performance problems. The canvas simply wasn't designed to be used this way. \nIf you're really needing to create a large area in which you can manage individual pixels, you can create a canvas with a single image that is the same size as the canvas. You can then set the color of individual pixels on the image through the photo image interface.","Q_Score":1,"Tags":"python,canvas,tkinter","A_Id":14500936,"CreationDate":"2013-01-23T23:07:00.000","Title":"Change the color of a pixel in a canvas, Tkinter, Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Someone know if it's possible to change the color of a pixel in a canvas without using un object, so without using something like canvas.create_oval or canvas.create_rectangle ?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3101,"Q_Id":14491092,"Users Score":0,"Answer":"Within tkinter itself, it's impossible.\nEven if you manage to change a pixel on canvas window (which is possible with X11 and Windows APIs in a platform-dependent way), you'd have to ensure it's repainted properly.\nYou can, of course, place a frame of size 1x1 over the canvas, with a background color you want. This way, pixel is \"changed\" and no canvas object is created. If there's a real (though strange) problem behind a question, this trick could be a solution.","Q_Score":1,"Tags":"python,canvas,tkinter","A_Id":14491248,"CreationDate":"2013-01-23T23:07:00.000","Title":"Change the color of a pixel in a canvas, Tkinter, Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using pycairo (actually cairocffi) on Ubuntu 12.04.\nThe library on the system is cairo 1.10.\nI've created an empty ImageSurface, having an ARGB32 format.\nIf, for example, I try to fill a semi-transparent white rectangle (RGBA(1,1,1,0.5)), I see a semi-transparent grey rectangle.\nThis is the same for every semi-transparent pixel drawn on a semi-transparent background : it seems cairo considers that blending with a transparent pixel is the same thing as blending with a black pixel...\nThe same issue applies to antialiased shapes drawn on transparent surfaces: they have dark unexpected borders.\nThere is no reference to this behaviour, nowhere. So I am wondering, is this the expected behaviour of cairo ? How can I fix this ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":835,"Q_Id":14514438,"Users Score":2,"Answer":"I have finally found what was wrong with cairo and the bad alpha blending.\nCairo supports ARGB32 surface, but only with premultiplied alpha.\nThat is, every component of a pixel is stored premultiplied with the alpha component.\nI have not found an answer for this over the internet, and I assume premultiplied alpha is not suited for the type of operation I'm doing. \nI switched to PyQt4, used ARGB32 images without premultiplication, and it worked like a charm.\nI also tried with PyQt4 premultiplied alpha images, and reproduced the problem.","Q_Score":3,"Tags":"python,cairo,pycairo","A_Id":14521313,"CreationDate":"2013-01-25T02:33:00.000","Title":"Cairo, ImageSurface : Cannot get correct alpha blending","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a newbie in this type of approach to programming since I really doesn't care for hardcore graphics generation. I design, write, run, and study parametrized climate models with python. But, at last, I have encountered myself with a visualization issue.\nI was looking for something in Cairo library that allows me to map a linear gradient onto an arbitrary curve (not necessarily a circumference) such that there is a more or less smooth variation of colour (or shade) across my path. Then I have been looking for some pattern and I finally found that maybe mesh gradients in Cairo are the solution.\nHowever, I can't create a new mesh gradient from my python script with cairo.pattern_create_mesh()!\nTherefore, my questions are: How I use mesh gradients in Cairo? Is there any other simple way to do what I want with Cairo (I don't know, like a simple mapping from a line segment to a curve via parametrization, I know I ask too much)?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":926,"Q_Id":14518005,"Users Score":0,"Answer":"Mesh patterns were added in cairo 1.12 which is the latest release. Thus, most language bindings likely don't support them yet. I don't know anything about the combination of python and cairo and thus don't know any workaround.\nI don't know any simple way to simulate what you need with other patterns, sorry. (Although I am not really sure how you want to do your mapping via mesh gradients either...)","Q_Score":1,"Tags":"python-2.7,cairo,pycairo","A_Id":14520708,"CreationDate":"2013-01-25T08:26:00.000","Title":"Using mesh gradients in Cairo for coloring a path","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to designing GUIs in python and have a query:\nIs there a way to have a label or any other widget with copyable text. I want to provide help section within GUI which will contain a sample xml to be given as input, I want user to be able to copy that xml.\nI don't want that information to go away if user cuts that information, so I am not using a entry widget with pre-filled data.\nIs there a way to achieve this?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":254,"Q_Id":14549545,"Users Score":1,"Answer":"Use a text widget in disabled state.\nThere is no insertion cursor in this state, but the text may still be selected and copied (but not modified).","Q_Score":0,"Tags":"python,user-interface,text,python-3.x,tkinter","A_Id":14549709,"CreationDate":"2013-01-27T16:39:00.000","Title":"Python tkinter GUI: which widget to use for having copyable text","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"An app I made from my script with py2app doesn't work on newer versions of OS X. I was told that this was because the build was partially standalone, meaning it requires my version of wxPython, but doesn't include it. How can I make it fully standalone (where my version of wxPython is included), or not standalone, where it uses whatever version of wxPython the host has installed? Which would be preferable, and how can I check that it has worked if I only have one mac with one version of wxPython?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":684,"Q_Id":14563591,"Users Score":2,"Answer":"Make sure you are using the latest py2app, it looks like they've resolved some issues lately related to semi-standalone, perhaps that may affect your build too.\nUse the Python from Python.org, not Apple's python installed with the OS.\nDon't use the --semi-standalone flag or options like it in the setup script.\n\nThat should be all there is to it.  Last I checked creating standalone applications was the default when using the Python.org Python, and it by default should be copying in the other packages (including wx) that your application imports as well.  You can look inside the generated application bundle to see exactly what it is and isn't including and you can then adjust your setup script as needed.","Q_Score":2,"Tags":"python,wxpython,wxwidgets,py2app","A_Id":14571464,"CreationDate":"2013-01-28T13:55:00.000","Title":"Toggling py2app standalone?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Gtk IconView. Actually, selected items are draw with a different background color (this is the normal behavior). However, I'd like to be able to distinguish between \"selected\" and \"active\" items, by using a different background color for the \"active\" item. How can I achieve that?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":127,"Q_Id":14612802,"Users Score":0,"Answer":"Are you using a theme? Check the panel.rc file and look for bg[ACTIVE]. Change that value and the button should change colour","Q_Score":0,"Tags":"python,gtk","A_Id":14612976,"CreationDate":"2013-01-30T20:13:00.000","Title":"How to distinguish active and selected item in Gtk IconView?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a game with two processes. One for rendering with OpenGL. The other is for Collision detection. This is so I can use more than a single core.\nHowever I can't use any pygame surfaces without the display open. So I can't use bitmasks to do pixel perfect collision or any other collision for that matter.\nI've tried to simply open another window just to see if I can the Surfaces to work but I can't open a second pygame window without getting an OpenGL function error.\nYou can open two non-OpenGL windows with pygame in two separate processes but I'm using OpenGL.\nI figured there might be somewhere I can insert a pointer to the display to get the surfaces to stop saying Dead Display. Some kind of SDL variable I can manipulate in the second process to say \"its not Dead its here\". Or some other way to use the pixel perfect collision.\nI'm open to pixel perfect alternatives that don't use pygame.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":141,"Q_Id":14643579,"Users Score":0,"Answer":"I'm going to use pymunk. The python port of Chipmunk.\nI did a silly experiment with it little over a year ago when I first started programming. It was pretty easy. I just totally forgot about it.\nI couldn't get pybox2d to work in any python version.","Q_Score":0,"Tags":"python,opengl,pygame","A_Id":14807386,"CreationDate":"2013-02-01T09:52:00.000","Title":"Using pygames Collision module without initializing display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to program a function that takes user input without requesting it? For example, during a game of tic-tac-toe, the user could press \"Q\" at any time and the program would close?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":362,"Q_Id":14651989,"Users Score":1,"Answer":"There are a few ways to do this, and they are all different.\nIf your game is a terminal application using curses, you would catch the q when you call getch(), and then raise SystemExit or simply break out of your while loop that many curses applications use.\nUsing tkinter or another GUI library, you would bind a key press event to your Frame widget that holds the tic-tac-toe board.","Q_Score":1,"Tags":"python,input","A_Id":14652103,"CreationDate":"2013-02-01T17:41:00.000","Title":"Python 3.2 Passive User Input","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using QT4 (4.2.1) with python 2.4 on CentOS. \nI assigned QAction with shortcuts to my menu and disable\/enable them accordingly.  I have event handlers assigned to the triggered event for the actions. Everything works as expected except that the shortcuts trigger the events for disabled actions. For example, I have a Delete QAction with Del shortcut. I see the disabled Delete menu option but if I hit the Del key my triggered event handler gets called. This is kind of odd...\nIs this by design or I am doing something wrong?\nAs a workaround I am now checking QAction isEnabled() in each action event handler but is there a way to not get triggered events for disabled actions?\nThank you very much for your help,\nLeo","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":199,"Q_Id":14653860,"Users Score":0,"Answer":"This behaves fine with Qt 4.8.5, and as far as I can tell from the source it should work with versions as old as Qt 4.5.\nTry upgrading Qt to a reasonably recent version, or at least try your code on a more modern version.","Q_Score":0,"Tags":"python,qt,qt4","A_Id":14654391,"CreationDate":"2013-02-01T19:46:00.000","Title":"Shortcuts trigger events for disabled QActions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In python I want to simulate a joystick that when used, to give values between -63 and +63 let's say. When the value it's positive, I want to press the \"w\" key and \"s\" key when negative.\nI am not having problems receiving the values, but to transform these analog values into digital key presses. Does anyone has any idea how to do it (code can be in any language, I just need an general idea).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":118,"Q_Id":14672039,"Users Score":1,"Answer":"Use PostMessage with the WM_CHAR command (if you're using Windows - you didn't say).","Q_Score":0,"Tags":"python,keypress,joystick,analog-digital-converter","A_Id":14709657,"CreationDate":"2013-02-03T11:36:00.000","Title":"Transforming analog keypresses to digital","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have developed the python script for checking out a source code from repository and build it using visual studio.When i run the script,a GUI opens(developed using wxPython) which shows a button,clicking on which does the checkout and build.I would want to show a progress bar showing the process running when i click on the button and a success message after the script finishes it's work.Please help me out.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":400,"Q_Id":14681697,"Users Score":0,"Answer":"You probably won't be able to get an accurate progress unless your build scripts are generating some progress information in the output that you can parse and represent in your GUI.  Either way you will probably want to use wx.ProgressDialog or use a wx.Gauge in your main panel or something like that.  Both wx.ProgressDialog and wx.Gauge can be used in a mode that shows actual values (a percentage complete) or an 'indeterminate' mode that represents that something is happening but there isn't any way to tell how far in the process it is.","Q_Score":0,"Tags":"python-2.7,wxpython","A_Id":14692494,"CreationDate":"2013-02-04T06:52:00.000","Title":"Show progress bar when running a script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application developed in Python using PyQt4, In which i used QTableView to display a reports.\nwhen i open one report window with QTableView it shows the result properly.\nIf i open another report window with QTableView it shows the result properly.\nNow both the windows are displaying the data in there QTableViews.\nNow the issue is, When i select the 1st report window the data in it is disappearing.\nCan anyone tell me exactly whats wrong i am doing.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":91,"Q_Id":14682935,"Users Score":0,"Answer":"Check if you are using same instance of QtSql.QSqlDatabase  for all the views you create.","Q_Score":1,"Tags":"python,pyqt4,qtableview","A_Id":16030744,"CreationDate":"2013-02-04T08:29:00.000","Title":"QTableView data disapears by opening another QTableView","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Tkinter with Python 2.6 and 2.7 for programming graphic user interfaces.\nThese User Interfaces contain dialogs for opening files and saving data from the tkFileDialog module. I would like to adapt the dialogs and add some further entry widgets e.g. for letting the user leave comments.\nIs there any way for doing so? \nIt seems that the file dialogs are taken directly from the operating system. In Tkinter they are derived from the Dialog class in the tkCommonDialog module and call the tk.call(\"tk_getSaveFile\") method of a frame widget (in this case for saving data). \nI could not find out where this method is defined.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1084,"Q_Id":14686543,"Users Score":1,"Answer":"I had to get rid of the canvasx\/y statements. That line now simply reads set item [$data(canvas) find closest $x $y], which works well. $data(canvas) canvasx $x for its own works well but not in connection with find closest, neither if it is written in two lines.","Q_Score":4,"Tags":"python,tkinter,filedialog","A_Id":14822605,"CreationDate":"2013-02-04T12:12:00.000","Title":"Python Tkinter: Adding widgets to file dialogs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently working on a small game using pygame. \nRight now I render images the standard way, by loading them and then blitting them to my main surface. This is great, if I want to work with an individual image size. Yet, I'd like to take in any NxN image and use it at an MxM resolution. Is there a technique for this that doesn't use surfarray and numeric? Something that already exists in pygame? If not, do you think it would be expensive to compute this?\nI'd like to stretch the image. So, upscale or downscale the image. Sorry I wasn't clearer.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":128,"Q_Id":14692367,"Users Score":1,"Answer":"There is no single command to do this.  You will first have to change the size using pygame.transform.scale, then make a rect of the same size, and set its place, and finally blit.  It would probably be wisest to do this in a definition.","Q_Score":0,"Tags":"python,pygame","A_Id":14694352,"CreationDate":"2013-02-04T17:45:00.000","Title":"Rendering image independent of size?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have seen a similar question on this site but not answered correctly for my requirements. I am reasonably familiar with py2exe.\nI'd like to create a program (in python and py2exe) that I can distribute to my customers which would enable them to add their own data (not code, just numbers) and redistribute as a new\/amended exe for further distribution (as a single file, so my code + data). I understand this can be done with more than one file.\nIs this conceptually possible without my customers installing python? I guess I'm asking how to perform the 'bundlefiles' option?\nMany thanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":167,"Q_Id":14692822,"Users Score":1,"Answer":"I think it is possible. I'm not sure how py2exe works, but I know how pyinstaller does and since both does the same it should work similiar. \nNamely, one-file flag doesn't really create one file. It looks like that for end user, but when user run app, it unpacks itself and files are stored somewhere physically. You could try to edit some source file (ie numbers.py, or data.py) and pack it again with changed data. \nI know it's not the best explanation, you have to think further on your own. I'm just showing you the possible way.","Q_Score":3,"Tags":"python,py2exe","A_Id":14693751,"CreationDate":"2013-02-04T18:11:00.000","Title":"compile py2exe from executable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a wx.Frame with a GLCanvas.  On some platforms, setting the WX_GL_DEPTH_SIZE attribute of the canvas to 32 works fine.  On another platform, I just get a blank frame (the GLCanvas doesn't render) unless I reduce the depth size to 16.  Is there an easy way in the calling code to determine the allowable values for the depth size?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":239,"Q_Id":14715739,"Users Score":1,"Answer":"Are you running Linux? Perhaps you could get that information from the table of display modes that glxinfo -t outputs.","Q_Score":1,"Tags":"python,wxpython,pyopengl","A_Id":14971097,"CreationDate":"2013-02-05T19:50:00.000","Title":"How can I determine the max allowable WX_GL_DEPTH_SIZE for a wx GLCanvas?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a simple application through glade, and I want to be able to set the color displayed in the color selection dialog. I found the set_current_color function, however, it requires a gdk.Color object.\nTrying to import gtk.gdk.Color fails (actually, just importing gtk fails). Is there another method I can use to create a color object?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":125,"Q_Id":14881732,"Users Score":0,"Answer":"It turned out to be an issue of mixing GTK2 and GTK3. gi.repository.Gtk has the Color constructor.","Q_Score":0,"Tags":"python,gtk,pygtk,gdk","A_Id":14906082,"CreationDate":"2013-02-14T18:36:00.000","Title":"pygtk issue - unable to create gdk.Color object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to find a way to test my C code using python scripts. So far my findings are\n1) with Ctypes, I can easily load the so and call the function directly from python. Plus, everything happens at run-time, so no extra compiling\/wrapping stuff.\n2) However, re-writing every types in python is tedious and error prone, especially for complex data types. And whenever the definitions change, I will have to update the definition in python scripts.\nI am wondering since Swig can export datatypes automatically, is it possible to mix Swig and Ctypes together? i.e. use Swig to export datatypes, which can be used to call functions through  Ctypes.\np.s I am not sure whether Cython suits better, but we don't have Cython in the environment.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":321,"Q_Id":14887374,"Users Score":0,"Answer":"I ended up using Swig with dynamic linking to the so library generated by the C code. In this way, I only have to include the header files in the swig interface file to tell swig what functions\/datatypes to expose. Another advantage of this approach is that I can write testing helper functions in C and easily expose those as well.","Q_Score":0,"Tags":"python,c,swig,ctypes","A_Id":14943730,"CreationDate":"2013-02-15T02:09:00.000","Title":"Python & C: Is it possible to mix Ctypes and Swig together?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been working on a very simple python\/tkinter script (a .pyw file) and I'd like to change it's application icon (the 'file' icon shown at the explorer window and the start\/all programs window, for example - not the 'file type' icon nor the main window of the app icon) and the taskbar icon (the icon shown at the taskbar when the application is minimized). Is it possible to change them or is it something only doable when you effectively install an application through an .exe?\nThis little app is supposed to run on Windows XP \/ 7 machines only and it's in Python 2.7.3.\nThanks in advance!","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":35930,"Q_Id":14900510,"Users Score":0,"Answer":"Create an single file exe using PyInstaller and use Inno Setup to build the windows installer package. Inno Setup will do the icon stuff for you.","Q_Score":15,"Tags":"python,tkinter","A_Id":42867640,"CreationDate":"2013-02-15T17:53:00.000","Title":"Changing the application and taskbar icon - Python\/Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been working on a very simple python\/tkinter script (a .pyw file) and I'd like to change it's application icon (the 'file' icon shown at the explorer window and the start\/all programs window, for example - not the 'file type' icon nor the main window of the app icon) and the taskbar icon (the icon shown at the taskbar when the application is minimized). Is it possible to change them or is it something only doable when you effectively install an application through an .exe?\nThis little app is supposed to run on Windows XP \/ 7 machines only and it's in Python 2.7.3.\nThanks in advance!","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":35930,"Q_Id":14900510,"Users Score":0,"Answer":"add\n--icon=iconname.ico\nto the pyinstaller command in the prompt\neg>> pyinstaller --windowed  --add-data \"pics\/myicon.ico;pics\" --add-data \"pics\/*.png;pics\" --icon=pics\/myicon.ico -d bootloader myscript.py\nthis will show your icon on the windows taskbar instead of the default python pkg icon","Q_Score":15,"Tags":"python,tkinter","A_Id":72111647,"CreationDate":"2013-02-15T17:53:00.000","Title":"Changing the application and taskbar icon - Python\/Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I tell a Tkinter window where to open, based on screen dimensions? I would like it to open in the middle.","AnswerCount":6,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":110461,"Q_Id":14910858,"Users Score":2,"Answer":"root.geometry('520x400+350+200')\nExplanation: ('width x height + X coordinate + Y coordinate')","Q_Score":67,"Tags":"python,python-2.7,tkinter","A_Id":55293163,"CreationDate":"2013-02-16T13:30:00.000","Title":"How to specify where a Tkinter window opens?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If there are lets say 4 buttons, all with the same Click event, how can I find out which button was pressed?\nif the event looks like this def Button_Click(self, sender, e): I'm sure I can compare sender to my buttons somehow. But how?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":901,"Q_Id":14959093,"Users Score":1,"Answer":"Well, I've never used IronPython so I don't know how much help this will be, but what I usually do when trying to figure out these things in regular python is to print type(sender) , print sender and print dir(sender) to console(or output to a file if you don't have a console available).\nThis should help you figure out what exactly is the \"sender\" parameter. In the simplest case it could be the button itself so a simple == will work to know which button it was. Or it could have a method\/property that gets you the button object. In which case, dir(sender) might contain an obvious one, or if not, google the class name gotten from type(sender) and see if you can find any docs.","Q_Score":0,"Tags":"python,.net,ironpython","A_Id":14959257,"CreationDate":"2013-02-19T13:47:00.000","Title":"event handling iron python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"mi problem is this. I\u00b4ve already created a program with tkinter, but I want to run it twice in the same window, one in each side of the window. How can I do that??\nThe idea is to be able to compare the data from both programs so I want them to work separated.\nMany thanks.\nPD: I cannot post an image for you because of my reputation, sorry :(","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":100,"Q_Id":14994651,"Users Score":2,"Answer":"Ultimately, what you need to do is put all of the logic behind creating and using a single workspace on a single Frame object.  Then you just need to create 2 Frames side-by-side -- Each one holding a \"workspace\".","Q_Score":0,"Tags":"python,programming-languages,tkinter","A_Id":14994664,"CreationDate":"2013-02-21T04:39:00.000","Title":"How can I create 2 workspaces in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Qt application written in PySide (Qt Python binding). This application has a GUI thread and many different QThreads that are in charge of performing some heavy lifting - some rather long tasks. As such long task sometimes gets stuck (usually because it is waiting for a server response), the application sometimes freezes. \nI was therefore wondering if it is safe to call QCoreApplication.processEvents() \"manually\" every second or so, so that the GUI event queue is cleared (processed)? Is that a good idea at all?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1998,"Q_Id":15014932,"Users Score":0,"Answer":"A couple of hints people might find useful:\nA. You need to beware of the following:\n\nEvery so often the threads want to send stuff back to the main thread. So they post an event and call processEvents\nIf the code runs from the event also calls processEvents then instead of returning to the next statement, python can instead dispatch a worker thread again and that can then repeat this process.\n\nThe net result of this can be hundreds or thousands of nested processEvent statements which can then result in a recursion level exceeded error message.\nMoral - if you are running a multi-threaded application do NOT call processEvents in any code initiated by a thread which runs in the main thread.\nB. You need to be aware that CPython has a Global Interpreter Lock (GIL) that limits threads so that only one can run at any one time and the way that Python decides which threads to run is counter-intuitive. Running process events from a worker thread does not seem to do what it says on the can, and CPU time is not allocated to the main thread or to Python internal threads. I am still experimenting, but it seems that putting worker threads to sleep for a few miliseconds allows other threads to get a look in.","Q_Score":2,"Tags":"python,qt,events,pyqt,pyside","A_Id":42914476,"CreationDate":"2013-02-22T00:37:00.000","Title":"Is calling QCoreApplications.processEvents() on a set interval safe?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have tried using pythonw and this only works if I drop and drag the file onto it. I remember reading somewhere there is a way to keep this from happening in the code but I can't find it. Thanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":57,"Q_Id":15018411,"Users Score":2,"Answer":"To run it with pythonw.exe just give your file a .pyw extension.","Q_Score":0,"Tags":"python,python-2.7,wxpython","A_Id":15018504,"CreationDate":"2013-02-22T06:44:00.000","Title":"How do I keep shell or IDLE shell from opening when running wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a 10 by 10 game board. It is a 2D list, with another list of 2 inside. I used \nboard = [[['O', 'O']] * 10 for x in range(1, 11)]. So it will produce something like \n['O', 'O'] ['O', 'O']...\n['O', 'O'] ['O', 'O']...\nLater on I want to set a single cell to have 'C' I use board.gameBoard[animal.y][animal.x][0] = 'C'\nboard being the class the gameBoard is in, and animal is a game piece, x & y are just ints. Some times it will work and the specified cell will become ['C', 'O'], other times it will fill the entire row with ['C', 'O']['C', 'O']['C', 'O']['C', 'O']\nDoes anyone know why that might be happening?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":168,"Q_Id":15036694,"Users Score":0,"Answer":"Your board is getting multiple references to the same array. \n  You need to replace the * 10 with another list comprehension.","Q_Score":1,"Tags":"python,list","A_Id":15036718,"CreationDate":"2013-02-23T03:25:00.000","Title":"2D Python list will have random results","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to run multiple processes in python without multithreading? For example consider the following problem:-\nWe have to make a Gui,which has a start button which starts a function(say, prints all integers) and there is a stop button, such that clicking it stops the function.\nHow to do this in Tkinter?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":7177,"Q_Id":15057789,"Users Score":0,"Answer":"Did you try to used multiprocessing module? Seems to be the one you're looking for.","Q_Score":4,"Tags":"python,tkinter,multiprocessing","A_Id":15057824,"CreationDate":"2013-02-24T23:08:00.000","Title":"Multiprocessing in Python tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im struggling opening a powerpoint presentation via python.\nI have a program in educational program in pyqt and i need to open up a powerpoint presentation(in powerpoint viewer mode) when i click a push button.\nI tried using pywin32 and such but ive had no luck :(","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3049,"Q_Id":15058771,"Users Score":0,"Answer":"Import the os module, then use os.system(\"powerpoint.exe filename\")","Q_Score":2,"Tags":"python,pyqt,powerpoint","A_Id":15058874,"CreationDate":"2013-02-25T01:20:00.000","Title":"How to open a powerpoint presentation via python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a simple game, whereby I want my characters quite customizable. I want my characters to be able to be fully edited in colours, for example, if a player wants their character to have cyan skin, they just put into the sliders, or what I choose to use, \"0,255,255\", or purple \"255,0,255\", or something random \"25,125, 156\", and have their character be that colour. I haven't even started creating the game, but I've got the basis down and I know exactly what I must do for pretty much every EXCEPT this.\nI done a search in Google, and it turns out, I need numerical python for this? Well this is a whole new package, and in order for the average player to play, I must change it to EXE form... (or have python, pygame and numerical python installed onto their PC, which will be a problem if they have a later version...). Now, it's already getting complex with just pygame, but with numerical python as well, is there even a tutorial on how to do this?\nAny suggestions? Thanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2070,"Q_Id":15076133,"Users Score":0,"Answer":"I assume by image you mean pygame.Surface.  You have several options:\n\npygame.Surface.set_at(...)\nUse a palettized surface.  Then change the palette.  Based on your use case, this is actually probably what I'd suggest.\nUse the pygame.PixelArray PyGame module.  I don't think it requires NumPy.\nJust use NumPy.  It's really not that huge of a requirement; lots of projects require it and it's simple to set up.  You get access to the powerful pygame.surfarray module","Q_Score":0,"Tags":"python,image,colors,pygame,numerical","A_Id":28798012,"CreationDate":"2013-02-25T20:44:00.000","Title":"PYGAME - Edit colours of an image (makes white red at 255,0,0) without numerical python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there anyway the pyc file can be extracted from an Application bundle? I'm referring to an application bundle that was created by using py2app on python code.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":171,"Q_Id":15093865,"Users Score":1,"Answer":"The pyc files are stored in a zipfile in the Resources folder. The name of the zip file depends on the Python version, for 2.7 it is .app\/Contents\/Resources\/python2.7\/site-packages.zip.\nThat zip file is a regular zipfile that can be manipulated with the usual tools.","Q_Score":0,"Tags":"python,macos,py2app","A_Id":15098915,"CreationDate":"2013-02-26T16:10:00.000","Title":"extract pyc from Application bundle","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a little game app that allows users to load up textures manually. One such example would be a standard deck of 52 cards.\nWould it be bad to store the processing info as:\nCard_79x123_53_53.png\nUpon getting the filename from a file dialog, I would split the underscores to get the following info:\n\nObjectType : matched to list\n(w,h)\nNumber of objects expected (in case there's tailing empty space)\nExtra info (in this case the location of the face-down texture relative to N above)\nand the dimensions of the image provide the rest, of course.\n\nANY error in processing would of course be raised and the attempt to load textures would be rejected.\nIs there a reason why this is a bad idea or should I keep toying with it?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":65,"Q_Id":15104090,"Users Score":0,"Answer":"Is there a reason why this is a bad idea or should I keep toying with it?\n\nThis is essentially like encoding file type by file extension. The only bad thing about encoding file metadata in the filename is it's quite limited in space. You can encode much richer metadata if you used proper PNG metadata field or in a separate file. Encoding metadata in the file name is hard to extend with new fields in new version, with optional fields, etc.\nFor example, you might find out that you want miscellaneous sprite sheet where each frame has different size, and so you need to encode the position, size, class name, and serial number for each individual frame.\nIt's fine as long as you don't expect to want to encode many other metadata in the future.","Q_Score":0,"Tags":"python,png","A_Id":15104289,"CreationDate":"2013-02-27T04:13:00.000","Title":"Is it a bad idea to use a PNG image's filename to store the info on how to process it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a little game app that allows users to load up textures manually. One such example would be a standard deck of 52 cards.\nWould it be bad to store the processing info as:\nCard_79x123_53_53.png\nUpon getting the filename from a file dialog, I would split the underscores to get the following info:\n\nObjectType : matched to list\n(w,h)\nNumber of objects expected (in case there's tailing empty space)\nExtra info (in this case the location of the face-down texture relative to N above)\nand the dimensions of the image provide the rest, of course.\n\nANY error in processing would of course be raised and the attempt to load textures would be rejected.\nIs there a reason why this is a bad idea or should I keep toying with it?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":65,"Q_Id":15104090,"Users Score":0,"Answer":"Probably it would be better to ask user about how to process image explicitly either by adding extra controls into file dialog, or by showing another dialog after file dialog is submitted.  In this case information taken from file name could be used as hints to preliminary fill these extra controls with values, but user will have a chance to correct what is wrong and fill what is missing.","Q_Score":0,"Tags":"python,png","A_Id":15104140,"CreationDate":"2013-02-27T04:13:00.000","Title":"Is it a bad idea to use a PNG image's filename to store the info on how to process it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wanted to create a file copy program in which progress bar indicates progress. Now if I started n copy\/paste operations, that many progress bars should be displayed like windows 8 does. \nThe program should be like one window, say \"SHOW\", is displaying QProgressbar for copy\/paste of 1st operation. When 2 copy\/paste will start before 1st one finishes, the 2nd QProgressbar will be added in SHOW and hence there will be 2 progressbars in SHOW.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":104,"Q_Id":15119751,"Users Score":0,"Answer":"Well create a layout (a vertical layout i suppose) and then create as many QProgressbar you need and add them to your layout with addWidget and that's it.\nIf you need scrolling, try using a QScrollArea.","Q_Score":0,"Tags":"python,multithreading,pyqt","A_Id":15119949,"CreationDate":"2013-02-27T18:40:00.000","Title":"How to add new QProgressbar to an existing window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Python 3 with gobject introspection for Gtk. How can I have more than one toggle button linked together so they behave similar to tabs or radiobuttons - e.g. one is selected by default, and when another is clicked the previously active one is de-selected.\nI have tried using set_sensetive, but that greys out the widget that it is applied on.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1466,"Q_Id":15120746,"Users Score":3,"Answer":"Use set_active() (or props.active). Alternatively, you can create some Gtk.RadioButton widgets and set draw_indicator property to False. In the latter case you can create radio groups in normal way, without custom handling.","Q_Score":3,"Tags":"python,button,gtk,radio-button,toggle","A_Id":15123955,"CreationDate":"2013-02-27T19:32:00.000","Title":"How can I link a set of toggle buttons like radio buttons?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Python 3 with gobject introspection for Gtk. How can I have more than one toggle button linked together so they behave similar to tabs or radiobuttons - e.g. one is selected by default, and when another is clicked the previously active one is de-selected.\nI have tried using set_sensetive, but that greys out the widget that it is applied on.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1466,"Q_Id":15120746,"Users Score":1,"Answer":"You listen to the toggle signals on the toggle button then call set_active() on the other ones. You need to block the toggled signals while calling set_active()so that you don't get into a loop.","Q_Score":3,"Tags":"python,button,gtk,radio-button,toggle","A_Id":15135787,"CreationDate":"2013-02-27T19:32:00.000","Title":"How can I link a set of toggle buttons like radio buttons?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a GUI in wxpython.\nI want to place images next to radio buttons.\nHow should i do that in wxpython?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":348,"Q_Id":15128404,"Users Score":0,"Answer":"I'm not sure what you mean. Are you wanting images instead of the actual radio button itself? That is not supported. If you want an image in addition to the radio button, then just use a group of horizontal box sizers or one of the grid sizers. Add the image and then the radio button. And you're done!","Q_Score":0,"Tags":"wxpython","A_Id":15138009,"CreationDate":"2013-02-28T05:51:00.000","Title":"Adding images next to radio buttons in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a GUI in wxpython.\nI want to place images next to radio buttons.\nHow should i do that in wxpython?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":348,"Q_Id":15128404,"Users Score":1,"Answer":"I suggest using wx.ToggleButton with bitmap labels if you are using 2.9, or one of the bitmap toggle button classes in wx.lib.buttons if you are still on 2.8.  You can then implement the \"radio button\" functionality yourself by untoggling all other buttons in the group when one of them is toggled.  Using the bitmap itself as the radio button will look nicer and will save space.","Q_Score":0,"Tags":"wxpython","A_Id":15145613,"CreationDate":"2013-02-28T05:51:00.000","Title":"Adding images next to radio buttons in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have application with QtGui.QSystemTrayIcon and a Qmenu in it. Is there a way to disable and enable it.\nI want this to disable when my application is launching, so that user have no option to access the menu items.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":798,"Q_Id":15131690,"Users Score":0,"Answer":"There are .show() and .hide() methods and a .visible property that allows to show or hide a QSystemTrayIcon.\nIs that what you were looking for?","Q_Score":0,"Tags":"python,pyqt4,system-tray","A_Id":15135837,"CreationDate":"2013-02-28T09:18:00.000","Title":"Disabling System Tray icon in pyqt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently have a wxPanel that I draw lines, text etc on to in response to paint events by using a device context from wx.PaintDC. However, my drawing can exceed the size of the panel and it continues off the visible screen. The only way to see more of the drawing is to expand the application window, which is impractical and still may not allow the full drawing to be seen in the case of very large drawings. Ideally, I want to be able to scroll the drawing so that the application window does not need to be resized and large drawings can be seen.\nLooking around, it seems that I may want to use a wxScrolledPanel instead of a wxPanel. However, i've had no success with using this - would using a wxScrolledPanel only work when using controls (e.g. buttons, text fields) rather than painting on the device context?\nWhat is the appropriate way to scroll a panel that has been drawn on?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1073,"Q_Id":15143323,"Users Score":2,"Answer":"It should work with a ScrolledPanel but if you are not going to have other widgets on the panel it is probably not the right answer since it depends on having a sizer to set the virtual size. \nTry using a wx.ScrolledWindow instead, and see its sample in the demo for some code.  Basically you just need to set the virtual size of the window and it will take care of the scrollbars and scrolling for you.  You will also need to call PrepareDC in your paint event handler so it will offset the drawing to match the scrolled viewport origin.","Q_Score":0,"Tags":"wxpython,paint,gdi","A_Id":15146608,"CreationDate":"2013-02-28T18:48:00.000","Title":"Scrolling a painted frame in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am coding for a mouse drag and drop effect on images. Meanwhile, I want to take record of the upper-left point of image each time I dragged and dropped it, are there any ways to get it?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1791,"Q_Id":15171378,"Users Score":1,"Answer":"What methods are you using to draw the images? It's hard to answer this question without that.\nIf you aren't already doing this, you could use a class to hold data about your image, such as position and geometry.","Q_Score":0,"Tags":"python,image,drag-and-drop,pygame","A_Id":15173810,"CreationDate":"2013-03-02T06:07:00.000","Title":"How to get image position in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am coding for a mouse drag and drop effect on images. Meanwhile, I want to take record of the upper-left point of image each time I dragged and dropped it, are there any ways to get it?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1791,"Q_Id":15171378,"Users Score":1,"Answer":"If you derive your classes from pygame.sprite.Sprite , you can get the position by guy.rect. Depending on if you want center, or toplef, or the full rect:\nguy.rect.topleft or guy.rect.center or guy.rect","Q_Score":0,"Tags":"python,image,drag-and-drop,pygame","A_Id":15177879,"CreationDate":"2013-03-02T06:07:00.000","Title":"How to get image position in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In most pygtk widget pages, they contain sections called 'Attributes', 'Properties', and 'Style Properties'. How can I change these properties and attributes?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":3329,"Q_Id":15180320,"Users Score":1,"Answer":"You can change a Widget property by using the Gtk.Widget.set_property(property, value) method. property should be a string.","Q_Score":3,"Tags":"python,styles,gtk,pygtk,pygobject","A_Id":15180684,"CreationDate":"2013-03-02T22:44:00.000","Title":"Editing GtkWidget attributes\/properties","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In most pygtk widget pages, they contain sections called 'Attributes', 'Properties', and 'Style Properties'. How can I change these properties and attributes?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3329,"Q_Id":15180320,"Users Score":4,"Answer":"There are three ways to change properties:\n\nAs in zheoffec's answer, use the set_property() function (or set_style_property() for style properties.) This function is actually not necessary in Python, but it is there for completeness because it is part of the C API.\nUse the props attribute. Any property that you find in the documentation can be accessed through this attribute. For example, btn1.props.label = 'StackOverflow' and btn1.props.use_underline = False.\nUse the getter and setter functions as frb suggests. These are also only present because they are part of the C API, but some people prefer them over the props attribute. Also, there is no guarantee that any particular property will have getter and setter functions! Usually in a well-designed C API they will be there, but it is not required.\n\nFor style properties, I believe the only option is #1. For \"attributes\", well, these are simply Python attributes. To access the allocation attribute, use btn1.allocation.","Q_Score":3,"Tags":"python,styles,gtk,pygtk,pygobject","A_Id":15184441,"CreationDate":"2013-03-02T22:44:00.000","Title":"Editing GtkWidget attributes\/properties","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have both text and image in QLabel, so setPixmap won't satisfy my requirement.\nAs far as I know, QLabel can load image from file by setting HTML label <img src=\"path_to_file\" \/>. But how can I load image from memory(e.g. QImage)?  Because some images are frequently used, it may have performance problem loading the same image from file every time.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1496,"Q_Id":15195880,"Users Score":0,"Answer":"You have two choices:\n\nuse two labels, one with the text and one with the image.\nuse a QPainter to draw the text over the image.","Q_Score":0,"Tags":"python,qt,python-3.x,pyqt","A_Id":15195943,"CreationDate":"2013-03-04T06:34:00.000","Title":"How to insert QImage(or sth like that) into QLabel?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have both text and image in QLabel, so setPixmap won't satisfy my requirement.\nAs far as I know, QLabel can load image from file by setting HTML label <img src=\"path_to_file\" \/>. But how can I load image from memory(e.g. QImage)?  Because some images are frequently used, it may have performance problem loading the same image from file every time.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1496,"Q_Id":15195880,"Users Score":0,"Answer":"You can also set stylesheet for your QLabel as:-\n            QLabel{\n                background-image: url(\/images\/button.png);","Q_Score":0,"Tags":"python,qt,python-3.x,pyqt","A_Id":15198050,"CreationDate":"2013-03-04T06:34:00.000","Title":"How to insert QImage(or sth like that) into QLabel?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a program in python, and use GTK for part of it.\nWhenever GTK opens, it causes the whole program to stop responding, and not move on to the next process. Ideally, i would like it if the gtk window opened independently to the rest of the program, since the GTK window is just to display information, and the functionality is text based\nIs there any way to continue executing the python program, after the GTK window opened. I can't find anything in the pygtk manuals\nAny help would be great, thansks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":159,"Q_Id":15271870,"Users Score":0,"Answer":"If your program has a Gtk UI then the program is supposed to be driven by the GTK main loop. You may be able to run a gtk main loop in a secondary thread, but that it not really a supported configuration and you may run into many more problems","Q_Score":0,"Tags":"python,gtk","A_Id":15276223,"CreationDate":"2013-03-07T12:58:00.000","Title":"gtk allow background processes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am having some problems with a app we are making with wxWidget\/wxPython and PyInstaller.\nWe have compiled the app into a single exe for windows but:\n1) On some machines it will not launch at all. It doesn't generate a error or anything in the app logs. It just stops almost immediately.\n2) On some machines it will launch fine from cmd but not from explorer. again, same behavior. It just stops almost immediately.  I don't even see it pop up in the process explorer.\n3) On some machines it works just fine.\nAre there any tips on how I can figure out what is going wrong? Is there a way to launch a exe with a debugger?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":374,"Q_Id":15298618,"Users Score":1,"Answer":"There are a few things you may want to look into:\n\nDid you compile it as \"one file\"? I have heard that one exe may be blocked by some antivirus programs. It uses a few of hacks to get everything in one executable which may be considered malicious.\nDid you compile it as Windows app (no console)? You may want to enable console and run it on machine where it does not run at all from console. That way you may see why it crashes.","Q_Score":0,"Tags":"windows,wxpython,wxwidgets,pyinstaller","A_Id":15678526,"CreationDate":"2013-03-08T16:24:00.000","Title":"PyInstaller Created App WIll Launch from cmd but not from explorer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Are there any Python game libraries (Pygame, Pyglet, etc.) with support for RPython? Or game libraries specifically made for RPython? Or bindings for a game library for RPython?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":255,"Q_Id":15317707,"Users Score":0,"Answer":"RPython is not Python. They are different languages even though it just so happens that you can execute RPython code with a Python interpreter and get similar effects (much more slowly) to running the compiled RPython program. It is extremely unlikely for there to ever be any reasonable Python library (game library or any other kind) that also works in RPython. It would have to be specifically written for RPython, and if it worked in RPython it would be so inflexible when considered as a regular Python library that nobody would use it in that context.\nIf you want to program in a lower level compiled language with game libraries, use C# or Java. RPython is not a good competitor (in large part because it has very few libraries for anything, not even much of a standard library).\nIf you want to program in Python, use Python (possibly use the PyPy implementation of Python, which can be faster than the standard Python interpreter if it supports all the libraries you're using). RPython will not help you write Python code that goes faster.\nIf your goal is not to specifically produce a game, but rather to do some project in RPython because you want to learn RPython specifically, then that's a perfectly reasonable aim. But writing a game in will probably not be the most helpful project for learning to write RPython; you should probably consider writing some sort of interpreter instead, since that's what RPython is designed to do.","Q_Score":1,"Tags":"python,game-engine,pypy,rpython","A_Id":15564865,"CreationDate":"2013-03-10T00:53:00.000","Title":"Game Library with Support for RPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I will be in charge of teaching a small group of middle school students how to program phone applications. After much research I found that Python might be the best way to go.\nI am a website development senior at my university, but I have not used Python before.  I understand both ActionScript and Javascript and I think their logic might be beneficial for learning Python. For the web languages I am familiar with writing I use Sublime2, Dreamweaver, or Flash to code them.  \nSo my questions are:\nWhich program do I use to code Python?\nHow do I use the code created in Python to work on Android phones?","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":91831,"Q_Id":15319018,"Users Score":0,"Answer":"Dr. python is a good ide\/editor, but its simple to use. If your using linux, you can install it in the software center. I don't know how to install it on OSX\/Windows","Q_Score":28,"Tags":"android,python","A_Id":27331662,"CreationDate":"2013-03-10T04:46:00.000","Title":"How do I program an Android App with Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a bunch of objects interacting with each other. They all draw ovals that constitute representations of themselves on a Tkinter Canvas, and store the representation's Tkinter id as an attribute.\nHow can I make it so when I click one of the ovals, my program will print the other attributes of the object which that oval represents?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":177,"Q_Id":15344185,"Users Score":1,"Answer":"When you click on an item, you can get the canvas item id of the one that was clicked on. You would then use this information to look up the actual object. You can either iterate over all your objects looking for one with the given id, or you can keep a dictionary which maps ids to objects. Once you have the actual object, you can print the other attributes however you want.","Q_Score":0,"Tags":"python,tkinter","A_Id":15344805,"CreationDate":"2013-03-11T16:55:00.000","Title":"Returning object information after clicking its representation in a Tkinter canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a python script(using python clang bindings) that parses C headers and extracts info about functions: name, return types, argument types.\nI have no problem with extracting function name, but I can't find a way to convert a clang.cindex.Type to C type string. (e.g. clang.cindex.TypeKind.UINT to unsigned int)\nCurrently, as a temporary solution, i have a dictionary clang.cindex.TypeKind -> C type string and code to process pointers and const qualifiers, but I didn't found a way to extract structure names.\nIs there a generic way to get C definition of clang.cindex.Type? If there isn't, how can I get C type string for clang.cindex.TypeKind.RECORD and clang.cindex.TypeKind.FUNCTIONPROTO types?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1599,"Q_Id":15388961,"Users Score":2,"Answer":"For RECORD, the function get_declaration() points to the declaration of the type (a union, enum, struct, or typedef); getting the spelling of the node returns its name. (Obviously, take care between differentiating the TYPEDEF_DECL vs. the underlying declaration kind.)\nFor FUNCTIONPROTO, you have to use a combination of get_result() and get_arguments().","Q_Score":4,"Tags":"python,clang,llvm-clang","A_Id":18359608,"CreationDate":"2013-03-13T15:04:00.000","Title":"Extract type string with Clang bindings","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a very simple script for my raspberry pi that loads an uncompressed WAV and plays it - however when I run the script as root (to be able to use GPIO and ServoBlaster), there is no sound output.  \nI have set the default audio device to a USB sound card, and this works - I have tested this using aplay fx.wav.\nRunning the pygame script without sudo, the sound plays fine.  \nWhat is going on here?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1087,"Q_Id":15405082,"Users Score":1,"Answer":"The issue was the sudo command changing the directory in which the script was being run - so running python with sudo -s or simply using an absolute path for the sound fixed it.","Q_Score":0,"Tags":"python,audio,pygame,sudo,raspberry-pi","A_Id":15428577,"CreationDate":"2013-03-14T09:08:00.000","Title":"When running a pygame script as root, no sound is output?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I have a lot of python scripts that I have written for my work but no one in my lab knows how to use Python so I wanted to be able to generate a simple Mac App where you can 'Browse' for a file on your computer and type in the name of the file that you want to save . . . everything else will be processed by the application for the python script I have generated.  \nDoes anyone know if this is possible? I watched some tutorials on people generating applications in Xcode with Objective C but I don't want to have to learn a new language to reconstruct my Python scripts.\nThank you","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3884,"Q_Id":15469799,"Users Score":0,"Answer":"Open Automator\nChoose \"Application\"\nDrag a \"Run Shell Script\" onto the workflow panel\nChoose \"\/usr\/bin\/python\" as the shell. Paste in your script, and select Pass Input: \"to stdin\"\nOr, choose bash as the shell, and simply have the automator script run your Python script with Pass Input \"as arguments\" selected on the top right. You'll then use the contents of $@ as your arguments.\nSave the application. \nDone. You have a .app onto which files can be dragged.","Q_Score":3,"Tags":"python,xcode,interface","A_Id":15469982,"CreationDate":"2013-03-18T04:31:00.000","Title":"Is it possible to create Python-based Application in Xcode or equivalent?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have a game, written in Python, and I use Panda3d.\nNow I want to have a possibility for restart, that is, I want to press a button with the result that the main is executed again, just as if the current instance of the game had never existed.\nIs there a simple way to do this?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":583,"Q_Id":15486091,"Users Score":3,"Answer":"Not really.  Panda3D doesn't really make this abstraction, that's up to the application developer.  It depends on the specific case what \"restart\" really means; do you want to close the existing window and then reopen a new one?  If not, then that means that you have to keep many Panda3D objects in place and can't simply recreate the ShowBase instance.  But do you then want to unload any models loaded into memory?  Do you want to resend the geometry for your UI objects to the graphics card?\nSo, depending on your specific needs, you will have to unload and get rid of the objects that you need to restart and then recreate them.  If you use an object oriented approach and structure your objects properly, this should be straightforward - ie, you implement an unload() on your Game object that unloads things specific to that game, and then let the references to that object go (causing it to be garbage collected), and create a new one.  (Beware of circular references!  If you have them, they may keep old instances of your objects in memory even when they have gone out of scope.)","Q_Score":1,"Tags":"python,application-restart,panda3d","A_Id":15522504,"CreationDate":"2013-03-18T20:17:00.000","Title":"panda3d - how to restart a game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Do you have to have pygame installed to run pygame games? I have programmed a game in pygame on my Raspberry Pi (using the Adafruit WebIDE), and I don't want to have to run it on the Pi itself, so I am planning to use it on my Windows 8 box, and I don't have pygame installed on the Windows box.","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":4043,"Q_Id":15488944,"Users Score":-1,"Answer":"You cannot run a python program without python installed. However you could make the program an exe file by using a certain converter. Some converters are py2exe, pyinstaller, and cx_freeze. I personally recommend cx_freeze. If you use cx_freeze you must add the line import pygame._view to your source code due to a bug.","Q_Score":1,"Tags":"python,pygame","A_Id":15625491,"CreationDate":"2013-03-18T23:36:00.000","Title":"Do you have to have pygame installed to run pygame games?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Do you have to have pygame installed to run pygame games? I have programmed a game in pygame on my Raspberry Pi (using the Adafruit WebIDE), and I don't want to have to run it on the Pi itself, so I am planning to use it on my Windows 8 box, and I don't have pygame installed on the Windows box.","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":4043,"Q_Id":15488944,"Users Score":-1,"Answer":"Yes, for a computer to run a program, it needs to have the modules included in the program. It's like saying that you want to solve a quadratic equation but numbers do not exist yet. Especially if you want to edit it on your computer, you would need to have Pygame installed.","Q_Score":1,"Tags":"python,pygame","A_Id":15488983,"CreationDate":"2013-03-18T23:36:00.000","Title":"Do you have to have pygame installed to run pygame games?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm really trying to fall in love with Python and move away from Matlab.  Is it possible to make Matlab style GUIs in Python?  How easy is it by comparison?  (I make matlab GUIs programmatically, wouldn't dare use GUIDE)  Can I put matplotlib graphics in these GUIs?  Is tk or wx (or something else) better for this?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":2810,"Q_Id":15507009,"Users Score":1,"Answer":"Haven't used Matlab before, not sure about it's GUI. But if you tend to use Python interactively, you may want to give iPython a try. Ipython with Qt can render you an elegant GUI.","Q_Score":0,"Tags":"python,matlab,wxpython,tkinter","A_Id":15508213,"CreationDate":"2013-03-19T17:59:00.000","Title":"Can python make Matlab style GUIs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to learn how to how to program apps for Android. I am not very fond of Java. I read that you could build Android apps with Python and C++. So can I build apps completely without using Java? Also what are the advantages of C++, Python, and Java when building Android? Another question: Will Django Framework work for Android? Thank you for your time.","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":3672,"Q_Id":15514294,"Users Score":3,"Answer":"You might want to checkout the likes of Phonegap, Scala, Groovy, Mirah, Rhodes, Clojure","Q_Score":1,"Tags":"java,android,c++,python,django","A_Id":15514369,"CreationDate":"2013-03-20T02:38:00.000","Title":"Is it possible to build Android apps without Java?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have c++ code that can be compiled under Linux, windows or Mac OS. The code compares two images. I would like to have its front end running on a browser and make available to the www. \nI am familiar with hosting and dns and that is not the issue. what I can't seem to figure out is:\n\nHow do I invoke the script once the image is uploaded by users? \nThe results from the code needs to be displayed back to the browser. How can a callback be set up for this?\n\nIs there a php solution? Or python (with flask)?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":959,"Q_Id":15519904,"Users Score":0,"Answer":"You can use sockets, and start listening on some port from C++ program, then from PHP you can connect and send\/receive data to\/from your program.","Q_Score":0,"Tags":"php,c++,python,flask","A_Id":15520011,"CreationDate":"2013-03-20T09:40:00.000","Title":"Web front-end for c++ code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Does embedding c++ code in python using ctypes, boost.python, etc make your python application faster?\nSuppose I am making an application in pygtk and I need some functions which need to be fast. So if I use c++ for certain tasks in my application will it be beneficial? \nAnd what are other options to make python code faster?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":624,"Q_Id":15543783,"Users Score":3,"Answer":"It depends, there's not a definitive answer. If you write bad code in C++ it could be even slower than well written Python code.\nAssuming that you can write good quality C++ code, you can expect speedups up to 20x in the performance critical parts.\nAs the other answer says, NumPy is a good option for numerical bottlenecks (if you think in matrix operations rather than loops!); and SciPy comes with weaver, that allows you to embed inline C++ and other goodies.","Q_Score":11,"Tags":"c++,python,c,ctypes,embedding","A_Id":15544287,"CreationDate":"2013-03-21T09:34:00.000","Title":"Does embedding c++ code in python make your python application faster?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My main question: can you have several processes write to one queue in a loop and use that queue to update a GUI?\nI have been looking at the posts regarding queues and multiple processes and I was wondering if anyone had any idea if it is possible or beneficial to use combinations of them. \nMy thought process is this: since all processors are made now with ~8 cores, most programs I make should have the ability to access this power if there is any part of the program that is at all computationally expensive. I would like to have a GUI which displays the progress of several different processes at the same time. I would like each of these processes to use as much of the processors as possible, but they all have to write to the GUI at the same time, so from what I have read, it seems like a queue will work for this. \nIs the best way to approach this to have several processes communicate to a queue via a pipe, and have the queue update the GUI? \nAt the moment I am using pyQt signals and slots  but I feel this is a bad solution for modern times since it only uses one CPU core.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":356,"Q_Id":15575872,"Users Score":1,"Answer":"Most GUI systems are event driven and expect all event handling to come from a single thread. This is true of the Windows event system, Android events, Swing, and probably many others. In the case of GUIs, the practical benefit of making all the event management functions thread-safe is small, while the difficulty is quite large. Most large scale concurrent systems do combine event based and thread based approaches to concurrency, for instance modern browsers. In your case, it's much simpler to just register an update event and have it posted to the event dispatching thread by your worker processes\/threads. This way your GUI remains responsive to other windowing events as it is only being notified periodically.","Q_Score":0,"Tags":"python,multithreading,user-interface,parallel-processing,queue","A_Id":15576036,"CreationDate":"2013-03-22T16:54:00.000","Title":"Shared queue across multiple processes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am searching for month now and growing quite frustrated.\nI just love python. \nSo after doing a lot of console based stuff I wanted to do some graphical UIs as well.\nI am aware of most of the frameworks (wxpython, glade, tk etc).\nBut: I do not want to write the code for the GUI itself per hand! Declaring every element from hand, thinking about grids and doing a trail and error to find out just how many pixels you have to move an object to get it in the right place. Well, lets say that just sounds like 1990's to me, and it is no fun at all.\nSo to put it plain and simple, what I am looking for is a solution that allows me to design a GUI graphically (WYSIWYG) and have an event based linking to python code.\nAlmost all major languages have that: For C\/C++ their are certainly the most IDEs\/tools that can do that. For Java there is Netbeans with Wwing (example of what i want; it would be ideal if that UI designer in Netbeans could spit out jython code, but no: python is supported but not UIdesign). Even Mono\/Visual Basic etc. has tools like that.\nSo why the hell is their nothing for python?\nP.S. And please, no comments like \"If you are are real programmer you do it by hand to get cleaner code\". If I want something very specific I edit it by hand, but designing a standard UI by hand is a waste of time.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5155,"Q_Id":15591618,"Users Score":0,"Answer":"See Glade, particularly in use with the libglade Python bindings.","Q_Score":0,"Tags":"python,wysiwyg","A_Id":15591769,"CreationDate":"2013-03-23T20:19:00.000","Title":"Is there really no event based wysiwyg Gui builder for python\/jython etc","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The python code: menu_item = gtk.MenuItem(\"apr\u00e8s\") gives a warning message: Gtk warning Invalid input string and the menu item is not shown. What should I add \/ change to have the menu item displayed?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":460,"Q_Id":15592613,"Users Score":1,"Answer":"Your editor is most likely saving the source file in another encoding, such as Latin-1 or Windows-1252, where GTK expects UTF-8. Try replacing \"apr\u00e8s\" with u\"apr\\u00e8s\".encode(\"utf-8\"). If that makes it work, the problem lies there.\nTo correctly fix the problem, you need to:\n\ndeclare the encoding to Python using the # -*- coding: utf-8 -*-\nmake sure your editor is saving the file in the declared encoding. If necessary, use a hex editor to verify this.\nuse Unicode string literals for non-ASCII strings, i.e. u\"apr\u00e8s\" instead of \"apr\u00e8s\". Where unicode strings are not accepted, use u\"apr\u00e8s\".encode(\"utf-8\"). PyGTK generally accepts Unicode strings, so explicit encoding to UTF-8 should not be necessary.","Q_Score":0,"Tags":"python,gtk","A_Id":15596366,"CreationDate":"2013-03-23T22:04:00.000","Title":"Gtk gives a warning and won't show my menu item","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anyone know a simple way to load a .gif image into python using pygame? I tried loading a .gif image using 'pygame.image.load(path)' which worked although only the first frame loaded.Ever since I had to use a loop to display multiple images at once.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":944,"Q_Id":15593813,"Users Score":1,"Answer":"Simply put, you cannot display multi-frame GIFs in Pygame, unless you use an extra library. Instead, explode your GIF. You will have to do everything manually, as Pygame does not control flow time, etc, which is necessary for animated GIFs.","Q_Score":2,"Tags":"python,loading,gif","A_Id":15593845,"CreationDate":"2013-03-24T00:41:00.000","Title":"Loading a multiframe\/moving .gif image into python using pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python noobie.\nI'm trying to make Python select a portion of my screen. In this case, it is a small window within a Firefox window -- it's Firebug source code. And then, once it has selected the right area, control-A to select all and then control-C to copy. If I could figure this out then I would just do the same thing and paste all of the copies into a .txt file.\nI don't really know where to begin -- are there libraries for this kind of thing? Is it even possible?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":556,"Q_Id":15626786,"Users Score":0,"Answer":"I would look into PyQt or PySide which are Python wrapper on TOp of Qt. \nQt is a big monster but it's very well documented and i'm sure it will help you further in your project once you grabbed your screen section.","Q_Score":0,"Tags":"python,asp.net,python-2.7,screen-scraping,web-crawler","A_Id":15627630,"CreationDate":"2013-03-25T23:34:00.000","Title":"How to: Python script that will 'click' on a portion of my screen, and then do key commands?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"By \"reasonable\" environment I mean that it should not require the user to manually install any dependencies of the application, but a working Python installation can be required. Additionally I would like the application to work on Windows, OSX, and popular Linux distributions. If I can package a Python interpreter as well, that's better. Size is not really a concern. A good example of what I want to accomplish is the SublimeText editor. \nIs there an established way of doing this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":380,"Q_Id":15679272,"Users Score":1,"Answer":"Yes, python comes with setup utilities, and there are packages which will put your complete application in a platform specific binary(exe on windows, .app on osx).\nSome of the packages I would recommend looking at would be:\ncx_freeze\npy2app\npy2exe","Q_Score":2,"Tags":"python,deployment,pyqt,pyside","A_Id":15679428,"CreationDate":"2013-03-28T10:20:00.000","Title":"How can I create a package of a PyQt\/PySide application which can be expected to run in \"reasonable\" environments?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"goal\nUnderstanding how a radiobutton in a Tkinter menu works\ncode\nI have a radio button inside the options menu as so:\n\n\nv = BooleanVar()\n\nv.set(True)\n\noptions.add_radiobutton(label=\"change pop up\", command =togglePopUp,variable=v,onvalue=True,offvalue=False)\n\n\ntogglePopUp is a function that changes the value of variable v from True to False or vice versa. Main window is already opened and this menu will be added later to the window. This is just the fragment of code that is related to the radiobutton. \nQuestion\nNow my question is when I press the radiobutton (after running the code) will the value of the variable be changed or will the function togglePopUp be called? If the function will be called then what will happen to the status of the radiobutton? will the status of the radiobutton be updated instantly or will there be a delay? \nresearch\nI read about the radiobutton and the Boolean variable from the Tkinter book at effbot.org. But I was not convinced about how it worked. I tried a program but I am not getting the output that I essentially want. So I decided to understand how it works at a deeper level. \nspecs python 2.7 Tkinter 8.5\nLinux Mint 14","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4326,"Q_Id":15700627,"Users Score":3,"Answer":"Both actions will occur. When you click on a radiobutton, first the variable will change its value, and after that the event handler passed as command option is called if present.\nAlso your example would not work, since add_radiobutton doesn't allow the onvalue and offvalue options - only value.","Q_Score":3,"Tags":"python,tkinter","A_Id":15724761,"CreationDate":"2013-03-29T09:32:00.000","Title":"Radio button in a Tkinter menu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've managed to make a single working executable file (for Windows) from a PyQt based Python app using PyInstaller, but is it also possible for Linux?\nOn linux machine (LUbuntu), when I run the .py script, I've got errors about missing PyQt bindings and I can't even download them by apt-get because of inability to connect the servers. It would be much more convenient to somehow pack the missing libraries to my program's files in order to make it more portable, but how can I do it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1029,"Q_Id":15714976,"Users Score":0,"Answer":"If you package your application in the Linux distribution's package format, it can contain dependency information. That is the canonical solution to this problem. \nOtherwise you'd have to include all nested dependencies to make sure that it'll work.","Q_Score":0,"Tags":"python,linux,pyqt,portability,python-bindings","A_Id":15716571,"CreationDate":"2013-03-30T04:29:00.000","Title":"How to convert a Python PyQt based program to a portable package in Linux?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"How do I create a bitmap button with attached text label in wxpyython. I have not come across any such generic buttons till now. I believe I will have to create one myself. How do I do it?\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1315,"Q_Id":15721749,"Users Score":2,"Answer":"Look at the wx.lib.buttons module for various flavors of generic buttons.  \nAlso, in the 2.9 release series the stock button class (wx.Button) can have a bitmap + text label.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":15724389,"CreationDate":"2013-03-30T18:09:00.000","Title":"Bitmap Button with attached text label in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if there was a way to make a slider static under certain conditions, i.e. the program is under trial license.\nOne solution I've thought up was putting an image instead of a slider, but I'd prefer a static slider.\nIs there a way I could do this?\nThanks!!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":51,"Q_Id":15745398,"Users Score":3,"Answer":"You can use the state=DISABLED option in the constructor, which is allowed in almost all Tkinter widgets.","Q_Score":0,"Tags":"python,slider,tkinter","A_Id":15745558,"CreationDate":"2013-04-01T14:33:00.000","Title":"Making a python 2 Tkinter slider static under certain conditions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When i run this program i get an error that MinimaxNode' object has no attribute 'value'\nConnectFour is an other class that initializes the board and marks the moves, checks if someone won, etc.\nUtility just returns 2 points (it is still in progress)\nThe problem arises that in MinimaxPlayer in child.get_minimax_value as it puts an error that MinimaxNode' object has no attribute 'value'","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":164,"Q_Id":15775010,"Users Score":0,"Answer":"Your output you see is simply because you print out the object MinmaxNode, which must not have a __repr__ method set up. \nYour error of \"local variable 'col' referenced before assignment\" is because you define col conditionally in your for loop but use it as an argument in play_turn regardless of whether it's been assigned.  You should check that col has been defined after running your for loop and before calling it.","Q_Score":0,"Tags":"python","A_Id":15775072,"CreationDate":"2013-04-02T21:46:00.000","Title":"Minimax For Connect four doesn't return a value","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to add spreadsheet functionality to my wxpython application running on Windows. The CSheet module seems broken in the latest 2.9 version. It shows:\nTypeError: EndEdit() takes exactly 4 arguments (5 given)\nMay I know if there is any suggestions to fix it or any other python module with good spreadsheet functionality ? I tried some but most of them are built on top of CSheet.\nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":203,"Q_Id":15778593,"Users Score":0,"Answer":"CSheet appears to just be a sub-class of Grid, so you could probably just use the Grid widget. Or you could go to wxPython's bug tracker on their website and submit this as a bug. They're usually pretty quick about patching stuff, especially in the 2.9 branch.","Q_Score":0,"Tags":"wxpython","A_Id":15788526,"CreationDate":"2013-04-03T03:57:00.000","Title":"wxPython CSheet issue and replacement","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When using the magic function %edit from QtConsole with IPython, the call does not block, and does not execute the saved code. It does however save a temporary file...\nI think this is intended behavior due to GUI editors and uncertainty, and whatever that reason is for not being able to communicate with subprocess (pyZMQ?).\nWhat do you suggest as the best way to mix %edit\/%run magics?\nI would not mind calling two different commands (one to edit, and one after I have saved and execution is safe). But those commands need a way to synchronize this target file location, or someone to persist storage, and probably need some crude form of predicatably generating filenames such that you can edit more than one file at a time, and execute in arbitrarily. Session persistence is not a must.\nWould writing my own magic do any good? Hope we can %edit macros soon, that would do well enough to make it work.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":883,"Q_Id":15802651,"Users Score":1,"Answer":"you shoudl be able to do %edit filename.py and %run filename.py. The non blocking behavior is expected, and IIRC due to technical reason. Not unsurmountable  but difficult.\nYou could define your own magic if you wish, improvement are welcomed. \n\nHope we can %edit macros soon, that would do well enough to make it work.\n\nFor that too, PR are welcomed. I guess as a workaround\/option you can %load macro which would put macro on input n+1 , edit it and redefine it, that might be a good extension for a cell magic %%macro macroname","Q_Score":0,"Tags":"edit,ipython,qtconsole","A_Id":15833277,"CreationDate":"2013-04-04T04:40:00.000","Title":"Ipython QtConsole %edit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been developing a wx.python application.  at some point  i need to create a fullscreen, no taskbar, etc. wx.Frame  which has exactly  the size of the screen and display in it a bimap which has exactly the dimensions of the screen, so one pixel of the bitmap equals exactly  one pixel of the screen.\neverything has been working fine (on dvi\/vga\/hdmi  monitors) up to the time when i pluged in displayport monitor. \nthe monitor is detected by wxwidgets to be lower  resolution than it actually  is, so the bitmap goes off the screen. EDID still  detects valid resolution so it is for sure  wxwidgets related issue.\n when i use wx.DisplaySize - it returns lower resolution than is actually  set. i also tried to create the bitmap according to the wx.DisplaySize()  output  but then, as expected, when i try to light up one pixel, its neighbours are changed too. (some sort of scalling occurs).\nsimilar issue  occurs when i plug a projector. \nhave  any of you had simmilar symptomes?  how to deal with it?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":110,"Q_Id":15817272,"Users Score":0,"Answer":"So i found the solution of the problem.\n It is because when I was plugging the different monitor - for some reason the DPI was changing. Adjusting the settings in the windows display control panel did the thing.","Q_Score":0,"Tags":"wxpython,wxwidgets","A_Id":16090332,"CreationDate":"2013-04-04T16:59:00.000","Title":"weird scalling on displayport monitors in wx.python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been developing a wx.python application.  at some point  i need to create a fullscreen, no taskbar, etc. wx.Frame  which has exactly  the size of the screen and display in it a bimap which has exactly the dimensions of the screen, so one pixel of the bitmap equals exactly  one pixel of the screen.\neverything has been working fine (on dvi\/vga\/hdmi  monitors) up to the time when i pluged in displayport monitor. \nthe monitor is detected by wxwidgets to be lower  resolution than it actually  is, so the bitmap goes off the screen. EDID still  detects valid resolution so it is for sure  wxwidgets related issue.\n when i use wx.DisplaySize - it returns lower resolution than is actually  set. i also tried to create the bitmap according to the wx.DisplaySize()  output  but then, as expected, when i try to light up one pixel, its neighbours are changed too. (some sort of scalling occurs).\nsimilar issue  occurs when i plug a projector. \nhave  any of you had simmilar symptomes?  how to deal with it?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":110,"Q_Id":15817272,"Users Score":1,"Answer":"Correct EDID values does not necessarily mean that the system is running it in that display mode.  Have you checked the system's display properties or screen resolution properties to ensure that the system is driving the display at its full resolution?  Your symptoms sound to me like it is running at a lower resolution and the display is stretching it to fill the full screen.","Q_Score":0,"Tags":"wxpython,wxwidgets","A_Id":15822502,"CreationDate":"2013-04-04T16:59:00.000","Title":"weird scalling on displayport monitors in wx.python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We already know that we can convert from ui to py easily with pyuic4.\nIs possible to convert .py (that only contains pyqt ui related stuff) code back to .ui.","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":20658,"Q_Id":15822786,"Users Score":11,"Answer":"I can give you an example of why such a thing: when you inherited a project and the original developer didn't place the ui files in the repository (only left there the generated by pyuic4). True, that is a very particular example and that's also my reason why I'm trying to find something (is not a matter of one single ui file).\nIn a more generic way I can imagine that this would had happen to the previous developer in case of a disk fail.\nYes, I'm completely agreed that such a tool is not a normal thing to be provided like pyuic4...","Q_Score":6,"Tags":"python,user-interface,pyqt,pyqt4","A_Id":17655662,"CreationDate":"2013-04-04T22:23:00.000","Title":"Converting .py to .ui file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We already know that we can convert from ui to py easily with pyuic4.\nIs possible to convert .py (that only contains pyqt ui related stuff) code back to .ui.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":20658,"Q_Id":15822786,"Users Score":1,"Answer":"Qt\/PyQt doesn't come with a tool for that, and AFAIK nobody's written one.\nAnd it's hard to imagine why you'd need it. Just keep the .ui file around, and never edit the generated .py file (or even use the .ui file dynamically at runtime with uic), and you'll never need to reverse-convert.\nMeanwhile, if you've got some random PyQt4 code that generates a GUI that wasn't even created by pyuic4, there's no guarantee that any .ui could possibly generate the code. (In fact, most of the PyQt samples you'll find online don't do things the same way pyuic4 would, and most likely any other code generator will similarly not do things the same way pyuic4 does.)","Q_Score":6,"Tags":"python,user-interface,pyqt,pyqt4","A_Id":15822891,"CreationDate":"2013-04-04T22:23:00.000","Title":"Converting .py to .ui file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having trouble importing a resource file. I'm using pyqt4 with monkey studio and I am trying to import a png image. When I run the program I get an import error like \n\nImportError: No module named icon_rc\n\nI know that I have to compile it using pyrcc4 but I don't understand how to do this can anybody help please. It would be very helpful to have an answer that fully explains how to compile the resource file so I can import it.","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":49757,"Q_Id":15864762,"Users Score":0,"Answer":"you could try with pyside as well like:\n--- pyside-rcc -o input.qrc output.py","Q_Score":15,"Tags":"python,pyqt,pyqt4,resource-files","A_Id":47707774,"CreationDate":"2013-04-07T16:30:00.000","Title":"PYQT4 - How do I compile and import a qrc file into my program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having trouble importing a resource file. I'm using pyqt4 with monkey studio and I am trying to import a png image. When I run the program I get an import error like \n\nImportError: No module named icon_rc\n\nI know that I have to compile it using pyrcc4 but I don't understand how to do this can anybody help please. It would be very helpful to have an answer that fully explains how to compile the resource file so I can import it.","AnswerCount":5,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":49757,"Q_Id":15864762,"Users Score":5,"Answer":"In Pyqt5 this command can be used Pyrcc5 input_file.qrc -o Out_file.py\nWe need to convert that qrc file into python file and then it can be imported to your code","Q_Score":15,"Tags":"python,pyqt,pyqt4,resource-files","A_Id":44592514,"CreationDate":"2013-04-07T16:30:00.000","Title":"PYQT4 - How do I compile and import a qrc file into my program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering how I fill a wxChoice with content at runtime.\nWhen creating the GUI I do not have the information of the content since it depends on the users what directory to choose.\nWhat am I doing? The user will have to select a directory from a wx.DirDialog. The event handler refers to a function that will search for files of certain type and the results will be returned as a list of strings.\nThe list of strings should be used to fill\/update the wx.Choice widget but I do not how to do this at runtime.\nDoes anybody has a solution for this problem?\nCheers Thomas","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":477,"Q_Id":15873307,"Users Score":1,"Answer":"I personally think that SetItems(listOfItems) is the quickest way of doing it and it works for several other widget types as well, such as ComboBox. The answer that Thomas mentions forces the developer to clear the widget and then Append individual items OR use AppendItems to add a list of items. Either way, that's a 2-step process compared with just using SetItems()","Q_Score":0,"Tags":"python,wxpython","A_Id":15888610,"CreationDate":"2013-04-08T07:14:00.000","Title":"Fill wx.Choice at runtime","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing an application that displays the content of a database table. My application shall display an image associated with each tuple\/row, among textual and numeric data.\nThe trouble is that I am dealing with huge data sets (up to 50k entries). The user will, of course, never see more than a few entries at once. But he should still be able to browse the data in a table-like view.\nRegarding the visual appearance, QTable would just do the job. But, after reading blog posts about this, QTable seems to be pretty slowish for such tasks, which is understandable since, for let's say 50k entries, on the order of 50k widgets QObjects need to be created.\nI though of using a QSlider as a replacement for the scrollbar of the table and a fixed layout. Whenever the slider is changed, the content of the gui-elements that make up the rows are adjusted.\nHowever, is there any Widget and\/or solution that provides the look and feel of a QTable but allows me to generate only those widgets that are actually displayed?\nMany thanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":292,"Q_Id":15889166,"Users Score":1,"Answer":"Overriding the paint-method of a corresponding delegate-class solves my problem. Thanks to cmannett85.","Q_Score":0,"Tags":"python,qt,pyqt","A_Id":15905007,"CreationDate":"2013-04-08T21:17:00.000","Title":"Qt: Alternatives to QTable for large datasets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a PySide application that connects a number of buttons to a function call that spins off a bunch of external processes (this isn't ideal, but it is necessary).\nThe function call takes less than a quarter of a second to run, but it still presents a chance for the user to outrun my code, causing lag, freezing, or crashing.\nThis leads me to a few questions...\n\nWhat exactly does it mean for a callable to be connected to a signal? Suppose button A's click signal is connected a Python function f. If A is clicked, and then clicked again before f exits, does PySide simply queue another call to f, or does it do something fancier?\nOne possible solution is to make f disconnect itself from the signal and then reconnect before it exits. Before I go off rewriting things to try this, does anyone know if this is at all efficient, or if there is a more elegant solution?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":70,"Q_Id":15914992,"Users Score":0,"Answer":"I'm guessing it does exactly what every other GUI toolkit does, which is try to execute that function for every button press. If you don't want that, then there are several approaches you can take:\n\nDisable the button until the function finishes\nUse a sentinel value, like self.running, and add a check to see if it is True. If so, return. Otherwise, set it to True and execute. Just remember to set it back to False at the end of the function\nDo what you mentioned and disconnect the function from the signal\n\nThose are the main ones. I'm sure there are some more esoteric solutions out there too though.","Q_Score":0,"Tags":"python-2.7,pyqt,pyside","A_Id":15953660,"CreationDate":"2013-04-10T00:36:00.000","Title":"Preventing PySide from Outrunning Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does Blender use OpenGl or DirectX? Or is it all done from scratch?","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":7585,"Q_Id":15916324,"Users Score":9,"Answer":"Does Blender use OpenGl or DirectX?\n\nAll graphics output of Blender is done using OpenGL.\n\nOr does it use a programming language (python?) to do everything from scratch?\n\nWhy \"or\"? An API doesn't substitute a programming language. Blender has been programmed in C, C++ and Python. OpenGL is used to render everthing on screen, including the user interface.","Q_Score":12,"Tags":"python,opengl,blender,cad","A_Id":15924089,"CreationDate":"2013-04-10T03:19:00.000","Title":"What was Blender created in?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any Wxpython control that looks like a tabbed panels...I can use notebook but im not able to close the pages..I need something similar to IE, where you can open new tabs and close it when not needed..","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":648,"Q_Id":15974476,"Users Score":1,"Answer":"Have a look at the agw.flatnotebook.","Q_Score":0,"Tags":"wxpython","A_Id":15974678,"CreationDate":"2013-04-12T14:50:00.000","Title":"wxpython control similar to tabbed panes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have looked at the documentation but I can't seem to implement the full screen toggle. Could someone please show me an example of the correct syntax?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2962,"Q_Id":15993287,"Users Score":0,"Answer":"pygame.display.toggle_fullscreen()  use this function","Q_Score":1,"Tags":"python,user-interface,pygame","A_Id":60500908,"CreationDate":"2013-04-13T21:48:00.000","Title":"What is the correct syntax to enable fullscreen toggle in Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to build an APK using Python for Android that doesn't need Python for Android to be there, i.e. it includes Python? If so, how?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":5413,"Q_Id":15994251,"Users Score":-1,"Answer":"I think you can use py2exe to convert your programm to an .exe - File and then convert this .exe - File to an .apk - File.","Q_Score":2,"Tags":"android,python,apk,sl4a","A_Id":28605884,"CreationDate":"2013-04-14T00:01:00.000","Title":"Python for Android APK without dependencies","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I make that when checkbutton is checked that then all Sliders move like one by using python 3 and tkinter?\nThanks for any help! :)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":132,"Q_Id":15999307,"Users Score":1,"Answer":"First, you will need to save a reference to each of your sliders, which are instances of the Scale widget. Next, you will need to associate a command with the checkbutton (using the command attribute) which will be called whenever the checkbutton is checked or unchecked. In that command you can call the set method of each slider.","Q_Score":0,"Tags":"python,slider,tkinter","A_Id":15999600,"CreationDate":"2013-04-14T12:59:00.000","Title":"Sliders and checkbtton in python 3 and tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"when reading python documentation and various mailing lists I always read what looks a little bit like a dogma. Global variables should be avoided like hell, they are poor design ... OK, why not ? But there are some real lifes situation where I do not how to avoid such a pattern.\nSay that I have a GUI from which several files can be loaded from the main menu.\nThe file objects corresponding to the loaded files may be used througout all the GUI (e.g. an image viewer that will display an image and on which various actions can be performed on via different dialogs\/plugins).\nIs there something really wrong with building the following design:\n\nMenu.py --> the file will be loaded from here\nMain.py --> the loaded file objects can be used here\nDialog1.py --> or here\nDialog2.py --> or there\nDialog3.py --> or there\n...\nGlobals.py\n\nwhere Globals.py will store a dictionary whose key are the name of the loaded files and the value the corresponding file objects. Then, from there, the various part of the code that needs those data would access it via weak references.\nSorry if my question looks (or is) stupid, but do you see any elegant or global-free alternatives ? One way would be to encapsulate the loaded data dictionary in the main application class of Main.py by considering it as the central access part of the GUI. However, that would also bring some complications as this class should be easily accessible from all the dialogs that needs the data even if they are necesseraly direct children of it.\nthank a lot for your help","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":12634,"Q_Id":16011056,"Users Score":12,"Answer":"Global variables should be avoided because they inhibit code reuse. Multiple widgets\/applications can nicely live within the same main loop. This allows you to abstract what you now think of as a single GUI into a library that creates such GUI on request, so that (for instance) a single launcher can launch multiple top-level GUIs sharing the same process.\nIf you use global variables, this is impossible because multiple GUI instances will trump each other's state.\nThe alternative to global variables is to associate the needed attributes with a top-level widget, and to create sub-widgets that point to the same top-level widgets. Then, for example, a menu action will use its top-level widget to reach the currently opened file in order to operate on it.","Q_Score":12,"Tags":"python,global-variables","A_Id":16011147,"CreationDate":"2013-04-15T08:45:00.000","Title":"How to avoid global variables","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if there is an online python interpreter with Pygame. It would be great if there is one, because when I share a game, I don't have to compile it first, I just send the code, and possibly upload the textures to a storage server and change the URL for the image location.\nIs there an online Python interpreter with Pygame?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":10085,"Q_Id":16044608,"Users Score":4,"Answer":"None that I'm aware of. Running a Pygame application in the browser would require some way of displaying graphics and playing sound from a remote Python interpreter. This would be pretty complicated to do, and would likely not perform very well anyway.\nIf you want to write games which run in a web browser, learn Javascript.","Q_Score":5,"Tags":"python,pygame","A_Id":16044733,"CreationDate":"2013-04-16T18:38:00.000","Title":"Is there an online Python interpreter with the Pygame module?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Did Qt 5 and Qt Quick supported by last Version Pyside or PyQt ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2837,"Q_Id":16048056,"Users Score":3,"Answer":"The latest version of PyQt (4.10?) works with Qt5. It does not support Qt Quick 2, AFAIK. I don't believe PySide supports either.","Q_Score":3,"Tags":"python,qt,pyqt,qml,pyside","A_Id":16048799,"CreationDate":"2013-04-16T22:12:00.000","Title":"Pyside or PyQt support Qt 5.0 and Qt Quick 2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a GUI developed using PySide. I have a long operation to perform from the interface, but there is no way to predict how long the operation will be. I'd like to display something to the user to tell him: the operation is in progress, please wait. Something like an infinite progress bar, or a spinning wheel. Is there a widget for such operation in Qt? I found the QProgressDialog (and QProgressBar), but it's not appropriate since I cannot predict the amount of work to perform.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3339,"Q_Id":16049395,"Users Score":0,"Answer":"If you want an infinite progress bar or spinning wheel, just have it play, then when you finish the process, stop and\/or delete the bar\/icon from the screen.","Q_Score":2,"Tags":"python,qt,pyside","A_Id":16050068,"CreationDate":"2013-04-17T00:19:00.000","Title":"Progress bar for event with unknown duration (PySide)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to write a metronome application in Python, and I intend to publish the application for Android and iOS. I have found a few cross-platform frameworks like Kivy, but their audio support is lacking. More specifically, I need very precise audio timing and I can't rely on thread timing or events. I want to write audio data directly to the device's audio output, or create a MIDI file that can be played on the fly. The problem is, I cannot find any suitable framework for this task. \nI know that many games have been written for Android in Python, and those games have excellent and precise sound timing. I need help finding either:\n\na way to create and play MIDI files on the fly in Android with Python,\na Python framework for Android with a suitable audio API to write sound directly to an audio device, or at least play audio with very accurate timing.\n\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1422,"Q_Id":16088764,"Users Score":1,"Answer":"I'm looking for the same thing. I too am looking at Kivy. The possible solutions I can see to audio is hooking in a 3rd party application as a \"recipe\" in Kivy.\nThere is aubio, which apparently can be compiled for iOS\/Android (see stackoverflow question regarding this), but I believe you have to get your own audio source for it, which could be potentially handled by the audiostream subproject in kivy.\nKivy\/audiostream imports the core libpd project it appears, so you can use libpd python bindings. I think this is the path of least resistance, but I had issues when trying to run the examples.\nBoth of these approaches, I think could work but both need some effort to be able to start using.","Q_Score":1,"Tags":"android,python,kivy","A_Id":16287866,"CreationDate":"2013-04-18T16:48:00.000","Title":"Android Audio API in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Im trying to write an IronPython app that uses a COM object interface. I manage to import it using clr.AddReference, and manage also to call some of the functions, create objects, etc.\nHowever at a certain point when trying to call a function I get :\n\nStandardError: Error while invoking GetK300RZ.\n\n(GetK300RZ being the function name.)\nWhy is this happening to me? What does this error mean exactly? could this be related to the 'embed interop types' option?\nI would greatly appriciate any insight as to how to get around this problem...\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":126,"Q_Id":16131781,"Users Score":0,"Answer":"This is just for anyone who ever runs into this question with a similar problem - the problem was that the parameters of the functions were of type out and ref in C#. The function could not be invoked because there was no corresponding function signature. I had to use clr.Reference[] to explicitly create references for the function parameters.\nI guess when using an external COM objects one should stop thinking python and start thinking .net or C#...","Q_Score":0,"Tags":".net,com,interop,ironpython","A_Id":16272641,"CreationDate":"2013-04-21T13:44:00.000","Title":"IronPython - error while invoking","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have downloaded and installed pygame and I know where it is (\/usr\/lib\/python2.7\/dist-packages). I am trying to get the program consisting of the line 'import pygame' to recognize its existence but I keep getting 'ImportError: No module named pygame'. How would I get it to work?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":691,"Q_Id":16133352,"Users Score":1,"Answer":"The installation packages for pygame are incompatible with python 3.x  However, the vast majority of the pygame modules have been ported to python 3.x, so really it's simply a matter of moving the Pygame modules to your python 3.x dist-packages. \nThe scrap, _movie, surfarray for Numeric, and threads modules are the ones that have NOT been ported yet.","Q_Score":0,"Tags":"python-3.x,pygame","A_Id":16134693,"CreationDate":"2013-04-21T16:19:00.000","Title":"Why can't the program recognize pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"issue\nI am writing an application in python. It takes care of contacts and other information about a person. I want to prompt the user for a master key every time that he\/she wants to perform a major operation. I have everything figured out. The whole application is ready and works well. But I store the master key in a file. This file is easily readable in the plain text form. And my friends who tried using this said that the software is useless if I don't apply a strong encryption algorithm as users would simply trust the application with the details that can be easily stolen.\ngoal\nTo store the master key in a form that can be deciphered (or read) only by my program. \nother things\n\nthere is an option for the user to change the master key.\nThe master key will be read and deciphered only once. At the start of the program. It will be stored in a variable then and and used from this variable. \nIt is a GUI application. And I am using python Tkinter. \n\ndetails\nPlease note that the data is stored using another encryption that is not un breakable but enough for this kind of information. \nI have not used any database to store the information. \nThe only data to be encrypted is a master key. It is an alphanumeric string of length anywhere from 7 to 80 characters. \nspecs\n\n1. Python 2.7\n2. Tkinter 8.5\n3. Linux Mint 14","AnswerCount":5,"Available Count":1,"Score":0.0798297691,"is_accepted":false,"ViewCount":859,"Q_Id":16142113,"Users Score":2,"Answer":"You don't need, or even want, complex encryption for passwords--and what you are describing is a password, not a key (it just grants access, it doesn't encrypt the data). Current best practice is to store passwords salted and hashed.  That is, when the user creates a new account and enters a password, you build a string from the password plus user name plus a \"salt\" (which is just a small string that's the same for everyone on your site--this is to thwart rainbow table attacks). Then you run that string through a good hash algorithm--something like SHA1 is fine (even MD5 is more than adequate, despite reports to the contrary). You certainly don't need anything like AES.  Anyway, now that you have a hash, you store the hash in the database, and not the password. Even a strong cipher like AES is useless if don't do the rest right.\nNext time the user logs in, you do the same: add his password to user name and salt, hash that, and compare the hash to what's stored. There's no way, even in principle, for you to know what his password was, so no way for an attacker to find it even if they get your database and know your algorithm and salt.","Q_Score":1,"Tags":"python,encryption,tkinter","A_Id":16146593,"CreationDate":"2013-04-22T08:00:00.000","Title":"Encryption -- how to do it","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the correct\/official\/proper\/recommended way of accomplishing drag\/drop in tkinter? My documentation section 24.1.1 includes:\n\nTkdnd Drag-and-drop support for Tkinter. This is experimental and\n  should become deprecated when it is replaced with the Tk DND.\n\nbut I can find no other official documentation. Does Tkinter have drag\/drop support at all? Is this something version dependant? Is this something not yet included in tk(tcl) which will then filter through to tkinter?\nI should stress that I am talking about drag\/drop between different applications and that I am currently using python 2 (although any solution which relies on python 3 would still be of interest).","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":11082,"Q_Id":16143460,"Users Score":6,"Answer":"Tkinter has no built-in support for dragging and dropping between applications. Tkdnd is, AFAIK, the only way to accomplish it without writing the low level code yourself.","Q_Score":9,"Tags":"python,python-3.x,drag-and-drop,tkinter","A_Id":16145812,"CreationDate":"2013-04-22T09:19:00.000","Title":"Drag and Drop in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What I am trying to achieve seems like it should be simple, but I can not find anything online to help.\nI would like to take my pyqt program and, instead of using the command prompt, export all my print() commands to a qtextbrowser.\nThere are 2 parts to my question.\n\nHow do I disable the command prompt from showing up when the app is run.\nHow to output the print() commands to the text browser in real time.\n\nI am using Python 3.3 and qt designer with pyqt4.\nThank you in advance!\nSome of the code is confidential so if it is needed to help I can remove the sensitive info and post it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":403,"Q_Id":16151727,"Users Score":0,"Answer":"I found out a solution. I was trying to do everything in my GUI thread. Im new to python but I am sure with some research I can teach myself threads.","Q_Score":1,"Tags":"python,python-3.x,pyqt,pyqt4,python-3.3","A_Id":16198711,"CreationDate":"2013-04-22T16:12:00.000","Title":"Real time command prompt export in text field using pyqt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to open the applications like notepad,photoshop,etc. inside the Tkinter window in Python. I tried using os.sytem() but it opens independently(not inside Tkinter window).\nI had searched a lot about this but didn't got any solution. Any kind of help will be appreciated.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":553,"Q_Id":16167995,"Users Score":1,"Answer":"You cannot do what you want. It is impossible to open an external program inside a Tkinter window.\nWhile it is true that it's possible to embed some X11 based apps into an X11 based Tkinter application if the app was designed to be embedded, you will never be able to do this with non-X11 based apps.","Q_Score":1,"Tags":"windows,python-2.7,tkinter,virtual-machine","A_Id":16169706,"CreationDate":"2013-04-23T11:18:00.000","Title":"How to open an exe file in Tkinter window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I used to use TKinter for my GUIS and am now trying to move to QT Designer. I am also new to event based programming. What I am trying to do is listen to communication on my serial port continuously after a start button has been pressed.\nI want to call a function update() which takes in the data and manipulates it and writes it to a file. It must then handle any other events queued up before calling update() again. Obviously if I use a while loop my CPU usage goes to 100% and my GUI becomes unresponsive.  In TKinter I got around this problem (messily) by using an after_idle call which called update() whenever the GUI was idle.\nWhat is the best practice manner of doing this kind of thing using QT?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":260,"Q_Id":16185594,"Users Score":0,"Answer":"Use a thread to monitor the serial port. Use appropriate mechanisms to communicate with the UI (main) thead.\nThat way you can write your comm module without worrying about the event base nature of the UI. Of course you still cannot use a busy while loop to listen to the serial port. But using the usual read() methods with a time out is ok.\nA Queue is well suitable to send data to the UI, and you can write files directly from you comm thread.","Q_Score":1,"Tags":"python,qt,user-interface,qt-designer,serial-communication","A_Id":16185984,"CreationDate":"2013-04-24T07:11:00.000","Title":"Running continuous communications using QT and python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program that displays many tkinter PhotoImages at once (relevant: I'm not using PIL). It currently has several screens, and when the play gets to the edge it loads a new tilemap, creating a bunch more photoimages in the currentTiles array after clearing the old contents. I'm fairly certain there are no other references to these photoimages in the rest of the program.\nThe weird thing is that when I print the contents of the last item in the array after the loadLevel function is called, it says things such as \"pyimage3761\", and it increments each time I load a new screen. Is this due to tkinter keeping track of how many have been created so far, or is it because the old tiles are still in memory? I can't for the life of me figure out where there could be another reference, so I'm just wondering if there are any other possibilities before I spend hours looking for errors.\nThanks!!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":238,"Q_Id":16241755,"Users Score":2,"Answer":"Every created image is assigned a unique name (unless you specify the name of the image when creating). This unique name is generated  by using a counter, which increases monotonically.","Q_Score":1,"Tags":"python,tkinter","A_Id":16241833,"CreationDate":"2013-04-26T17:09:00.000","Title":"Tkinter PhotoImage: References in Memory?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to add a custom image to the tkinter built in tkMessageBox?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3397,"Q_Id":16243650,"Users Score":3,"Answer":"No, there is not. You'll need to create your own message box with a Toplevel and some widgets. When you do that, you'll have complete control over what goes in the window.","Q_Score":0,"Tags":"python,image,dialog,tkinter","A_Id":16244140,"CreationDate":"2013-04-26T19:15:00.000","Title":"Python Tkinter message box add custom image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to TKinter and cant seem to find any examples on how to view a document in a window. What I am trying to accomplish is that when selecting a PDF or TIF it will open the file and show the first page in a window using TKinter. Is this possible?","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":6715,"Q_Id":16244303,"Users Score":1,"Answer":"No, it is not possible to show a TIF or PDF in a Tkinter window. Your main options are to show plain text, and to show images (.gif with plain Tkinter, other formats if you include PIL - the python imaging library).","Q_Score":1,"Tags":"python,tkinter","A_Id":16244366,"CreationDate":"2013-04-26T19:59:00.000","Title":"View a document TKinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using wx.Grid to build spreadsheetlike input interface. I want to lock the size of the cells so the user can not change them. I have successfully disabled the drag-sizing with grid.EnableDragGridSize(False) of the grid but user can still resize the cells by using borders between column and row labels. I am probably missing something in wxGrid documentation.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":426,"Q_Id":16278613,"Users Score":0,"Answer":"I found the solution. To completely lock user ability to resize cells it is needed to use .EnableDragGridSize(False) , .DisableDragColSize() and .DisableDragRowSize()  methods.","Q_Score":1,"Tags":"python,wxpython","A_Id":16279016,"CreationDate":"2013-04-29T12:26:00.000","Title":"wx.Grid cell size lock","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Tkinter\/ttk app that analyzes packets arriving every 10-25 ms.  My present implementation uses a thread that updates 30 StringVars after every socket read, then calls update_idletasks() to update the corresponding Entry widgets.  My app crashes no more than 30 minutes after starting.\nSearches revealed that Tk isn't really thread-safe, and I have two main choices:\n\nUse a thread + queues.\nUse a function + .after(1, function).\n\nThe UI does little more than start\/stop the updates, and provide the Entry widgets for display.\nThe primary wait in the system is the socket read, which has a timeout of 2x the expected packet rate (so it can't block forever).\nIn this case, would you prefer approach #1 or #2?\nI'm leaning toward #2 for its simplicity, but I'm not sure if there are any Tk gotchas waiting along that path.  I'll probably try both while I await the community wisdom.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":548,"Q_Id":16282141,"Users Score":0,"Answer":"I just implemented #2 (function + .after(1, function)) by changing literally 8 lines of code in my original implementation, and it runs perfectly.  So #2 wins based on simplicity and effectiveness.  It runs using 3-4% of 1 core (i5-2500, 3.3 GHz)\nBut if my UI becomes more complex, such as by adding stripchart recording via matplotlib animation, then queues and a separate acquisition thread may become necessary.  But not today!\nEDIT: But don't use .after(0, ...): My UI locked up when I tried it.","Q_Score":0,"Tags":"python,tkinter,real-time,ttk","A_Id":16283361,"CreationDate":"2013-04-29T15:09:00.000","Title":"Real-time Tkinter\/ttk Entry widget update: thread+queue or .after(1)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Tkinter\/ttk app that analyzes packets arriving every 10-25 ms.  My present implementation uses a thread that updates 30 StringVars after every socket read, then calls update_idletasks() to update the corresponding Entry widgets.  My app crashes no more than 30 minutes after starting.\nSearches revealed that Tk isn't really thread-safe, and I have two main choices:\n\nUse a thread + queues.\nUse a function + .after(1, function).\n\nThe UI does little more than start\/stop the updates, and provide the Entry widgets for display.\nThe primary wait in the system is the socket read, which has a timeout of 2x the expected packet rate (so it can't block forever).\nIn this case, would you prefer approach #1 or #2?\nI'm leaning toward #2 for its simplicity, but I'm not sure if there are any Tk gotchas waiting along that path.  I'll probably try both while I await the community wisdom.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":548,"Q_Id":16282141,"Users Score":0,"Answer":"My personal rule of thumb is to avoid threads unless they are strictly required. Threads add complexity. Plus, there's a large percentage of programmers who aren't particularly thread-savvy, so threads add an element of risk if this program will be used or maintained by others. \nThat being said, in this particular case I think I'd go with thread + queues. Since you know how often the display should update, I'd set up a poll of the queue for every 10ms or so to update the widgets.","Q_Score":0,"Tags":"python,tkinter,real-time,ttk","A_Id":16282853,"CreationDate":"2013-04-29T15:09:00.000","Title":"Real-time Tkinter\/ttk Entry widget update: thread+queue or .after(1)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I programmed a simple, little game with wxpython and created an .exe of it with py2exe (and in a 2nd try with pyinstaller). I also programmed an installer which just creates a folder and copies all the game files into this folder. I also created an .exe for this installer. Everything works fine on Windows 7. But on Windows XP i get this problem: My installer.exe succesfully works, but when I start the .exe from my game then I get this error:\n\nfoo.exe is not a valid win32 application\n\nI use python 2.7","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1262,"Q_Id":16307421,"Users Score":0,"Answer":"Is the Windows 7 box you're using to create the installer 64-bit? Is the Python version you were using on Windows 7 64-bit? If so, then you'll need to create the exe using a 32-bit Python, 32-bit wxPython and 32-bit installer. \nA 64-bit program will run just fine on a 64-bit system, but it won't work on a 32-bit one. However, a 32-bit program will run on both.","Q_Score":0,"Tags":"python,wxpython","A_Id":16307892,"CreationDate":"2013-04-30T19:20:00.000","Title":"py2exe\/pyinstaller: execution failure","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need help in pygame for 3.1 i am watching The New Bostons tutorials and whenever I put in\nimport pygame\nfrom pygame.locals import *\nI receive\nTraceback (most recent call last):\n  File \"C:\\Documents and Settings\\Aidan\\Desktop\\pygame.py\", line 8, in \n    import pygame\n  File \"C:\\Documents and Settings\\Aidan\\Desktop\\pygame.py\", line 9, in \n    from pygame.locals import *\nImportError: No module named locals","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":156,"Q_Id":16347535,"Users Score":4,"Answer":"Your problem is that your script (or something else it imports) is already named pygame. So, Python can't find the package with the same name.\nJust rename your script to something else, like my_game.py.","Q_Score":0,"Tags":"python,pygame","A_Id":16347585,"CreationDate":"2013-05-02T20:53:00.000","Title":"Pygame python 3.1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I try to write a simple 2d game using python 3.x and pygame 1.9.2. I want to simulate changing of days\/nights. I have got in-game time(like real, but faster) and I'd like to make my screen darker at exact time but have no ideas how to do it. Could you advice me how to reduce the brightness of my screen or other ways how to show changing of days and nights?\nExcuse for my language if I make mistakes. English isn't native for me)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":755,"Q_Id":16375396,"Users Score":0,"Answer":"Setting gamma or screen brightness is not the best way to go. \nWhen your game gets more complicated, it's easier if you use the technique ecline6 suggested:\nchanging your background image.\nBut since it is a loaded image i suppose, you can use this trick:\nLet's say you have a background surface. Every 10s you will fire an event that will change the backround by blitting an low alpha-black surface on top of it. That way your background will get darker.\nYou can do the same with white, to make it more brighter too.","Q_Score":0,"Tags":"python,pygame","A_Id":16377757,"CreationDate":"2013-05-04T14:33:00.000","Title":"Changing days and nights with pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I\u00b4d like to create a program which will react on actions by user in real time. For example there will be three Labels. And when user clicks on one, I want to recolor the border to a different color and the user should be able to \"type\" a (single) number in this Label. I know about the Entry widget, but Labels are suitable for the whole application. \nThank you for any answers","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":418,"Q_Id":16378144,"Users Score":0,"Answer":"Your question is too vague to answer precisely, but to specifically address each individual point:\n\nYes, it's possible to \"react .. in real time\" -- whenever an event is detected it will be acted upon as soon as possible.\nYes, it's possible to color the border of a widget when an event is detected\nYes, it's possible to type into a label. Though, obviously, the behavior is unusual and may not be what you expect. \n\nI suspect none of those help you solve your real problem, but I have no idea what you're actually trying to accomplish.","Q_Score":0,"Tags":"python,events,tkinter,label,real-time","A_Id":16378921,"CreationDate":"2013-05-04T19:29:00.000","Title":"How to react on actions (events) in real time in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am soon going to be helping my friend create a 3D game with Python.  Will I be able to use Tkinter for this (Which I doubt because the module only excepts .gif images) and add a Z axsis?  Or will I have to use an extra module like PGReloaded, PyGame, etc.  If so could someone give me a good place to learn the module.  By the way the name of the game will be The Search.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1469,"Q_Id":16390995,"Users Score":0,"Answer":"No, Tkinter is not enough for making 3D games.","Q_Score":0,"Tags":"python,module,pygame","A_Id":16391007,"CreationDate":"2013-05-06T01:51:00.000","Title":"3 Dimensional Games in Python Modules","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I work mostly with Matlab but I am little bit familiar with Python as well. I have never created a GUI before, however, I have been suggested to develop a GUI for an important project in Python and not in Matlab. \nConsidering this situation, are there any suggestions that you would like to give which could help me create GUI in python in a time period of a month? Also, I would like to know if I can use Python's Spyder IDE and create GUI from that platform?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":25474,"Q_Id":16428064,"Users Score":3,"Answer":"I would definitely vouch for wxpython. It's very good for advanced GUI work.","Q_Score":4,"Tags":"python,matlab,user-interface,transitions","A_Id":16455768,"CreationDate":"2013-05-07T20:33:00.000","Title":"Creating Graphical User Interface (GUI) in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to design such function that user can use mouse to draw a line to connect two shapes? I'm using this module in wxpython  :  wx.lib.ogl.\nThe doc for theses methods are brief and no good demo that I can learn from.\nDoes anyone can give me some ideas?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":150,"Q_Id":16431949,"Users Score":1,"Answer":"Did you look at the wxPython demo? It shows exactly how to do this. It draws several shapes and then connects them with arrows and lines. You can get the wxPython demo from the wxPython website, which I assume you already know since you keep re-posting your questions to the wxPython mailing list.","Q_Score":0,"Tags":"connection,wxpython,draw,shapes","A_Id":16444284,"CreationDate":"2013-05-08T02:57:00.000","Title":"draw lines to connect two shapes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is mostly for Py2app, but I plan to also port to Windows so Py2exe is also applicable.\nFor Mac: How can I access the Resources folder of my app bundle from Python code? The ideal way for me would be to get the path to this folder into a variable that my classes prepend to any file they need to access. Given the portable nature of OSX app bundles this Resources folder can move, so it's obviously not acceptable to assume it'll always be at \/Applications\/MyApp.app\/Contents\/Resources. \nFor development I can preset this variable to something like \".\/Resources-test\" but for the final distribution I would need to be able to locate the Resources folder to access files therein as file objects.\nFor Windows: If I use py2exe, what's the correct way to get the path to where the application is running from? (Think portable app - the app might be running from Program files, or a directory on someone's flash drive, or in a temp directory!) On Windows it'd be suitable to simply know where the .exe file is and just have a Resources folder there. (I plan to make cross-platform apps using wxwidgets.)\nThanks","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":1524,"Q_Id":16434632,"Users Score":4,"Answer":"By default the 'Resource' folder is current working directory for applications started by py2app.\nFuthermore the environment variable \"RESOURCEPATH\" is set to the absolute path of the resource folder.","Q_Score":5,"Tags":"python,resources,py2app","A_Id":17084259,"CreationDate":"2013-05-08T07:05:00.000","Title":"How to directly access a resource in a Py2app (or Py2exe) program?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I want a key press to be mapped with a button click function in Gtk-python, i.e. if Enter key is pressed, the data-process function should execute, which is called by pressing the process button.\nCan this be done?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1088,"Q_Id":16485470,"Users Score":0,"Answer":"Assuming you are using a gtk.Entry() and a gtk.Button(), I think what you need to do is just connecting the gtk.Entry() to your data-process function like this:\n\n    b = gtk.Button(\"Process\")\n    b.connect(\"clicked\", data-process)\n    e = gtk.Entry()\n    e.connect(\"activate\", data-process)\nThat should do the \"Trick\".\nHope this helped.","Q_Score":0,"Tags":"python,button,gtk","A_Id":33197888,"CreationDate":"2013-05-10T15:14:00.000","Title":"Map a key press to a button click in Gtk Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been experiencing a really weird bug recently:\nOften when I zoom too much on a QGraphicsItem (using scale on the view containing it) that has a QGraphicsDropShadowEffect on it, my app closes with a segmentation fault (core dumped) error.\nWhat's weird is that:\n\nI use Python (with the PySide binding)\nIf I remove the QGraphicsDropShadowEffect, the bug disappears\n\nI also had to remove the QGraphicsDropShadowEffect on a relatively big item because it got the app so slow to the point it became irresponsive when I zoomed a bit too much.\nDo anyone know how I could fix this ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":150,"Q_Id":16487059,"Users Score":0,"Answer":"This may or may not help but when I encountered this the only thing that helped was reinstalling\/updating pyside. I thought the fixed that bug a while back however.","Q_Score":2,"Tags":"python,qt,user-interface,pyside","A_Id":16492340,"CreationDate":"2013-05-10T16:43:00.000","Title":"Qt : Segfault when zooming on QGraphicsDropShadowEffect","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am designing a GUI with several components and two wx.Frame objects F1 and F2. F1 is the main frame and F2 is the secondary frame. I would like to have a mechanism, so the user can attach these two frames into one frame, and also detach them into two frames again if needed.\nAssume F1 and F2 contain panels P1 and P2 respectively. When detached, the use should be able to move and resize each frame independently, and closing F1 will close the entire GUI. When attached, F1 will contain both P1 and P2 vertically and F2 will seem to vanish and become a part of F1. There is a lot of wiring and events and messages passed between P1 and P2 which should work in both attached and detached modes.\nI have seen this effect in some modern GUI's, but I was unable to find a proper technique online to carry this out. What is a proper way to do this?\nThanks","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":829,"Q_Id":16490263,"Users Score":0,"Answer":"I'm not sure you can move a wxPanel from a wxFrame to another on the fly on wx. \nThe main reason is that the panel is dependent of its parent and you can't change it on the fly.\nNow if you really want to do it, you'll have to create copy the panel in the other frame and delete the previous panel and frame (or just hide them). \nThere's no built in copy but you can find a way to get the content of your original panel and copy it on the other one.","Q_Score":2,"Tags":"python,user-interface,frame,wxwidgets","A_Id":16537239,"CreationDate":"2013-05-10T20:23:00.000","Title":"Attach\/Detach two frames in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Got a QStandardItemModel on my QTableView and trying to remove all the rows in it.\nI was first calling a method I created with a call to takeRow, which does not delete the object if I'm right.\nWhat about removeRows from QAbstractItemModel? I've tried it, and as I had a signal on the model ( dataChanged ), it seems that the signal hasn't been disconnected cause I still have some error in the background like \"Underlying C\/C++ object has been deleted\" when I try to delete, and then add some new rows.\nAm I missing something here..?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":371,"Q_Id":16603207,"Users Score":0,"Answer":"Did you follow the advice on subclassing model classes? I only encountered such problems if I didn't followed the hints in the docs ;)\n\nA removeRows() implementation must call beginRemoveRows() before the rows are removed from the data structure, and endRemoveRows() immediately afterwards.","Q_Score":0,"Tags":"python,pyqt,qtableview,qstandarditemmodel","A_Id":16761536,"CreationDate":"2013-05-17T06:56:00.000","Title":"QStandardItemModel removeRows does not remove signals on cells?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am just learning python as my first programming language, and I just installed python 3.3, 64 bit on my windows 7 OS.\nI installed komodo edit 8.0, and I am trying to print ('Hello world'). I set up the correct path so that I can access python through my command prompt.\nFrom komodo, I saved my helloworld.py file to my desktop.\nWhen I try to run the command prompt, I search for the file, and it says file not found, or file does not exist. I can open the folder from komodo, but it appears that it is empty. When I open the folder directly from my desktop, I see the file is in there, so it seems that komodo is not recognizing it.\nHow can I get Komodo to recognize my saved file and run it in python? I am very new so please go step by step if you can.\nThank you!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":968,"Q_Id":16615838,"Users Score":0,"Answer":"Ok heres what I personally do.\n\nOpen run, type in cmd\nNavigate to whatever directory my mypythonfile.py file is\nOpen whatever text editor you feel like ( personally i use notepad++ because it is NOT an IDE like kodomo, but just a pretty text editor.)\nType python mypythonfile.py and hit enter. This will run the program.\nOpen mypythonfile.py in text editor program.\nMake changes to the python file.\nGo back to the cmd window and press arrow up ( to go to the last typed command) and then press enter again, to run the program again.\n\nRepeat steps 6-7 until your program is perfect.\nIt seems like you are having trouble with the Kodomo IDE instead of the actual learning python process. IDEs are complicated tools with lots of buttons that are scary. Learn the language first, then once you are comfortable there, then maybe you will use an IDE? Or maybe you will just keep using a text editor instead. Thats up to you.","Q_Score":1,"Tags":"python,komodo","A_Id":16616493,"CreationDate":"2013-05-17T18:40:00.000","Title":"I need help recognizing files in komodo in order to run them in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm learning the Python and now I'm trying to choose cross-platform-GUI-framework. As I see, the PyGTK is the best one, which fits my goals completely.\nThe only question: is there any analog of pyuic4 (which creates python class based on .ui file created by QtDesigner) for files made with Glade app? Or the only way is creating class manually?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2653,"Q_Id":16616029,"Users Score":2,"Answer":"The user interfaces create with glade are saved as xml file: using gtkbuilder, this file can be used with many programming languages, like c++ or python.\nPygtk lets you create application with user interfaces, based on glade file.But you have to do all by hand.","Q_Score":3,"Tags":"python,gtk,pyqt,pygtk","A_Id":16616290,"CreationDate":"2013-05-17T18:52:00.000","Title":"How to convert .glade file to python class?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can someone tell whether there is any application that converts a PyQt4 (with syntax in Python) project to a Qt4 (with syntax in C++) project?\nThis will help people to switch from using a GPL non-commercial license in case of PyQt to a much liberal LGPL non-commercial license in case of Qt!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":217,"Q_Id":16616728,"Users Score":0,"Answer":"Use PySide. It's about 99.8 % compatible with PyQt, except for Signals and Slots.\nReplace every occurence of PyQt4 with PySide in your project, then replace pyqtSignal with Qt.Signal and pyqtSlot with Qt.Slot.\nIt should work out of the box.\nMany projects support both PyQt and PySide because there is virtually no difference between the two\u2026","Q_Score":0,"Tags":"c++,python,qt,pyqt,pyqt4","A_Id":16761507,"CreationDate":"2013-05-17T19:43:00.000","Title":"is there any application that converts a PyQt (with syntax in Python) project to a Qt (with syntax in C++ ) project?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to install wxpython onto my Mac OSX 10.8.3. I download the disk images from their downloads page and mount it. When I try to install the package I get an error that saying that the package is damaged and can't be opened. Any suggestions on how I can fix this?\nI have also tried opening the package through the terminal but no luck.\nThanks in advance.","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":7577,"Q_Id":16638977,"Users Score":8,"Answer":"Go to System preferences --> Security and privacy --> Allow applications downloaded from..select 'Anywhere'","Q_Score":6,"Tags":"python,macos,wxpython","A_Id":20097953,"CreationDate":"2013-05-19T20:08:00.000","Title":"Trying to install wxpython on Mac OSX","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Started messing with Tkinter today, but when I tried to run my first program it crashed. It appears the reason is that I don't have Tkinter. This is a standard installation of Python 3.3 on Windows 7, why is it not there? How can I get it?","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":4331,"Q_Id":16639752,"Users Score":2,"Answer":"Maybe you disabled it during Python installation? It is Tcl\/Tk item in install wizard and it can be disabled. Try reinstall Python and do not turn it off.","Q_Score":1,"Tags":"python,python-3.x,tkinter","A_Id":16639964,"CreationDate":"2013-05-19T21:41:00.000","Title":"Why is Tkinter missing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Started messing with Tkinter today, but when I tried to run my first program it crashed. It appears the reason is that I don't have Tkinter. This is a standard installation of Python 3.3 on Windows 7, why is it not there? How can I get it?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":4331,"Q_Id":16639752,"Users Score":6,"Answer":"This answer might be irrelevant with more information, but, for now: are you capitalizing \"Tkinter\" when using the import command?  In Python 3.x, it's imported as lower-case (\"import tkinter\"), but in 2.x code it's imported with an initial capital (\"import Tkinter\").","Q_Score":1,"Tags":"python,python-3.x,tkinter","A_Id":16639892,"CreationDate":"2013-05-19T21:41:00.000","Title":"Why is Tkinter missing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've collected many nice wall papers over years. \nI know python and c++ (a little MFC eperience).\nI want to make a programme that can change my wallpapers.\nI want to operate like this:\n     there is a little icon (half transparent), if i click it, it change my wallpapers to the next picture in my wallpaper collection folder.\nI found many infos of changing wallpaper by programme by google.\nBut can't find out the win7 API for adding a button on desktop.\nPlease some one tell me how to set a icon-button on the desktop, or it's just there's no such API?\nEDIT:\n    I just find that there are ways to make a window unmovable. So, I think now I need to find ways to make windows out of an icon. Then it'll looks like a button on desktop. And, there are ways to make windows taking some response when it's clicked(once), right?\nClosure:\n    Captain's method may be a better way for people with good understanding of windows. \n    I know python, but few knowledge of MFC or similar framework with deep relations with the OS itself. This desktop button creation is very hard to implement for me. \n    Modifying christian's script and a windows shortcut would be a not-good-looking compromise. I'll do it this way.","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":672,"Q_Id":16644007,"Users Score":-1,"Answer":"There is an easiest way.\nInstall VBest Icon groups. ( it is a desktop icon stack )\nThen select any stack and add a single button. ( drag and drop any application will get its link and icon in the stack )\nSelect the stack and in its settings, set transparency equals 0 ( slide to left)\nThat is it. Now you have a single button with link.","Q_Score":0,"Tags":"c++,python,windows,api","A_Id":66233621,"CreationDate":"2013-05-20T06:45:00.000","Title":"create an button on desktop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've recently discovered IronPython in C# and only tutorials I found were how to use python script in C#, but I've noticed, that IronPython has classes and methods you can use directly in C# like :  PythonIterTools.product some_pr = new PythonIterTools.product(); and others, can anyone explain how does this work?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":223,"Q_Id":16646135,"Users Score":1,"Answer":"Parts of IronPython's standard library are implemented in C#, mainly because the equivalents in CPython are written in C. You can access those parts directly from a C# (or any other static .NET  language) directly, but they're not intended to be used that way and may not be easy to use.","Q_Score":0,"Tags":"c#,ironpython","A_Id":16652356,"CreationDate":"2013-05-20T09:11:00.000","Title":"Using IronPython in C#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I add a \n\nTextCtrl \n\narea that will allow input only if a checkbox is ticked?  Otherwise the TextCtrl area will be ignored.","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":42,"Q_Id":16680798,"Users Score":3,"Answer":"Bind an event handler for the checkbox widget that will call the textctrl's Enable method, passing True or False based on the status of the checkbox.","Q_Score":0,"Tags":"python,wxpython","A_Id":16681397,"CreationDate":"2013-05-21T22:51:00.000","Title":"wxPython - Optional Text Boxes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've spent literally all day on google, stackoverflow, and many other sites trying to find a way to implement a windowless app using python, to no avail. I'm familiar with python and have been using pygtk to create previous apps, but it doesn't look like pygtk can cut it.\nI'm using the standard Ubuntu 12.10 Unity setup, and don't want to switch over to something that uses compiz. I also don't want to use screenlets.\nThe app I want to create is to notify me of any updates on my social media accounts, and I want it to be floating perpetually on the screen, accessible at any time. I want it to be stand-alone, and not be dependent on outside apps (like screenlets) to run, and I want it to be as minimalistic as possible.\nIf I can't accomplish this with pygtk, what else should I use? If it is possible, how would I go about implementing it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":336,"Q_Id":16706907,"Users Score":0,"Answer":"BTW Unity is COMPIZ plugin :D\nAlso I think that PyGTK will not be able to do it. You'd need some kind of desktop plugin, but what are you trying to do is tricky, it may break in future versions of Unity - you need to use the desktop manager (wm) to manage that as a borderless window with static position, somethink like desktop plugins in KDE. Also it will not work in other wm's. \nMaybe you should consider making it a simple icon in the notification area that would change and on hover it would display more info.. that I'm sure would work anywhere.","Q_Score":0,"Tags":"python,ubuntu,user-interface,pygtk,desktop-application","A_Id":16709612,"CreationDate":"2013-05-23T06:23:00.000","Title":"How would I create a windowless app using python on Ubuntu 12.10?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently developing a small application in Python with the use of GTK+ (and Glade). Everything has been fairly simple to integrate so far, until I came up with the idea to add tabs instead of pop-ups. Note: Still using Python 2.7+\nIs there any easy way to implement already existing pages inside a new tab(notebook) like structure? I'm having difficulties to find how to add content per separate tab created in glade. \nPerhabs a more 'clear' question: What Notebook function will be required to call a specific V\/HBox with every different tab? The current structure looks like (minus Menu \/ statusbar):\n[ mainWindow ] --> (1) mainOverview (gtkVbox) --> (2A) mainContent (gtkHbox) ... other non-related content\nThe structure I was hoping for would look like:\n[ mainWindow ] --> (1) mainOverview --> (2) noteBook --> (3) Tab1 --> (4) mainContent (gtkHbox) -- (3) Tab2 --> (4) secondaryContent (gtkHbox)\nThe application itself works fine (multithreaded, fully functioning) without the tabs, the mainContent(gtkHbox) contains a file\/recursive directory analyzer, a few checkboxes and a general overview. I was hoping for an easy way to display this main window (the gtkHbox) ONLY when having Tab1 selected.\nHaving difficulties to find good reference pages that display a proper way to call content pages per notebook tab. Any reference-pages or useful links are very much appreciated! Thanks so far! My apologies if this is a rather newbish question, I'm not new to Python coding, but interfaces on the other hand... ;)","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1912,"Q_Id":16744702,"Users Score":1,"Answer":"Not an answer, but it looks like \"another.anon.coward\" already answered this in a comment...\n\nIf you double click on the tab, then that page is selected for adding content in glade. You can go ahead and add content for that page. As for switching you can use set_current_page to switch to page whose content you want to display. Register for \"switch-page\" signal to find out which page has been switched to.","Q_Score":6,"Tags":"python,gtk,glade","A_Id":22049793,"CreationDate":"2013-05-24T22:57:00.000","Title":"Python GTK (Glade) Notebook","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible for, in python + tkinter, to set a maximum number of characters per line in a label? I have a program that opens a Toplevel window with some information taken from other information the user gave in the past. It is unresizable, which is a probel because every now and then the window get's too small for the information, which is shown in labels, so I was wandering if I could set it to add a line break every 30 characters, for example.\nI looked through some label documentation, but the only thing I found was the possibility to change the label's width, which is not what I need, since is basically hides every character after the 30th.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1975,"Q_Id":16761726,"Users Score":2,"Answer":"The option you are looking for is wraplength, which sets when a label\u2019s text should be wrapped into multiple lines. However, this parameter is given in screen units, while width is text units if the widget displays text (so you can't use 30 directly).","Q_Score":2,"Tags":"python,string,tkinter,label","A_Id":16761818,"CreationDate":"2013-05-26T17:15:00.000","Title":"Label break line if string is too big","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a game in Python and was wondering how to give it its own icon.  I am using a windows computer and have no extra things installed with Python.  Oh also I am using version 3.3  Is this even possible.\nP.S I have found other things on Stack Overflow but they are using different Operating Systems like Ubuntu and Macintosh","AnswerCount":7,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":40170,"Q_Id":16782047,"Users Score":0,"Answer":"You can't. In Windows, custom icons can only be assigned to certain types of files (executables and shortcuts, mostly), and Python scripts are not one of those types.","Q_Score":7,"Tags":"python","A_Id":16782089,"CreationDate":"2013-05-28T00:04:00.000","Title":"How To Add An Icon Of My Own To A Python Program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a game in Python and was wondering how to give it its own icon.  I am using a windows computer and have no extra things installed with Python.  Oh also I am using version 3.3  Is this even possible.\nP.S I have found other things on Stack Overflow but they are using different Operating Systems like Ubuntu and Macintosh","AnswerCount":7,"Available Count":2,"Score":0.057080742,"is_accepted":false,"ViewCount":40170,"Q_Id":16782047,"Users Score":2,"Answer":"If you are trying to change the icon of the shortcut for your program,\n\nthen you need to get to the file where ever it is right-click it and go to create a shortcut\n\nthen drag that shortcut to your desktop\n\nthen right-click that shortcut and click properties\n\nthen click on \"Change Icon\"\n\nthen go to where your desire .ico image is saved and set that as the icon\n\n\nif you do this and you open your program in the corner will be the .ico you selected and on your desktop, it will show the icon instead of the python image.\nthat is how you change the shortcut icon but there is no way to change the actual window icon in the corner unless you're using something like Tk or Pygame.","Q_Score":7,"Tags":"python","A_Id":16782121,"CreationDate":"2013-05-28T00:04:00.000","Title":"How To Add An Icon Of My Own To A Python Program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a 2D project with a lot of tile sprites, and one player sprite. I'm trying to get the camera to follow the player, and for the most part it's working. However, there's one problem:\nIf you go to the edge of the map, it scrolls normally, but instead of the black background, it displays copies of the sprites on the edge of the map instead of the background (black). It has the same problem if I leave some squares empty, when I move it displays a copy of the tile that was previously there.\nThe camera works like this:\n\nSelect sprites that should be visible\nDo sprite.visible = 1 for them, and sprite.visible = 0 for all other sprites\nSet the position sprite.rect of all sprites to coords - offset\nUpdate the screen (I use flip(), because the camera moves every turn, so the whole screen has to be updated every turn)\n\nAll DirtySprites have dirty = 2.\nDoes anyone know why it's displaying copies of the sprites on the edge instead of the background?\nHelp would be appreciated!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":86,"Q_Id":16794333,"Users Score":1,"Answer":"Unless you manually clear your screen surface, flip will not change its content.\nThus, if you neglect to draw to a certain location, it will remain the same.\nIf you want to get rid of this effect, usually called \"hall of mirrors\", you will have to keep track of what portions of the screen have not been drawn to yet and draw over these yourself. \nIt may be easier to define background sprites around your map's contours and block your camera from going off too far.\nSince you use a \"dirty\/clean\" approach to only redrawing what's changed, you won't have the option to just fill the whole screen surface before you draw your frame, because that would draw over anything that's stayed the same since the last frame.","Q_Score":0,"Tags":"python,pygame,sprite,rect","A_Id":16797483,"CreationDate":"2013-05-28T14:13:00.000","Title":"(pygame) Empty squares displaying copies of what was previously there instead of background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a project in eclipse, i have been working for the last few months in python\/pygame, making pygames in the Python IDLE. I have my eclipse build setup with android sdk and pydev to run python programs (pygame) in eclipse. What I am trying to do is build an app with the android sdk that can use my pygame inside the app (put game built in pygame on android app through android sdk) that way the main menu would be coded in java with buttons, etc, then when you click the play button it goes to the pygame code. Is there anyway of doing this, you can make individual projects of the 2, and make an android app, but I want to integrate both languages features for the best performance. How am I going to do this???? I have looked on the web and I can't find anybody talking about doing this, it may be impossible, maybe not. Is it possible for this to be done for an app in eclipse????","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":418,"Q_Id":16803826,"Users Score":0,"Answer":"No, there's really no way of doing this. Pygame is not natively runnable on Android: you'd need to somehow find a Pygame port to Jython and then figure out how to make that work using the Android drawing primitives. Probably more work than it is worth.","Q_Score":0,"Tags":"android,python,eclipse,pygame,pydev","A_Id":16803982,"CreationDate":"2013-05-29T00:55:00.000","Title":"How do you integrate PyGame and Android SDK together inside Eclipse to build an Android App running Java SDK as the main menu for PyGame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have used cx_freeze several times in my windows 7 and I had never any problem with it but now I want to run the executable produced by cx_freeze in a Windows XP.\nBut when I run the program I get this error:\nthe application configuration is incorrect. Reinstalling this application may fix this problem\nI have searched for info about this problem and it seems to be the that the Microsoft Visual Studio 2008 redistributable is not intstalled. I am going to launch this executable in many computers so I don't want to install absolutelly nothing in the system.\nI have read that I can just place those 4 files in the same folder than my binary is:\nThose 3 from this directory\n\nC:\\WINDOWS\\WinSxS\\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375\nmsvcm90.dll msvcp90.dll msvcr90.dll\n\nAnd this file from this directory\n\nC:\\WINDOWS\\WinSxS\\Manifests\nx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375.manifest\n\nI have search this direcories in my system (Win 8) and they are not with this exactly folder. Anyway I downloaded them from internet and try it but it did not work\nI have Python 2.7 and cx_Freeze-4.3.1\nI have read that if I use a lower version of pyython it could works. It is true? Why?\nDo you know hoy can I solve it without installing anything in the system? \nThank you very much for your help.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1636,"Q_Id":16804806,"Users Score":3,"Answer":"Thank you eveyone for your help. I finally get it working with a different solution.\nI found other programs in my system that has this dlls too. Eclipese was one of them (in this path: \n\neclipse\\plugins\\com.intland.hgbinary.win32_2.3.2\\os\\win32\n\n)so I just took:\n\nMicrosoft.VC90.CRT.manifest\nmsvcm90.dll\nmsvcp90.dll\nmsvcr90.dll\n\nthis files and copy and paste them to the folder of my compiled python code. And it works like magic.\nThank you anyway for your help!! :D","Q_Score":6,"Tags":"python,windows-xp,cx-freeze","A_Id":16848122,"CreationDate":"2013-05-29T03:04:00.000","Title":"Python Cx_Freeze error in Windows XP","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i need to use select() on a bool because the module pygame.midi lets you know when a midi message is ready only through the function Input.poll() that returns a bool.\nif i check this value in the simple way, i do busy waiting and my cpu works at 100% all the time.\nis there a way to use the select() or similar functions to wait for a variable to change its value in a context without automatic event raising?\n(i don't strictly need to live eventless, indeed i would love to use them, but i can't see midi events anywhere in the package..)","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":364,"Q_Id":16822338,"Users Score":2,"Answer":"When developing games you usually do everything in a main loop. If you want e.g. 50 fps, then you want to go through this loop 50x per second. If you assume that you are not doing anything time consuming, then you can sleep for 20ms at the end of every iteration.\nSo I think that's the reason why only poll is available, you are supposed to check whether the midi is loaded in your loop. If it is, then you can do something with it, otherwise you would continue rendering or doing something else. Generally while creating games and apps that should have consistent fps, you don't want to wait for some event.","Q_Score":0,"Tags":"python,select,boolean,pygame,midi","A_Id":16822525,"CreationDate":"2013-05-29T19:31:00.000","Title":"python - select() on boolean variable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i need to use select() on a bool because the module pygame.midi lets you know when a midi message is ready only through the function Input.poll() that returns a bool.\nif i check this value in the simple way, i do busy waiting and my cpu works at 100% all the time.\nis there a way to use the select() or similar functions to wait for a variable to change its value in a context without automatic event raising?\n(i don't strictly need to live eventless, indeed i would love to use them, but i can't see midi events anywhere in the package..)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":364,"Q_Id":16822338,"Users Score":0,"Answer":"If your input doesn't have any way to fire events, you have to check it on a timer.\nIn most games, your main event loop already has some \"frame limiter\" code, so the event loop runs no more than 50 times\/sec. So, you can just poll once per event loop. If not, you'll essentially have to add a frame limiter now.\nIf your game for some reason doesn't fit this paradigm\u2014or if you need to poll the input much more often than your max frame rate\u2014you have to write a background thread that reads from the input (blocking if possible, polling and sleeping if not) and either handles the events directly, or pushes then onto a queue that the main thread can read from each time through the loop.","Q_Score":0,"Tags":"python,select,boolean,pygame,midi","A_Id":16822580,"CreationDate":"2013-05-29T19:31:00.000","Title":"python - select() on boolean variable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So, I am actually trying to restart a frame.  I have my frame defined in my mainF.py file, and my panels defined as classes in a panels.py file.  I call these two methods when my clear button is pressed:\nself.frame.Destroy() \nmain()\nwhere main() is my method for jumpstarting my frame object.\nIn my mainF file, I am using this statement\nfrom panels import * \nand in my panels file, I have tried\nimport mainF and\nfrom panels import *\nHowever, I always receive NameError: Panel1 is not defined.\nThis is confusing me since I do define it in my import statements, and the programs executes main() the first time through without this error.  When I had all classes defined in one file, I never received this error.  Any help would be appreciated, thanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":173,"Q_Id":16825742,"Users Score":0,"Answer":"It's probably due to circular imports.  One file is not yet fully imported when it imports another, which then imports the first one again.  Since it was already started the original module object is returned, but it hasn't yet defined the class you are looking for.","Q_Score":0,"Tags":"wxpython","A_Id":16826193,"CreationDate":"2013-05-29T23:47:00.000","Title":"wxpython global name not defined error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to display a file having Unicode data (Malayalam) in a window with a scrolled area, with all the named entities in different colours in tkinter (PYTHON).\nFor example, consider the sentence - 'Python is a programming language.' \nIn my window, Python should be in a different colour. My file contains more than 100 lines. So I need the display in a scrolled area and text in it having different colours.\nThanks in advance for your help.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":65,"Q_Id":16829049,"Users Score":1,"Answer":"You will want to use the text widget. To color certain words or characters you will need to define a tag, and apply that tag to a range of text.","Q_Score":0,"Tags":"python,tkinter","A_Id":16834234,"CreationDate":"2013-05-30T06:05:00.000","Title":"How to display unicode data in a file with named entities in different colours in a popup window with scrolled area in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I'm using an image and I want to know the image's size in the file.\nThere is a function to get the picture's height and width ?\nEDIT: Of course I loaded the image to the program with pygame.image.load(PATH).","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":3476,"Q_Id":16840711,"Users Score":1,"Answer":"I believe you need to load the image as a Surface before you can get its width and height. You do that with foo = pygame.image.load(PATHNAME).\nThen you can get the width and height by creating a Rectangle with foo.get_rect() and asking the rectangle.","Q_Score":1,"Tags":"python,image,pygame","A_Id":16841217,"CreationDate":"2013-05-30T15:55:00.000","Title":"How to get the picture size in pygame (python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an Android application that captures an image and Python code that extracts some features from images. I want to connect them to each other (receive the image in Python from the Android application). I read some things about building a TCP Server, but I don't know how to do it and how to start as it's my first time to do something like that.\nCan anyone help?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":653,"Q_Id":16846967,"Users Score":1,"Answer":"Well, you could have the Android Application save the image to a folder and have the Python file import that image.","Q_Score":1,"Tags":"android,python,sockets,tcp","A_Id":16847185,"CreationDate":"2013-05-30T22:37:00.000","Title":"Connect Android to Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an Android application that captures an image and Python code that extracts some features from images. I want to connect them to each other (receive the image in Python from the Android application). I read some things about building a TCP Server, but I don't know how to do it and how to start as it's my first time to do something like that.\nCan anyone help?","AnswerCount":2,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":653,"Q_Id":16846967,"Users Score":-1,"Answer":"You can upload a image to server using any of the database, use python code on server side and you will get the result.","Q_Score":1,"Tags":"android,python,sockets,tcp","A_Id":36057987,"CreationDate":"2013-05-30T22:37:00.000","Title":"Connect Android to Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In your opinion, what is the best way to create gui in Windows with python ? \nDo you recommend PyQt for windows?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":5220,"Q_Id":16848912,"Users Score":1,"Answer":"I prefer PyQt, there is some examples in the pyqt release directory, you can try it out. I think the effect is really cool.\nI  haven't tried other library so i could not compare PyQt with others . As I am familiar with Qt, the coding experience is very easy if you switch Qt to PyQt.","Q_Score":1,"Tags":"python,windows,qt,gtk,pyqt","A_Id":16854156,"CreationDate":"2013-05-31T02:34:00.000","Title":"Your best library for create GUI with Python (PyQt, PyGTK, wxPython, IronPython, etc)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use pygtk app for android app development. I want to use app like pygtk which will have easy drag and drop options for developing the front end for android application.  \nIs there any of such thing which can let me design my front end for android app with drag and drop? (specially in python or else in java)","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1574,"Q_Id":16869621,"Users Score":2,"Answer":"I see you tagged the question with kivy, I can only answer that we don't have such a thing for kivy yet, although a GSOC student got accepted for this and will start working on it soon, let's hope it'll work out nicely :). I'm of the opinion that the kvlang we have in kivy makes the need of a Graphical Designer far less than in other toolkits, but i guess YMMMV.\nOther than that, I don't think you can do PyGTK development on Android currently, but I think PySide works, so maybe QtDesigner or some other Qt design application would be worth a look?","Q_Score":3,"Tags":"java,android,python,pygtk,kivy","A_Id":16878423,"CreationDate":"2013-06-01T06:00:00.000","Title":"use pygtk for android apps development","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use intellij idea plug in for python developing. I want to import pygame module to my project, but everytime I get error \"ImportError: No module named 'pygame'\". I tried to add the pygame lib folder to dependencies but it didn't work, I also added it to library but it didn't work either. Could anyone help me with this issue.\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1211,"Q_Id":16874716,"Users Score":0,"Answer":"you can try to install the pygame lib to your python directory, but you might have to make your python 32 bit for that to work dunno how it works on windows. On mac though there are several tutorials.","Q_Score":3,"Tags":"python,import,intellij-idea,pygame","A_Id":32979653,"CreationDate":"2013-06-01T16:22:00.000","Title":"importing pygame in Intellij IDEA","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im running Mac OS 10.8.3 and python\/idle 2.7.5.\nI tried to install pygame 1.9.1 but it didnt work. Is this the right pygame? if not which is?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":356,"Q_Id":16899170,"Users Score":1,"Answer":"I solved it. I installed \"Lion apple supplied python: pygame-1.9.2pre-py2.7-macosx10.7.mpkg.zip\"\nThen i went into terminal and tried to import pygame through Aplle python and it prompted me to install \"Xquartz\" after i did this pygame works in both Terminal and 64 bit Idle 2.7.5.","Q_Score":0,"Tags":"python,installation,version,pygame","A_Id":16899819,"CreationDate":"2013-06-03T14:30:00.000","Title":"Which pygame should i install?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made an object controlled with arrow keys. When I move it to the edge of the pygame screen, the object moves off the screen. I was wondering how to keep the object on the screen. Any suggestions?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":364,"Q_Id":16952059,"Users Score":1,"Answer":"On each handle of the input, check if the object's target x position plus its width exceeds the width of the canvas or if it is less than 0. Deny the movement if so. \nRepeat for the y coordinate and the height.","Q_Score":0,"Tags":"python,pygame","A_Id":16952066,"CreationDate":"2013-06-06T00:47:00.000","Title":"In pygame how to make an object controlled with arrow keys not move of the edge of the screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C++ GUI, it load a DLL when running. I use SIP to import the DLL in python. I need to embed the python part in the GUI, and some data are needed to exchange between python and C++. \nFor example, in the C++ GUI, I can enter command from a panel, such as \"drawSomething()\", it will call corresponding function in python, and the result will be shown in the GUI.\nCan I use SIP to \nextract a C++ object from python object (just like the way boost.python does), or is there a better way to share data between python and c++ seamlessly?\nthanks.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":447,"Q_Id":16952350,"Users Score":0,"Answer":"It turns out that I do not need to do anything complicated...\nIn my case, there is no difference to call functions in DLL from C++ or from python code embedded in C++.\nI am totally over-thinked.","Q_Score":0,"Tags":"c++,python,python-sip","A_Id":16976040,"CreationDate":"2013-06-06T01:28:00.000","Title":"python-sip: How to access a DLL from both Python and C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am planning to implement, as an exercise and for personal use, in a very relaxed pace, a GPS\/Mapping\/Cycling desktop application, with Python as the primary language. It must be cross-platform (windows and linux), and the graphical front-end should allow the following:\n\nRelatively fast rendering of map tiles \u00e0 la Google Maps, Bing Maps, etc. with panning, zooming, overlay, image-blending, etc.\nGood support for retained-mode 2D graphics (routes, points) with direct manipulation, hit-testing, highlighting, selection, etc;\nGood integration with multithreaded architecture (no UI freeze while performing calculations;\nPreferrably good support to events-based communication between application code and GUI code;\nPreferrably some support to 3D rendering with OpenGL or similar.\n\nI have some experience with GTK, but I feel it too low-level, so I'm wondering if wxWidgets could be a good alternative IN THIS SCENARIO (rich graphics as a main requirement of the UI).\nAny","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":283,"Q_Id":16968889,"Users Score":1,"Answer":"wxWidgets probably won't help you a lot here. I.e. you should be able to do what you want with it but you will need to implement most of your bullet points yourself. E.g. drawing would almost certainly be done using OpenGL but using OpenGL in a wxWidgets application is exactly the same as using it anywhere else. And you will have to implement panning\/zooming\/hit-testing.\nwxWidgets does provide decent multi-threading support for the typical background-worker-threads-one-main-GUI-thread scenario that you would be almost certainly using here too. And simple communications between the threads (although I'm speaking about C++ here, not sure how is it done on Python side). But then any other decent framework should provide this too...","Q_Score":0,"Tags":"python,user-interface,graphics,gtk,wxwidgets","A_Id":16970638,"CreationDate":"2013-06-06T17:53:00.000","Title":"Cross platform, python based, rich-graphics application for mapping and gps: GTK or wxWidgets?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a code to pop up a window on my screen and to print a data on the window.Here according to my requirement i want the entire screen to be BLACK in color. SO that i can print some text on that black window. The window title bar tkinter should be removed and the entire window screen should be in black.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":875,"Q_Id":16982300,"Users Score":1,"Answer":"Try self.configure(background='black') or self['bg'] = 'black'. Most Tkinter widgets can be configured with similar properties.","Q_Score":0,"Tags":"python-2.7,tkinter","A_Id":16991920,"CreationDate":"2013-06-07T10:49:00.000","Title":"python:window with no title bar, and change window default color(grey) to black","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that \"No module named PyQt4\". Can somebody help me with that?","AnswerCount":5,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":122359,"Q_Id":16994232,"Users Score":23,"Answer":"After brew install pyqt, you can brew test pyqt which will use the python you have got in your PATH in oder to do the test (show a Qt window).\nFor non-brewed Python, you'll have to set your PYTHONPATH as brew info pyqt will tell.\nSometimes it is necessary to open a new shell or tap in order to use the freshly brewed binaries.\nI frequently check these issues by printing the sys.path from inside of python:\npython -c \"import sys; print(sys.path)\"\nThe $(brew --prefix)\/lib\/pythonX.Y\/site-packages have to be in the sys.path in order to be able to import stuff. As said, for brewed python, this is default but for any other python, you will have to set the PYTHONPATH.","Q_Score":27,"Tags":"python,pyqt4,homebrew","A_Id":17066007,"CreationDate":"2013-06-07T23:11:00.000","Title":"ImportError: No module named PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that \"No module named PyQt4\". Can somebody help me with that?","AnswerCount":5,"Available Count":4,"Score":0.1973753202,"is_accepted":false,"ViewCount":122359,"Q_Id":16994232,"Users Score":5,"Answer":"I solved the same problem for my own program by installing python3-pyqt4.\nI'm not using Python 3 but it still helped.","Q_Score":27,"Tags":"python,pyqt4,homebrew","A_Id":39129422,"CreationDate":"2013-06-07T23:11:00.000","Title":"ImportError: No module named PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that \"No module named PyQt4\". Can somebody help me with that?","AnswerCount":5,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":122359,"Q_Id":16994232,"Users Score":14,"Answer":"You have to check which Python you are using. I had the same problem because the Python I was using was not the same one that brew was using. In your command line:\n\nwhich python\noutput: \/usr\/bin\/python\nwhich brew\noutput: \/usr\/local\/bin\/brew      \u00a0\u00a0\u00a0\u00a0\/\/so they are different\ncd \/usr\/local\/lib\/python2.7\/site-packages\nls\u00a0\u00a0   \/\/you can see PyQt4 and sip are here\nNow you need to add usr\/local\/lib\/python2.7\/site-packages to your python path.\nopen ~\/.bash_profile   \u00a0\u00a0\/\/you will open your bash_profile file in your editor\nAdd   'export PYTHONPATH=\/usr\/local\/lib\/python2.7\/site-packages:$PYTHONPATH'     to your bash file and save it\nClose your terminal and restart it to reload the shell\npython \nimport PyQt4 \u00a0\u00a0 \/\/ it is ok now","Q_Score":27,"Tags":"python,pyqt4,homebrew","A_Id":37955316,"CreationDate":"2013-06-07T23:11:00.000","Title":"ImportError: No module named PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that \"No module named PyQt4\". Can somebody help me with that?","AnswerCount":5,"Available Count":4,"Score":0.1586485043,"is_accepted":false,"ViewCount":122359,"Q_Id":16994232,"Users Score":4,"Answer":"It is likely that you are running the python executable from \/usr\/bin (Apple version) instead of \/usr\/loca\/bin (Brew version)\nYou can either \na) check your PATH variable\nor \nb) run brew doctor\nor \nc) run which python\nto check if it is the case.","Q_Score":27,"Tags":"python,pyqt4,homebrew","A_Id":16994978,"CreationDate":"2013-06-07T23:11:00.000","Title":"ImportError: No module named PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I want to craw a circle, I use the regualr draw.circle but the problem is that I don't want it filled so I draw a smaller circle inside of it, it makes a circle with thickness.\nEverything is good right? no. The background image inside that circle disappeared because the circles are filled.\nNow my question is: There is a function that draws a circle (and other shapes[?]) that gets thick and not filling the whole inside of the shape?\nEDIT: If you can give me the signature so I know how to use it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":9645,"Q_Id":16994243,"Users Score":5,"Answer":"The command is pygame.draw.circle(Surface, color, pos, radius, width=0).  The last argument of width can be changed to not fill the circle in.  If it is zero, the circle is solid and if it is anything else it is with an edge thickness of whatever the parameter is.","Q_Score":1,"Tags":"python,pygame,draw","A_Id":17000916,"CreationDate":"2013-06-07T23:13:00.000","Title":"pygame not filled shapes (Python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a ListCtrl and i wish to add the new rows to the top of the list (prior rows to be pushed down)\ncan you help me on that?\nThanks!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":981,"Q_Id":17029608,"Users Score":1,"Answer":"I don't believe there is a built-in method to accomplish this. You would have to save the data, clear the control and then insert the new row or rows followed by the original rows. Personally, I would switch to using the ObjectListView widget where you can use lists of objects. Then you could just insert an object into the list and reset the control.","Q_Score":0,"Tags":"wxpython,listctrl","A_Id":17091808,"CreationDate":"2013-06-10T17:31:00.000","Title":"WxPython, ListCtrl add rows to the top","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am doing research with mobile apps and need to analyze their code after unzipping the .apk file. However, the process of unzipping naturally involves lots of IO, which doesn't make it scalable, I am thinking if it's possible to hold the unzipped data in memory, with several variables representing it, thus saving the trouble of writing to FS. I am loaded with thousands of apps to analyze, so being able to do something like this would significantly speed up my process.  Is there anyone who can suggest a way out for me. I am using python. \nThanks in advance","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":14330,"Q_Id":17055496,"Users Score":0,"Answer":"A late entry...but all I had to do was rename the file to a .ZIP extension.","Q_Score":2,"Tags":"android,python,unzip","A_Id":64447721,"CreationDate":"2013-06-11T23:28:00.000","Title":"is it possible to unzip a .apk file(or generally any zipped file) into memory instead of writing it to fs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have to make a GUI for some testing teams. I have been asked to do it in Python, but when I Google, all I see is about Iron Python.\nI also was asked not to use Visual Studio because it is too expensive for the company. So if you have any idea to avoid that I would be very happy. \nI am still new to Python and programming overall so not any to advanced solutions.\nIf you have any questions just ask. \nGUI PART: with would you use when using windows and mac(most windows) I would like some drag and drop so I don't waste to much time making the display part","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":21603,"Q_Id":17081821,"Users Score":0,"Answer":"All implementations can run on Eclipse via PyDev. So it kills the argument of which one to use as it is all the same language, implementations other than this instance are more domain specific. Iron Python targets Microsoft, Jython targets Java, Python targets itself. Each environment naturally has its own complier\/library all you are doing is trading environments by choosing one over the other. Each has its positives and negatives but naturally you would want to give Python a try before touching other environments as a beginners rule.","Q_Score":13,"Tags":"python,ironpython","A_Id":37896844,"CreationDate":"2013-06-13T07:46:00.000","Title":"Python vs Iron Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have to make a GUI for some testing teams. I have been asked to do it in Python, but when I Google, all I see is about Iron Python.\nI also was asked not to use Visual Studio because it is too expensive for the company. So if you have any idea to avoid that I would be very happy. \nI am still new to Python and programming overall so not any to advanced solutions.\nIf you have any questions just ask. \nGUI PART: with would you use when using windows and mac(most windows) I would like some drag and drop so I don't waste to much time making the display part","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":21603,"Q_Id":17081821,"Users Score":1,"Answer":"If you're just trying to create a GUI that runs on Windows, C# on Visual Studio is the easiest way to go.  Their free version, Community (used to be Express) provides all the Windows controls you're used to using with a drag and drop GUI builder.","Q_Score":13,"Tags":"python,ironpython","A_Id":30813721,"CreationDate":"2013-06-13T07:46:00.000","Title":"Python vs Iron Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"as the question states, I wish to embed a tinymce editor in a PyQT webkit component.\nAs far as I understand, evaluateJavascript allows for js functions to be called.\nHowever, when I try loading tinymce.min.js, the editor does not display anything at all. As suspected, when evaluating a javascript that 'loads' other javascript files, they don't actually get loaded.\nAt this point, I feel lost. I will try to manually load 'plugins' that will be specified in tinymce's init function and will update this.\nTill that time, any help would be really appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":239,"Q_Id":17119388,"Users Score":0,"Answer":"EvaluateJavaScript does make javascript function calls, or embed a whole javascript file. The following details out the attempts to solve the problem:\n\nThe approach of first reading the tinyMCE.js file and then using that in an evaluatejavascript method embeds the javascript somewhere, and can't be sniffed out in a webkit console. When loading files using the evaluatejavascript method, any dependencies, such as the ones that tinymce require, are not loaded. I think it's because javascript calls are \"attached\" to the webkit but not embedded in the frame's DOM itself.\nThe second approach consists of creating a webkit page and loading an html file. The html file itself embeds the javascript, so the component works like a \"browser\". In tinymce's configuration, toolbars and unnecessary parts were hidden. TinyMCE version 3 worked well with PyQt4. When the 4th version was embedded in an html page however, textareas were not being converted to tinymce editors. The console itself shows 'undefined' error messages, deduced to the assumption that tinymce 4 uses different javascript syntax and a different compiler.\n\nAnd so ends my quest to write a stand-alone webkit editor. :)","Q_Score":0,"Tags":"javascript,python,tinymce,pyqt,qwebkit","A_Id":17288641,"CreationDate":"2013-06-15T01:29:00.000","Title":"Embedding a TinyMCE editor in PyQT QWebkit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a school project where my team needs to build a board game. We want to use Python based on all the good things we have heard.  I have been researching MVC frameworks and came across Django (its part of my installation on Pydev). I have a Mac, fyi.\nI have also been looking up Tkinter but cant seem to understand what the difference is between Django and Tkinter.  Why would you use one over the other?  I understand that Django is for Web Development.  And I think I understand that Tkinter is for building GUI's right?  \nThe board game will have multiple players who should all get updated when one of the players makes a move.  \nCan any of you point me to where I should be looking online based on what I am trying to do?  I am not looking for code, but just the right website with some good documentation and tutorials that will help me out.  Thanks again, Mash","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":2632,"Q_Id":17137050,"Users Score":3,"Answer":"Tkinter is a GUI library (for desktop applications) and Django is for web development. Both are completely different and in fact it is useless to compare them even.","Q_Score":0,"Tags":"python,django,model-view-controller,event-handling,tkinter","A_Id":17137094,"CreationDate":"2013-06-16T19:49:00.000","Title":"Trying to understand Python and all its moving parts - What is the difference between Tkinter and Django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I really would like to start getting into Objective C coding, specifically so I can write applications for iOS.\nMy coding background is that I have written C# .NET GUI Windows apps and PHP web scripts for years; I've also become a very good Python coder in the past year. I have written hundreds of useful command-line Python scripts, and also a few GUI apps using wxPython successfully. I also wrote VB6 GUI apps way back in the day, and of course, I cut my teeth on QuickBASIC in DOS. ;-)\nI understand OOP concepts: I understand classes, methods, properties and the like. I use OOP a lot in Python, and obviously use it extensively in C#.\nI haven't actually taken the time to really get good at C or C++, however I am able to write simple \"test\" programs to accomplish small tasks. The problem is that I understand the syntax just fine, but the APIs can be very different depending on platform, and accomplishing the same thing in C on Linux at the command line is totally different than accomplishing it in Windows in a GUI.\nI've looked over a few books out there for iOS coding but they seem to assume little to no programming knowledge and quickly bore me, and I can't easily find the information I really need buried among all of the \"here's what an object is\" or \"this is called a class and a method\" stuff...\nI also tried the Stanford lectures on iTunes U, but I found myself struggling with the MVC concepts and the idea of setting up different files for \"implementation\" and \"header\" and all of that...\nIs there any resources that you guys can think of that would be good for me to get started with iOS? \nIt's also worth noting I have dabbled with PyObjC a little on Mac and therefore do understand a LITTLE about the NS foundation classes and such, and I've also looked at Apple's reference documentation and I'm sure that once I get the basics down I could put good use to it, but I still don't know how to actually get a functional iOS app that does something useful going.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":166,"Q_Id":17138389,"Users Score":1,"Answer":"I learned to write iOs apps from the CS 193P iPhone Application Development course on iTunes U. It's fantastic and I highly recommend it if you are sure iOs is what you want to do.","Q_Score":0,"Tags":"python,.net,ios","A_Id":17138453,"CreationDate":"2013-06-16T22:38:00.000","Title":"Best intro to iOS for Python\/PHP\/C# Coder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I really would like to start getting into Objective C coding, specifically so I can write applications for iOS.\nMy coding background is that I have written C# .NET GUI Windows apps and PHP web scripts for years; I've also become a very good Python coder in the past year. I have written hundreds of useful command-line Python scripts, and also a few GUI apps using wxPython successfully. I also wrote VB6 GUI apps way back in the day, and of course, I cut my teeth on QuickBASIC in DOS. ;-)\nI understand OOP concepts: I understand classes, methods, properties and the like. I use OOP a lot in Python, and obviously use it extensively in C#.\nI haven't actually taken the time to really get good at C or C++, however I am able to write simple \"test\" programs to accomplish small tasks. The problem is that I understand the syntax just fine, but the APIs can be very different depending on platform, and accomplishing the same thing in C on Linux at the command line is totally different than accomplishing it in Windows in a GUI.\nI've looked over a few books out there for iOS coding but they seem to assume little to no programming knowledge and quickly bore me, and I can't easily find the information I really need buried among all of the \"here's what an object is\" or \"this is called a class and a method\" stuff...\nI also tried the Stanford lectures on iTunes U, but I found myself struggling with the MVC concepts and the idea of setting up different files for \"implementation\" and \"header\" and all of that...\nIs there any resources that you guys can think of that would be good for me to get started with iOS? \nIt's also worth noting I have dabbled with PyObjC a little on Mac and therefore do understand a LITTLE about the NS foundation classes and such, and I've also looked at Apple's reference documentation and I'm sure that once I get the basics down I could put good use to it, but I still don't know how to actually get a functional iOS app that does something useful going.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":166,"Q_Id":17138389,"Users Score":1,"Answer":"I have gotten more from Erica Sadun's books than any of the others, personally.  iOS apps use a lot of animation and graphics, by necessity, and her code examples are clean and concise.  They aren't beginner's books but you sound as though you're not a beginning coder.  They hit on a lot of topics it is hard to find much on.  \nIf you're willing to work through the sample programs, I found iPad iOS 6 Development Essentials to be comprehensive (Neil Smith).  However, it tends to focus on the visual IDE of xCode which I think is lousy and chose not to use at all; if you plan to use it, then that would be a good resource imo.  Also, I got a book that covered Objective C only (Aaron Hillegass) which I thought was good.  The iOS book from the same author was not good for me, because it depended on you working prior chapter examples to proceed to later chapters, which for me was a waste of time, so I bailed out of it quickly.  I also got Pro Core Data (Privat and Warner) which I found to be of limited (actually, little) value for the same reason as the Hillegass iOS book -- the examples are too big and not to the point.\nAnd, of course, Google.","Q_Score":0,"Tags":"python,.net,ios","A_Id":17140686,"CreationDate":"2013-06-16T22:38:00.000","Title":"Best intro to iOS for Python\/PHP\/C# Coder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying do a very simple task: Make a Button click in Tkinter.\nI have an array of Buttons and, when I finish an event, I want to make a Button click event in one of my buttons.\nI thought it should be as simple as buttons[2].click(), but that doesn't do anything.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":972,"Q_Id":17162992,"Users Score":3,"Answer":"Try calling .invoke() on the button","Q_Score":1,"Tags":"python,button,tkinter","A_Id":17163119,"CreationDate":"2013-06-18T07:28:00.000","Title":"Make a click event in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I changed my computer recently, and the very same program using Python and Pyglet runs a lot slower on the newer computer than on the old one (25 seconds vs. 10 seconds).\nThe older was an Asus EEE 1015p, with the following specs :\n\nprocessor : Intel Atom N570\nmemory : 2 Gb\ngfx : Intel GMA 3150\nOS : Windows 7 Starter Edition 32\npython version : 2.7\npyglet version : 1.1.4\n\nThe newer is a HP Pavilion dm1 :\n\nprocessor : Processeur   AMD E2-1800 APU with Radeon(tm) HD Graphics, 1700\u00a0MHz\ngfx : AMD Radeon HD 7340 Graphics\nmemory : 4 Gb\nOS : Windows 8 64\npython version : 2.7 (32 bits)\npyglet version : 1.2alpha1\n\nI suspected a problem of graphics driver, but some programs using OpenGL (for example, Playstation2 Emulator PCSX2) run clearly faster on the newer (by around 40 %) so I'm quite surprised. So I wonder if speed issues are known for some pyglet versions.\nThe program use batches to render a map made of 4 tiled layers, on which sprites are moving.\nThanks to anyone who can point me what is wrong...","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":270,"Q_Id":17164837,"Users Score":1,"Answer":"Problem solved. I give the answer in the unlikely case someone would encounter it :\nit was a driver settings issue : in AMD Vision Engine Control Center, I had to move performance vs. quality setting to max. performance. I have now similar performances on the 2 machines.","Q_Score":3,"Tags":"python,hardware,pyglet","A_Id":17254328,"CreationDate":"2013-06-18T09:07:00.000","Title":"Pyglet slower on a faster computer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Qt interfaces currently look horrible on a retina display as they scale up.Its possible to use an Info.Plist for a complied application but does anyone have a solution for dynamic python such as interfaces created in PySide?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2959,"Q_Id":17211006,"Users Score":1,"Answer":"I basically found out the solution: be sure you have QT >= 5 installed, since it has been introduced in that version, secondly I am now running python3.3.\nEnjoy your retina","Q_Score":3,"Tags":"python,qt,pyqt,pyside","A_Id":17515469,"CreationDate":"2013-06-20T10:12:00.000","Title":"Optimising Python QT apps on retina displays","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"using 2.5.4 on windows 7\nis there a simple way to print py files in color (as they appear on the screen) AND select a desired font?\nthanks\nGlen","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":104,"Q_Id":17215202,"Users Score":1,"Answer":"If you are using IDLE, the default IDE that comes with Python for Windows you should be able to print your Python script with syntax highlighting from there.\nIf you are looking for a script that takes a python file and then prints it with syntax highlighting, you'd need to provide more information as to what you are trying to achieve.","Q_Score":2,"Tags":"python,printing","A_Id":17225483,"CreationDate":"2013-06-20T13:42:00.000","Title":"Is there a way to print a py file in color?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anyone know how to display the waveform of a sound file in a Tkinter window (Python)?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":257,"Q_Id":17303998,"Users Score":0,"Answer":"Depending on the sound file format, if it is a .wav then you can probably just read it in to a numpy array then plot it, otherwise you are going to have to parse the file format first.","Q_Score":0,"Tags":"python,python-2.7,audio,tkinter","A_Id":17304375,"CreationDate":"2013-06-25T17:41:00.000","Title":"Plot wavewform in Tkinter (Python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Problem: I have QTableWidget cells populated with text (10 columns). I found out that no matter how much rows I have (10 or 100000) scrolling over rows with heigth ~ over 3000 is very slow and not smooth enough (I've used table.verticalHeader().sectionSize(i) to find out heigth of every row).\nWhat I've tried to do: So I've tried to set height of those rows using table.setRowHeight(i,3000), but still when I scroll over those rows I get delay of 1-5 secunds. Also in that case I need to manualy resize height of row in order to see all text in that row (because it was cuted), and that is slow too.\nQuestions: I need to do table.resizeRowsToContent() for all smaller rows, so I think solution would be to set limit for height of every row in table. There is setMinimumSectionSize() method but I can't find any for max size, so how can I do it? Is it possible to have scrollbars inside every cell where height is >3000 so I can scroll through text inside that cell? Maybe that will speed up scrolling throug table?\nAny help would be appreciated","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":913,"Q_Id":17324670,"Users Score":1,"Answer":"This is how I've solved it:\nWhile populating table cells with text, if my text have over 1000 lines (text.count(\"\\n\")) I put it in QTextEdit() and then set it with setCellWidget. Reason I didn't put them all in QTextEdit()s is that Windows can show limited number of GUI elements (<20000) and, as I said, I have 10 columns x up to 100000 rows","Q_Score":1,"Tags":"python,scroll,qtablewidget","A_Id":21234521,"CreationDate":"2013-06-26T15:45:00.000","Title":"Qtablewidget does not scroll smoothly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I show a window created with Tkinter.Tk() outside visible screen? I need to make it much bigger than the desktop size, and show part of it defined by coordinates.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":656,"Q_Id":17326583,"Users Score":0,"Answer":"Another possible way is to insert a frame and resize that, eg: \nimport tkinter as tk  \nroot = tk.Tk()\n frame = Frame(root, width = 1000, height = 1000)\n frame.pack()\n root.mainloop\nThe size of your window will then be determined by the frame, although the answer already given works just fine too","Q_Score":2,"Tags":"python,tkinter,tk","A_Id":33200160,"CreationDate":"2013-06-26T17:22:00.000","Title":"Tkinter window outside desktop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been thinking about my final year project topic and to be honest I want to create something GREAAAT like many others. I know C,C++,Java and Python (Python is getting quite popular these days).. I want to create a small-scale application like Blender (graphics rendering software) any tips for me? I prefer using OpenGL and it's shading language rather than Direct3D since it is open-source. \nTell me the stuffs I should know to pull this off and also if the combination of python and OpenGL a good choice for this application ?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":688,"Q_Id":17328290,"Users Score":0,"Answer":"I want to create a small-scale application like Blender (graphics rendering software) any tips for me?\n\nYes: Readjust your perception of software size\/complexity. I occasionally contribute (TBH, it's been years since I submitted something substantial) to Blender and over the years it turned into a mighty suite. But the codebase is just as large.","Q_Score":0,"Tags":"python,opengl,graphics,blender","A_Id":17328734,"CreationDate":"2013-06-26T18:58:00.000","Title":"Creating small scale application like Blender?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been thinking about my final year project topic and to be honest I want to create something GREAAAT like many others. I know C,C++,Java and Python (Python is getting quite popular these days).. I want to create a small-scale application like Blender (graphics rendering software) any tips for me? I prefer using OpenGL and it's shading language rather than Direct3D since it is open-source. \nTell me the stuffs I should know to pull this off and also if the combination of python and OpenGL a good choice for this application ?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":688,"Q_Id":17328290,"Users Score":0,"Answer":"A small object-viewer should definitely be possible. That's something you can build and add features upon, depending on how much time is left. I would do the visualization and movement in your scene first, then some basic interactions with your objects (translating, rotating, etc.). The final step would be adding tools (edit polygons, sculpt, etc.). If you are fit enough in C++, OpenGL and Software-Architecture on a larger scale it should be doable.","Q_Score":0,"Tags":"python,opengl,graphics,blender","A_Id":17330177,"CreationDate":"2013-06-26T18:58:00.000","Title":"Creating small scale application like Blender?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to use C++ lib with python using SWIG,\nmy problem is that the main class symbol is missing,\n\n\n\n    $ ldd -r -d _rf24.so 2>&1|grep RF24\n    undefined symbol: _ZN4RF24C1Ehh (.\/_rf24.so)\n\n    $ objdump -t librf24-bcm.so.1.0 |grep RF24\n    .\n    .\n    .\n    000032cc g     F .text  00000044              _ZN4RF24C1Ehhj\n    000032cc g     F .text  00000044              _ZN4RF24C2Ehhj\n    .\n    .\n    .\n\n\npython exception:\n\n\n        ImportError: .\/_rf24.so: undefined symbol: _ZN4RF24C1Ehh\n\n\nI tried using the lib objs from the original Makefile or tried to compile them with some flags but the result is the same\nbuild lines:\n\n\n    $ gcc -c RF24_wrap.cxx -I\/usr\/include\/python2.7\n    $ gcc -lstdc++ -shared bcm2835.o RF24.o RF24_wrap.o -o _rf24.so\n\n\nRF24.i (the SWIG file):\n\n\n    %module rf24\n    %{\n    #include \"RF24.h\"\n    %}\n\n    %include \"RF24.h\"\n    \/\/%include \"bcm2835.h\"\n    %include \"carrays.i\"\n    %array_class(char, byteArray);\n\n\nRF24.h (relevant part of the class header file):\n\n\n        .\n        .\n        .\n        \/\/ bla bla bla enums...\n\n        class RF24\n        {\n        private:\n        \/\/ bla bla bla\n\n        protected:\n        \/\/ bla bla bla\n\n        public:\n             RF24(uint8_t _cepin, uint8_t _cspin);\n             RF24(uint8_t _cepin, uint8_t _cspin, uint32_t spispeed )\n\n        \/\/bla bla bla","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":215,"Q_Id":17362909,"Users Score":0,"Answer":"Problem Solved! After using c++filt, I have found out that one of the constructors in the lib wasn't defined, after deleting it problem solved","Q_Score":0,"Tags":"c++,python,swig,porting,symbols","A_Id":37594931,"CreationDate":"2013-06-28T10:44:00.000","Title":"Missing \/ wrong signature whan converting c++ library to python using SWIG","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a desktop application that is interfaced with using a mobile app or mobile communications ( twitter, txt )\nI already have the mechanisms in place to share media ( youtube, instagram, )\nwith the desktop app from a mobile device.\nBut, I would like to add a websocket chatbox to the desktop interface. So, that users can add msgs using a webview or websocket client within the mobile app.\nBUT\nHow do I combine websockets with pyqt?\nI've found very few examples online... just looking for some insight on this problem.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1153,"Q_Id":17416893,"Users Score":1,"Answer":"A way to do this is to use a QWebView, insert that into your App and then load a HTML5 page in the WebView and use that to communicate with the server.\nThis way you can probably even reuse the code for the mobile client as the code for the desktop chat interface.","Q_Score":0,"Tags":"python,user-interface,websocket,pyqt","A_Id":17417077,"CreationDate":"2013-07-02T03:20:00.000","Title":"PyQt and WebSockets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Simple question, but I've tried a few things and nothing seems to work.\nI want to overlay some statistics onto a 3d VTK scene, using 2D vtkTextActors. This works fine, but the text is at times difficult to see, depending on what appears behind it in the 3D scene.\nFor this reason, I'd like to add a 2d, semi-transparent \"box\" behind my text actors to provide a darker background.\nWhich VTK object is appropriate for this? I've tried so far:\n\nvtkLegendBoxActor: Not what I want, but I can use this with no text to display a semi-transparent box on screen. I cannot size it directly and I get warnings about not initialising some of the content.\nvtkImageData: Tried manually creating image data and adding it to the scene; I believe it was placed within the 3d scene and not used as an overlay. If that's not the case then I couldn't get it to show at all.\nvtkCornerAnnotation: Scales with window size, is fixed to a corner and the background opacity cannot be set AFAIK.\nvtkTextActor: Cannot set a background color or opacity\n\nCan anyone tell me how they might achieve what I'm after in VTK?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1042,"Q_Id":17461600,"Users Score":0,"Answer":"just use vtktexture, vtkimagedata & add your own image as texture background to the vtkrenderer by reducing the opacity like a watermark. thats it","Q_Score":1,"Tags":"python,vtk","A_Id":25908567,"CreationDate":"2013-07-04T03:53:00.000","Title":"Semi-transparent 2d VTK text background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know that many large-scale applications such as video games are created using multiple langages. For example, it's likely the game\/physics engines are written in C++ while gameplay tasks, GUI are written in something like Python or Lua. \nI understand why this division of roles is done; use lower-level languages for tasks that require extreme optimization, tweaking, efficiency and speed, while using higher-level languages to speed up production time, reduce nasty bugs ect.\nRecently, I've decided to undertake a larger personal project and would like to divy-up parts of the project similar to above. At this point in time, I'm really confused about how this interoperability between languages (especially compiled vs interpreted) works. \nI'm quite familiar with the details of going from ANSCII code test to loading an executable, when written in something like C\/C++. I'm very curious at how something like a video game, built from many different languages, works. This is a large\/broad question, but specifically I'm interested in:\n\nHow does the code-level logic work? I.e. how can I call Python code from a C++ program? Especially since they don't support the same built-in types?\nWhat does the program image look like? From what I can tell, a video game is running in a single process, so what does the runtime image look like when running a C\/C++ program that calls a Python function?\nIf calling code from an interpreted language from a compiled program, what are the sequence of events that occur? I.e If I'm inside my compiled executable, and for some reason have a call to an interpreted language inside a loop, do I have to wait for the interpreter every iteration?\n\nI'm actually finding a hard time finding information on what happening at the machine-level, so any help would be appreciated. Although I'm curious in general about interoperation of software, I'm specifically interested in C++ and Python interaction.\nThank you very much for any insight, even if it's just pointing me to where I can find more information.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1114,"Q_Id":17507004,"Users Score":3,"Answer":"In the specific case of python, you have basically three options (and this generally applies across the board):\n\nHost python in C++: From the perspective of the C++ programme, the python interpreter is a C library. On the python side, you may or may not need to use something like ctypes to expose the C(++) api.\nPython uses C++ code as DLLs\/SOs - C++ code likely knows nothing of python, python definitely has to use a foreign function interface.\nInterprocess communication - basically, two separate processes run, and they talk over a socket. These days you'd likely use some kind of web services architecture to accomplish this.","Q_Score":8,"Tags":"c++,python,game-engine,language-interoperability","A_Id":17507117,"CreationDate":"2013-07-06T20:49:00.000","Title":"How interoperability works","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've to output few points in an interactively selected region of an image. I'm not familiar with PyQt to select the appropriate elements for the task. Please suggest the right way to do it. Currently, this is what I intend to do :\n\nLoad the image. \n\nUse QImage (QPixMap?) to display the image.\n\nSelect a rectangular region in the image.\n\nUse QRubberBand to select the region.\n\nDraw a grid in the region.\n\nUse QLines?\n\nMake the grid points (interesctions) selectable.\n\nNo idea.\n\n\nAny pointers to snippets using the required classes will be greatly helpful. Thanks !","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":934,"Q_Id":17509478,"Users Score":1,"Answer":"Use QGraphicsScene and QGraphicsView to display your scene. \n\nUse scene->addPixmap to add the image. \nUse QRubberBand to select the region as you said. \nUse view->mapToScene to convert viewport coordinates obtained from QRubberBand to the scene coordinates.\nAdd lines using scene->addLine\nAdd small circle items to lines intersection points using scene->addEllipse. This function returns QGraphicsEllipseItem* object. You should use circles with (0, 0) center. Use item->setPos to move each circle in the proper place.\nUse item->setFlag(QGraphicsItem::ItemIsSelectable) to make circle items selectable. You can now select items with mouse clicks.\nUse view->dragMode(QGraphicsView::RubberBandDrag) if you want to enable items selection using automatic QRubberBand. \nUse QGraphicsScene::selectedItems to obtain selected items. You can then use item->pos() to obtain items positions.","Q_Score":0,"Tags":"python,qt,pyqt","A_Id":17510954,"CreationDate":"2013-07-07T05:10:00.000","Title":"How to select an area and fill it with a grid in PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am aiming to change the a part of the Tkinter screen when a button is clicked.  Do I have to destroy the screen then redraw it (to create the illusion that only a part is being changed?) Or can I keep the button there and somehow only change one part (like the graphics.) Thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":881,"Q_Id":17517961,"Users Score":0,"Answer":"No, you do not have to destroy the screen and redraw it. You can easily insert widgets into the current window when a button is clicked. There's nothing special about being run from a button click -- the code is the same as your initialization code.","Q_Score":0,"Tags":"python,tkinter","A_Id":17518474,"CreationDate":"2013-07-08T01:16:00.000","Title":"Changing Tkinter Screen when button is clicked?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know this question has been asked before but those questions typically lack specific details and result in answers that say something like \"It depends what you are trying to do...\" so the main gist of this app is that it retrieves remote data (ex. text) and object (ex. images).\nSince PHP and python are the two programming languages I feel comfortable with I felt python was more suited for desktop gui apps.  I'm creating a desktop music player and here are some of the technical specs I want to include:\n\nA sign in construct that authenticates user credentials  (Like\nspotify, skype, league of legends) against a remote database (This\nwill be in mysql.)  My thinking is to create a web api for the client to query via HTTP\/HTTPS GET\/POST\nA client side SQLite database that stores the filename, filepath and\nid3 tags of the song so upon launching, the application displays each song in a row with the song length, artist, album, genre (Like iTunes)\nRetrieve remote images and display them within the application's frame (Like skype displays a person's profile picture.)\nMust be cross-platform (At least in Windows and Mac), look native in different OS's but the native look and feel should be easily overridden with custom styles (Ex. rounded buttons with gradients.)\nCompilation for Windows and Mac should be relatively straightforward\n\nOf the popular python gui toolkits like PyQt, PyGTK, Tkinter, wxPython, Pyjamas, PyGObject and PySide which are well suited for my application and why?  Why are the others not well suited for these specs?    Which have good documentation and active communities?","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1760,"Q_Id":17522223,"Users Score":0,"Answer":"I only got expirience with Qt-based Python GUI-toolkits, and found them to be very powerful, well documented and simple to use (as long as you stay away from model-view framework). And they can do all the things you mentioned. So my recomendation would be PyQt or PySide. PySide's advantage is it's license - LGPL, so if your stuff is proprietary - go for PySide. PySide has some troubles however, as it is basically abandoned as of writing this, so you will have to dodge some bugs (nothing realy critical IMO). PyQt is more actively maintained and developed, but it's GPL or commercial (about 400 euros). So if your stuff is free, you should choose PyQt. And yes, use ORM, if possible. Just my 2 cents.","Q_Score":1,"Tags":"python,tkinter,wxpython,pyqt,pygtk","A_Id":17525347,"CreationDate":"2013-07-08T08:37:00.000","Title":"Considerations for python gui toolkit for app that queries remote database?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know this question has been asked before but those questions typically lack specific details and result in answers that say something like \"It depends what you are trying to do...\" so the main gist of this app is that it retrieves remote data (ex. text) and object (ex. images).\nSince PHP and python are the two programming languages I feel comfortable with I felt python was more suited for desktop gui apps.  I'm creating a desktop music player and here are some of the technical specs I want to include:\n\nA sign in construct that authenticates user credentials  (Like\nspotify, skype, league of legends) against a remote database (This\nwill be in mysql.)  My thinking is to create a web api for the client to query via HTTP\/HTTPS GET\/POST\nA client side SQLite database that stores the filename, filepath and\nid3 tags of the song so upon launching, the application displays each song in a row with the song length, artist, album, genre (Like iTunes)\nRetrieve remote images and display them within the application's frame (Like skype displays a person's profile picture.)\nMust be cross-platform (At least in Windows and Mac), look native in different OS's but the native look and feel should be easily overridden with custom styles (Ex. rounded buttons with gradients.)\nCompilation for Windows and Mac should be relatively straightforward\n\nOf the popular python gui toolkits like PyQt, PyGTK, Tkinter, wxPython, Pyjamas, PyGObject and PySide which are well suited for my application and why?  Why are the others not well suited for these specs?    Which have good documentation and active communities?","AnswerCount":5,"Available Count":2,"Score":0.0798297691,"is_accepted":false,"ViewCount":1760,"Q_Id":17522223,"Users Score":2,"Answer":"Both PySide and WxPython support all five of your requirements. WxPython uses actual native widgets and also has custom extensions and widgets built on top. It has goodies like wx.CallAfter which'll allow you to run your background tasks in a separate thread and hop back on the UI thread easily. \nPySide has a nicer API but draws its own widgets that imitate the underlying OS's UI. It's not as mature as WxPython and packaging it with tools like cx_freeze and PyInstaller is slightly more involved.\nAlso I recommend that you use an ORM like peewee over plain Sqlite3 for the data storage, it makes managing the data a lot easier and plays well with the freezing tools.","Q_Score":1,"Tags":"python,tkinter,wxpython,pyqt,pygtk","A_Id":17523987,"CreationDate":"2013-07-08T08:37:00.000","Title":"Considerations for python gui toolkit for app that queries remote database?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Could you please tell me what is the closest data type in C++ to python list? If there is nothing similar, how would you build it in C++?","AnswerCount":5,"Available Count":2,"Score":0.0798297691,"is_accepted":false,"ViewCount":21803,"Q_Id":17528657,"Users Score":2,"Answer":"There is no real equivalent, and it would be extremely difficult\nto provide one.  Python and C++ are radically different\nlanguages, and providing one really wouldn't make much sense in\nthe context of C++.  The most important differences are that\neverything in Python is dynamically allocated, and is an\n\"object\", and that Python uses duck typing.\nFWIW: one very early library (before templates) in C++ did offer\ncontainers of Object*, with derived classes to box int,\ndouble, etc.  Actual experience showed very quickly that it\nwasn't a good idea.  (And I'm curious: does any one else\nremember it?  And particularly, exactly what it was \ncalled---something with NHS in it, but I can't remember more.)","Q_Score":15,"Tags":"c++,python,list","A_Id":17529258,"CreationDate":"2013-07-08T14:03:00.000","Title":"Python list equivalent in C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Could you please tell me what is the closest data type in C++ to python list? If there is nothing similar, how would you build it in C++?","AnswerCount":5,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":21803,"Q_Id":17528657,"Users Score":5,"Answer":"Actually no C++ container is equivalent to Python's list, which is partially a result of the very different object models of C++ and Python. In particular, the suggested and upvoted std::list is IMHO not even close to Python's list type, a I'd rather suggest std::vector or maybe std::deque. That said, it isn't clear what exactly it is that you want and how to \"build it\" strongly depends on what exactly \"it\" is, i.e. what you expect from the container.\nI'd suggest you take a look at the C++ containers std::vector, std::deque and std::list to get an overview. Then look at things like Boost.Any and Boost.Variant that you can combine with them, maybe also one of the smart pointers and Boost.Optional. Finally, check out Boost.Container and Boost.Intrusive. If the unlikely case that none of these provide a suitable approximation, you need to provide a better explanation of what your actual goals are.","Q_Score":15,"Tags":"c++,python,list","A_Id":17529154,"CreationDate":"2013-07-08T14:03:00.000","Title":"Python list equivalent in C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a scrollable wx.textcontrol widget that updates during the course of the program. Whenever the text is updated,the scrollbar resets to the top of the screen. I don't want that to happen, but I can't figure out how to stop it. Does any of you know?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":70,"Q_Id":17535252,"Users Score":2,"Answer":"Just keep track of the line that you are on\/or has been updated and call EnsureVisible on the text control.  (Also ensure you are using Append rather than Set to add new text).\nCorrection, (now I have access to the help files), I was getting mixed up with MakeCellVisible from Grid controls:\nYourTextCtrl.ShowPositon(YourTextCtrl.GetLastPosition()) should do the job nicely.\nEven better if you call SetInsertionPointEnd() on your text control before the text is inserted, (by using WriteText), then your problem goes away.","Q_Score":0,"Tags":"python,wxpython","A_Id":17535320,"CreationDate":"2013-07-08T20:18:00.000","Title":"Scroll bar problems","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a frame with buttons and plotting options and wanted to include a table as well in that frame. Is there any example or suggestion on how to do it?\nThanks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":88,"Q_Id":17539441,"Users Score":0,"Answer":"You would use a wx.grid.Grid in most cases. You could use a wx.ListCtrl or an ObjectListView widget too. The idea is to put the widgets inside of sizers. So you could have a top level BoxSizer in vertical orientation that contains another sizer or sizers. In this case, I would create a sizer to hold the buttons and nest that sizer in the top level sizer. Then add the table (i.e. grid) to the top level sizer and you're done.","Q_Score":0,"Tags":"python-2.7,wxpython","A_Id":17550349,"CreationDate":"2013-07-09T03:31:00.000","Title":"How to insert a table inside a frame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a frame with buttons and plotting options and wanted to include a table as well in that frame. Is there any example or suggestion on how to do it?\nThanks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":88,"Q_Id":17539441,"Users Score":0,"Answer":"The wxpython demo is full of examples of all differant controls.","Q_Score":0,"Tags":"python-2.7,wxpython","A_Id":17547609,"CreationDate":"2013-07-09T03:31:00.000","Title":"How to insert a table inside a frame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Sorry for the sort of general question, but I'm having a hard time figuring out how to start this. I'm trying to incorporate some natural language toolkit code in Python with a mobile app I'm developing in Unity. It's a very small amount of code, but it's critical for the functioning of the app. \nDo I need to have the python code running on some kind of server? How would I go about doing this? I'm very new to python and mobile development. \nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":292,"Q_Id":17549279,"Users Score":0,"Answer":"Traditional\/classic Python is implemented in C. This makes it easy to integrate into any environment that has support for compiled C.\nI'm unfamiliar with Unity, but here are some general guidelines on how you would do it with standard iOS and Android.  On iOS, you would just add all of the Python C source files (minus the ones that have a 'main' function) to your project in Xcode. On Android, you would add all of the C source files (again, minus the ones that have a 'main' function) to your project in the JNI part of your project and would use ndk-build to build a native shared library that would be part of your app.\nAre you limited to Python? If not, you might want to have a look at Lua as it's much smaller (fewer C source files) and might be quicker to get going.","Q_Score":0,"Tags":"python,mobile,unity3d,nltk","A_Id":17551204,"CreationDate":"2013-07-09T13:20:00.000","Title":"How can I incorporate Python code in a mobile app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the best way to a text based output in a Qt widget? what I mean by this is... like in win RAR or some windows installers where there is a drop down arrow showing more details and it shows live text output of files modified and things of that nature. how would I go about doing that in a Qt app?  \nI was thinking maybe a none editable multiple line text box... but I'm not sure, because I don't wan't it to be editable. \nany help on this would be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":590,"Q_Id":17555111,"Users Score":1,"Answer":"QLabel\nQTextDocument\nQTextEdit\nAlmost all of the options above, can be configured to be \"Read-only\" or even unclickable by making them disabled.\nQTextStream is also a really useful class.\nHope that helps.","Q_Score":0,"Tags":"python,qt,pyside","A_Id":17557946,"CreationDate":"2013-07-09T18:01:00.000","Title":"how to make a Qt text output widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am aiming to make a money counter for the game i am programming.  For example, if I buy something (in the game) I want my money label to update with the new value once this happens.  How would I go about this besides creating a loop that checks every second to see if my variable has changed?  Thanks so much!","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":858,"Q_Id":17557489,"Users Score":2,"Answer":"Tkinter has a way to link widgets and data. You can create an instance of StringVar, and assign it to the textvariable attribute of a label. Whenever you change the value of the variable, the label will automatically update.","Q_Score":2,"Tags":"python,user-interface,tkinter","A_Id":17560333,"CreationDate":"2013-07-09T20:24:00.000","Title":"Updating Label when variable changes in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am aiming to make a money counter for the game i am programming.  For example, if I buy something (in the game) I want my money label to update with the new value once this happens.  How would I go about this besides creating a loop that checks every second to see if my variable has changed?  Thanks so much!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":858,"Q_Id":17557489,"Users Score":0,"Answer":"Ping the money counter with a function whenever an action such as buying or selling something occurs","Q_Score":2,"Tags":"python,user-interface,tkinter","A_Id":17557564,"CreationDate":"2013-07-09T20:24:00.000","Title":"Updating Label when variable changes in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to add a timer for my simple math game. So far everything works just fine, the user gets questions when pressing the button and is given feedback on the answer. I want to add a timer for the user to see how much time it takes to answer the multiplication. This is the final part of my prototype to this mathgame. I want the timer to start when the user clicks \"nytt tal\" which means new number in swedish, and to stopp when the user clicks \"svar\" which means answer in swedish. Here is my code.\n\nfrom Tkinter import *\nimport tkMessageBox\nimport random\nimport time\nimport sys\n\n# Definition for the question asked to user \ndef fraga1():\n    global num3 \n    num3 = random.randint(1, 10)\n    global num4 \n    num4 = random.randint(1, 10)\n    global svar1 \n    svar1 = num3 * num4\n    label1.config(text='Vad blir ' + str(num3) + '*' + str(num4) + '?')\n    entry1.focus_set()\n\n\n#The answer giving feedback based on answer\ndef svar1():\n   mainAnswer = entry1.get()\n   if len(mainAnswer) == 0:\n      tkMessageBox.showwarning(message='Skriv in n\u00e5gra nummer!')\n   return\n   if int(mainAnswer) != svar1:\n      tkMessageBox.showwarning(message='Tyv\u00e4rr det r\u00e4tta svaret: ' + str(svar1))\n   else:\n      tkMessageBox.showinfo(message='R\u00c4TT!! :)')\n\n#The quit button definition\ndef quit():\n   global root\n   root.destroy()\n\n#Definition for the timer this part doesnt work\ndef start():\n   global count_flag \n   fraga1()\n   count_flag = True\n   count = 0.0\n   while True:\n      if count_flag == False:\n          break\n   label['text'] = str(count)\n   time.sleep(0.1)\n   root.update()\n   count += 0.1\n\n\n#Window code\nroot = Tk()\nroot.title(\"multiplikations tidtagning\")\nroot.geometry('800x500')\n\ncount_flag = True\n\n# Welcome message in labels\nlabel2 = Label(root, text=\"Hej!\\n  Nu ska vi l\u00f6sa lite matteproblem!\")\nlabel2.config(font=('times', 18, 'bold'), fg='black', bg='white')\nlabel2.grid(row=0, column=0)\n\n#Instructions how to play in labels\n\nlabel3 = Label(root, text=\"Instruktioner!\\n  F\u00f6r att starta ett spel tryck p\u00e5 nyttspel\") \nlabel3.config(font=('times', 12, 'bold'), fg='black', bg='white')\nlabel3.grid(row=2, column=2)\n\n#other label\nlabel1 = Label(root)\nlabel1.grid(row=2, column=0)\n\n\n# entry widget for the start button\nentry1 = Entry(root)\nentry1.grid(row=3, column=0)\n\n# restart gives a new question\nentry1.bind('', func=lambda e:checkAnswer())\n\n#Buttons\n\nfragaBtn = Button(root, text='Nytt tal', command=fraga1)\nfragaBtn.grid(row=4, column=0)\n\nsvarButton = Button(root, text='Svar', command=svar1)\nsvarButton.grid(row=4, column=1)\n\n\nquit_bttn = Button(root, text = \"Avsluta\", command=quit)\nquit_bttn.grid(row=5, column=0)\n\n\n\nroot.mainloop()","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3643,"Q_Id":17569007,"Users Score":7,"Answer":"I think what you need is this .\n\nfrom Tkinter import *\nimport time\n\nclass StopWatch(Frame):  \n    \"\"\" Implements a stop watch frame widget. \"\"\"                                                                \n    def __init__(self, parent=None, **kw):        \n        Frame.__init__(self, parent, kw)\n        self._start = 0.0        \n        self._elapsedtime = 0.0\n        self._running = 0\n        self.timestr = StringVar()               \n        self.makeWidgets()      \n\n    def makeWidgets(self):                         \n        \"\"\" Make the time label. \"\"\"\n        l = Label(self, textvariable=self.timestr)\n        self._setTime(self._elapsedtime)\n        l.pack(fill=X, expand=NO, pady=2, padx=2)                      \n\n    def _update(self): \n        \"\"\" Update the label with elapsed time. \"\"\"\n        self._elapsedtime = time.time() - self._start\n        self._setTime(self._elapsedtime)\n        self._timer = self.after(50, self._update)\n\n    def _setTime(self, elap):\n        \"\"\" Set the time string to Minutes:Seconds:Hundreths \"\"\"\n        minutes = int(elap\/60)\n        seconds = int(elap - minutes*60.0)\n        hseconds = int((elap - minutes*60.0 - seconds)*100)                \n        self.timestr.set('%02d:%02d:%02d' % (minutes, seconds, hseconds))\n\n    def Start(self):                                                     \n        \"\"\" Start the stopwatch, ignore if running. \"\"\"\n        if not self._running:            \n            self._start = time.time() - self._elapsedtime\n            self._update()\n            self._running = 1        \n\n    def Stop(self):                                    \n        \"\"\" Stop the stopwatch, ignore if stopped. \"\"\"\n        if self._running:\n            self.after_cancel(self._timer)            \n            self._elapsedtime = time.time() - self._start    \n            self._setTime(self._elapsedtime)\n            self._running = 0\n\n    def Reset(self):                                  \n        \"\"\" Reset the stopwatch. \"\"\"\n        self._start = time.time()         \n        self._elapsedtime = 0.0    \n        self._setTime(self._elapsedtime)\n\n\ndef main():\n    root = Tk()\n    sw = StopWatch(root)\n    sw.pack(side=TOP)\n\n    Button(root, text='Start', command=sw.Start).pack(side=LEFT)\n    Button(root, text='Stop', command=sw.Stop).pack(side=LEFT)\n    Button(root, text='Reset', command=sw.Reset).pack(side=LEFT)\n    Button(root, text='Quit', command=root.quit).pack(side=LEFT)\n\n    root.mainloop()\n\nif __name__ == '__main__':\n    main()\n\nP.S: Fit this in your code I just implemented the basic timer in tkinter.","Q_Score":4,"Tags":"python,user-interface,python-2.7,timer,tkinter","A_Id":17570984,"CreationDate":"2013-07-10T11:03:00.000","Title":"Python timer in math game Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to add a timer for my simple math game. So far everything works just fine, the user gets questions when pressing the button and is given feedback on the answer. I want to add a timer for the user to see how much time it takes to answer the multiplication. This is the final part of my prototype to this mathgame. I want the timer to start when the user clicks \"nytt tal\" which means new number in swedish, and to stopp when the user clicks \"svar\" which means answer in swedish. Here is my code.\n\nfrom Tkinter import *\nimport tkMessageBox\nimport random\nimport time\nimport sys\n\n# Definition for the question asked to user \ndef fraga1():\n    global num3 \n    num3 = random.randint(1, 10)\n    global num4 \n    num4 = random.randint(1, 10)\n    global svar1 \n    svar1 = num3 * num4\n    label1.config(text='Vad blir ' + str(num3) + '*' + str(num4) + '?')\n    entry1.focus_set()\n\n\n#The answer giving feedback based on answer\ndef svar1():\n   mainAnswer = entry1.get()\n   if len(mainAnswer) == 0:\n      tkMessageBox.showwarning(message='Skriv in n\u00e5gra nummer!')\n   return\n   if int(mainAnswer) != svar1:\n      tkMessageBox.showwarning(message='Tyv\u00e4rr det r\u00e4tta svaret: ' + str(svar1))\n   else:\n      tkMessageBox.showinfo(message='R\u00c4TT!! :)')\n\n#The quit button definition\ndef quit():\n   global root\n   root.destroy()\n\n#Definition for the timer this part doesnt work\ndef start():\n   global count_flag \n   fraga1()\n   count_flag = True\n   count = 0.0\n   while True:\n      if count_flag == False:\n          break\n   label['text'] = str(count)\n   time.sleep(0.1)\n   root.update()\n   count += 0.1\n\n\n#Window code\nroot = Tk()\nroot.title(\"multiplikations tidtagning\")\nroot.geometry('800x500')\n\ncount_flag = True\n\n# Welcome message in labels\nlabel2 = Label(root, text=\"Hej!\\n  Nu ska vi l\u00f6sa lite matteproblem!\")\nlabel2.config(font=('times', 18, 'bold'), fg='black', bg='white')\nlabel2.grid(row=0, column=0)\n\n#Instructions how to play in labels\n\nlabel3 = Label(root, text=\"Instruktioner!\\n  F\u00f6r att starta ett spel tryck p\u00e5 nyttspel\") \nlabel3.config(font=('times', 12, 'bold'), fg='black', bg='white')\nlabel3.grid(row=2, column=2)\n\n#other label\nlabel1 = Label(root)\nlabel1.grid(row=2, column=0)\n\n\n# entry widget for the start button\nentry1 = Entry(root)\nentry1.grid(row=3, column=0)\n\n# restart gives a new question\nentry1.bind('', func=lambda e:checkAnswer())\n\n#Buttons\n\nfragaBtn = Button(root, text='Nytt tal', command=fraga1)\nfragaBtn.grid(row=4, column=0)\n\nsvarButton = Button(root, text='Svar', command=svar1)\nsvarButton.grid(row=4, column=1)\n\n\nquit_bttn = Button(root, text = \"Avsluta\", command=quit)\nquit_bttn.grid(row=5, column=0)\n\n\n\nroot.mainloop()","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3643,"Q_Id":17569007,"Users Score":0,"Answer":"Use a global variable storing current time when person presses start. Then when the user presses svar in your function svar, just fetch current time, substract them from one another and you get time taken, then reset the global var to 0 also and voila, you have the time taken","Q_Score":4,"Tags":"python,user-interface,python-2.7,timer,tkinter","A_Id":39337514,"CreationDate":"2013-07-10T11:03:00.000","Title":"Python timer in math game Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Install QPython from Google Play store\nOpen QPython, slide right and click \"Console\"\nTry some code, starting with import androidhelper\nu0_a98@android:\/ $ python\nPython 2.7.2 (default, Jun 3 2013, 20:01:13)\n[GCC 4.4.3] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\n\n\nimport androidhelper\n      Traceback (most recent call last):\n        File \"\", line 1, in \n        File \"\/storage\/sdcard0\/com.hipipal.qpyplus\/lib\/site-packages\/androidhelper.py\", line 43, in \n          import sl4a\n      ImportError: No module named sl4a\n\n\n\n\nI'm running Cyanogenmod 10.0.0, Android 4.1.2.  Any idea how to import androidhelper successfully?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3999,"Q_Id":17569671,"Users Score":0,"Answer":"Install the latest from the Google Play store.  I'm not getting this error using QPython (classic, not QPython3).","Q_Score":2,"Tags":"system,qpython","A_Id":31173913,"CreationDate":"2013-07-07T17:45:00.000","Title":"Why does qpython say \"No module named sl4a\"?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a way to embed a Tkinter GUI into a wiki page. I have looked around Google for a few hours and haven't had any success with a method. Is there a way to do this?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":183,"Q_Id":17603825,"Users Score":0,"Answer":"Ideas\n\nThis may sound like a lot of work, but it needs to be done and hopefully it would solve your problem:\n\nMake your own web browser that uses the latest Python version instead of JavaScript. In fact, write it in Python, with Tkinter. Then you'll be able to use the widgets more naturally.\nTell me. (I might even help.)\nMake it so you can embed Python Tkinter widgets as you please.\nFigure out how to make the browser so it's not a magnet for people who like to write malicious Python code, or else have a big disclaimer.\n\nWrite a plugin and\/or extension that either includes or depends upon the Python interpreter and Tkinter, and make the page request that people install it. Make sure your wiki supports plugins, or that your plugin\/extension supports wikis that don't support plugins.\n\nAs others have said, Python doesn't come with a natural way to make Tkinter widgets in your web browser. You kind of have to make a way, or use someone else's way. If you can put applets in your wiki, I might recommend the Jython method someone else mentioned.","Q_Score":0,"Tags":"python,tkinter,wiki","A_Id":23421260,"CreationDate":"2013-07-11T21:26:00.000","Title":"Python on a wiki","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the best library (and the link) for utilizing animated GIF files into pygame 2.6? I've been searching through some and they all seem to be either buggy, broken, or removed.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":241,"Q_Id":17627748,"Users Score":0,"Answer":"Just seperate the gif into images and animate it with pygame.","Q_Score":1,"Tags":"pygame,python-2.6","A_Id":17653503,"CreationDate":"2013-07-13T06:44:00.000","Title":"Best Library for utilizing animated GIF in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have wx.grid filled with data and I have search option so when user enters some text, I find it and select that row. The problem is that row only gets selected but doesnt become visible. It doesnt scroll down or up to that row. How can I manually scroll to that row?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":646,"Q_Id":17640500,"Users Score":3,"Answer":"MakeCellVisible( int row, int col ) \u2014 forces the particular cell to be visible, effectively works to scroll the grid to be given cell.","Q_Score":0,"Tags":"python,wxpython,wxgrid","A_Id":17640718,"CreationDate":"2013-07-14T14:54:00.000","Title":"Go to specifc row in wx.grid","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am designing a GUI using the wxPython toolkit, which means it's being written in python2. However, I want to use python3 for the actual application code. How would I go about calling my python3 code from the GUI?","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":19541,"Q_Id":17665124,"Users Score":18,"Answer":"Talk over a pipe or socket\nEnable such python 3 features as you can from __future__ or use a library like six to write code which is compatible with both.\nDon't do this. \n\nFinally, are you sure you can't use wxPython in Python 3? There's nothing in the online docs saying you can't.","Q_Score":13,"Tags":"python,python-2.7,python-3.x","A_Id":17665156,"CreationDate":"2013-07-15T22:40:00.000","Title":"Call python3 code from python2 code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I try to run any PyQt5 program from Eclipse, I got this error.\n\nFailed to load platform plugin \"windows\". Available platforms are: windows, minimal\n\nI've never encountered this problem with PyQt4 but with the new version.\nI'm not able to run a program. From other questions here I know it happens with Qt C++ development and the solution is to copy some Qt dll files to executable program directory.\nDo I need to do the same in Python development (PyQt5) too? Add those files to the directory, where my *.py files reside? Shouldn't this be managed by PyQt5 installation?\nThank you","AnswerCount":8,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":22391,"Q_Id":17695027,"Users Score":11,"Answer":"I encountered this issue with PyQt5 5.0.2, Windows 8, Python 3.3.2; slightly different error message:\nFailed to load platform plugin \"windows\". Available platforms are:\nSet the following environment variable and then run the application.\n$env:QT_QPA_PLATFORM_PLUGIN_PATH=\"C:\\Python33\\Lib\\site-packages\\PyQt5\\plugins\\platforms\"","Q_Score":9,"Tags":"python,pyqt,pyqt5","A_Id":18178711,"CreationDate":"2013-07-17T08:39:00.000","Title":"PyQt5 - Failed to load platform plugin \"windows\". Available platforms are: windows, minimal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I try to run any PyQt5 program from Eclipse, I got this error.\n\nFailed to load platform plugin \"windows\". Available platforms are: windows, minimal\n\nI've never encountered this problem with PyQt4 but with the new version.\nI'm not able to run a program. From other questions here I know it happens with Qt C++ development and the solution is to copy some Qt dll files to executable program directory.\nDo I need to do the same in Python development (PyQt5) too? Add those files to the directory, where my *.py files reside? Shouldn't this be managed by PyQt5 installation?\nThank you","AnswerCount":8,"Available Count":2,"Score":0.1243530018,"is_accepted":false,"ViewCount":22391,"Q_Id":17695027,"Users Score":5,"Answer":"i had a similar problem when compiling my code with cx_freeze. \nCopying the folder platforms from python installation directory into my built folder solved the problem. the \"platforms\" folder contains qminimal.dll","Q_Score":9,"Tags":"python,pyqt,pyqt5","A_Id":43377112,"CreationDate":"2013-07-17T08:39:00.000","Title":"PyQt5 - Failed to load platform plugin \"windows\". Available platforms are: windows, minimal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program completed that does the following:\n1)Reads formatted data (a sequence of numbers and associated labels) from serial port in real time.\n2)Does minor manipulations to data.\n3)plots data in real time in a gui I wrote using pyqt.\n4)Updates data stats in the gui.\n5)Allows post analysis of the data after collection is stopped.\nThere are two dialogs (separate classes) that are called from within the main window in order to select certain preferences in plotting and statistics.\nMy question is the following:  Right now my data is read in and declared as several global variables that are appended to as data comes in 20x per second or so - a 2d list of values for the numerical values and 1d lists for the various associated text values.  Would it be better to create a class in which to store data and its various attributes, and then to use instances of this data class to make everything else happen - like the plotting of the data and the statistics associated with it?\nI have a hunch that the answer is yes, but I need a bit of guidance on how to make this happen if it is the best way forward.  For instance, would every single datum be a new instance of the data class?  Would I then pass them one by one or as a list of instances to the other classes and to methods?  How should the passing most elegantly be done?\nIf I'm not being specific enough, please let me know what other information would help me get a good answer.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":184,"Q_Id":17709153,"Users Score":2,"Answer":"A reasonably good rule of thumb is that if what you are doing needs more than 20 lines of code it is worth considering using an object oriented design rather than global variables, and if you get to 100 lines you should already be using classes.  The purists will probably say never use globals but IMHO for a simple linear script it is probably overkill.\nBe warned that you will probably get a lot of answers expressing horror that you are not already.\nThere are some really good, (and some of them free), books that introduce you to object oriented programming in python a quick google should provide the help you need.\nAdded Comments to the answer to preserve them:\nSo at 741 lines, I'll take that as a yes to OOP:) So specifically on the data class. Is it correct to create a new instance of the data class 20x per second as data strings come in, or is it more appropriate to append to some data list of an existing instance of the class? Or is there no clear preference either way? \u2013 TimoB\nI would append\/extend your existing instance. \u2013 seth\nI think I see the light now. I can instantiate the data class when the \"start data\" button is pressed, and append to that instance in the subsequent thread that does the serial reading. THANKS! \u2013 TimoB","Q_Score":1,"Tags":"python,user-interface,pyqt","A_Id":17709406,"CreationDate":"2013-07-17T20:01:00.000","Title":"python program structure and use of global variables","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a relatively simple tkinter program that just uses Event, Button and Label objects. I would like to translate this to be usable on an android platform.\n1) What python for android should I use? QPython, py4a?\n2) And on that platform, what GUI module should I use?\nI'd like a little bit of detail for why you think a specific module or app would be best, as I'm just getting into the android scene and want to make an intelligent jump.","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":16370,"Q_Id":17721796,"Users Score":6,"Answer":"Even for native purposes, most developers would advise you keep away from Tkinter. It's a dated and unintuitive library that often makes GUI creation and maintenance harder than it needs to be.\nThe main advantage of developing apps using a Python library and embedding in Android is cross-platform support.\nThese libraries will often allow you to port your app with ease to many different operating systems.\nI will not answer which is \"best\" since this is an opinion-based question outside the scope of StackOverflow, however I will say it is (generally) easier to port from Kivy to android than it is in some other libraries (such as Qt). But take this with a grain of salt.\nMost libraries nowadays offer advanced GUI capabilities built-in, and your choice will likely not limit you in that regard.\nEither way, there is no direct\/simple way to translate your Tkinter project to any of these, and you will likely have to rewrite it with the library you end up choosing.\nI will add that if your intent is developing only for android, most would advise developing in a native Android language, such as Java or Kotlin, or using a development tool which makes use of such languages. This would result in smaller APK sizes and likely faster running times for your app.","Q_Score":12,"Tags":"android,python,tkinter","A_Id":54502540,"CreationDate":"2013-07-18T11:09:00.000","Title":"Tkinter to android translation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to Ipython Notebook.  I can cut and paste from other apps into my notebooks, but how do I copy\/paste code out of notebook into a different app?\nI'm accessing a Linux VNC session via Chicken.  I can cut\/paste with wild abandon between OSX\/Linux using both command X\/C\/V and\/or middle mouse button.  I can also copy code into IPython notebook.  I'm stopped dead in my tracks trying to get code out of IpyNotebook.\nUsing Notebook's 'Edit\/Copy Cell' doesn't work, neither does 'Ctrl-m c'.\nI'm running IPython 0.13.1","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":12168,"Q_Id":17731701,"Users Score":6,"Answer":"You have to select and copy code using normal Ctrl-C Ctrl-V. 'Edit\/Copy Cell' is a specific action in javascript that does a little more and that browser security policy prevent us to bind with clipboard.","Q_Score":6,"Tags":"ipython-notebook","A_Id":17732561,"CreationDate":"2013-07-18T18:55:00.000","Title":"Possible to copy\/paste from IPython Notebook to other apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a window that is always on top as a status display. The problem is that when it is not the focused window the text (using wx.StaticText) becomes gray and thus harder to read.\nIs it possible to make the text render in black even though the window is not focused?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":272,"Q_Id":17764457,"Users Score":0,"Answer":"You could always set the background colour to make the grey clearer.","Q_Score":0,"Tags":"wxpython","A_Id":17770596,"CreationDate":"2013-07-20T16:54:00.000","Title":"Make disabled text render black","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In python 3.3.2, how you adjust the time it takes for the suggestion box to appear just after typing a '.'. For example, say I import wxPython and type wx. after 3 seconds a list box would appear showing the available options. Is there any way to set this to appear instantly or in a very short time? Sort of like Visual Studio's intellisense feature which appears instantly.\nThanks in advance :)","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":104,"Q_Id":17777487,"Users Score":0,"Answer":"I think you are referring to your IDE, the editor you are using to write your code. If this is the case, that would depend on your editor, which one are you using?\nIf you are using the built-in editor IDLE, then what you are looking to do is not an available option.\nIf you are trying to do this within your own code using wxPython (as \nSexySaxMan suggested), please provide an example of your code so we can get a better idea of what you are trying to do.","Q_Score":0,"Tags":"python,autosuggest","A_Id":17777911,"CreationDate":"2013-07-21T22:13:00.000","Title":"How to adjust delay of suggestion list in Python 3.3.2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm recently using Boa Constructor to build GUI, and here's my problem:\n\ncreate a new wx.Frame\nadd a wx.Panel\nadd a wx.BoxSizer\nadd a wx.StaticBox\nadd a wx.StaticBoxSizer\n\nIt crashes every single time and I've no idea why? Am I doing something wrong?\nEnvironment: win 7 Ultimate 64bit \/ python 2.7.3(32bit) \/ wxPython 2.8.12.1 \/ Boa Constructor 0.6.1","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":187,"Q_Id":17807106,"Users Score":0,"Answer":"Found the problem:\nBoa Constructor always automatically add wx.StaticBox into previous wx.BoxSizer you created on wx.Panel, and you have to remove wx.StaticBox from wx.BoxSizer before you add wx.StaticBoxSizer for wx.StaticBox, or the whole program would crash.","Q_Score":0,"Tags":"python,wxpython","A_Id":18277589,"CreationDate":"2013-07-23T10:04:00.000","Title":"Boa Constructor keeps crashing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing an application for a company that is trying to brand itself with a particular font. They've given me all the .otf files for the fonts their other products use. Is it possible to set the font on widgets such as buttons and static texts to use these external files?\nIf so, would it be platform-independent? \nThanks","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1017,"Q_Id":17822123,"Users Score":2,"Answer":"Not yet, but it will probably be possible soon.  I saw a patch and discussion about it recently in the wxWidgets Trac.","Q_Score":3,"Tags":"python,fonts,widget,wxpython","A_Id":17824813,"CreationDate":"2013-07-23T22:30:00.000","Title":"Set wxPython widget font to external font file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using win32api in a Python script to control mouse movements. It's working fantastic, but as soon as I click (I also generate click events) outside my Python shell\/IDE, all my mouse events immediately stop. If I click my shell\/IDE again, control is restored.\nIt seems like mouse control is only working when my Python shell or IDE is the \"active\" window - is there any way to retain mouse control even after Python is sent to the background?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":435,"Q_Id":17878039,"Users Score":0,"Answer":"Turns out this was not a Python issue, but was an issue with the device I was using to generate mouse movements. A separate API call was required to allow this device to push events when its owner was out of focus.","Q_Score":1,"Tags":"python,winapi","A_Id":18193224,"CreationDate":"2013-07-26T09:42:00.000","Title":"Python win32api mouse control losing focus","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to move a (stereoscopic) video on a computer screen automatically. Think of the video as the ball in a Pong game. The problem is that it should be a stereoscopic 3D video. So the video size itself is kind of small. I did this kind of movements with pictures or drawing object, but I don't know how to do it with video material!\nDoes somebody know how I can do this? I already searched for video tools in python like pygame or pyglet. I have an external player Bino 3d which can open the desired video. But how can I make it move around the screen?\nOr is there a tool in other programming languages like c\/c++ or Matlab which can help?\nBy the way, the program will be on a Linux OS.\nI'll be grateful for any help or hints!\nAnna","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":110,"Q_Id":17881838,"Users Score":0,"Answer":"I'd try to use a decent video client (mplayer, vlc).  They can present the video in lots of ways, hopefully your stereoscopic issue can be solved by them.\nThen I would let the client present a single window (not fullscreen) which I then would move around using window manager controls.\nIf you must not have window decorations around the video or if the output shall be a specific window, I think mplayer at least can be told to use an existing window to perform the output in.  Maybe that's an approach then.","Q_Score":2,"Tags":"python,video,3d,move","A_Id":17882938,"CreationDate":"2013-07-26T12:53:00.000","Title":"move a stereoscopic video on the screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Now I have read the other stackoverflow Game of Life questions and also Googled voraciously.I know what to do for my Python implementation of the Game Of Life.I want to keep track of the active cells in the grid.The problem is I'm stuck at how should I code it.\nHere's what I thought up but I was kinda at my wit's end beyond that:  \n\nMaintain a ActiveCell list consisting of cell co-ordinates tuples which are active\ndead or alive.\nWhen computing next generation , just iterate over the ActiveCell list,compute cell\nstate and check whether state changes or not.  \nIf state changes , add all of the present cells neighbours to the list  \nIf not , remove that cell from the list  \nNow the problem  is : (\" . \"--> other cell)\nB C D\n        . A .\n        . . .\nIf A satisfies 3)  then it adds B,C,D\nthen if B also returns true for 3) ,which means it will add A,C again\n(Duplication)  \n\nI considered using OrderedSet or something to take care of the order and avoid duplication.But still these I hit these issues.I just need a direction.","AnswerCount":5,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1235,"Q_Id":17897988,"Users Score":1,"Answer":"You have two lists, I'll name them currentState, and newChanges.  Here will be the workflow:\n\nIterate over currentState, figuring out which are newly born cells, and which ones are going to die.  Do NOT add these changes to your currentState.  If there is a cell to be born or a death, add it to the newChanges list.  When you are finished with this step, currentState should look exactly the same as it did at the beginning.\nOnce you have finished all calculations in step 1 for every cell, then iterate over newChanges.  For each pair in newChanges, change it in currentState from dead to alive or vice versa.\n\nExample:\n\ncurrentState has {0,0} {0,1} {0,2}. (Three dots in a line)\nnewChanges is calculated to be {0,0} {-1,1} {1,1} {0,2} (The two end dots die, and the spot above and below the middle are born)\ncurrentState recieves the changes, and becomes {-1,1} {0,1} {1 ,1}, and newChanges is cleared.","Q_Score":5,"Tags":"python","A_Id":17898513,"CreationDate":"2013-07-27T12:50:00.000","Title":"Game Of Life : How to keep track of active cells","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Now I have read the other stackoverflow Game of Life questions and also Googled voraciously.I know what to do for my Python implementation of the Game Of Life.I want to keep track of the active cells in the grid.The problem is I'm stuck at how should I code it.\nHere's what I thought up but I was kinda at my wit's end beyond that:  \n\nMaintain a ActiveCell list consisting of cell co-ordinates tuples which are active\ndead or alive.\nWhen computing next generation , just iterate over the ActiveCell list,compute cell\nstate and check whether state changes or not.  \nIf state changes , add all of the present cells neighbours to the list  \nIf not , remove that cell from the list  \nNow the problem  is : (\" . \"--> other cell)\nB C D\n        . A .\n        . . .\nIf A satisfies 3)  then it adds B,C,D\nthen if B also returns true for 3) ,which means it will add A,C again\n(Duplication)  \n\nI considered using OrderedSet or something to take care of the order and avoid duplication.But still these I hit these issues.I just need a direction.","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1235,"Q_Id":17897988,"Users Score":0,"Answer":"Did you consider using an ordered dictionary and just set the values to None?","Q_Score":5,"Tags":"python","A_Id":17898267,"CreationDate":"2013-07-27T12:50:00.000","Title":"Game Of Life : How to keep track of active cells","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I have a Tkinter program, which is a nice IDE, since none of them aren't at my standards. Similar to most programs, they have the menu bar at the top? Since in HTML you use the li tag, What is the equivalent of the li tag in python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":17914476,"Users Score":0,"Answer":"parse it as an int! Despite common belief, int parsage is always effective!","Q_Score":0,"Tags":"python-2.7,tkinter","A_Id":17914482,"CreationDate":"2013-07-29T00:35:00.000","Title":"Li tag equivalent in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i have 2 treewidgets placed in a frame in mainwindow. how can i have 2 different set of context menu options for the 2 treewidgets? i need individual set of right click options for the treewidgets.Thanks in advance..","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1433,"Q_Id":17961363,"Users Score":0,"Answer":"Every QWidget has a contextMenuPolicy property which defines what to do when context menu is requested. A simpliest way to do what you need is like this:\n\nCreate QAction objects that call methods you want.\nAdd these actions to your tree widgets using widget.addAction()\nCall widget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)\n\nThat's it. Context menu for the widget will contain actions you added.","Q_Score":1,"Tags":"python,pyqt,qtreewidget","A_Id":17962727,"CreationDate":"2013-07-31T04:00:00.000","Title":"PyQT treewidgets with different context menu options","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using the cgkit.wintab module in python to access x,y coordinates of my Wacom tablet. The command cgkit.wintab.Packet.x is supposed to give me the value of the x co-ordinate of the touch on the tablet. Instead I get the response <property object at (hex memory address)>.\nHow do I extract the value of the x co-ordinate from this object?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1974,"Q_Id":18019599,"Users Score":1,"Answer":"cgkit.wintab.Packet is a class. You need to look up x on an instance of the class, not the class itself.","Q_Score":1,"Tags":"python,properties,cgkit","A_Id":18019711,"CreationDate":"2013-08-02T14:35:00.000","Title":"How to get the value of a Property Object in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a tkinter GUI for my python script. When I run the script, I want a dynamic string in one of the Label widgets on the GUI window, which will display:\n\"Working.\"\nThen:\n\"Working..\"\nthen\n\"Working...\"\nand then start from \"Working.\" again until the script is completed.\n(Actually I'd prefer a progress bar in this area)\nIs it possible?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":22257,"Q_Id":18047636,"Users Score":1,"Answer":"Yes, it is possible. There are two ways to do it:\n\nWhenever you want to update the label from your code you can call the_widget.configure(the_text). This will change the text of the label.\nYou can create an instance of a tkinter.StringVar, and assign it to the textvariable attribute of a label. Whenever you change the value of the variable (via the_variable.set(the_text), the label will automatically update.\n\nNote that for either of these to work, the event loop needs to be able to process events (ie: you won't see anything if your function takes a long time to run and you never call update_idletasks or re-enter the event loop).","Q_Score":4,"Tags":"python,user-interface,tkinter","A_Id":18048021,"CreationDate":"2013-08-04T21:15:00.000","Title":"Python: Is it possible to create an tkinter label which has a dynamic string when a function is running in background?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Ok. so I know 2to3 only provides a dif list. However, 2o3 should modify the actual file right?\nwhen I run this command with -w it gives me a dif list. The file is not changed (it is still Tkinter) Also, I sse no backup like 2to3 is supposed to provide. \nEdit: I  actually did this on a folder. One file in the folder(which was already 3.x) was modified. I put this file in the folder by mistake but the files I wanted we're not changed (though terminal did give me a dif list).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":182,"Q_Id":18059436,"Users Score":1,"Answer":"2to3 -w will both replace the files and print the diffs; you need to use --no-diffs to turn off the diff output.  2to3 --no-diffs -w dir\/*.py should do the trick.","Q_Score":1,"Tags":"python,python-2.7,python-3.x,diff,python-2to3","A_Id":18995552,"CreationDate":"2013-08-05T13:31:00.000","Title":"python 2to3 doesn't change huey file when -w argument is provided","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can I use pack once the main loop has been showed, or should I use something else to add \/remove widgets to \/from a vbox afterwards ?\nI have this gtk.Window() that contains a vbox, where a menu, a treeview and a button are packed. At the push of this button, I want to display an image in a new container inside this window \/ vbox, and ideally, close said container at will.\n(think image viewer with a file list, you click on an image file and a pane opens displaying it, if you click on another image file the new image is displayed in place of the old, and you can close the image pane)\nMy question is : How do you do that ? My trials so far led me to believe that once the vbox has been show()'d, you cant pack anything else into it..?\nHas the \"image\" container have to exist prior to being displayed...?\nWhat is the proper process to do this, in witch direction of the GTK manual should I look?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":152,"Q_Id":18065677,"Users Score":2,"Answer":"In GTK+ all widgets are hidden by default (which I think was a stupid design decision, but oh well). You usually call show_all() on a window, so indirectly show all widgets contained in it by the time of the call. If you add (pack, whatever) a widget later, don't forget to show() it manually.","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":18066003,"CreationDate":"2013-08-05T18:59:00.000","Title":"pyGTK : pack and unpack","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxpython grid sizer that is sizing sublists of bitmap buttons. The master list I would like to create just once because creating these buttons takes a considerable amount of time, and thus I do not want to destroy them.  My idea is to somehow remove all of the buttons from the sizer, make a new list of the buttons that I want the sizer to contain, and then use the sizer's AddMany method.\nIf I can't remove the buttons from the sizer without destroying them, then is there a way to use the sizer's Show method to hide some of the times, but then have the sizer adjust to fill in the gaps?  When I hide them, all I can get them to do right now is just to have them disappear and leave a gap.  I need the next item to be adjusted to the gap's place.\nAlso is there a way to sort the grid sizer's item list?\nThanks for any help you can offer.","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":698,"Q_Id":18079351,"Users Score":0,"Answer":"You should be able to call the Layout method on the parent of the sizer, this will make it recalculate the shown items.","Q_Score":0,"Tags":"python,user-interface,wxpython,wxwidgets","A_Id":18079725,"CreationDate":"2013-08-06T11:48:00.000","Title":"How to either sort a wxsizer or remove items without destroying them?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxpython grid sizer that is sizing sublists of bitmap buttons. The master list I would like to create just once because creating these buttons takes a considerable amount of time, and thus I do not want to destroy them.  My idea is to somehow remove all of the buttons from the sizer, make a new list of the buttons that I want the sizer to contain, and then use the sizer's AddMany method.\nIf I can't remove the buttons from the sizer without destroying them, then is there a way to use the sizer's Show method to hide some of the times, but then have the sizer adjust to fill in the gaps?  When I hide them, all I can get them to do right now is just to have them disappear and leave a gap.  I need the next item to be adjusted to the gap's place.\nAlso is there a way to sort the grid sizer's item list?\nThanks for any help you can offer.","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":698,"Q_Id":18079351,"Users Score":0,"Answer":"So I found out that the detach method is what I'm looking for! I would still be interested to know of a way to sort a sizer's item list though, without detaching all of the items and then re attaching a sublist.","Q_Score":0,"Tags":"python,user-interface,wxpython,wxwidgets","A_Id":18079420,"CreationDate":"2013-08-06T11:48:00.000","Title":"How to either sort a wxsizer or remove items without destroying them?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxpython grid sizer that is sizing sublists of bitmap buttons. The master list I would like to create just once because creating these buttons takes a considerable amount of time, and thus I do not want to destroy them.  My idea is to somehow remove all of the buttons from the sizer, make a new list of the buttons that I want the sizer to contain, and then use the sizer's AddMany method.\nIf I can't remove the buttons from the sizer without destroying them, then is there a way to use the sizer's Show method to hide some of the times, but then have the sizer adjust to fill in the gaps?  When I hide them, all I can get them to do right now is just to have them disappear and leave a gap.  I need the next item to be adjusted to the gap's place.\nAlso is there a way to sort the grid sizer's item list?\nThanks for any help you can offer.","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":698,"Q_Id":18079351,"Users Score":0,"Answer":"You can't sort the sizer items in place. It would be possible to write your own function for doing this, of course, but it would use wxSizer::Detach() and Insert() under the hood anyhow.","Q_Score":0,"Tags":"python,user-interface,wxpython,wxwidgets","A_Id":18086362,"CreationDate":"2013-08-06T11:48:00.000","Title":"How to either sort a wxsizer or remove items without destroying them?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have multi threaded wxpython app and main GUI thread receives notification from other threads to show it under modal dialog box. I want some kind of scheduling\/queuing so dialog should appear one after other if multiple notification (from other threads) comes at same time.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":332,"Q_Id":18104712,"Users Score":1,"Answer":"As each notification arrives add it to a queue, (i.e. a list), and as each dialog is closed remove that notification from the queue and if it is not empty show the next - and listen to your users complain.  \nN.B. Be especially careful not to get into a situation I spotted a few times where clicking on the dismiss button always caused another notification. Another classic case was an error window reporting too many error windows were open.","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":18120007,"CreationDate":"2013-08-07T13:28:00.000","Title":"wxpython, showing modal dialog one by one","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have small Python3 application for manipulating some specific XML files. For gui I am using PySide and for parsing files -lxml. \nI had some troubles with freezing it with cx_freeze but finally succeed. Now - some parts of application simply don't work... no error message & no log created. \nFor example on Enter press signal in LineEdit - new dialog should be shown... but nothing happens. \nI have same version in standard python files and those are running correctly.  How do I debug the frozen application?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1843,"Q_Id":18119631,"Users Score":0,"Answer":"Take a look at the pyside documentation and see if there is a redirect output to a window option - it is entirely possible that something is causing an error that is being printed out to nowhere.","Q_Score":4,"Tags":"python,pyside,cx-freeze","A_Id":18120660,"CreationDate":"2013-08-08T06:50:00.000","Title":"cx_freeze - how debug app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to edit the pygame.image to add a method that returns the name of the object.\nI've been looking around in \/Library\/Python\/2.7\/site-packages where I found Pygame, but I can't find the image class, even though I have found the folder.\nAnyone knows?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":54,"Q_Id":18133117,"Users Score":0,"Answer":"Assuming pygame 1.9.1 release, it's in the src folder, but is implemented in C.","Q_Score":0,"Tags":"python,pygame","A_Id":18133587,"CreationDate":"2013-08-08T18:14:00.000","Title":"Where can I find the pygame.image class?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using python 2.7 and I'd like to have an GUI with a scrollable list where each item in the list has both an image and some text. I'd like these items to be selectable like in a ListBox. I've tried a couple things and it seems ListBox only accepts text?\nWhat widget\/combination of widgets should I use?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":794,"Q_Id":18135386,"Users Score":0,"Answer":"Try placing a whole bunch of buttons in a frame and assigning a scroll bar a to that frame and make it so when the user presses a button is changes colour or picture or something and then any button with that same colour of picture before will go back to normal. Also, and a tkinter variable with which button is active so you can reference it later. \nI'm fairly sure you can use both texts and images in a button simultaneously, but if not you can just put a button and an image side by side in the same row on the frame\nI recommend you make this entire scrolling object a class and keep references of everything inside within that class.\nIf you need any help doing this, just give me a shout.","Q_Score":0,"Tags":"python,tkinter","A_Id":18137477,"CreationDate":"2013-08-08T20:20:00.000","Title":"Python tkinter: a scrollable list with text and images?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In Tkinter, when I create an image on a canvas and find the coordinates of it, it only returns two coordinates, so the find_overlapping method doesn't work with it (naturally). Is there an alternative?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1295,"Q_Id":18178061,"Users Score":0,"Answer":"You should be able to get the image's bounding box (bbox) by calling bbox = canvas.bbox(imageID).  Then you can use canvas.find_overlapping(*bbox).","Q_Score":0,"Tags":"python","A_Id":18178111,"CreationDate":"2013-08-12T00:25:00.000","Title":"How to find the overlapping of an image on TkInter Canvas (Python)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have developed my first .app for mac, written in python and would like to share this .app with some friends.\nI have converted the python scripts via py2app. Then I have one .app and compress it to an .dmg file. \nI share this .dmg file with the guys and for one, this is working fine. (He has already python installed) \nThe other people can\u00b4t open the .app file, they get error messages. After an intensive search I got it. They have no python installed. \nNow my question: How can I include a \"one click python installation\" in my .dmg file (or as package?!)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1590,"Q_Id":18208650,"Users Score":0,"Answer":"If you create the .dmg, you can setup a background image that tells users to move your application to the \/Applications folder. If your application needs no extra setup, this is preferred, or a (Mac OS X created) .zip file with it.\nThe package option is better if some additional setup, or scripts checking for Python dependencies, are required.","Q_Score":1,"Tags":"python,macos,package,dmg","A_Id":18209869,"CreationDate":"2013-08-13T12:05:00.000","Title":"I want to share my python app as dmg or package?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"How do I run C++ and Boost::Python code in parallel without problems?\nEg in my game I'd want to execute Python code in parallel with C++ code; if the embedded Python interpreter's code executes a blocking loop, like while(True): pass, the C++ code would still be running and processing frames to render with its own loop.\nI tried with boost::thread and std::thread but unless I joined these threads with the main thread the program would crash...\nAny suggestions or examples?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1171,"Q_Id":18213159,"Users Score":0,"Answer":"You need to use the multiprocessing module in python so that you get a separate GIL for each python thread.","Q_Score":4,"Tags":"c++,python,multithreading,loops,boost-python","A_Id":18213302,"CreationDate":"2013-08-13T15:25:00.000","Title":"Embedded Boost::Python and C++ : run in parallel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need a video player in my PySide application on Windows without any dependencies. Right now I play a video in a QWebView that loads Flash, which works okay, except most of the people using the application are running it on freshly installed copies of Windows which lack Flash, and they aren't willing to install Flash just to play the video in my application.\nI could include the flash plugin with my distribution, but that's disallowed by Adobe's licensing.\nI must have tried at least two dozen things, but nothing has worked well enough so far. The things that have worked best so far are:\n\nFlash, licensing forbids it from being packed in with my app\nPyGame, 1 - only accepted mpeg-1 files, which I've found are massive, 2 - has a tendency to crash\nQMovie - seems to only support .mng files, which I've been unable to find a converter for. Additionally, that format is visual only - I need audio, too.\n\nI've been trying to get PyMedia to work, but it's refusing to install (it wants Python 2.7 but I have Python 2.7.3. I've tried installing multiple copies of Python and downgrading before... it's just not worth the headache of trying to get all my code to run with a single version.)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":240,"Q_Id":18234020,"Users Score":0,"Answer":"Qt's Phonon module plays Videos using the codecs installed  in the operating system. So depending on the lowest Version of Windows you plan to support, you could chose one of the preinstalled codecs. Like wmv7 for XP.\nAlternatively you could use Phonon and install an efficient free codec like x264.","Q_Score":0,"Tags":"video,python-2.7,pyside","A_Id":18250434,"CreationDate":"2013-08-14T14:07:00.000","Title":"Play videos with Python on Windows without Dependencies?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using wx.ListCtrl for live report in my app, and there will be continuous status updating including inserting a new row when a task starts and deleting related rows when the tasks end. Since the list gets sorted every now and then, you cannot simply delete the rows by the rowid you started with. Although you can assign a unique id using SetItemData, and that way you know exactly which row to delete when a task is done, there does NOT seem to be any method related to deleting a row by that unique id, not even a method to get rowid by unique id, and the only method I found is GetItemData, which will return the unique id for a certain row. \nSo the only way came to my mind is to iterate all rows checking their unique ids and compares it against the given id, if it matches then delete that row. But this sounds way too clumsy, so is there a better way to delete a specific row after sorting?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":911,"Q_Id":18246847,"Users Score":0,"Answer":"I ended up using ObjectListView to do the job. Basically you build an index for your objects in the list, and then you are able to operate on any row you want. It's way more convenient than wx.ListCtrl","Q_Score":0,"Tags":"python,user-interface,wxpython,listctrl","A_Id":40836750,"CreationDate":"2013-08-15T05:31:00.000","Title":"How to delete a specific row in wxListCtrl after sorting?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Would it be possible to create an internal image viewer plugin for Sublime Text 3? I noticed in their forum people have mentioned it not possible for ST2 due to the fact that the API doesn't allow access to the UI and widgets, but just wondered if it was still the case for ST3?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4022,"Q_Id":18329995,"Users Score":0,"Answer":"There is nothing yet in Sublime Text 3. It would be nice to preview the image and its dimensions right inside of sublime. For now, you will have to open in finder\/browser\/whatever you use.","Q_Score":4,"Tags":"python-3.x,sublimetext3","A_Id":18389949,"CreationDate":"2013-08-20T08:09:00.000","Title":"Sublime Text 3 internal image viewer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've a c++ code on my mac that uses non-standard lybraries (in my case, OpenCV libs) and need to compile this so it can be called from other computers (at least from other mac computers). Runned from python. So I've 3 fundamental questions:\n\nHow to compile my project so it can be used from python? I've read\nthat I should create a *.so file but how to do so?\nShould it work like a lib, so python calls some specific functions,\nchosen in python level?\nOr should it contain a main function that is executed from\ncommand line?\n\nAny ideas on how to do so? PS: I'm using the eclipse IDE to compile my c++ project.\nCheers,","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":3206,"Q_Id":18342535,"Users Score":1,"Answer":"How to compile my project so it can be used from python? I've read\n  that I should create a *.so file but how to do so?\n\nThat depends on your compiler. By example with g++:\ng++ -shared -o myLib.so myObject.o\n\nShould it work like a lib, so python calls some specific functions,\n  chosen in python level?\n\nYes it is, in my opinion. It seems do be the \"obvious\" way, since it's great for the modularity and the evolution of the C++ code.","Q_Score":2,"Tags":"c++,python,c,opencv,compilation","A_Id":18342743,"CreationDate":"2013-08-20T18:33:00.000","Title":"Calling c++ function, from Python script, on a Mac OSX","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Where exactly can I override the collective.documentviewer code to disable the icon to view the document full screen in another window? Actually when I only click on the 'customize'  button for the documentviewer in zcml it throws up an exception for 'widget', even without addition of a letter of code there and the viewer crashes.I am using version 2.2.1 for collective.documentviewer and Plone 4.1.4 on linux. Please guide.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":119,"Q_Id":18350333,"Users Score":1,"Answer":"You need to carefully blank the <div>  section for 'View Document in Fullscreen'  in this javascript: \ncollective.documentviewer-2.2.1 py2.6.egg\/collective\/documentviewer\/resources\/assets\/viewer.js","Q_Score":0,"Tags":"python,linux,plone","A_Id":18373792,"CreationDate":"2013-08-21T06:32:00.000","Title":"How do I override the document viewer icon to view in Full Screen in Plone?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Background:\nI am just about to start development on an mobile and desktop app. They will both be connected to a local wifi network (no internet connection) and will need to communicate with one another. At the outset we are targeting iOS and Windows as the two platforms, with the intention of adding Linux, OSX, and Android support in that order. The desktop app will largely be a database server\/notification center for receiving updates from the iOS apps and sending out the data to other iOS apps. There may be a front end to the desktop app, but we could also incorporate it into the iOS app if needed.\nFor the moment we just want the iOS app to automatically detect when it is on the same network as the server and then display the data that is sent by that server (bonjour like).\nAs far as I see it there are two paths we could take to implement this\n\nCreate a completely native app for each platform (Windows, Linux, OSX). \nPro: We like the ideas of having native apps for performance and ease of install.\nCon: I know absolutely nothing about Windows or Linux development.\nCreate an app that is built using web technologies (probably python) and create an easy to use installer that will create a local server out of the desktop machine which the mobile apps can communicate with.\nPro: Most of the development would be cross-platform and the installer should be easy enough to port.\nCon: If we do want to add a front-end to the server app it will not be platform native and would be using a css+html+javascript GUI.\n\nQuestion:\nMy question is how would  implement the connection between the iOS app and server app in each circumstance.\n\nHow would I receive and send notifications over a local network.\nHow could I connect to the server using NSURLConnection if it does not have a static ip?\n\n\nI hope this is clear. If not please ask and I will clarify.\nUpdate 09\/06\/2013\nHopefully this will clear things up. I need to have a desktop app that will manage a database, this app will connect to iOS devices on a local wireless network that is not connected to the internet. I can do this with either the http protocol (preferably with a flask app) or by using a direct socket connection between the apps and the server. My question is which of the above two choices is best? My preference would be for a web-based app using Python+Flask, but I would have no idea how to connect the iOS app to a flask app running on a local network with out a static ip. Any advice on this would be appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1265,"Q_Id":18405726,"Users Score":0,"Answer":"I would definitely suggest a webapp. And the answer to your questions are given below:\nHow would I receive and send notifications over a local network.\n\nUse a REST based web service to communicate with the server. \n  You have to use polling to receive data:-(\n\nHow could I connect to the server using NSURLConnection if it does not have a static ip?\n\n\nIf possible configure a domain name in your network which points to server ip. (Configure local DHCP to give same IP to your server every time based on mac address!)\nHave a IP Range and when the app starts, try to reach a specific URL and check if it is  responding.\nAsk the user to enter the server IP every time the app starts!","Q_Score":4,"Tags":"python,ios,windows,web,bonjour","A_Id":18773687,"CreationDate":"2013-08-23T14:46:00.000","Title":"Connecting iOS app to Windows\/Linux apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1},{"Question":"I'm new to programming and learning to use python with kivy. I have windows 7. Is it possible to open kivy widgets without the terminal automatically opening in the background?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":291,"Q_Id":18429202,"Users Score":1,"Answer":"use pythonw.exe that is in the python installation directories.\nif you have virtualenv installed and your kivy project rests in a virtualenv,\ntry\n\/<virtual_env_foler>\/scripts\/pythonw.exe for pythonw.exe","Q_Score":1,"Tags":"python,windows,windows-7,kivy","A_Id":18429288,"CreationDate":"2013-08-25T12:53:00.000","Title":"Opening kivy widgets without the terminal?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to convert a ui formed with qtDesigner to a python version to use without having an extra file?\nI'm using Maya for this UI, and converting this UI file to a readable python version to implement would be really great!","AnswerCount":12,"Available Count":3,"Score":0.0166651236,"is_accepted":false,"ViewCount":247890,"Q_Id":18429452,"Users Score":1,"Answer":"Update for anyone using PyQt5 with python 3.x:\n\nOpen terminal (eg. Powershell, cmd etc.)\ncd into the folder with your .ui file.\nType: \n\"C:\\python\\Lib\\site-packages\\PyQt5\\pyuic5.bat\" -x Trial.ui -o trial_gui.py\nfor cases where PyQt5 is not a path variable. The path in quotes \" \" represents where the pyuic5.bat file is.\n\nThis should work!","Q_Score":53,"Tags":"python,pyqt,maya,pymel","A_Id":50134039,"CreationDate":"2013-08-25T13:24:00.000","Title":"Convert pyQt UI to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to convert a ui formed with qtDesigner to a python version to use without having an extra file?\nI'm using Maya for this UI, and converting this UI file to a readable python version to implement would be really great!","AnswerCount":12,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":247890,"Q_Id":18429452,"Users Score":73,"Answer":"You can use pyuic4 command on shell:\npyuic4 input.ui -o output.py","Q_Score":53,"Tags":"python,pyqt,maya,pymel","A_Id":18430351,"CreationDate":"2013-08-25T13:24:00.000","Title":"Convert pyQt UI to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to convert a ui formed with qtDesigner to a python version to use without having an extra file?\nI'm using Maya for this UI, and converting this UI file to a readable python version to implement would be really great!","AnswerCount":12,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":247890,"Q_Id":18429452,"Users Score":0,"Answer":"I've ran into the same problem recently. After finding the correct path to the pyuic4 file using the file finder I've ran:\n\nC:\\Users\\ricckli.qgis2\\python\\plugins\\qgis2leaf>C:\\OSGeo4W64\\bin\\pyuic4 -o ui_q gis2leaf.py ui_qgis2leaf.ui\n\nAs you can see my ui file was placed in this folder...\nQT Creator was installed separately and the pyuic4 file was placed there with the OSGEO4W installer","Q_Score":53,"Tags":"python,pyqt,maya,pymel","A_Id":28266946,"CreationDate":"2013-08-25T13:24:00.000","Title":"Convert pyQt UI to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a vector of pointers to objects in c++ and want to expose it to python with a list. So far I gave a reference of a python list to c++. I figured pointers are not suitable for python so I read about how to make a pointer to a reference by (*obj) it. But when I call: myList.append((*obj)); python just crashes. Can someone tell me how to put objects I only have pointers of into a python list correctly so I can manipulate that list later?\nGreetings\nChris","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":123,"Q_Id":18462319,"Users Score":0,"Answer":"Okay so the Problem appears when the type is not declared for boost::python. !","Q_Score":0,"Tags":"c++,python,list,boost,reference","A_Id":18467078,"CreationDate":"2013-08-27T09:56:00.000","Title":"appending object references to python list with boost","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a GUI program using wxPython.  I am also using matplotlib to graph some data.  This data needs to be animated. To animate the data I am using the FuncAnimate function, which is part of the matplotlib package.\nWhen I first started to write my code I was using a PC, running windows 7.  I did my initial testing on this computer and everything was working fine.  However my program needs to be cross platform.  So I began to run some test using a Mac.  This is where I began to encounter an error.  As I explained before, in my code I have to animate some data.  I programmed it such that the user has the ability to play and pause the animation.  Now when the user pauses the animation I get the following error: AttributeError: 'FigureCanvasWxAgg' object has no attribute '_idletimer'.  Now I find this to be very strange because like I said I ran this same code on a PC and never got this error.  \nI was wondering if anyone could explain to me what is meant by this _idletimer error and what are possible causes for this.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":287,"Q_Id":18472394,"Users Score":1,"Answer":"_idletimer is likely to be a private, possibly implementation specific member of one of the classes - since you do not include the code or context I can not tell you which.\nIn general anything that starts with an _ is private and if it is not your own, and specific to the local class, should not be used by your code as it may change or even disappear when you rely on it.","Q_Score":1,"Tags":"python,macos,matplotlib,wxpython","A_Id":18474882,"CreationDate":"2013-08-27T17:55:00.000","Title":"AttributeError: 'FigureCanvasWxAgg' object has no attribute '_idletimer'","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I noticed wx.ListCtrl would always highlight a whole row wherever it's clicked by default, is there a way to make it only highlight the selected cell?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":97,"Q_Id":18481533,"Users Score":1,"Answer":"No, I think that's built-in. You would have to catch the selection event and probably make all the cells editable so you could select just the cell. Otherwise I would look at UltimateListCtrl as that is a custom widget and you can probably subclass it in such a way as to add that functionality.\nOr don't use a ListCtrl at all and switch to using a wx.Grid","Q_Score":1,"Tags":"python,wxpython,listctrl","A_Id":18491970,"CreationDate":"2013-08-28T07:15:00.000","Title":"Is there a way to only highlight a cell instead of the whole row when it's clicked with wx.ListCtrl?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a wx.lib.filebrowsebutton.FileBrowseButton button match both txt and csv files, but it doesn't seem to support glob pattern as described, *.{txt,csv} ends up matching nothing on windows and it literally tries to look for files with extension of {txt,csv}.\nSo how do I make it work for both txt and csv files?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":157,"Q_Id":18489613,"Users Score":3,"Answer":"The documentation is not very clear. You should be using a semi-colon inside parenthesis, like so:  \"TXT and CSV files (*.txt; *.csv)|*.txt; *.csv\"\nYou can also add a second line like so: \"TXT and CSV files (*.txt; *.csv)|*.txt; *.csv|PNG files (*.png)|*.png\"","Q_Score":3,"Tags":"python,wxpython,glob,filebrowse","A_Id":18489942,"CreationDate":"2013-08-28T13:40:00.000","Title":"Is there a way to add multiple filemasks in wx.lib.filebrowsebutton.FileBrowseButton?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"You know you can after working in Qt Designer and  converting via pyuic4 command to executable program or module, You can modify your code and merge together and build a complete program, But i have serious question: \nSuppose I have QMainWindow, some  QFrame and i don't want to save in separately *ui files, i need to save in just one *ui files, it's possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":114,"Q_Id":18499379,"Users Score":1,"Answer":"You can't save two forms in one .ui file, but I think that you can do this (I did not tried it but it should work): \nsave for example one QDialog and one QMainWindow (QFrame can't stand alone-it needs parent widget) in separate .ui files, convert them via pyuic4 command to two .py files and then join those two files into one .py module (copy data from one to another - copy class and create instance in __main__).\nThat is not very practical when you want to change something in designer , because you'll need to do whole procedure again.","Q_Score":0,"Tags":"python,qt,user-interface,qt-designer","A_Id":18715408,"CreationDate":"2013-08-28T22:32:00.000","Title":"some Qframe and other widget just in one *ui files (pyuic4)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I noticed that even if you set your wildcard to match *.txt files only, all wx.FileDialog does is list all txt files under that directory, still you can input any existent file with a different extension and hit open button without having any problem at all? \nThere doesn't seem to exist a window style to avoid this from happening, so I guess you have to validate the file extension yourself, right? Interesting, does this count as a bug?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":333,"Q_Id":18501677,"Users Score":1,"Answer":"This is not exclusive to wxPython and is not a bug. Try this in any Windows application and you will see you can save a txt file as a .exe in Notepad or open a .png file in MS Word. A file extension is just a convention, which means it can be broken for any number of reasons. If you are confident that you must check the file extension of a file, you will need to perform some validation with the return value of the wx.FileDialog.","Q_Score":0,"Tags":"python,wxpython,filedialog","A_Id":18511156,"CreationDate":"2013-08-29T03:06:00.000","Title":"How to make wx.FileDialog(wx.FD_OPEN mode) check input file name extension against the wildcard?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I implemented most of my projects in C++ and python. However, we recently got a new database interface that I could only use Java to retrieve data. \nI want to stay with my Python\/C++ tools but I am wondering if there is a good solution to integrate Java to my Python application. I heard about Jython, but it is a different python implementation and I am concerned some of my C++ tools will not work well with it. Jpype seems simple but it hasn't been updated since 2011, so a little concerned with the compatiablity with the current python\/java.\nIs there a good solution to this? all opinions are welcomed.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":251,"Q_Id":18538170,"Users Score":0,"Answer":"gcj (gcc compiler for java) supports java 1.5 syntax (1.4 is working better on it) and therefore some Java programs may be compiled to native code. gcjh (or javah) can produce headers for java libraries, so you can write C extensions for python. Of course some libraries could not be compiled with gcj (like Apache Commons Logging) because of using com.sun packages. Did not updated from 2009.\nThere is another Java to native compiler, commercial Excelsior Jet (it's another JavaVM, it supports Java 1.6 and soon Java 1.7). They said linux-64bit version of their product will be available in 2013-Q4. But I didn't try it well, I don't know, are headers for compiled library can be produced.\nThere is a lot packages at pypi, like JCC (from PyLucene creator) or Py4J that can use Oracle JavaVM through JNI or sockets.","Q_Score":1,"Tags":"java,c++,python,interface,integration","A_Id":18609443,"CreationDate":"2013-08-30T17:09:00.000","Title":"Python Integration with Java \/ C","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I implemented most of my projects in C++ and python. However, we recently got a new database interface that I could only use Java to retrieve data. \nI want to stay with my Python\/C++ tools but I am wondering if there is a good solution to integrate Java to my Python application. I heard about Jython, but it is a different python implementation and I am concerned some of my C++ tools will not work well with it. Jpype seems simple but it hasn't been updated since 2011, so a little concerned with the compatiablity with the current python\/java.\nIs there a good solution to this? all opinions are welcomed.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":251,"Q_Id":18538170,"Users Score":0,"Answer":"One way to do this is to write web services.  A web service can accept an HTTP request, marshal it into a data request, pass that to a Java class that get the data out, map the quert results into a response of some kind, and send it back.\nAny client that can send an HTTP request, accept the response and unmarshal it can interact with that service.  They need not know that it's implemented in Java.\nYou pay the price of an extra network roundtrip to get the benefit of language interoperability.","Q_Score":1,"Tags":"java,c++,python,interface,integration","A_Id":18538315,"CreationDate":"2013-08-30T17:09:00.000","Title":"Python Integration with Java \/ C","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a program thats like a desktop enviroment with educational games and I was wondering how to put the menubar on the bottom of the window.\nThanks In Advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":269,"Q_Id":18546876,"Users Score":0,"Answer":"You can't, if you're talking about the native menubar you get when you set the menu attribute of the root window.\nYou can create your own menubar that behaves a little bit like a menubar by using a frame and one or more menubuttons, and place that at the bottom.","Q_Score":0,"Tags":"python,tkinter","A_Id":18548116,"CreationDate":"2013-08-31T10:02:00.000","Title":"tkinter - Change menubar location","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a python developer with little experience creating android apps in java and want to create an app that will access my university web portal, retrieve some data and show on a view.\nSo, after researching Kivy, I have a few questions:\n1) Which one is easier and faster to develop android apps?\n2) Does Kivy have any android feature limitations?\n3) And finally, would an android app developed using kivy run as fast as one developed using java?","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":11995,"Q_Id":18553849,"Users Score":14,"Answer":"To complete inclement's answer, pyjnius indeed allows to access a lot of the android api. But it's not perfect, calling existing classes is not always enough, and an android programmer often need to create code that will be called by android to manage events, there are two ways to do that, both used by the android api. \n\nThe first one is interfaces: you need to create a class that implement an existing java interface, pyjnius can do that, you create a python class and declare which java interface it implements, and have a decorator to declare the methods you have to declare.\nThe second is subclassing, you need to subclass an existing java class and override some methods, and we don't have a way to do that with pyjnius yet, so for these ones, you'd have to create a java class and use it in your program (fortunately you can mix that with kivy\/pyjnius, it's just can't be 100% python in that scenario).\n\nSo it can be worth a look to the api beforehand, to see if the parts of the android api you have to access requires that.","Q_Score":21,"Tags":"java,android,python,kivy","A_Id":18563503,"CreationDate":"2013-08-31T23:44:00.000","Title":"Difference between Kivy and Java for android apps","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning to program (python 3.x) and was wondering what would be best to learn for making android apps\/games. I dont know anything about UI really but have heard that kivy? Is on android. Is that worth learning or should i use something else.\nThanks\nEdit: \nI am using sl4a and py34a on my android device.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":2257,"Q_Id":18560367,"Users Score":1,"Answer":"I'm loving kivy. The irony is, that I found this topic here looking for help with python 3. Python 2 works perfectly, but 3 is still being made compatible. Other than that Kivy is great for beginner coders. Especially, because you don't have to code the complex stuff.","Q_Score":0,"Tags":"android,python-3.x,kivy,sl4a","A_Id":18723415,"CreationDate":"2013-09-01T16:17:00.000","Title":"kivy or something else for android UI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning to program (python 3.x) and was wondering what would be best to learn for making android apps\/games. I dont know anything about UI really but have heard that kivy? Is on android. Is that worth learning or should i use something else.\nThanks\nEdit: \nI am using sl4a and py34a on my android device.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":2257,"Q_Id":18560367,"Users Score":2,"Answer":"Kivy is good, and will run on Android, but you can't make Android apps with it. It has no way of interacting with the Android API. You can run a kivy app on the device, but can not read sensors or anything like that. They have a project called pyjnius, which allows you to access Java classes from Python, but not with Python3, and it's not very easy to use unless you know Java.\nYou have SL4A installed, so you can use web technology to do UIs, including games, which can be rendered on the device using webviews. That said, Kivy is a much more mature and well maintained project.","Q_Score":0,"Tags":"android,python-3.x,kivy,sl4a","A_Id":19018485,"CreationDate":"2013-09-01T16:17:00.000","Title":"kivy or something else for android UI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to send a set of information to model widget,  QTableView\/QTableWidget, Then When user click on a row, can open a new widget with ID of  sent by information to QTableView\/QTableWidget. \n\nI use PyQt\nI need to send hidden, it means user can't see my hidden id of database on QTableView\/QTableWidget\n\nPrimative Question: How can send data to QTableView\/QTableWidget without user can see them in TableModel widget such as id of my database table ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1156,"Q_Id":18563715,"Users Score":2,"Answer":"You can hide a column in a QTableWidget by calling setColumnHidden(int column, bool hide) with the column number, and True for the hide option.\nA better solution to this would to be to prevent the user interface from ever receiving this information. A Model-View-Controller setup, or the use of a data access layer could ensure that only the relevant information is sent on to the interface and nothing would require hiding.","Q_Score":2,"Tags":"python,qt,qt4,pyqt,pyqt4","A_Id":18565528,"CreationDate":"2013-09-01T22:52:00.000","Title":"How to send data to QTableView\/QTableWidget (PyQt)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been write window programs with C# + WPF for a while now. It is very good, has alot of rich elements as of .NET 4.5 but I dont really buy the idea of porting window based programs to other operating system like OS X using mono and others. \nI started working on Java and Python, I haven't written any desktop based program with anyone of them yet as there are war of GUI framework\/toolkit out there and everyone is just getting religious about things.\nI need some clarification hence the following Questions, mind you these questions might be answered before but like I said, Clarifications:\n\nWhat is the different between GUI toolkit and GUI framework\nFor Java programming, I see swing is integrated with Netbeans, from my research, people are speaking of qt's Jambi and GTK for java and python, I have no idea about any of these and I want to know, (1) Which do you use and why? (for Java and python), (2) Visual studio do all the magic for WPF and C#, which IDE can do these magic in java and python.\nLastly, I want you all to know that my asking these question is just to know which rich, powerful GUI and cross platform toolkit\/framework (Whichever the right term is) is best for java and python with easy learning curve.\n\nConstructive criticism  are welcome BUT, I will be glad if there are answers.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3817,"Q_Id":18579076,"Users Score":0,"Answer":"I know QT is for Java (and Python of course). It is well documented and is used by a lot of people around the world.","Q_Score":3,"Tags":"java,python,swing,user-interface,toolkit","A_Id":18579176,"CreationDate":"2013-09-02T18:36:00.000","Title":"Best GUI Toolkit\/Framework for Java and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know how to disable the window Maximise button in pyqt4. I am at present using QWidget.setFixedSize (self, QSize) to prevent user window resizing, however the maximise button is still enabled and when pressed causes the application to move to the top left corner of the screen. I am basically wanting to replicate the behaviour of the Windows calculator application, where the maximise icon is greyed out. Does anyone know how to achieve this with PyQt4?","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":20169,"Q_Id":18600081,"Users Score":1,"Answer":"you could set the maximumSize and minimumSize with the same values, it'll get to dissapear maximise button","Q_Score":12,"Tags":"python,resize,window,pyqt,pyqt4","A_Id":29042473,"CreationDate":"2013-09-03T19:32:00.000","Title":"how to disable the window maximize icon using PyQt4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have scowered stack overflow all day today trying to figure out why when I try to install cython \nunable to execute gcc-4.0: No such file or directory\nerror: command 'gcc-4.0' failed with exit status 1\nI am using OSX mountain lion and I am using default python with pygame and easygui and command line tools installed trying to make my first app using kivy and I need cython to make the gui.. Are there any other things I should use instead of Kivy but I am pretty impressed from what I saw online. If anyone has any other tips on installing Kivy? I am very lost doing this sorry for a trivial question!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":531,"Q_Id":18603205,"Users Score":1,"Answer":"Which python are you using, the system python or macports or something else?  \nMake sure you have XCode and gcc installed on your system first.  Running which gcc on the command line will help identify where your current version of gcc resides.  I assume you already checked this?  \nAs an alternative, you can try installing a precompiled version of cython such as the one that comes with anaconda or the enthought python distribution.\nUnfortunately, there's not enough information here to give a definitive answer.....","Q_Score":0,"Tags":"python,macos,gcc,cython,kivy","A_Id":18794769,"CreationDate":"2013-09-03T23:48:00.000","Title":"When I try to install cython I get an error message unable to execute gcc-4.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am in the process of making a text based game with Python, and I have the general idea down. But I am going to make the game in depth to the point where, it will take longer than one sitting to finish it. So I want to be able to make the game to where, on exit, it will save a list of variables (player health, gold, room place, etc) to a file. Then if the player wants to load the file, they go to the load menu, and it will load the file.\nI am currently using version 2.7.5 of Python, and am on Windows.","AnswerCount":8,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":36232,"Q_Id":18606097,"Users Score":4,"Answer":"First, don't overthink this. You don't need to use anything complicated. As a preliminary step, research basic file input\/output in python. \nSecond, I'm assuming you have a player class in your game? Or possibly an overall class which keeps track of game state. Well have that class store default values for your variables like health, gold etc. Then have a method which can modify this class like def load_stats(player): or def load_stats(game): something. and have it read in from a save file which can have any format you like and modify the variables of your player\/game state. \nFirst test loading of game files and make sure you can get it so that your player class gets modified.\nThen all you have to do is add a save game feature that lets you output these variables back to a file in your directory system somewhere. \nTry doing this and let me know if you need any help afterwards.","Q_Score":5,"Tags":"python,save","A_Id":18606314,"CreationDate":"2013-09-04T05:35:00.000","Title":"Python text game: how to make a save feature?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use Grid from wxpython and use it in my GUI which is based on PyQt. Is it possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":264,"Q_Id":18711451,"Users Score":2,"Answer":"The simple answer is, no.  Or, if it is possible, it's certainly not easy.\nAlthough there are many similarities in look and function between wxPython and PyQt, under the hood they are essentially different.","Q_Score":0,"Tags":"python,user-interface,wxpython,pyqt","A_Id":18732393,"CreationDate":"2013-09-10T05:43:00.000","Title":"Can wxpython and PyQt be used together in same GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hi want to add text box and label in plone site\nbut, that plone site does not display text box \nhow can i create text box in plone site \nthanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":111,"Q_Id":18711815,"Users Score":5,"Answer":"You can create a static text portlet in that context you need it: folder, page.","Q_Score":0,"Tags":"python,html,plone","A_Id":18714130,"CreationDate":"2013-09-10T06:12:00.000","Title":"How to create text box in plone site","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Currently i need to transfer data between C++ and Python applications.\nAs long as Thrift doesn't work with unsigned int, what's the best way to transfer unsigned? \nIs there only way like:\n\nassign unsigned to signed\nserialize -> send -> receive -> deserialize this signed\nassign signed to unsigned\n\nShould i do it manually all the time or there are already some 3rd party libraries?\nHow do i do it in the case of C++\/Python applications? In C++\/C++ applications i can just static_cast<signed\/unsigned>(unsigned\/signed) for conversion, but what about Python?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1934,"Q_Id":18758535,"Users Score":3,"Answer":"There are two options that make sense (and a bunch of others):\n\nUse the next largest signed integer with Thrift. Of course, with UINT64 this is not possible, as there is no i128, but it works up to UINT32\nCast the unsigned bits into signed. Not very clean and requires documentation, but it works.\n\nThe \"bunch of others\" include\n\nConvert it into a string and back. And watch your performance going down.\nUse binary type. Ok, that's a bit far out, but still possible and can be done by just reinterpreting the bits as with 2. above\n\nBut again, I'd recommend 1. or 2.","Q_Score":2,"Tags":"c++,python,serialization,thrift","A_Id":18772101,"CreationDate":"2013-09-12T07:51:00.000","Title":"apache thrift, serialize unsigned","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We are currently using Cython to make bindings to some networking and DB libraries. We want also use SDL, but PySDL2 uses ctypes for binding. While Cython is whole interpreter, ctypes is just library. But, Cython and ctypes are most often portrayed as alternatives to each other. Thus I am totally unsure if they are compatible.\nSo, question: it is possible to use Cython and ctypes together in one project?","AnswerCount":1,"Available Count":1,"Score":0.761594156,"is_accepted":false,"ViewCount":2695,"Q_Id":18785825,"Users Score":5,"Answer":"Here's a brief summary of how  both tools work:\nctypes is a very pythonic wrapper over a library called cffi, which is able to load shared libraries (.so or .dll files), and call them, without first compiling any code to wrap the functions defined in those libraries.  You do have to tell ctypes about the functions it'll call, so that it can convert from the python types (int, str, and so on) to the abi expressed in the shared lib (uint32_t, char *, and so on).\nCython is a 'sort of python' to C translator.  The generated C code can be compiled and the result is a special sort of shared library (.so or .dll again) which has all the right functions to be a Python C extension.  Cython is very smart, based on the type annotations in the input, it knows whether to emit code that directly calls C functions (when you use cdef) or calls regular python objects by way of the PyObject_Call C api.\nSince you can (more or less) freely mix C and python in Cython sources, you should have no difficulty using PySDL2 in your Cython library, just invoking it as though it were regular python, import it, call it, everything should \"just work\".\nThat said, You might benefit from including libsdl declarations in your code, directly, if you end up calling out to SDL from tight inner loops, to avoid the overhead of converting from the low level C types to python types, just to have ctypes convert them back again.  You could probably put that off until your application has grown a bit and you notice some performance bottlenecks.","Q_Score":3,"Tags":"python,ctypes,cython,pysdl2","A_Id":19071067,"CreationDate":"2013-09-13T12:00:00.000","Title":"Cython + ctypes?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to add a reference to IronPython.dll to my project.\nI found this dll in C:\\Program Files (x86)\\IronPython 2.7\\ and different dll's for different Net versions in C:\\Program Files (x86)\\IronPython 2.7\\Platforms\\ . What is the difference between these dll's and which one shall I use? \nThe same story with Microsoft.Scripting.dll & Co.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":86,"Q_Id":18827760,"Users Score":3,"Answer":"The assemblies in the root (C:\\Program Files (x86)\\IronPython 2.7\\) are for ipy.exe to use. Apps that embed IronPython should use the ones in the appropriate Platform directory (or NuGet, which will pick the right ones automatically).\nFor now, the assemblies in the root are identical to the ones in Platforms\\net40, but that is not in any way guaranteed and will almost certainly change in the future.","Q_Score":1,"Tags":"python,.net,ironpython","A_Id":18834374,"CreationDate":"2013-09-16T12:13:00.000","Title":"IronPython.dll - which one to use?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been using pygame to make a game recently, and have ran into a little problem...\nBasically, I would like to be able to stretch the whole image that is on the screen (all the things that I have blitted to it) into the resolution which the user has resized the window to. I've searched a lot on the documentation for pygame and on stack overflow and I can't seem to find an answer... Is it even possible? The source code for my game is pretty big atm, if anyone needs it I'll be willing to post it. Sorry if I made my question a little unclear :)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2471,"Q_Id":18835940,"Users Score":4,"Answer":"Blit everything to a separate surface (not directly to the screen), let's call it main_surface. Then blit the main_surface to the screen. \nCall pygame.transform.scale(main_surface, (width, height) with the new width and height that you get from the VIDEORESIZE event to scale the main_surface and everything in it to the new window dimensions.","Q_Score":3,"Tags":"python,pygame,resolution","A_Id":18950357,"CreationDate":"2013-09-16T19:37:00.000","Title":"Is there a way to stretch the whole display image to fit a given resolution?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"[Edits noted:]\nI want to hook into the ScrolledText widget so that when a user clicks anywhere in the scrollbar (or even scrolls it with the mouse wheel, hopefully) I can have it call a callback function where I can\n[Add: \"set a flag, and then return to let the ScrolledText widget do its thing.\"]\n[Delete: \" do something first (like turn off automatic scrolling) before the scrolling action takes place.\"]\nIs this possible?\nThanks","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1968,"Q_Id":18839464,"Users Score":2,"Answer":"Do you want to do something like turning off automatic scrolling, or is that actually what you want to do? \nIf you want to turn automatic scrolling on or off, just check the position of the text before inserting text. If it's at the end, add the text and autoscroll. If it's not at the end, add the text but don't scroll. This will work even if they scrolled by some other mechanism such as by using the page up \/ page down keys. \nYou can check a couple of different ways. I think the way I've always done it (not at my desktop right now to check, and it's been a few years...) is to call dlineinfo on the last character. If the last character is not visible, this command will return None. You can also use the yview command to see if the viewable range extends to the bottom. It returns two numbers that are a fraction between zero and one, for the first and last visible line. \nWhile the user can't turn auto-scrolling on or off by clicking a button, this is arguably better because it will \"just happen\" when they scroll back to see something.","Q_Score":1,"Tags":"python,tkinter,scrollbar","A_Id":18840373,"CreationDate":"2013-09-17T00:29:00.000","Title":"python tkinter - want to call a function when scrollbar clicked in ScrolledText widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to hide the entire QTableWidget and show it. I  didn't find the same function for both in its documentation. Do you have any idea?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":50,"Q_Id":18872300,"Users Score":1,"Answer":"QTableWidget is a QWidget. Just use the hide() function.","Q_Score":0,"Tags":"c++,python,qt,qt4,pyqt","A_Id":18872394,"CreationDate":"2013-09-18T12:28:00.000","Title":"I need to hide QTableWidget by default","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to Python (IronPython), I come from VS environment.\nI want to integrate Python with WPF and I understand that IronPython is good a solution for that.\nI've install IronPython on my computer, but i wonder if the project (Python+WPF) can run on a machine that IronPython is not installed on ? \nMy computer has:    Python, IronPython, .Net Freamwork\nTarget Machine has: Python, .Net Freamwork","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":223,"Q_Id":18880490,"Users Score":1,"Answer":"Absolutely, you just have to include the appropriate assemblies (IronPython.dll, IronPython.Modules.dll, Microsoft.Scripting.dll, and Microsoft.Dynamic.dll) and any standard library modules you may be using with your application.","Q_Score":1,"Tags":"python,wpf,ironpython","A_Id":18882572,"CreationDate":"2013-09-18T19:15:00.000","Title":"Can IronPython run on machine that it does not installed on?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"My application has an html-based front-end and uses python logic on the back-end. This application needs to run offline, not connected to the internet, so by \"back-end\" here I don't mean a server running remotely, but rather python logic running side-by-side in the same app as the browser\/html engine. For Windows or Mac desktop apps, I build a Chromium Embedded Framework application, and then launch a sub-process which runs a CherryPy python application built using py2exe (or py2app). The client and the server then communicate using normal http.\nI'd like to achieve the same thing on both iOS and Android. I've researched several alternatives, but nothing seems to do quite what I need.\nKivy is close, but as far as I can tell it doesn't offer a browser\/html front-end, but rather provides its own layout engine on top of OpenGL. It has an extension mechanism, but that seems to be more about extending the python side, not the front-end side.\nOn the other hand, I could start with PhoneGap and then add a python library as an extension (possibly using Kivy's mobile library build of python). Or for that matter I could just write a regular C++ app that embeds a browser and uses a python library build.\nOn the third hand, I've played with using various python-to-javascript converters to get the back-end logic into something that can work with PhoneGap directly, but that approach gets pretty difficult given all of the python logic I have -- some of it just doesn't convert so easily.\nDo you know of apps that are displaying html and running python logic in the same app?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2655,"Q_Id":18884259,"Users Score":3,"Answer":"You could do a very simple kivy app, that would start a service (inside which you would do your \"server\" side, with a small engine like flask or bottle, but i guess cherryPy should work too), and in the main.py of the \"kivy\" app, don't import kivy, just import webbrowser and start a browser window to localhost:your port. This will use the android browser.\nedit: oh, services are android only for now, apparently ios 7 supports them too, but kivy-ios hasn't been updated to make use of them.","Q_Score":5,"Tags":"android,python,ios,mobile,browser","A_Id":18892784,"CreationDate":"2013-09-18T23:57:00.000","Title":"combining html front-end and python \"back-end\" in mobile app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm building a project that depends on pyqt (e.g. VTK with pyqt).  I'm getting an error like QtCoremod.sip: No such file (or something similar).  What's going wrong?","AnswerCount":3,"Available Count":1,"Score":0.2605204458,"is_accepted":false,"ViewCount":2960,"Q_Id":18922009,"Users Score":4,"Answer":"In Ubuntu, package  python-qt4-dev was missing. I installed it and it fixes the problem.","Q_Score":1,"Tags":"python,pyqt,python-sip","A_Id":20581575,"CreationDate":"2013-09-20T16:55:00.000","Title":"pyqt: unable to find QtCoremod.sip","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to read\/search in an XML document in a window of a wxPython application.\nA lot of text editors will highlight the content and maybe have support for\nblock and unblock of XML elements.\nIs there a component that provides at this sort of functionality in wxPython?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":678,"Q_Id":18923762,"Users Score":1,"Answer":"Take a look at the wxPython demo of the StyledTextCtrl. It's in wx.stc. Anyway, the demo labeled StyledTextCtrl_2 shows how to create syntax highlighting for a Python file using self.SetLexer(stc.STC_LEX_PYTHON). \nFor XML, you would just need to change that line to self.SetLexer(stc.STC_LEX_XML). You should also look at PyShell \/ PyCrust or possibly Editra. The latter is a text editor created with wxPython that does this sort of thing.","Q_Score":0,"Tags":"python,xml,wxpython,wxwidgets","A_Id":18925053,"CreationDate":"2013-09-20T18:45:00.000","Title":"How should I display an XML document in a wxPython UI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to add and delete rows to a GridBagSizer dynamically. Each row of the sizer has a collection of widgets with the rightmost being a 'delete' button which removes the row it's in when pressed.  Another button outside the sizer adds a new bottom row of widgets to the sizer when pressed.\nI have a simple example app that works, but it's rather baroque and I'm hoping there's a simpler way.\nThe working example detaches and destroys all widgets in the row being deleted, but this doesn't remove the blank row where the widgets used to be, even after sizer.Layout(). What I have done to get around this is detach all widgets in rows below the removed row and move them one row up.\nIt works, but is there a better way?\nRoss","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":356,"Q_Id":18940685,"Users Score":1,"Answer":"This is a tip really. Use \nsizer.SetEmptyCellSize((0,0)) \nand your empty row will not take any space.","Q_Score":1,"Tags":"wxpython","A_Id":20538024,"CreationDate":"2013-09-22T05:32:00.000","Title":"A better way of deleting and Adding GridBagSizer rows dynamically?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My simple Python app uses PyQt4 for its GUI and clicking a QPushButton causes the app to send a message via serial. GUI elements also update frequently.\nQuestion: I did not know how to implement multithreading. Will not having multithreaded process cause the app to be less responsive and less consistent in sending the serial communication especially when a GUI element will be updated at the same time the serial message is being sent?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":105,"Q_Id":18981428,"Users Score":1,"Answer":"That depends. Your PC is idle 99.9995% of the time while you type; so it has a lot of CPU power to spend on background tasks. Most people don't notice this since the virus scanner typically eats 5-20% of the performance. But typing or clicking a button barely registers in the CPU load.\nOTOH, if you run a long task in the UI thread, then the UI locks up until the task is finished. So from a user perspective, the UI will be blocking while for the serial port, the world will be OK. Overall, this will be faster but it will feel sluggish.\nMultithreading is generally slower than doing everything in a single thread due to synchronization or locking. But a single thread doesn't scale. Eventually, you hit a brick wall (performance wise) and no trick will make that single thread execute faster.","Q_Score":1,"Tags":"python,multithreading,python-2.7,pyqt,pyqt4","A_Id":18983482,"CreationDate":"2013-09-24T12:18:00.000","Title":"Is Multi-threading required for PyQt4 and Writing to Serial","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running Windows 7 32-bit. I've installed Python 3.2.2 and selected every module for installation (including Tcl\/Tk). On my computer, I can run a script by double-clicking the .py file and it will find my Tkinter import just fine. If I run it from a command line, it says ImportError: No module named 'Tkinter'. I passed this script on to a coworker who also installed the same way, and she can't run the script at all even with double-clicking. Same Tkinter problem. Our PATHs are identical with C:\\Python33 being the first item and tkinter shows in the lib folder. I'm running out of ideas. What's going on? Why is Tkinter so finicky with existing?\nUpdate:\nApparently Tcl\/Tk do not include Tkinter. The reason it worked for me was because I had installed a special Python package via our company's download system that happened to include it. This version was linked to .py extensions. In command prompt, however, my updated Python (with Tcl\/Tk but without Tkinter) was the python of choice as selected by my PATH variable. My coworker did not have this special package installed so it did not work for her. I had thought it was my Python 3.3 that was running the script but it was not which is why it seemed like it worked for me. That said, if anyone else runs into this issue, check out the sys.executable and sys.version as indicated below to figure out just what is going on!","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":31781,"Q_Id":19030579,"Users Score":2,"Answer":"ImportError: No module named 'Tkinter'\nIn Python 3 Tkinter is changed to tkinter \nTry import tkinter as tk\nHope it helps!","Q_Score":8,"Tags":"python,python-3.x,tkinter,python-3.3,importerror","A_Id":61686010,"CreationDate":"2013-09-26T14:08:00.000","Title":"Tkinter Not Found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a C++ python extension and I've been experiencing a SIGSEGV whenever I call (from C++) a virtually-inherited method of a certain class that is also a PyObject (i.e. it has a PyObject_HEAD).\nI finally remembered that python doesn't know anything about C++. Sure enough, GCC is putting a vtable pointer in the first 4 bytes of my object (you can tell because the first field of PyObject_HEAD is offset 4 bytes from the address of the object). When python INCREFs the object, it's actually altering the vtable pointer.\nMy question: what should I do to fix this? Moving the virtual methods to a subsidiary class would solve it, but it seems like admitting defeat. Any other thoughts \/ experiences?\n(Python 2.7, GCC 4.7.2 on mingw32 \/ windows 7)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":226,"Q_Id":19072787,"Users Score":0,"Answer":"Python doesn't know about C++ but it does know about structures. So have Python call a pure C function that creates a structure. Instead the structure have a pointer to the C++ object. This way Python sees a pure C interface, but the implementation of the C interface creates a private internal object.\nWe actually do this on one of my projects. It works and it's pretty portable.","Q_Score":1,"Tags":"c++,python","A_Id":19073978,"CreationDate":"2013-09-28T23:29:00.000","Title":"I think python is overwriting my vtable (c++ extension)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to get a float value (like 1.91, 1.92 and so on) using the tkinter Spinbox Widget in Python 3.x?\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3803,"Q_Id":19078656,"Users Score":10,"Answer":"Use the format and the increment options. Format takes a string format value; use something like %.2f for a floating point number truncated to two decimal places.\nThe increment option specifies the increment value; the default is 1.0. \nNow, using get() on a Spinbox returns an instance of str. Typecast it to float to get a floating-point value.","Q_Score":8,"Tags":"python,tkinter","A_Id":19079141,"CreationDate":"2013-09-29T13:37:00.000","Title":"Python Tkinter Spinbox with float","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Consider following problem:\nI have a gtk \/ tk app which displays content from a website in a List(Store). I want to do the following things in order:\n\ndisplay the window & start downloading\nshow a progress bar\non completion of the downloads add the data into the list(Store)\n\nThis is the condition: the user has to be able to interact with the app while it is downloading. That means that the program is in the window's mainloop during the entire download.\nWhat does not work:\n\nurllib.urlopen() waits for the entire download to complete\nPopen() does not allow the communication I want between the two threads\n\nHow to notify the program that the download has complete is the biggest question\nSince I am event driven anyway because of Tk\/Gtk I might as well use signals\nMy preferred way of solving this would be registering an additional signal \"dl_done\" and sending that signal to gtk when the download has finished. Is that even possible?\nAny suggestions are apreciated!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":97,"Q_Id":19079107,"Users Score":1,"Answer":"A simple solution is:\n\nto share a Queue object between the Gtk thread and the download thread\nwhen a download is complete, you put the data in the queue (eg. a tuple with the\ndownload URL and the downloaded contents) from the download thread\nin the Gtk thread, you set up a glib timer checking periodically if something\nnew is in the queue (say, every 100 milliseconds for example) thanks to the \"get_nowait\"\nmethod of the Queue object.\n\nYou can have multiple download threads, if needed.","Q_Score":0,"Tags":"python,multithreading","A_Id":19079260,"CreationDate":"2013-09-29T14:20:00.000","Title":"Multithreading url requests in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyOpenGL to implement a small 2D game engine. I'm hesitating on the way I implement a Sprite class.\nI'm already keeping all the scene (tiled map) in a VBO, and all textures are kept in the same big texture. All the sprite's images are also in this texture. So I suppose that, for performance, I should include the sprite in the VBO, let say from position sprite_start_position.\nThe first question is : since a sprite can have several stances (images), is it better to :\n\nsetting only one entry in the VBO for the sprite, and modifying the texture coords in this entry accordingly to the stance, using glBufferSubData\nsetting as many entries in the VBO as there are stances, but drawing only the current one with glDrawArrays \nother ?\n\nThe second is the similar with sprite position. Must I :\n\nchange the position of the right entry in the VBO with glBufferSubData\nuse some glTranslate before glDrawArrays(GL_QUADS, sprite_start_position, 1)\nother ?\n\nI'm relatively new to OpenGL and I still feel a little lost in this API...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":442,"Q_Id":19083941,"Users Score":1,"Answer":"You really shouldn't have to worry about performance for simple sprite based 2D game. Your graphics card is capable of rendering tens or hundreds of thousands of triangles per second (or more!) which is way more than you are likely to need.\nThus, it really doesn't matter much which method you choose to use for updating sprites. If you want to have animated sprites though, I recommend you look into 3D textures. They allow you to interpolate between animation frames, which makes your animations look even better!\nAs a side note, you mentioned using glTranslate which is a function from OpenGL 1.x\/2.x that has been removed from later versions of the API. I recommend that you try to use \"modern OpenGL\" (ie OpenGL 3.x\/4.x). You can find plenty of information about the differences online. That said, it is still OK to use the older versions of the API if you have a specific reason for doing so,  and if you do functions like glTranslate will continue to work.","Q_Score":0,"Tags":"python,opengl,vbo,pyopengl","A_Id":19084756,"CreationDate":"2013-09-29T22:15:00.000","Title":"Fastest way to implement a sprite","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using appium and using Sudoku app for Android on a Windows 7 machine using Python. If someone can help me find out what the app activity is to opening this and how they were able to figure that out","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":103,"Q_Id":19128188,"Users Score":0,"Answer":"A simple VM emulate an Android device. Not dificult.","Q_Score":0,"Tags":"android,python,appium","A_Id":19128261,"CreationDate":"2013-10-02T00:31:00.000","Title":"What is the android activity for opening sudoku and how do I find how to?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using appium and using Sudoku app for Android on a Windows 7 machine using Python. If someone can help me find out what the app activity is to opening this and how they were able to figure that out","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":103,"Q_Id":19128188,"Users Score":0,"Answer":"You just need to run adb shell command in command prompt. After that , Open the Suduko app in your device(make sure your device is connected to your laptop\/pc) and go back to the command prompt and run the below command :\ndumpsys window windows | grep -E 'mCurrentFocus'\nThe Above command will give you the package name & activity name of the currently focused app.","Q_Score":0,"Tags":"android,python,appium","A_Id":51240166,"CreationDate":"2013-10-02T00:31:00.000","Title":"What is the android activity for opening sudoku and how do I find how to?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My objective is to use a QSpinBox to display the numbers from 0 to 9999 with the increasement of 1 using 4-digits format.\nI managed to set the Maximum value 9999 by using setMaximum command. But I can't seems to find a way to display the values in 4digits format (eg. 0000, 0001,0002). Whenever i set the value to 0000  using setValue , the SpinBox display as 0. \nHow do i display the numbers in 4-digits format (i.e adding leading zero as required) in QSpinBox?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2829,"Q_Id":19172262,"Users Score":0,"Answer":"To do what you want, just set the \"prefix\" attribute of the spinbox widget to \"000\". This will then pad values to be 0001, 0002, etc.","Q_Score":0,"Tags":"python,pyqt,pyqt4,qwidget,qspinbox","A_Id":27464660,"CreationDate":"2013-10-04T02:31:00.000","Title":"PyQt4 QSpinBox value format","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to use Cython to code my project.\nMy plan is to write .dll in C++, and call them from Python via Cython. So I can have high computational performance of C++, while keeping the simplicity of development of Python.\nAs I go further, I am a bit confused. As I understand, Cython wraps python code into C. The performance is improved since C has better calculation performance. Am I correct at this?\nIf I am right above, then is it necessary to write .dll in C++ and call it from Python in order to improve the performance? \nIf I write python code and wrap it into C, then call it from Python, does it perform better than calling .dll that written in C++?","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":17220,"Q_Id":19181984,"Users Score":4,"Answer":"First of all, let me disband a few misconceptions that you seem to have.\n\nCalling a library from another program will speed up your library.\n\nNo, no, no, no, no. This makes about as much sense as saying \"driving a car at a set speed is slower than having a F1 racer drive a car at the same speed\". It just makes no sense. When Python loads your library, it loads and processes it similar to how the kernel loads and processes it (in fact, the kernel does that in Python's case too). In fact, this \"double loading\" (which wasn't the original design for dynamic libraries) can slow down your library. I should emphasise that this is a tiny difference, and should not concern the ordinary programmer.\n\nCython \"wraps\" Python code into C\n\nIt doesn't. It compiles the python code into C, which is then compiled into a dynamic library for Python to load later. This may optimise your Python code somewhat, and give you the ability to interface with atomic C data types, with Python's magic sauce on top. While this is pretty cool, it doesn't give your code any \"magical\" abilities.\nI would also like to add that some tests have proven that Java is (drum roll) actually faster than C, C++, Python and other languages because the JVM is very optimised. That doesn't mean you should use Java (because it has other problems), but it should give perspective.","Q_Score":14,"Tags":"c++,python,c,dll,cython","A_Id":19182661,"CreationDate":"2013-10-04T13:06:00.000","Title":"Cython VS C++ Performance Comparison?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have always problems to close my Qt applications properly. What should one take care of when quitting from a Qt::Application? I want to compile a check-list that I can follow to exit all parts properly, depending what functionalities the program uses. For example, if I use QThreads, what needs to done to make sure they are shut down properly, and so on with all other parts that might need special care.\nI hope I am not the only one having such problems and it turns out to be useful for many.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":600,"Q_Id":19227318,"Users Score":0,"Answer":"There is no checklist beyond proper C++ design. A QThread doesn't, unfortunately, offer any sane default destruction behaviors. In C++ land, that's nominally a no-no. You need some QObject that owns your threads and, before vanishing itself, takes care to either quit or terminate them, followed by waiting on them before they get destroyed. Same goes for all the classes that you wrote yourself: they must act properly when destructed. Qt generally acts appropriately when the instances of its various classes are deleted, QThread is really a standout.\nOnce you follow the base tenet of C++ design, namely that objects release resources upon destruction, you won't have any problems. Use smart pointers, including C++11 if available. QPointer, QSharedPointer, QScopedPointer are all your friends.","Q_Score":0,"Tags":"c++,python,qt","A_Id":19238373,"CreationDate":"2013-10-07T14:22:00.000","Title":"Qt: Quit application -> checklist for proper clean up","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Here is what I want to do. A user enters a search query \"hello world\". The text is searched for this query, when the sentence with \"hello world\" is found it is inserted in Text widget and shown to the user. \nI want to somehow highlight the words from the search query so they would look like this:\n\n\"This is a simple hello world expression.\"\n\nHow can I do it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":796,"Q_Id":19277240,"Users Score":3,"Answer":"The text widget allows you to associate tags with a block of text. You do this with the tag_add method of a text widget object. You can then associate various attributes to a tag, such as a bold font, colors, underlining, etc. You configure the attributes of a tag with the tag_configure method of the text widget object.","Q_Score":1,"Tags":"python,tkinter,text-widget","A_Id":19277903,"CreationDate":"2013-10-09T16:11:00.000","Title":"Tkinter: How to make found words bold in Text widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Could anyone suggest a python library which has the ability to construct simple 3D objects and interact(touch) them?\nHere's what I'm exactly looking into:\n\nTo have a test object, square\/rectangular box(or any object) on a ground plane.\nTo have another sphere object of certain diameter.\nTo simulate, i.e. the roll the sphere all over and all sides of the test object.\nTo highlight or shade the parts of the test objects that are touched during the rolling process. (it won't roll all over, due to the ground plane restriction)\nNot interested to see any animations, just the end product of the test object which were touched by the sphere.\n\nAny suggestions on libraries or mathematical methods?\nMany thanks.\np.s. In electrical engineering, this is one of the method to see which part of the building the lightning may be able to strike, i.e the \"touched\" area.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1707,"Q_Id":19356408,"Users Score":1,"Answer":"Vtk is a very sophisticated framework, but it might be overkill.","Q_Score":0,"Tags":"python,3d","A_Id":19362585,"CreationDate":"2013-10-14T08:41:00.000","Title":"Python: How to model 3D objects and interact them in 3D space?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to wrap two C++ classes: Cluster and ClusterTree. ClusterTree has a method get_current_cluster() that instantiates a Cluster object, and returns a reference to it. ClusterTree owns the Cluster object, and manages its creation and deletion in C++.\nI've wrapped Cluster with cython, resulting in PyCluster. \nPyCluster should have two ways of creation: \n1) By passing in two arrays, which then implies that Python should then automatically handle deletion (via __dealloc__)\n2) By directly passing in a raw C++ pointer (created by ClusterTree's get_current_cluster()). In this case, ClusterTree then assumes responsibility of deleting the underlying pointer.\n\nfrom libcpp cimport bool\nfrom libcpp.vector cimport vector\n\ncdef extern from \"..\/include\/Cluster.h\" namespace \"Terran\":\n    cdef cppclass Cluster:\n        Cluster(vector[vector[double]],vector[int]) except +\n\ncdef class PyCluster:\n    cdef Cluster* __thisptr\n    __autoDelete = True\n\n    def __cinit__(self, vector[vector[double]] data, vector[int] period):\n        self.__thisptr = new Cluster(data, period)  \n\n    @classmethod\n    def __constructFromRawPointer(self, raw_ptr):\n        self.__thisptr = raw_ptr\n        self.__autoDelete = False\n\n    def __dealloc__(self):\n        if self.__autoDelete:\n            del self.__thisptr\n\ncdef extern from \"..\/include\/ClusterTree.h\" namespace \"Terran\":\n    cdef cppclass ClusterTree:\n        ClusterTree(vector[vector[double]],vector[int]) except +\n        Cluster& getCurrentCluster()\n\ncdef class PyClusterTree:\n\n    cdef ClusterTree *__thisptr\n\n    def __cinit__(self, vector[vector[double]] data, vector[int] period):\n        self.__thisptr = new ClusterTree(data,period)\n\n    def __dealloc__(self):\n        del self.__thisptr\n\n    def get_current_cluster(self):\n\n        cdef Cluster* ptr = &(self.__thisptr.getCurrentCluster())\n        return PyCluster.__constructFromRawPointer(ptr)\n\nThis results in:\n\nError compiling Cython file:\n------------------------------------------------------------\n...\n    def get_current_cluster(self):\n        cdef Cluster* ptr = &(self.__thisptr.getCurrentCluster())\n        return PyCluster.__constructFromRawPointer(ptr)\n                                                     ^\n------------------------------------------------------------\n\nterran.pyx:111:54: Cannot convert 'Cluster *' to Python object\n\nNote I cannot cdef __init__ or @classmethods.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":857,"Q_Id":19370230,"Users Score":0,"Answer":"I know this is an old question, but  after my own recent struggles with Cython I thought I'd post an answer for the sake of posterity.  \nIt seems to me you could use a copy constructor to create a new PyCluster object from an existing Cluster object.\nDefine the copy constructor in your C code, then call the copy constructor in the Python class definition (in this case, when a pointer is passed) using new.  This will work, although it may not be the best or most performant solution.","Q_Score":0,"Tags":"python,cython","A_Id":28981092,"CreationDate":"2013-10-14T22:20:00.000","Title":"Cython: overloaded constructor initialization using raw pointer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an hybrid c# object, with some instance properties and methods, and I pass it to IronPython. What I want is to syncronize the dispatch to the c# members, both static and dynamics, from Py code.\nI implemented the IDynamicMetaObjectProvider on the c# object, and I noticed that when Py invokes the static methods of my object, and with instance methods, defined at compile time vs dynamics, the method BindInvokeMember is never used, but it is always called the method BindGetMember.\nI'm a little confused, probably this thing can't be done?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":216,"Q_Id":19397436,"Users Score":0,"Answer":"IronPython will always use BindGetMember and then Invoke the result because that's how Python works - get the attribute from the object, then call it. Your BindGetMember implementation should return another dynamic object that implements BindInvokeMember, which will have the arguments you need.","Q_Score":1,"Tags":"c#,ironpython,dynamic-language-runtime","A_Id":19430707,"CreationDate":"2013-10-16T07:24:00.000","Title":"Intercepting method invocation to c# objects","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In 2D plane, I have a rectangle defined by 4 vertices, A, B, C and D. I now wish to find the integer points (coordinates are integer) that fall into rectangle ABCD.\nBefore asking, what I did is extremely expensive in computation. Briefly, I was enumerating all the integer points and checked whether that point was in the rectangle or not. I found that it was too brutal to be used in my project, as I have many many point.\nHow should this be done elegantly?\nUPDATE: Note that the rectangle can be of a random orientation, depending on the coordinates of the four points. Assuming nicely-placed is kinda cheating.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1554,"Q_Id":19400489,"Users Score":0,"Answer":"You can map the 4 vertices on the coordinate axis. Suppose the A(x1, y1),B(x2, y1), C(x1, y2),D(x2, y2) and x1 <= x2 && y1 <= y2, if and only if x1<= x <=x2 and y1 <= y <= y2, the point p(x,y) falls into rectangle ABCD.","Q_Score":4,"Tags":"python,algorithm","A_Id":19400758,"CreationDate":"2013-10-16T10:04:00.000","Title":"Find integer points within a rectangle in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a X-plotter like widget that plots incomming data live.\nI already searched for an solution to realize a scrolling along the x-axis if the widget has to much values and so they don't fit.\nI had the folling approaches to realize it:\n\nderive from a widget that supports scrolling and child widgets and add my own widget while making it bigger and bigger during the live updates: -> Which parent do I need to use and how do I avoid to draw all the stuff that is currently not visible?\nmodify my widget in a way that it supports the scrollbars itself -> but how?\ndraw\/handle my own scrollbars -> worstcase :(\n\nI really searched the web for suggestions or examples, but there is nothing about how to \"construct\" custom controls in a good way (beyond drawing something) esp. in the case of interaction...\nSorry but I'm a newbie at GTK in general :\/","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":574,"Q_Id":19411111,"Users Score":2,"Answer":"Most widgets in Gtk do not have scrollbars.\nIf you want to scroll the entire widget, you have to implement the GtkScrollable interface. Then, you add the widget to a GtkScrolledWindow. The scrolled window has the scrollbars, those GtkScrollbars are linked with GtkAdjustments which are passed to your custom widget through the GtkScrollable interface set_vadjustment and set_hadjustment.\nIf you just want to add a scrollbar and control its behaviour yourself, then you need to somehow add a GtkScrollbar in your widget, which means you will need to make it a container too.\nThe GtkScrollable approach is the following, first you implement vadjustment and hadjustment setters and getters, then when the GtkAdjustments are set, you set its lower and upper limits and the page size(how much of the widget is visible at once). After that, you connect their value-changed signal so you can refresh your widget when the scrollbars are dragged. A GtkScrollable doesn't get to check the scrollbars, only the adjustments that will be bound to the scrollbars. When drawing the widget you get the adjustments' value property in order to determine how much the scrollbars have shifted in the horizontal and vertical axes.","Q_Score":0,"Tags":"python,gtk,custom-controls,scrollbar,pygtk","A_Id":19477901,"CreationDate":"2013-10-16T18:34:00.000","Title":"Python: Creating own Widget with scrollbars","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Anyone who has worked with Multithreaded PyQt4 apps? I was just wondering if the inbuilt signal\/slot mechanism coupled with QtThread of PyQt4 framework has any benefit over the standard Python threads (which are designed in my code to handle the UI components in a thread safe way offcourse) using event driven async callback.\nI am looking for any major speed or security concerns, any specific run-time exceptions or edge cases. (The UI is quite complex hence a re-write at a later stage would be very counter-productive).\nThanks.\nEdit: I realize this might mean replicating some of the already present PyQt core functionality but it is ok if it allows more flexibility within the app.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":257,"Q_Id":19492277,"Users Score":0,"Answer":"There's no point really using Qt\/PyQt if your're not using the signal-and-slot mechanism and rolling your own event loop. Basically, you'd be reimplementing the core of the framework itself. But I'm guessing this is not what you're asking about.\nIt would be nice if you could clarify your question a bit, (because of which I've had to make a few assumptions)\nbut here's the deal:\nI think you're a bit confused about what the signal and slot mechanism does. (or maybe not, forgive me for reiterating some stuff that might probably be obvious to you). \nThe signals-and-slots do not implement threading for you (so the question of using signal\/slots having any benefit over standard Python threads is moot)\nYou're probably assuming that the signal-slot mechanism is multithreaded, and that a slot when called by a signal, executes in a new thread. Well, this is not the case.\nThe signal and slot mechanism in Qt runs in a single event loop in Qt (implemented by QApplication), which itself runs in a single thread. \nSo signals and slots are not replacements for multi-threading in any way.\nIf there's a slot that blocks, then it will block your entire application.\nSo any blocking I\/O or time intensive functions should ideally be in a separate thread from the UI, and your slots should start execution of these threads.\nNow whether to use QThread or standard Python threads to implement your own threads is another issue, and it's been asked on StackOverflow before, but I tend to use QThreads for Qt apps.\nSo if you have a button, and you want to start a file download with the Requests library when its clicked, you'll connect the clicked signal of the QPushButton to a slot say for example downloadButtonClicked, and that slot would start a new QThread which would take care of downloading the file using Requests. You can further connect the finished() signal from the QThread to know when the download is complete and to update your UI\n(I'll add a code example if this is indeed what you're asking about. So please clarify your question)","Q_Score":0,"Tags":"python,multithreading,qt,thread-safety,pyqt","A_Id":19494905,"CreationDate":"2013-10-21T10:39:00.000","Title":"PyQt4: Conventional multithreaded UI over Signal\/Slot mechanism?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program that opens two separate windows, one of which is full screen. I would like to open the full screen window on the secondary display (this program will require at least 2 screens to be properly functional, but is not enforced) and the other window on the main display.\nIs there any way to do this in python 3 and tkinter?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2170,"Q_Id":19509244,"Users Score":0,"Answer":"Probably not a very portable solution, but what I have seen done in the past is to use absolute positioning (using wxPython, though).  So if you have two monitors set at 1024X768 in a side by side setup, the first screen's x would be 0, and the second screen's x would be 1024 (or 768 if I have my x's and y's mixed up ;).","Q_Score":1,"Tags":"python-3.x,window,tkinter,multiple-monitors","A_Id":19516336,"CreationDate":"2013-10-22T04:54:00.000","Title":"python 3 open window on screen 2 by default (multi displays)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Qlineedit widget which i will use to accept the username. It will be displayed as soon as user launch the application. I want the Qlineedit widget ready for typing (ie, with cursor already in place) without needing the user to use mouse to click on the widget before typing. \nI have tried  .setFocus() and  .setCursorPosition(1) but doesn't seem to work.\nWhich method should i use to set the cursor at the starting position of Qlineedit without user needing to click on it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":148,"Q_Id":19509950,"Users Score":1,"Answer":"It was my mistake. I was trying to use setFocus before i add the widget to the layout.\nNow, I used the setFocus method after the wiget is added to the layout and it works fine.","Q_Score":0,"Tags":"python,cursor,pyqt,qlineedit","A_Id":19513341,"CreationDate":"2013-10-22T05:50:00.000","Title":"Tkinter .focus_set() equivalent in PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm building a medical application that should respond to a RFID card scan (and pop up some information). I'm using PyQT to build this, btw.\nCould someone tell me what tool to use to simulate rfid scans on the machine ? I'm a little noob to this, but I'm assuming I'll use a USB based reader and I should be able to somehow hook to the reader to get some data.\nHelp...","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":331,"Q_Id":19539031,"Users Score":0,"Answer":"Unfortunately there is pretty much no way we can know how a particular rfid reader will work. Your best  would just be to assume that it will fire off events somehow, and implement a fake rfid reader that sends off a string of data (that you expect to get from an rfid chip) when you want. Once you get an rfid reader, you can then wrap whatever library you have been provided to access it (or write your own) so that it matches the format\/communications protocol you made up for your fake one.\nBut the far simpler solution is to just get yourself an rfid reader and find out experimentally...","Q_Score":0,"Tags":"python,winapi,pyqt,nfc,rfid","A_Id":19565664,"CreationDate":"2013-10-23T10:22:00.000","Title":"What tool to simulate rfid events on windows (python-win32 compatible?)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been playing with using tkinter to make overlays so some information would appear on top of the rest of the screen.\nI'd rather not have this window block the mouse. Is there any way I can have it so click events pass though my overlay? So the window below my tkinter app receives the event.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":2078,"Q_Id":19546104,"Users Score":1,"Answer":"One way to do this is build your own msg queue with a lightweight caller and scheduler to process msg and state of widget. This class or function is usually there without such name as queue manager because having back-end class is general-purpose item for application. Adding to simple event transfer queue could have this done which is what I am now doing.","Q_Score":4,"Tags":"python,tkinter","A_Id":52703943,"CreationDate":"2013-10-23T15:34:00.000","Title":"How to make click events pass though a tkinter window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been playing with using tkinter to make overlays so some information would appear on top of the rest of the screen.\nI'd rather not have this window block the mouse. Is there any way I can have it so click events pass though my overlay? So the window below my tkinter app receives the event.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2078,"Q_Id":19546104,"Users Score":2,"Answer":"No, there is nothing built in to tkinter that would allow you to do that. The best that you could hope for is to capture an event, then use some sort of platform-specific tool that lets you create new events, and use the coordinates from the captured event to generate a new, non-tkinter event.","Q_Score":4,"Tags":"python,tkinter","A_Id":19547637,"CreationDate":"2013-10-23T15:34:00.000","Title":"How to make click events pass though a tkinter window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have the path to a file\/folder. How can I get the icon image in the system for this file\/folder? I'm writing a customized file browse model for a QTreeView and would like to display the icon like what the QFileSystemModel does.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":688,"Q_Id":19552495,"Users Score":2,"Answer":"AFAIK QFileSystemModel relies on QFileIconProvider to get the correct icon.\nYou can do the same in your implementation by using the icon (const QFileInfo  &info) method.\nThis may work or not depending on the Desktop Environment you use.","Q_Score":1,"Tags":"python,pyqt4,qfilesystemmodel","A_Id":19566575,"CreationDate":"2013-10-23T21:18:00.000","Title":"How do I retrieve the system icon for a file in python or qt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.). \nSo, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button. \nDo you know what is the difference between them? Why would you choose one or the other?","AnswerCount":6,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":51337,"Q_Id":19561727,"Users Score":0,"Answer":"It is just a matter of the design of a GUI Window. So Tkinter is a really easy-to-use efficient and useful GUI toolkit. But it looks a bit outdated. Tkinter Ttk widgets are similar to that of Tkinter. It is basically a sub-module of Tkinter. So, in Tkinter Ttk, almost many widgets are the same but to use them is different. Tkinter Ttk widgets are more customizable and a lot of windows programs are done and designed using Tkinter","Q_Score":68,"Tags":"python,tkinter,ttk","A_Id":67762390,"CreationDate":"2013-10-24T09:14:00.000","Title":"What is the difference between the widgets of tkinter and tkinter.ttk in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.). \nSo, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button. \nDo you know what is the difference between them? Why would you choose one or the other?","AnswerCount":6,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":51337,"Q_Id":19561727,"Users Score":8,"Answer":"My opinion for beginners who are starting to learn Tkinter, is to use Tkinter widgets, because they're really easy to learn. But on the other hand Tkinter.ttk is a module designed to make Tkinter widgets look really perfectly, but is really hard to learn and there are no easy options there. Like there are no -fg, -bg. Perhaps, there are no new styles available in Tkinter. Style are only designed for ttk, and can be found in ttk.\nAnd Tkinter widgets really don't look like other native platform widgets.\nBut ttk is nicer and smoother looking, and look like other native platforms.\nSo if you are making apps for your own private use, then use Tkinter and also use some ttk if needed, because ttk supports much cooler widgets that can change the look of your app.\nAnd if you are making apps for public use, then go for both because Tkinter is needed for creating the window and some more important stuff, and for widgets go for ttk.\nBut honestly, I say use both because there are no conflicts between the two; just use them both to your advantage.\nHonestly using ttk is a challenge! Because it has no Grid,Pack, Place and many other options that are normally available in Tkinter widgets. But wait!! Tkinter has those options! So use both! Try to make a nice app!\nThat is the real difference between the two: Tkinter widgets are more configurable, and ttk is more modern and it is configurable with styles which are really handy shortcuts. And Tkinter is like the core of the window and ttk is styling. Think of it like this:\nTkinter --- HTML,\nttk --- CSS,\nPython --- JavaScript.","Q_Score":68,"Tags":"python,tkinter,ttk","A_Id":53561414,"CreationDate":"2013-10-24T09:14:00.000","Title":"What is the difference between the widgets of tkinter and tkinter.ttk in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.). \nSo, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button. \nDo you know what is the difference between them? Why would you choose one or the other?","AnswerCount":6,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":51337,"Q_Id":19561727,"Users Score":90,"Answer":"The widgets in tkinter are highly and easily configurable. You have almost complete control over how they look - border widths, fonts, images, colors, etc.\nttk widgets use styles to define how they look, so it takes a bit more work if you want a non-standard button. ttk widgets are also a little under-documented. Understanding the underlying theme and layout engines (layout within the widgets themselves, not pack, grid and place) is a challenge. \nGenerally speaking, the themed widgets will give you an application that looks more \"native\", but at the expense of a loss of configurability. \nMy advice is to use ttk widgets if you want your GUI to look a little more modern, and the tkinter widgets if you need a bit more configurability. You can use them both in the same applications.","Q_Score":68,"Tags":"python,tkinter,ttk","A_Id":19564114,"CreationDate":"2013-10-24T09:14:00.000","Title":"What is the difference between the widgets of tkinter and tkinter.ttk in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a program, which uses tkinter to create a window where stuff happens. It contains images and loops to constantly shift and move the images.\nNow, when I close the window, the scripts are still running and it creates error messages that it has nowhere to place the images with new coordinates.\nI think that the loops are still running. So my question is, how do I close the program all together after clicking the x on the window. Is there a way to bind the x(close window) to terminate the program, or cat n ibe done inside a code, to see when the tkinter window is closed(to me this way seems to be bad, because it would keep checking for if the window is still existing or not).\nThanks a lot!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1700,"Q_Id":19624968,"Users Score":0,"Answer":"I had the same issue caused by a top level window I had created and withdrawn but didn't destroy.  Properly destroying it fixed my issue.","Q_Score":1,"Tags":"python","A_Id":54815571,"CreationDate":"2013-10-27T23:30:00.000","Title":"Closing a python program window leaves program still running in the background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I load a TrueType font file in Tkinter without installing it in the font directories and beside the running script, like for example in Windows\/Linux?\nI'm trying to create a script with the fonts not need to be installed separately and already included in my main package.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1254,"Q_Id":19635133,"Users Score":1,"Answer":"You cannot dynamically load fonts with tkinter.","Q_Score":1,"Tags":"python,tkinter,truetype","A_Id":19635408,"CreationDate":"2013-10-28T12:44:00.000","Title":"Loading a TrueType font file in Tkinter without installing it in fonts folder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"After some research I've decided to use wxWidgets to build user interfaces for my Python programs. I learnt this could be done in two ways: either I blend my \"behind the scenes\" raw Python code with interface related wxPython code, or I could separate the interface from the main code, creating a separated XRC file for the interface and just calling it in the main Python code. What should I do, should I learn wxPython or should I learn XRC code?\nI read some advantages of learning\/using XRC:\n\nSeparates the interface from the program logic.\nDialog Blocks only outputs to C++ and XRC, not for Python.\nAbility to choose between different resource files at run time.\nXRC is a wxWidgets standard, so it can be generated and processed by\nany program that understands it.\nXML is easier to parse than most programming languages.\n\nBut I think there are some disadvantages too:\n\nDocumentation seems a lot bigger for wxPython.\nMore people seems to learn and talk about wxPython, so support for.\nXRC may be scarce\n\nSo, what would be the best to learn, XRC code or wxPython code?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":612,"Q_Id":19671933,"Users Score":2,"Answer":"You should learn wxPython. XRC does have its advantages, but it only covers the core widgets. If you want access to the rest of wxPython, then you'll have to figure out how to make XRC wrap the unsupported widgets, which is non-trivial and will require you to learn wxPython anyway.\nThere are tons of wxPython tutorials, but only a few XRC tutorials. I've written about both, but I usually stick with wxPython code.","Q_Score":1,"Tags":"python,user-interface,wxpython,xrc","A_Id":19686565,"CreationDate":"2013-10-30T00:55:00.000","Title":"Should I learn wxPython code or XRC code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to hide python shell while using a tkinter window or turtle window?\nWhile opening py file by clicking the py shell shows every time but I don't need it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":550,"Q_Id":19679256,"Users Score":4,"Answer":"Start your Python program using pythonw.exe instead of python.exe. This is specifically designed for this.","Q_Score":2,"Tags":"python,python-3.x,tkinter","A_Id":19679336,"CreationDate":"2013-10-30T10:05:00.000","Title":"Hide python shell while using tkinter window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I already import the projects but when I cleaned them, there's an error.\nPlease help me to fix it. I'm stuck.\nErrors occurred during the build.\nErrors running builder 'Android Resource Manager' on project 'PyDroid'.\njava.lang.NullPointerException\nErrors running builder 'Android Resource Manager' on project 'Python32APK'.\njava.lang.NullPointerException\nErrors running builder 'Android Resource Manager' on project 'PythonAPK'.\njava.lang.NullPointerException","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":418,"Q_Id":19724167,"Users Score":0,"Answer":"I had same problem, I removed project\/s from package explorer and re-imported again. so go to your project right click and select delete (make sure don't delete from disk) and then go file\/import and browse it again. If your project is on your work space, just cut and paste in different location and than import from there. hope this help.","Q_Score":1,"Tags":"android,python,eclipse,workspace,sl4a","A_Id":20184174,"CreationDate":"2013-11-01T09:37:00.000","Title":"Error in building workspace For Eclipse for Python Android Programming","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create Validators for inputs on forms. I learned already that in wxPython it is necessary to inherit from wx.Validator due to lack of support for standard wxTextValidator and others.\nMy question is:\n\nhow effectively check that string complies to simple rules (no regexp please)\nacceptableChars = ['a', 'b', ...]\nall(char in acceptableChars for char in string)\nis something like this efficient? and how to cleanly specify all alphanumeric or digits? or maybe is there any ready class or function?\nwill overriding Validate method only keep the constraints while inputing data - I mean  will it prevent user from entering digits into alphanumerical TextCtrl or will it check only at closing the modal diagog?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":215,"Q_Id":19759096,"Users Score":1,"Answer":"Validate() is called only when the dialog is about to close by default, but you may also call it yourself when the control loses focus. Finally, if your control doesn't accept some characters at all, you can also intercept wxEVT_CHAR events to prevent them from being entered. I do believe wxPython demo shows how to do it.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":19760286,"CreationDate":"2013-11-03T22:42:00.000","Title":"Validating data in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have PyQt application which uses SQLite files to store data and would like to allows multiple users to read and write to the same database.  It uses QSqlDatabase and QSqlTableModels with item views for reading and editing.  \nAs is multiple users can launch the application and read\/write to different tables.  The issue is this:\nSay user1's application reads table A then user2 writes to index 0,0 on table A.  Since user1 application has already read and cached that cell and doesn't see user2's change right away.  The Qt item view's will update when the dataChanged signal emits but in this case the data is being changed by another application instance.  Is there some way to trigger file changes by another application instance.  What's the best way to handle this.  \nI'm assuming this is really best solved by using an SQL server host connection rather than SQLite for the database, but in the realm of SQLite what would be my closest workaround option?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":74,"Q_Id":19759594,"Users Score":0,"Answer":"SQLite has no mechanism by which another user can be notified.\nYou have to implement some communication mechanism outside of SQLite.","Q_Score":0,"Tags":"python,sql,qt,sqlite","A_Id":19764106,"CreationDate":"2013-11-03T23:40:00.000","Title":"Signaling Cell Changes across multiple QSqlDatabase to the same SQliteFile","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Pressing command-H in OSX immediately hides the active window. How do I achieve the same effect, programmatically, from Python? Specifically, I'd like to find a particular window that my application creates and then be able to show & hide it programmatically.\nI already know how to do this with pywin32 but I'm afraid my expertise there doesn't quite cover OSX as well.\nIf it helps, the window in question is one created by pygame. I know that pygame has pygame.display.iconify() but that doesn't satisfy my requirements - the window doesn't disappear immediately, but rather the disappearance is animated, and there's no corresponding \"uniconify\" function that I can find.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":819,"Q_Id":19787324,"Users Score":0,"Answer":"Well, this ended up working. When I want to hide the window, I do pygame.display.quit() and make my code properly handle not having a display. When I want to show it, I do pygame.display.set_mode(...) with the former resolution. \nThe net effect is that of hiding & showing the window. Unfortunately the window gets created in a different spot than where it started, and although apparently you can tell SDL to create the window in a particular spot, I haven't been able to find a way to get the window's location...","Q_Score":1,"Tags":"python,macos,user-interface,pygame","A_Id":19800717,"CreationDate":"2013-11-05T10:55:00.000","Title":"hide pygame window on OSX","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to develop GUI for a who wants to be a millionaire game using pygame. If the user is presented with the welcome screen and clicks new game, it should clear the welcome screen and bring up the main game screen.\nI tried using os.system('xxx.py') but it doesnt stay on, it just flashes and goes off. \nAny ideas on how to make this work?\nThanks in anticipation.","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":208,"Q_Id":19864484,"Users Score":3,"Answer":"You probably shouldn't be trying to launch a new instance of your game. You should create a reset method which can be called to restart everything. It would clear all variables, set the game state back to the start, etc.","Q_Score":0,"Tags":"python,pygame","A_Id":19864546,"CreationDate":"2013-11-08T16:55:00.000","Title":"Clear previous screen to show next screen pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a lot of code in Delphi I would like to use in python.\nIn Delphi XE is an option to generate C \/ C + + files. obj\nCan I generate these files. Obj in Delphi and use it in python code\npython code to use it. obj will still be cross-platform?\nthank you","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":245,"Q_Id":19867190,"Users Score":2,"Answer":"Delphi generated .obj files cannot be consumed by Python because Python doesn't consume .obj files. You'd need to compile them to a library at the very least. At which point, emitting .obj files is pointless \u2013 you may as well just output a full module. I conclude that you'll need to compile your Delphi code to a library (DLL) or a COM object. \nTo support multiple platforms, you'll need to compile separately for each platform. Which means that you'll only be able to support platforms on which Delphi compilers exist. FreePascal has wider platform support and may be a better choice.\nObviously COM would restrict you to Windows. So the other option is a library. This can be consumed using ctypes or by making your module a Python extension module.","Q_Score":3,"Tags":"c++,python,c,delphi,.obj","A_Id":19867378,"CreationDate":"2013-11-08T19:37:00.000","Title":"delphi code compiled to obj files to be used in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am still working on my text editor, and now I want to make it run faster. So I thought I may somehow get currently visible text, and parse it as I want. So is there a way to get currently visible lines?\nP.S. Or maybe there is another way to increase StyledTextCtrl's performance? Thanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":273,"Q_Id":19896965,"Users Score":2,"Answer":"Use GetFirstVisibleLine() to determine the first visible line. Lines are numbered starting at zero.\nUse LinesOnScreen() to determine how many lines are visible on the screen.\nYou can use GetLine(line) to get a string of an individual line.","Q_Score":2,"Tags":"python,performance,wxpython,scintilla","A_Id":19897133,"CreationDate":"2013-11-11T00:16:00.000","Title":"wxPython - StyledTextCtrl get currently visible lines","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on an app that will display an image and some text. But I want to export the whole QT interface as a PDF (By pressing on a button on the UI itself). All the text and all the images just as it appears on the UI.\nNow if that isn't possible, maybe I can some how automatically create a jpg, save it and then somehow, using reportlab, to convert the jpg to a PDF.\nI have no idea where to start. Can any one please give me an example or even just a hint.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1204,"Q_Id":19904687,"Users Score":2,"Answer":"You can use QPixmap.grabWidget to capture you main window widget and QPrinter to produce a pdf file. A QPainter is needed to draw the pixmap to the printer.","Q_Score":1,"Tags":"python,qt,pdf-generation,pyqt4","A_Id":19905659,"CreationDate":"2013-11-11T11:01:00.000","Title":"Creating a PDF from a QT application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a QMainWindow in python with Qt library. When user clicks on the close button, I'm prompting a warning QMessageBox (Yes\/No). I want to fully disable main window's functionality until user chooses yes or no -to the second window-. (I want something like \"freezing\" the main window.)\nI have tried \"self.setEnabled(False)\" for the main window, but user could still click on minimize and maximize buttons.\nThank you in advance.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":6641,"Q_Id":19906736,"Users Score":0,"Answer":"Nicolescu's answer is perfect and working.\nWhen you open popup\/modal(QWidgets.QWidget) window, and want to disable parent window activiy, until the child is open, just use hist example.\ndef init(self):\nself.setWindowModality(QtCore.Qt.ApplicationModal))","Q_Score":5,"Tags":"python,qt,user-interface,pyqt","A_Id":63035982,"CreationDate":"2013-11-11T12:46:00.000","Title":"disable window functionality in pyqt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've created a form in Qt Creator 4 and 'compile' it to python module with pyuic4. Everything is ok but when I call the class represented my for it contains over 20 form elements as a public members (including Spacers etc.). But I need only 5 of them. It's not fatal but annoying... Is there a way to declare an element in Qt Creator as private\/hidden? I mean it has to be done in Qt Creator because if I'll make any changes and recompile .ui file all changes in .py file would be overwritten.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":96,"Q_Id":19939598,"Users Score":0,"Answer":"The pyuic tool uses the objectName to generate the names of the top-level class and its members. So to make a member \"private\", just prepend some underscores to the objectName property in the designer component.","Q_Score":0,"Tags":"python,qt,pyqt,pyqt4","A_Id":19943638,"CreationDate":"2013-11-12T20:50:00.000","Title":"Qt Creator: how to hide members?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been searching for a library I can import and superimpose on my wxpython-based layout to give it a Flat-UI look.\nDoes there exist libraries that can be used along with wxpython or just python?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1140,"Q_Id":19978119,"Users Score":1,"Answer":"You can use the custom widgets in wx.lib for the flat look, however there is no way to apply a \"theme\" to all the widgets in wxPython. Why? Because wxPython tries to wrap the native widgets on each platform, so it does its best to look native. If the native widgets are flat, then you'll see wxPython doing that too. Otherwise, you have to use the custom widgets.\nIf you want your app to have the \"flat\" look on all platforms, then you'll probably want to take a look at some other toolkit that allows theming, like Kivy or Tkinter. I think PySide\/PyQt might even allow a little theming too.","Q_Score":0,"Tags":"python,wxpython","A_Id":19981325,"CreationDate":"2013-11-14T12:51:00.000","Title":"Are there Flat-UI libraries for wxpython or just python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have one button and when user clicks it I catch an event and in the handler function I call Disable() function on that button but it isnt greyed out... Only if I click on some other widget after that, button becomes greyed out... Anyone knows what could be the problem?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":737,"Q_Id":20023377,"Users Score":2,"Answer":"Sounds strange. Try one of these...\n\nUse wx.CallAfter(button.Disable) instead of button.Disable().\nCall button.Refresh() after disabling it.","Q_Score":1,"Tags":"python,wxpython","A_Id":20023469,"CreationDate":"2013-11-16T20:19:00.000","Title":"Button isnt greyed out when disabled","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to place group of buttons ontop of a QLabel showing image, the question is how do I animate the fade in visibility of the QButtonGroup, I want to place my buttons at the bottom area so whenever pointer is at the bottom area the button group should animate to fully visible but if I move the pointer out of the bottom area, the button group should animate to a gradual fade out.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":107,"Q_Id":20026876,"Users Score":0,"Answer":"I did same thing with QLabels, QButtons and other Widgets. There are different solutions accordingly on what you need. In my case I just created a custom component with a QTimer and a QGraphicsOpacityEffect. The timer increases or decreases the opacity value (by a coefficient)..","Q_Score":0,"Tags":"python,qt,pyqt4,fadein","A_Id":20217728,"CreationDate":"2013-11-17T03:33:00.000","Title":"animate visibility of QButtonGroup or layout containing it","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Python 2.4.3 and Qt Designer to make a GUI.  When I press one of my buttons it goes off and does several serial processes.  After each process I want to update the user by outputting text to the GUI, however, that text doesn't come out until I have completed all my processes.  I have seen other questions regarding this same issue where processEvents() is recommended.  Dumb question, what module do I have to import to get the processEvents() function that will make this work or is there one for Python 2.4.3?  I am running on a Red Hat Linux machine.  Thanks in advance.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":235,"Q_Id":20052953,"Users Score":0,"Answer":"Qt.qApp or QApplication.instance() yields the QApplication object which has a processEvents that you can call.","Q_Score":1,"Tags":"python,qt,user-interface,python-2.4","A_Id":20053291,"CreationDate":"2013-11-18T16:37:00.000","Title":"Interrupting process in Qt to update GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have searched to the point of confusion, so I need some guidance. I want to make a game on Android with Python - ONLY using my android device. \nI'm confused in the difference between Kivy and Sl4a and what steps i need to take in order to be able to program and run my game on my phone. I seem to only be able to find outdated or misleading information,  so i apologize if this is simple. \nAny guidance is much appreciated. Thanks!","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":2130,"Q_Id":20060481,"Users Score":3,"Answer":"I have searched to the point of confusion, so I need some guidance. I want to make a game on Android with Python - ONLY using my android device.\n\nAs others have said, this is somewhere between 'really hard and annoying' and 'impossible'. Especially without a computer to do any of the process!\n\nI'm confused in the difference between Kivy and Sl4a\n\nKivy is a cross-platform (linux, windows, osx, android, ios, maybe more) graphical framework for python. The same developers maintain a python-for-android project that lets you very easily compile a kivy program to an android apk. You can also do java api interaction etc. using the pyjnius project, which is also maintained by the same devs, and some apis (vibrate, accelerometer etc.) are already abstracted as a python module so you don't have to touch java.\nsl4a was originally (I think) a way to run python scripts on android. It has its own way to do some stuff with the android apis, but I don't know the details or what is possible. There are also some ways to package as an apk or to do some kinds of graphical work, but I'm not familiar with this either - I think they're much more limited as a graphical framework than kivy is (not that it sets out to be a full framework in the same way), but I don't know much about it, and at the very least the graphical stuff works in a quite different way that has advantages of its own.\n(Edit: Notice all the 'I think' in the previous paragraph? That's because I really don't know for sure and don't want to say something wrong. Don't take my word for it, try it!)\nOverall, kivy and sl4a (plus both of their related projects) are separate projects, with different focuses and technical capabilities. I personally think kivy is a more obvious choice for purposes other than basic scripting (though even simple sl4a scripts are useful to make tasker scripts etc.), but while some of kivy's advantages are arguably objective, some of my opinion is subjective.\n\nwhat steps i need to take in order to be able to program and run my game on my phone\n\nThis is really a big topic on its own. Already knowing kivy, I reckon I could throw together a process to do it, but I'd absolutely not want to because it would need a  horribly painful mishmash of other tools interacting in ways that are not a good user experience. In essence, I'd use text editors to create android files to run with kivy's interactive launcher (which is on the play store), and can probably in principle compile to an apk using kivy's online buildozer tools. However, I'll really stress that this is only in principle possible and I can't recommend trying - I think android really does not have a good set of tools for general purpose programming of this sort, and the os doesn't fit well with the multitasking of coding.\nIf you just want to write scripts and run them, you may have more luck. You can look at apps like qpython and codepad2 lite, along with the sl4a stuff (and probably other apps, these are just a couple I've seen or tried recently) for apps that can let you edit and run these kinds of scripts. This might be usable for certain things, but even then I don't think it would be a fun experience if you also need to switch between reading docs in a different app etc.\nSo overall...certain things are possible, but building full apps with (say) kivy is not likely to be an easy or pleasant experience with the current tools. Since you say you're constrained by circumstance and not choice, I suggest playing with qpython etc. and seeing what happens, but you aren't missing some fabulous ide that takes all the pain away.","Q_Score":0,"Tags":"android,python,pygame,kivy,sl4a","A_Id":20061233,"CreationDate":"2013-11-18T23:57:00.000","Title":"Python programming from my phone?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"what I want to do is to change the color of a QTableWidget item, when I hover with the mouse over the item of my QTableWidget.","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":13694,"Q_Id":20064975,"Users Score":1,"Answer":"There are no events based on QTableWidgetItem, but you can do this:\n\nreimplement the mouseMoveEvent() of QTableWidget, you can get the mouse position;\nuse itemAt() method to get the item under your mouse cursor;\ncustomize your item;\n\nThis may simalute what you want.","Q_Score":1,"Tags":"python,pyqt,qtablewidget,mousehover,qtablewidgetitem","A_Id":20068068,"CreationDate":"2013-11-19T06:47:00.000","Title":"How to catch mouse over event of QTableWidget item in pyqt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using a Flexgridsizer that contains a mix of statictexts and buttons within it.  My flexgridsizer contains 1 column of statictext that never changes, 3 columns that update constantly (sometimes a tenth of a second) and the last column has all buttons that remain the same -- I have about 12 rows.  \nWhen I push \"go\" on my code, the three statictext columns update constantly.  I do this by self.text1.SetLabel('newtext').  This works great.  However, I initially set up the gridsizer so the statictext is centered.  Therefore, when i run my code, after updating each cell, i run self.panel.Layout().  This helps get my columns centered again.\nThe problem with this is that since I do so much updating, it causes my buttons in the last column to look like they are moving left and right (since it appears to be resetting the layout of the buttons).  I want the buttons to \"stay still\".  To fix this, I removed the self.panel.Layout() BUT this now makes all my text be right-justified.  \nIs there any way to apply the Layout() to just specific columns of the gridsizer?  I really need to keep the gridsizer if possible.  I have also seen the \"noautoresize\" but one of my columns experiences texts of different lengths at each update.  \nAny thoughts?  Thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":113,"Q_Id":20085750,"Users Score":1,"Answer":"Try setting the StaticText size to something specific, like (100, -1). That way it should stay the same unless you happen to apply a string that's greater than the size you set. I'm not sure what happens then, but probably it would get truncated. However, if you're updating it so fast that you can't read it to begin with, I don't think this will be an issue.","Q_Score":0,"Tags":"python,text,grid,wxpython,alignment","A_Id":20100885,"CreationDate":"2013-11-20T01:38:00.000","Title":"wxpython update wx.statictext inside wx.gridsizer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So basically, I'm going to make a Brick Breaker type of game.  Just my beginning CS Python class didn't teach much OO programming, and I was wondering how I could make this free moving ball register when it hits the slider.  I think I have an idea, but I would like to see other peoples explanations.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":147,"Q_Id":20086958,"Users Score":0,"Answer":"You know the position of the two objects that can collide and compute the distance. When this is smaller than a threshold then they collide\nYou use the Canvas.find_overlapping(*rectangle). to find out the figures on the canvas in a rectangle.\n\nI always prefer option 1. It helps dividing model and presentation to the user which do not always need to be linked.","Q_Score":0,"Tags":"python,canvas","A_Id":20093393,"CreationDate":"2013-11-20T03:47:00.000","Title":"How can I make one canvas object collside with another canvas object using Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using PyScripter version 2.5.3.0 X86. \nWhen I run a python script which has an error (ValueError), an error window popups with a annoying beep sound. \nIs it possible to disable this error window with the sound? \nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":297,"Q_Id":20145650,"Users Score":0,"Answer":"Disable the system sounds in the taskbar if working in windows. This only removes the beep however.","Q_Score":2,"Tags":"python,pyscripter","A_Id":22344568,"CreationDate":"2013-11-22T13:05:00.000","Title":"Pyscripter: Disable error windows popup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create an application with tkinter, and I want the ability to connect it to a website and display what's there. It's sort of a web browser without the URL bar. Is it possible? If so, is there any documentation I could use? Do you have any source code I could learn from?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":817,"Q_Id":20164834,"Users Score":0,"Answer":"There is no tkinter widget for displaying the contents of a web page.","Q_Score":0,"Tags":"python,tkinter,browser","A_Id":20166229,"CreationDate":"2013-11-23T16:33:00.000","Title":"Connection to Webpage and Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Pygame offers a pretty neat bitmask colliding function for sprites, but it's really slow when you are comparing large images. I've got my level image, which worked fine when it was 400x240, but when I changed the resolution to (a lot) bigger, suddenly the game was unplayable, as it was so slow. \n\nI was curious if there was a way to somehow crop the bitmask of a sprite, so it does not have to do as many calculations. Or, an alternative would be to split the whole stage sprite into different 'panels', and have the collision check for the closest one (or four or two, if he is on the edge of the panels). But I have no idea how to split an image into several sprites. Also, if you have any other suggestions, they would be appreciated.\n\nI have seen the many places on the internet saying not to bother with bitmask level collision, because it is far too slow, and that I should use tile based collision instead. Although, I think bitmask would make it a lot more flexible, and it would give the opportunity for level destruction (like in the worms games), so I would prefer it if it was bitmask.\n\nI think I've explained it enough not not need to post my code, but please tell me it you really need it.\n\nMany thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":95,"Q_Id":20173519,"Users Score":0,"Answer":"Okay, I worked out a fix for it that actually wasn't any of these things... Basically, I realised that I was only colliding one pixel with the stage at a time, so I used the Mask.get_at() function. Kinda annoyed this didn't occur to me before. Although, I've heard that using this can be quite slow, so if somebody would be willing to offer a faster alternative of get_at() that'd be nice.","Q_Score":0,"Tags":"python,optimization,pygame,bitmask","A_Id":20182011,"CreationDate":"2013-11-24T10:31:00.000","Title":"Pygame level bitmask checking optimisation?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way in pygame to look for a collision between the a particular side of a sprite and a particular side of another sprite in pygame? For example, if the top of sprite A collides with the bottom of Sprite B, return True.\nI am certain there is a way to do this, but I can't find any particular method in the documentation.\nThanks!","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":9637,"Q_Id":20180594,"Users Score":1,"Answer":"Like Furas has said, no, there is not way to get side collisions in Pygame past the point system he set up. And even that one wont give you what you want, because you can never be sure  which direction the collision happened when dealing with rows, columns or corners of Rectangles.\nThis is why most tutorials recommend saving your sprites initial direction. then moving in the opposite direction in case of a collision.","Q_Score":6,"Tags":"python,pygame,sprite,collision","A_Id":20197302,"CreationDate":"2013-11-24T20:30:00.000","Title":"Pygame: Collision by Sides of Sprite","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way in pygame to look for a collision between the a particular side of a sprite and a particular side of another sprite in pygame? For example, if the top of sprite A collides with the bottom of Sprite B, return True.\nI am certain there is a way to do this, but I can't find any particular method in the documentation.\nThanks!","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":9637,"Q_Id":20180594,"Users Score":0,"Answer":"For objectA give the object this method:\ndef is_collided_with(self, sprite):\n    return self.rect.colliderect(sprite.rect)\nThis return statement returns either True or False\nthen in the main loop for collisions just do:\nif objectA.is_collided_with(ObjectB):\n                                            Collision happened!","Q_Score":6,"Tags":"python,pygame,sprite,collision","A_Id":58675517,"CreationDate":"2013-11-24T20:30:00.000","Title":"Pygame: Collision by Sides of Sprite","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a python script with a Tkinter GUI. I would like to create a desktop icon that will execute this script so that the end-user (not myself) will be able to double-click the icon and have the GUI load, rather than 'run' the script from the terminal or python shell and then have to F5 from there.\nIs there a way to do this? I have googled many arrangements of my question but most answers seem to be normal python scripts, not ones which are Tkinter based.\nI am using a Raspberry Pi with Wheezy and Python 2.7\nThanks in advance.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":7292,"Q_Id":20182350,"Users Score":1,"Answer":"Besides creating executable file other option is create simple .bat file:\n\nOpen notepad\nEnter \"C:\\ProgramData\\Anaconda3\\python.exe\" \"C:\\Users\\Your ID\\script.py\"\nFirst part is path to python.exe, second to your python script\nsave file as .bat file, ex. \"open_program.bat\"\n\nNow simply double click on saved .bat file icon should open your script.","Q_Score":3,"Tags":"python,tkinter,raspberry-pi,desktop,shortcut","A_Id":62213416,"CreationDate":"2013-11-24T23:13:00.000","Title":"Create a desktop icon for a Tkinter script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a python script with a Tkinter GUI. I would like to create a desktop icon that will execute this script so that the end-user (not myself) will be able to double-click the icon and have the GUI load, rather than 'run' the script from the terminal or python shell and then have to F5 from there.\nIs there a way to do this? I have googled many arrangements of my question but most answers seem to be normal python scripts, not ones which are Tkinter based.\nI am using a Raspberry Pi with Wheezy and Python 2.7\nThanks in advance.","AnswerCount":4,"Available Count":2,"Score":-0.049958375,"is_accepted":false,"ViewCount":7292,"Q_Id":20182350,"Users Score":-1,"Answer":"You can save the script as a .pyw file so the user can click on the file and the GUi would open","Q_Score":3,"Tags":"python,tkinter,raspberry-pi,desktop,shortcut","A_Id":69898319,"CreationDate":"2013-11-24T23:13:00.000","Title":"Create a desktop icon for a Tkinter script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to build an application in wxPython which have multiple windows like MDI. I don't want use MDIParentFrame which is old. I've seen wx.aui too but I don't like it.\nWhat I want is a main frame that hase a menu and toolbar and more child windows. Child windows must minimize when main frame minimize and got focus when main frame clicked\nHow do this ?\nThanks all","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":181,"Q_Id":20213112,"Users Score":0,"Answer":"You either use one of the MDI implementations that wxPython already has built-in or you reinvent the wheel and create your own widgets.","Q_Score":0,"Tags":"python,wxpython,mdi","A_Id":20219489,"CreationDate":"2013-11-26T09:31:00.000","Title":"wxPython and MDI like app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there some example of people embedding ipython-qt console inside their C++\/Qt application?\nI've only seen examples of people embedding that in PyQt applications.\nWhat I would like to do is at the end something like the console example available for PythonQt, where from a console with autocompletition, one can modify internal status of c++ variables.\nMaybe is it possible thanks to an additional layer of binding of C++ methods via Boost.Python?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":951,"Q_Id":20247408,"Users Score":1,"Answer":"I have been looking to try and do something similar.  I'm trying to at the very least use the ipython kernel in a c++ widget.  So far the only stuff I have found online is importing modules into python.  I have found nothing on the ipython github site either yet.  But I'm still digging.","Q_Score":2,"Tags":"c++,qt,boost,ipython","A_Id":20943115,"CreationDate":"2013-11-27T16:09:00.000","Title":"Embedding ipython qt-console as qwidget inside qt\/c++ application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Assuming I have a line with coordinates x1,y1 and x2,y2, and I know the length of the hypotenuse connecting those two points (thus also knowing the angle of rotation of the line through trig), if the line is 1 pixel thick how can I find every pixel on that line and store it to a list?\nI first proposed the simple vector calculation, stating with x1,y1 and performing line\/z*math.cos(angle),line\/z*math.sin(angle) (for x1 and y1 respectively) until I reached point x2,y2, but the problem with that is finding variable 'z' such that every single pixel is covered without duplicating pixels.\nSo what would be the best way of calculating this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":369,"Q_Id":20296712,"Users Score":0,"Answer":"Using float you should get all points without duplications - but you need int. \nUsing int you always get duplications - int(0.1) == int(0.2) == int(0.3) == etc.. \nSo you have to check if point is on your list.","Q_Score":0,"Tags":"python,pygame,lines,pixels","A_Id":20298727,"CreationDate":"2013-11-30T04:57:00.000","Title":"How can I find every pixel on a line with pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I put goog_appengine inside android located at \/mnt\/sdcard\nI also put wsgiref folder  at same location.\nfrom Qpython I manage to \"send control key\" + \"d\"\nI got sh $\nI put command like the ff:\n\"$python \/mnt\/sdcard\/google_appengine\/appcfg.py\"\nBut Igot ImportError: no module _csv\nI feel putting these is not same architecture \" \/usr\/lib\/python2.7\/lib-dynload\/_csv.x86_64-linux-gnu.so\"\nThat come from ubuntu 13.04.  \nWhat to do next, Where I can find _csv module for Qpython+android_version.\nIs it possible to upload my code through android?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":840,"Q_Id":20308674,"Users Score":0,"Answer":"To install _csv or any other module, follow these steps.  Here's what I did to install websocket (and all of its dependencies):\nTo install websocket on the phone:\n\nStart QPython   \nClick the big button\nSelect \u201crun local script\u201d\nSelect \u201cpip_console.py\u201d\nType \u201cpip install websocket\u201d","Q_Score":0,"Tags":"importerror,qpython","A_Id":31173939,"CreationDate":"2013-12-01T04:17:00.000","Title":"ImportError: No module named _csv . Qpython for android logs","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I put goog_appengine inside android located at \/mnt\/sdcard\nI also put wsgiref folder  at same location.\nfrom Qpython I manage to \"send control key\" + \"d\"\nI got sh $\nI put command like the ff:\n\"$python \/mnt\/sdcard\/google_appengine\/appcfg.py\"\nBut Igot ImportError: no module _csv\nI feel putting these is not same architecture \" \/usr\/lib\/python2.7\/lib-dynload\/_csv.x86_64-linux-gnu.so\"\nThat come from ubuntu 13.04.  \nWhat to do next, Where I can find _csv module for Qpython+android_version.\nIs it possible to upload my code through android?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":840,"Q_Id":20308674,"Users Score":0,"Answer":"You can install _csv from QPython's system. ( You can find system icon in qpython's new version 0.9.6.2 )","Q_Score":0,"Tags":"importerror,qpython","A_Id":21482814,"CreationDate":"2013-12-01T04:17:00.000","Title":"ImportError: No module named _csv . Qpython for android logs","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I want to use pywinauto to write an auto-click script. I know I can use app.ListView2.Select(4) to select an item. So I tried to use select() or Check(), but it's not working.\nHow can I doubleclick an item?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2317,"Q_Id":20331622,"Users Score":0,"Answer":"ListView in pywinauto inherited from HwndWrapper which has DoubleClick() method, try it. Also make sure you've tried Select(item) for ListView. (You've mentioned select())","Q_Score":0,"Tags":"python,pywinauto","A_Id":20384256,"CreationDate":"2013-12-02T15:16:00.000","Title":"How to doubleclick a listview item with pywinauto?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have stated time=pygame.time.get_ticks\nthen when bliting thing to the screen \nI try window.blit(time, (0,0))\nbut where the time is supposed to be it just says built in function.\nWhy is this??","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":244,"Q_Id":20362190,"Users Score":0,"Answer":"Just to add a bit to furas answer.\nSince this function is called get_ticks, you need to do the actual action to get the ticks.\nThere is one more thing that troubles me, you are trying to blit a integer to the screen, and this is not possible. \nWhat you need to do is create a surface from the string value of the miliseconds, and blit that.","Q_Score":0,"Tags":"python,pygame","A_Id":20385564,"CreationDate":"2013-12-03T21:36:00.000","Title":"Trouble with pygame.time.get_ticks","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I updated my MacBook to Mavericks, reinstalled Macports and all Python 2.7 modules I usually use. While running Python I get the following messages:\nwhen importing mlab:\nfrom mayavi import lab\n(process:1146): Gtk-WARNING **: Locale not supported by C library.\n    Using the fallback 'C' locale.\nwhen running a mlab command such as mlab.mesh(), the display window opens, shows no content and freezes.\nI don't get this message while importing spectral, but I get it when running view_cube() the display window showing the image cube, freezes but shows the data cube. It seems there is something wrong with Xterm, but I can't figure it out. How can I keep the display window from freezing and get rid of the Gtk-WARNING?\nI checked locale and locale -a, but couldn't see anything unusual:\nlocale: \nlocale\nLANG=\nLC_COLLATE=\"C\"\nLC_CTYPE=\"C\"\nLC_MESSAGES=\"C\"\nLC_MONETARY=\"C\"\nLC_NUMERIC=\"C\"\nLC_TIME=\"C\"\nLC_ALL=","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5430,"Q_Id":20366533,"Users Score":2,"Answer":"While using OS X Mavericks one has to use: ipython --pylab=wx instead of ipython --pylab=osx to avoid crashing the X11 window. I don't know why this works.","Q_Score":4,"Tags":"python,gtk,mayavi,spectral","A_Id":20513075,"CreationDate":"2013-12-04T03:57:00.000","Title":"Gtk-WARNING **: Locale not supported by C library. while using several Python modules (mayavi, spectral)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am looking to develop an application as a personal project. What I have in mind is a network-based application that would entail writing code for a typical client-server architecture using TCP Sockets as well as a heavy use of GUIs. \nI believe I have quite a few choices: Swing in Java, PyQt, PyGTK, wxpython and the like in Python.\nI was just wondering if anyone could direct me to which language would be better in the above respects.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":101,"Q_Id":20367296,"Users Score":1,"Answer":"I would suggest you go for JavaFX. It comes with the JDK and has a lot of good features.\nPlus, it can inter-operate with Swing, backwards and forwards. It allows you to use CSS to pretty-paint your UI. t gives you best of both the worlds.","Q_Score":0,"Tags":"java,python,swing,user-interface","A_Id":20367301,"CreationDate":"2013-12-04T05:07:00.000","Title":"Which language has better support for developing GUIs coupled with network programming, Python or Java?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to disable only one item in a listbox with wxpython. I already searched in the Internet for a way to do this, but I found nothing...\nI hope you can give me a hint!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":389,"Q_Id":20402359,"Users Score":0,"Answer":"I don't think there's a direct way to do this, so the only way would be to do it by hand: catch click events, use the HitTest to find which item was selected, and then ignore the event if it's the \"deactivated\" item.  (Tree Controls have the EVT_TREE_SEL_CHANGING which would be useful here, but there's no analog for a ListBox afaik.)","Q_Score":0,"Tags":"listbox,wxpython","A_Id":20416806,"CreationDate":"2013-12-05T14:17:00.000","Title":"Disable only one item in a wxpython.listbox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to disable only one item in a listbox with wxpython. I already searched in the Internet for a way to do this, but I found nothing...\nI hope you can give me a hint!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":389,"Q_Id":20402359,"Users Score":0,"Answer":"You will need to bind to wx.EVT_LISTBOX and check if the selection is in your \"deactivated\" list. If so, set the selection to a different item in the control.","Q_Score":0,"Tags":"listbox,wxpython","A_Id":20426709,"CreationDate":"2013-12-05T14:17:00.000","Title":"Disable only one item in a wxpython.listbox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two pyqt files that I made in qt4 designer. I put them both in a directory and created a  file outside the directory, which I imported them with. The first file is a window with a button, that when clicked, should close the first window, and open the second window. \nI can import them, and launch them both at the same time, but I can't figure out how to have the button in the first window affect the other, yet alone have it close itself and spawn the other.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":150,"Q_Id":20411315,"Users Score":0,"Answer":"In the handler of the button-click in the first window, instantiate the second window and invoke its show-method, and then close (emit the close-signal to) the first window.","Q_Score":0,"Tags":"python,qt,pyqt4","A_Id":20411550,"CreationDate":"2013-12-05T21:38:00.000","Title":"How to tie two windows together in pyqt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently using CustomTreeCtrl instead of the regular TreeCtrl because it allows me to have checkbox \/ radio button with the tree nodes.\nHowever, I realize the control itself catches event EVT_KEY_DOWN (whenever any key is pressed) to look for any matching tree nodes. I need the event EVT_KEY_DOWN for other purposes, so is there a way to disable the tree control from recognizing EVT_KEY_DOWN?\nOr would it work if I create my own CustomTreeCtrl that does not have self.Bind(wx.EVT_KEY_DOWN, self.onKeyDown) inside? How would I locate that Python file then (wx.lib.agw.customtreectrl) on Linux?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":230,"Q_Id":20411647,"Users Score":0,"Answer":"treeCtrl.Unbind(wx.EVT_KEY_DOWN)\nI think would work :P","Q_Score":0,"Tags":"python,file,module,tree,wxpython","A_Id":20411707,"CreationDate":"2013-12-05T21:57:00.000","Title":"wxPython: CustomTreeCtrl disable checking for event EVT_KEY_DOWN","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The wizard in wxpython automatically responds to keyboard accelerators for the buttons on the page (for example \"Alt-N\" to activate the next button). I want this but ...\nIt only does this if there is at least one interactive widget on the visible wizard page. If the page only has static text then accelerator keystrokes don't do anything.\nThe wizard also responds to keys that shouldn't do anything at all, eg \"C\" or \"c\" activates the cancel button whenever the focus is on an image button (note that it doesn't do that if the focus is on a text entry widget - in that case the corresponding character is entered into the text box).\nHow can I change the behaviour of the wxpython wizard so that:\n\n\"Alt-N\" and \"Alt-C\" should activate the next and cancel buttons even on pages that only have static text controls\n\"N\" and \"C\" should NOT activate the next and cancel buttons regardless of which widget has the current focus.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":117,"Q_Id":20421648,"Users Score":0,"Answer":"The problem with Alt-N not having any effect seems to be a wxWidgets bug, so I don't think you can work around it in wxPython. Perhaps you could try to catch EVT_CHAR for them in the wizard itself and see if you get the event there.\nAs for disabling some keys when some specific control has focus, you definitely should be able to catch EVT_KEY_DOWN in this control. Although I don't really understand why would you want to do this.","Q_Score":1,"Tags":"wxpython,wxwidgets","A_Id":20425632,"CreationDate":"2013-12-06T10:30:00.000","Title":"How to make wx wizard respond to keyboard accelerators like a normal Microsoft Windows application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to define an event object in pygame?\nWhat I am trying to do is loop through all the keyboard events in a method, I then want to call that method with an event as a parameter, but I first need to define it. Is this possible?\nIm using Pygame 3.3 and python 3.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":198,"Q_Id":20442022,"Users Score":1,"Answer":"An event can be made with the command pygame.event.Event(type, dict).  The type will be what you want it to return when the event.type() command is used on it.  The dict will include every other attribute.\nAn example: pygame.event.Event(pygame.MOUSEBUTTONDOWN, {'button':1}) would return a MOUSEBUTTONDOWN event with an attribute button of 1.","Q_Score":0,"Tags":"python,pygame","A_Id":20443462,"CreationDate":"2013-12-07T13:41:00.000","Title":"Pygame event object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im learning Kivy and would like to center an object inside of a parent object.  I know I can access an object's own properties with the self keyword in the kv language, but is there a shortcut for accessing a parent widget's, say, size and position properties?  Both root.size and parent.size are failing for me.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5845,"Q_Id":20460867,"Users Score":14,"Answer":"A widget keeps a reference to its parent in self.parent. So you can just so self.parent.size or self.parent.pos or whatever.\nDepending on what you're doing, it may be necessary or useful to make sure you check if self.parent is None first, so that your code doesn't fail for widgets with no parent.","Q_Score":11,"Tags":"python,kivy","A_Id":20470745,"CreationDate":"2013-12-09T00:00:00.000","Title":"Accessing the parent object's size parameters in kivy widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I primarily program in Python and have always tried to steer clear of Java (no particular reason, really). Now I find myself in a position where I have to build an app for Android. \nMy question is, is there any inherent difference in terms of speed, resource-consumption, access to hardware features etc if I build the app in Python, using SL4A or Kivy or some other platform(I still need to explore those options in detail)? Or should I Download the SDK Bundle and go about learning to build apps for Android exclusively?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":6207,"Q_Id":20463104,"Users Score":0,"Answer":"From what I can tell, neither of the projects you mention is meant for building native Android apps. If you were really knowledgeable in Jython and Android, maybe you could finagle Jython to make native apps, but since you mention that you've never used Java, that's unlikely. Unfortunately, the only project that attempted to do it is dead (and turned into SL4A, maybe?).\nSo TL;DR, if you want completely native, I-can't-believe-it's-not-Java experience, you have no choice. If not, you should specify what exactly you wan't to accomplish, maybe Python is good enough.","Q_Score":4,"Tags":"android,python,mobile","A_Id":20463265,"CreationDate":"2013-12-09T04:21:00.000","Title":"Building apps for Android using Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a function that will cause a giraffe to move in a certain direction and distance (don't ask). \nIf the user types \"west\" in the parameters, the turtle should move west however the direction is. But the turtle's angle changes every time, I can't fix a value for my turtle to turn to go a certain direction.\nI need to set the angle to, say, 90 so that it can move East. I can't find useful functions for this purpose. I tried to use Pen().degrees(90) but that didn't work. Does anyone know how I can do this?","AnswerCount":2,"Available Count":1,"Score":-0.2913126125,"is_accepted":false,"ViewCount":18276,"Q_Id":20502766,"Users Score":-3,"Answer":"turtle.right(90)\nthis will turn the turtle 90","Q_Score":6,"Tags":"python,angle,turtle-graphics","A_Id":49330538,"CreationDate":"2013-12-10T18:45:00.000","Title":"Setting the angle of a turtle in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wx.grid with size 1*3 (1 row, 3 columns). Cell 1*1 has value 3, cell 1*2 has value 5 and I want cell 1*3 to display sum of the other cells (3 + 5 = 8). And I want cell 1*3 to autoupdate its value as cell 1*1 and cell 1*2 changes. How to do this wit wxpython grid?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":163,"Q_Id":20519669,"Users Score":1,"Answer":"You will need to catch a cell related events. I would recommend EVT_GRID_EDITOR_HIDDEN as that event fires after you have left a cell where you had double-clicked it to start an edit. You could also use EVT_GRID_CELL_CHANGE, although just because you changed cells doesn't mean you did an edit. \nEither way, in the event handler, you would grab the first two cell values, sum them and insert them into the third cell.","Q_Score":0,"Tags":"python,grid,wxpython,sum,auto-update","A_Id":20523503,"CreationDate":"2013-12-11T12:52:00.000","Title":"How to display sum of 2 cell values in another cell and autorefresh it as cell values change in wxpython grid?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to create a multiple choice quiz in Tkinter.\nEach question has between 2-4 different answers all displayed as checkboxes, how do I ensure the user can only tick one check box and not all of them?\nThanks","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1562,"Q_Id":20528082,"Users Score":1,"Answer":"Don't use checkboxes; use radoibuttons instead. The behavior of checkboxes and radiobuttons is well established -- checkboxes allow you to select N of N choices, radiobuttons are designed to allow you to select exactly 1 of N. Don't violate this design pattern or your users will be confused. \nTo make radiobuttons work, create a single StringVar and associate it with two or more radiobuttons. All of the radiobuttons that share the same variable will work as a set, allowing only one to be selected.","Q_Score":0,"Tags":"python,validation,user-interface,checkbox,tkinter","A_Id":20528169,"CreationDate":"2013-12-11T19:19:00.000","Title":"Checkbox validation: how do i ensure user can only tick one box only?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using VTK version 5.1, I'm having some issues with some models not displaying correctly in OpenGL.\nThe process for getting the models into VTK is a bit roundabout, but gets there and is fairly simple. Each model is a manifold mesh comprised of only quads and tris.\nBlender models->custom export format containing points, point normals, and polygons\nCustom export format->Custom C++ parser->vtkPolyData\nvtkPolydata->vtkTriangleFilter->vtkStripper->vtkPolyDataNormals->final product\nAs our final product was showing irregular and missing normals when it was rendered, I had VTK write the object to a plaintext file, which I then parsed back into Blender using python.\nInitial results were that the mesh was correct and matched the original model, however, when I used the Blender \"select non-manifold\" option, about 15% of the model showed to be nonmanifold. A bit of reading around online suggested the \"remove doubles\" as a solution, which did in fact solve the issue of making the mesh closed, but the normals were still irregular.\nSo, I guess I'm hoping there are some additional options\/functions\/filters I can use to ensure the models are properly read and\/or processed through the filters.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":175,"Q_Id":20528456,"Users Score":0,"Answer":"This was solved by requesting that Blender perform a triangulization of the mesh prior to  the export operation. \nThe mangling was due to Blender performing implicit triangulization of quads, resulting in faces which were stored as 4 non-coplanar points. By forcing explicit triangulation in advance, I was able to successfully perform the export and maintain model integrity\/manifold-ness. The holes that were being experienced were due to the implicit triangulation not being copied by the exporter and thus causing loss of data.","Q_Score":0,"Tags":"c++,python,opengl,blender,vtk","A_Id":25369835,"CreationDate":"2013-12-11T19:41:00.000","Title":"vtk Filters causing point doubling and mangling normal values","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wxPython GUI with a wx.stc.StyledTextCtrl text editor. It is possible that its content contain some unicode characters such as Greek letters. I have noticed that StyledTextCtrl.SaveFile() method works only when the content has no unicode characters. Otherwise the saved file ends up being an empty file.\nI tried calling StyledTextCtrl.SetCodePage(stc.STC_CP_UTF8) but it did not help either. So, I am not quite sure whether there is a bug in the StyledTextCtrl code, or that I am missing something. Any help is appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":255,"Q_Id":20532581,"Users Score":0,"Answer":"Saving code uses wxConvCurrent, so you could try setting it to wxConvUTF8 to ensure that UTF-8 is used even when it's not the encoding of the current locale (which is never the case under Windows).\nUnfortunately I'm not sure if you can change wxConvCurrent from Python. If you can't, the simplest solution would probably be to just write wxStyledTextCtrl::GetValue() to a file yourself instead of relying on its SaveFile() method. Don't forget to call SetSavePoint() after saving successfully if you do this.","Q_Score":1,"Tags":"unicode,wxpython,wxwidgets,wxstyledtextctrl","A_Id":20545016,"CreationDate":"2013-12-12T00:10:00.000","Title":"An issue with calling w.stc.StyledTextCtrl.SaveFile with a unicode content","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to create a custom tooltip with no border using wx.TipWindow. I can do this with PopupTransientWindow but I could not figure out the which event to use to dismiss the popup when the mouse is moved away from a given rectangle bound(not clicked but moved away).","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":131,"Q_Id":20539077,"Users Score":0,"Answer":"You may not be able to customize that particular control very well as it wraps the native widget (if it exists). Instead, I would recommend switching to BalloonTip or possibly better, the SuperToolTip. Both of these controls are generic, pure Python controls. That means that they usually have additional customization and they are definitely easier to modify yourself if you need to because they're Python instead of C++.\nThere are demos of both of those controls in the wxPython demo package. You should check them out and see if they work better for you.","Q_Score":0,"Tags":"wxpython","A_Id":20569837,"CreationDate":"2013-12-12T09:03:00.000","Title":"Tooltip without border in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a personal project in Python that involves creating a user-interface. For that purpose, I have chosen to go with PyQt4.\nAs part of the GUI code, I need a widget in which we can append text but the requirement is that it should not allow to be edited. A QtGui.QTextEdit would solve the purpose of appending text but would not satisfy the second requirement. What widget can I use that satisfies both the requirements?\nThanks","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":69,"Q_Id":20544190,"Users Score":1,"Answer":"You could have two TextEdit's, one that is set to readonly that displays the full text and a smaller one below it for entering text to append to the one above.","Q_Score":1,"Tags":"python,user-interface,pyqt4","A_Id":20544425,"CreationDate":"2013-12-12T12:55:00.000","Title":"What is the ideal widget in PyQt4 in which we can append text but cannot edit it after the text gets populated?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a personal project in Python that involves creating a user-interface. For that purpose, I have chosen to go with PyQt4.\nAs part of the GUI code, I need a widget in which we can append text but the requirement is that it should not allow to be edited. A QtGui.QTextEdit would solve the purpose of appending text but would not satisfy the second requirement. What widget can I use that satisfies both the requirements?\nThanks","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":69,"Q_Id":20544190,"Users Score":1,"Answer":"Edited by who ?\nIf you don't want that a user can edit it, I think you just need to set the QTextEdit as readonly with QTextEdit.setReadOnly(True)\nIf you don't want to edit again from the code, I think you just need to check if the control has some text in it: if no, add the text otherwise return an error (or whatever you need)","Q_Score":1,"Tags":"python,user-interface,pyqt4","A_Id":20544331,"CreationDate":"2013-12-12T12:55:00.000","Title":"What is the ideal widget in PyQt4 in which we can append text but cannot edit it after the text gets populated?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I had a page that was working fine with respect to tab order, but since I added a scrolled panel to the page, you can only tab between the first control in the ScrolledPanel and the navigation buttons outside the ScrolledPanel.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":119,"Q_Id":20561820,"Users Score":0,"Answer":"I need to set wx.TAB_TRAVERSAL as a style on the ScrolledWindow.  Apparently it's not set by default.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":20561947,"CreationDate":"2013-12-13T08:08:00.000","Title":"wxWidgets ScrolledPanel tab order doesn't work","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a 32-bit Windows 7 OS. Today, I tried downloading the PySide setup program. However, after I try running the downloaded file, I get the following error: \"PySide Setup program invalid or damaged.\"\nWhy am I getting this? I have recently started a course on building GUI applications with Python using the Qt framework, and need PySide for the same. I use Python 2.7 btw.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1660,"Q_Id":20588259,"Users Score":0,"Answer":"My solution to nearly the same exact problem was simply that it needed to be installed with admin privileges, so that might be your issue also.","Q_Score":2,"Tags":"python,qt,user-interface,pyside","A_Id":23973285,"CreationDate":"2013-12-14T21:04:00.000","Title":"Pyside Installation Error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program that generates a game board in Pygame. It draws the background, then randomly assigns Start and End squares, then randomly places three squares in between them. I need to fill in the space in between the five placed squares with other squares on a line. How would I go about doing this? I need the length of the line, and a list of points on the line to correctly place the squares. \nThanks,\nAdam","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1185,"Q_Id":20601473,"Users Score":1,"Answer":"There is no way using pygame that I know of that will allow you to do this.  You will instead have to use plain old-fashioned algebra.\nYou are going to be using the equation of the line that the squares are on.  Ax, Ay, Bx, and By will be representing the coordinates of the different squares.  All you have to do is get a y coordinate for an inputted x coordinate by using y=(Ay-By)\/(Ax-Bx)*(x-Ax)+Ay, or get an x coordinate for an inputted y coordinate by using x=(Ay-By)\/(Ax-Bx)*(x-Ay)+Ax.  You will have to figure out which y or x coordinates to enter manually.\nTo find the distance between the squares, simply use the distance formula: math.sqrt((Ax-Bx)**2+(Ay-By)**2)","Q_Score":0,"Tags":"python,line,pygame,placement","A_Id":20601985,"CreationDate":"2013-12-15T23:57:00.000","Title":"How to get a list of all points in a line in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using pygame.font.Font.render() to render some text. I'd like the text to be translucent, ie have an alpha value other than 255, so I tried passing a color argument with an alpha value (eg (255, 0, 0, 150)) as the color argument for pygame.font.Font.render() but it didn't have any effect. I also tried using pygame.Surface.convert_alpha() on the resulting Surface object, but that didn't do anything either. Any ideas?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":6139,"Q_Id":20620109,"Users Score":2,"Answer":"You can change the transparency of the entire surface using a individual alpha value.\nUse surf=pygame.Surface((size,pygame.SRCALPHA). Now if you change the alpha value by setting surf.set_alpha(alpha) of the screen, the surface around the text wont be black anymore.","Q_Score":7,"Tags":"python,pygame","A_Id":68090814,"CreationDate":"2013-12-16T20:19:00.000","Title":"How to render transparent text with alpha channel in PyGame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I make Python3+Delphi app. I packed all files+dirs from Libs folder into python32.zip. It works. \n\nDo I need PYC files (and __pycache__ dirs) in that zip?\nIf I pack PYC files, will Py3k work fasteer?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":284,"Q_Id":20646723,"Users Score":1,"Answer":"You don't need to include the pyc files, no.  Assuming, that is, you are adding your zip file to sys.path and importing from that (the question could use more details along those lines), the Python zipimporter will gladly compile the bytecode for you on the fly.\nYou should have a little faster startup time if you include the pyc files (or for a stand-alone application you might consider including .pyo files instead, which you can make in various ways, such as running python with the -O flag).  That said this bytecode compilation is pretty fast, so depending on how many modules your application imports it might not make a noticeable difference.  Try it for yourself and see.","Q_Score":0,"Tags":"python,python4delphi","A_Id":20648897,"CreationDate":"2013-12-17T23:22:00.000","Title":"PythonNN.zip: are PYC files needed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to establish a \"supports-screens\" kind of configuration to make my application available only for normal and large screens android devices.is there a way to do this with the build.py script?(i have bets on --intent-filters option but not sure how it might be used)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":84,"Q_Id":20666947,"Users Score":1,"Answer":"There is no way to do it from the build.py. However, you can change manually the templates\/AndroidManifest.xml.tmpl and adapt it for your needs.","Q_Score":1,"Tags":"android,python-2.7,kivy","A_Id":22365294,"CreationDate":"2013-12-18T19:40:00.000","Title":"screen support in kivy set to normal and large screens","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I there any library in Python so that you can cut a certain part of an image (like a person) and paste it in other image?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":266,"Q_Id":20682797,"Users Score":0,"Answer":"You can use segmentation technique(seed based approach) in first image and then OpenCV library to place it onto another image by creating a mask.","Q_Score":0,"Tags":"python-2.7,image-processing","A_Id":20689518,"CreationDate":"2013-12-19T13:16:00.000","Title":"Cut a certain part of an image and paste it in other image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it normal that Tkinter's Canvas' create_text 's font size doesn't change when I change the Canvas' scale with canvas.scale ?\nI thought that, as it is a high level GUI management system, I wouldn't have to resize manually the text done with create_text after a zooming. Isn't this strange, or am I wrong ?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":500,"Q_Id":20689760,"Users Score":1,"Answer":"It's normal, even if not entirely what you want. The scale method just changes the coordinate lists, but text items only have one of those so they just get (optionally) translated.\nThis also applies to image and bitmap items. And features of other items like the line width; they're not scaled.","Q_Score":0,"Tags":"python,user-interface,canvas,tkinter,tcl","A_Id":20692285,"CreationDate":"2013-12-19T19:08:00.000","Title":"Tkinter, canvas, create_text and zooming","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Google Protobuf in my Python application. Experimenting with the protobufs  I found that Protobuf Message Creation is much slower in CPP based python implementation as compared to Python based Python implementation.\nMessage creation with PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp was upto 2-3 times slower as compared to pure python based Protobuf Message Creation.\nIs this expected? I found that SerializeToString and ParseFromString both are faster in the cpp verison. The difference in each case widens as the size of the Message increases.\nI am using python's standard timeit module to time these tasks. \n(Using Version 2.4.1 of google protobuf)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4148,"Q_Id":20701971,"Users Score":4,"Answer":"Yes, I believe this is expected.  The pure-Python implementation stores all the fields in a dict.  To construct a new message, it essentially just creates an empty dict, which is very fast.  The C++ implementation actually initializes a C++ DynamicMessage object under the hood and then wraps it.  DynamicMessage actually initializes all of the fields upfront, so even though it's implemented in C++, it's \"slower\" -- but this upfront initialization makes later operations faster.\nI believe you can improve performance further by compiling C++ versions of your protobuf objects and loading them in as another extension.  If I recall correctly, the C++-backed Python protobuf implementation will then automatically used the compiled versions rather than DynamicMessage.","Q_Score":2,"Tags":"c++,python,protocol-buffers","A_Id":20713817,"CreationDate":"2013-12-20T10:52:00.000","Title":"Performance of C++ based python implementation of Google Protobuf","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently working on creating a paint program using python and pygame.  I am currently having trouble with creating the undo\/redo function in the program.  The way I was thinking of doing so would be to save the canvas image after each time the user releases the mouse, but I am not sure if the individual images would have to be saved in a temporary folder that is deleted after the program is closed.  I have also read that this method can affect performance of the program so I am wondering if there are any other methods that will work more efficiently.  Thank you.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":982,"Q_Id":20827199,"Users Score":1,"Answer":"My suggestion is to have a buffer of the last operations that have been done. Each operation will consist of a sprite, and a position of where it is placed. \nYou will be drawing the canvas, as well as all sprites from that buffer. When you have to many sprites in the buffer, you can blit the oldest onto the canvas, thus saving memory.\nThe undo itself would be rather easy. Just remove the last sprite that was added.\nA redo would be slightly more difficult. Since instead of removing, I would have a pointer, that points to the last sprite that I will draw. If a new action will be added, only then I remove all the sprites that have been \"invisible\".","Q_Score":1,"Tags":"python,pygame,paint,undo,redo","A_Id":20828238,"CreationDate":"2013-12-29T16:15:00.000","Title":"Paint Program in Python - Undo and Redo","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to maintain 2 python projects. one of them is using PyQt4 and another one is using PyQt5. So I created 2 virtualenv as follow.\n\n1) installed virtualenv and virtualenvwrapper by sudo\n2) logout from root(sudo)\n3) created virtualenv at \/home\/thura\/workspace\/python\/virtualenv\n4) mkvirtualenv gui_pyqt4 under\n  \/home\/thura\/workspace\/python\/virtualenv\n5) mkvirtualenv gui_pyqt5 under\n  \/home\/thura\/workspace\/python\/virtualenv\n\nAnd I want to install the lib\/module\/etc of PyQt4 into gui_pyqt4 and install the lib\/module\/etc of PyQt5 into gui_pyqt5. I tried to install \"pip install python-qt4\" and \"pip install python-qt5\" but not working.\nHow can I install different module into different environment.?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1320,"Q_Id":20833826,"Users Score":0,"Answer":"You need to activate the appropriate virtual environment and then use the command pip install PyQt4or pip install PyQt5. Since you are using virtualenvwrapper, the virtual environment is activated automatically. Otherwise, use workon virtualenv_name to activate the environment.Do tell if the problem still persists.","Q_Score":0,"Tags":"python,python-2.7","A_Id":47946736,"CreationDate":"2013-12-30T05:27:00.000","Title":"How to install PyQt4 and PyQt5 at different virtualenv?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two objects troll and pig. I'm detecting collisions between these two characters with Pygame's colliderect function. collisions for this works perfectly, however I am unable to remove the object from the screen when a collision occurs. When a troll collideswith a pig, I want the pig to disappear from the screen. I set an image for both of these and bit them, is there a way to un-blit? Ive tried pygame.image.set_alpha(255) (which set full transparency of an image) function to no avail. \nAny suggestions?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":489,"Q_Id":20839246,"Users Score":0,"Answer":"Can't you just stop drawing the pig? Each frame you fill the screen with the background, so it won't be visible.","Q_Score":0,"Tags":"python,pygame,sprite","A_Id":20843239,"CreationDate":"2013-12-30T12:07:00.000","Title":"remove object after collision","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking for some advice mainly here. \nI'm working on an application, where the main processing (stored on a server) is carried out in C++ and the GUI (front-end) is carried out in Python. These two programs will communicate with each other. The Python will send across the files needed for the C++ program to work, and give the C++ program some data to work with.. The back-end will then communicate back with the processed data.\nWould therefore it be better to use Sockets? I thought about completing this using text files, but, have gone off this idea, instead will just save the data as a .txt file so it can be opened up in future instances. Also, if I was to use sockets, would there be any conflict in using Python\/C++?\nAny help or advice would be greatly appreciated.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3600,"Q_Id":20839944,"Users Score":0,"Answer":"I would go for named pipes, would be readily available in your circumstance because it is just similar to reading and writing to file, but it also has features similar to sockets i.e. you can make them communicate on a network (different hosts)","Q_Score":4,"Tags":"c++,python,sockets","A_Id":20840334,"CreationDate":"2013-12-30T12:50:00.000","Title":"Sending\/Receiving data between two different programs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to publish an Android application that I have developed but have a minor concern.\nThe application will load with a database file (or sqlite3 file). If updates arise in the future and these updates are only targeting the application's functionality without the database structure, I wish to allow users to keep their saved entries in their sqlite3 files.\nSo what is the best practice to send updates? Compile the apk files with the new updated code only and without the database files? Or is there any other suggestion?\nPS: I am not working with Java and Eclipse, but with python for Android and the Kivy platform which is an amazing new way for developing Android applications.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":487,"Q_Id":20856465,"Users Score":0,"Answer":"if you're using local sqlite then you have to embed the database file within the app as failure to do so it means there's no database, in case for updates database have version numbers where as it can not upgrade the database provided the version number is the same as the previous app updates","Q_Score":4,"Tags":"android,python-2.7,sqlite,apk,kivy","A_Id":20856571,"CreationDate":"2013-12-31T11:14:00.000","Title":"Update apk file on Google Play","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I want to publish an Android application that I have developed but have a minor concern.\nThe application will load with a database file (or sqlite3 file). If updates arise in the future and these updates are only targeting the application's functionality without the database structure, I wish to allow users to keep their saved entries in their sqlite3 files.\nSo what is the best practice to send updates? Compile the apk files with the new updated code only and without the database files? Or is there any other suggestion?\nPS: I am not working with Java and Eclipse, but with python for Android and the Kivy platform which is an amazing new way for developing Android applications.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":487,"Q_Id":20856465,"Users Score":0,"Answer":"I had the same issue when I started my app but since kivy has no solution for this I tried to create a directory outside my app directory in android with a simple os.mkdir('..\/##') and I put all the files there. Hope this helps!","Q_Score":4,"Tags":"android,python-2.7,sqlite,apk,kivy","A_Id":46767741,"CreationDate":"2013-12-31T11:14:00.000","Title":"Update apk file on Google Play","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I want to call a python\/pygame program from inside another. I do this with the os.startfile(minigame1) command. But when the program launches it first runs a python command line window and then opens the minigame in a seperate window. How can I make both programs share the same pygame window? Thank you in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":296,"Q_Id":20861890,"Users Score":0,"Answer":"If it is at all possible for two instances of a Pygame program to share a common display, then try using pygame.display.get_surface() to get the display surface- this will return None if the display isn't already initialized.\nAnother issue you will have to overcome in your project is the fact that calling pygame.event.get() (or a similar method) in one program will hide it from the other, so you will have to share the pygame.event.Events between the two programs.\nThis would only work if you can get the two programs to share the same window though; if Pygame's written so that separate Python processes will have separate Pygame windows, then I doubt you'll be able to get around that without changing up the Pygame source.","Q_Score":0,"Tags":"python,pygame","A_Id":20862261,"CreationDate":"2013-12-31T18:41:00.000","Title":"Two python\/pygame programs to run in the same window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm very new in the python world I know some about command line commands and gui commands.\nI've already succeeded in writing a working python script for Abaqus and now I want to add some GUI in it instead of changing the parameters in the text file everytime.\nI discovered GUI Toolkit but it seems to difficult, for two reasons: 1) it doesn't seem to be portable; 2) I don't really like the code written by someone else, especially because most of the times it adds things that I don't understand and gives me error that I can't fix, maybe because the GUI Toolkit interface is not complete.\nHere's my question.\nCan I use python tk GUI for abaqus? Is there anyone who has tried it and can share some simple codes.\nThanks for the help","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3171,"Q_Id":20883944,"Users Score":0,"Answer":"I have used tk GUIs with Abaqus but I find they don't ingrate that well and end up causing all sorts of strange errors (eg ignoring text input, windows hanging etc). If you are used to tk its not that much of a leap with the FX & AFX routines. I didnt know about RSG though and just had a quick play, liking it.","Q_Score":0,"Tags":"python,user-interface","A_Id":29543626,"CreationDate":"2014-01-02T13:20:00.000","Title":"Is it possible to use python GUI instead of Abaqus GUI Toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm very new in the python world I know some about command line commands and gui commands.\nI've already succeeded in writing a working python script for Abaqus and now I want to add some GUI in it instead of changing the parameters in the text file everytime.\nI discovered GUI Toolkit but it seems to difficult, for two reasons: 1) it doesn't seem to be portable; 2) I don't really like the code written by someone else, especially because most of the times it adds things that I don't understand and gives me error that I can't fix, maybe because the GUI Toolkit interface is not complete.\nHere's my question.\nCan I use python tk GUI for abaqus? Is there anyone who has tried it and can share some simple codes.\nThanks for the help","AnswerCount":3,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":3171,"Q_Id":20883944,"Users Score":3,"Answer":"I am no expert in the topic, but I do have some experience with writing plug-ins for Abaqus. \nYou may want to look into using the RSG (Really Simple GUI) Dialogue Builder. It is under the plug-ins options on the Abaqus toolbar. \nThe RSG is a GUI for building GUIs based on Abaqus's customized version of the FOX Toolkit. It is limited compared to programming the GUI yourself, but has plenty of options for creating some useful plug-ins. I generally start writing a plug-in by using the RSG to develop the base layout of my GUI. If there are options that I wish to include in my GUI that are not included in the RSG, I just edit the python files generated by the RSG. \nResponding to your original question about whether or not you can use tk in Abaqus; I have run scripts in Abaqus that calls for the tk file browser and it has worked successfully. I don't see why you wouldn't be able to register the plug-in using the FOX Toolkit and then call tk to open a GUI.\nHope this helps. I know this is an old question, but the responses were weak. Additionally, I know how hard it can be to find good help\/information on Abaqus scripting.","Q_Score":0,"Tags":"python,user-interface","A_Id":24072899,"CreationDate":"2014-01-02T13:20:00.000","Title":"Is it possible to use python GUI instead of Abaqus GUI Toolkit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed the SimpleCv on my raspberryPi and the driver to use the camera board with it (uv4l driver) and now I'd like to play with it. \nWhen I type on simpleCV shell \"Camera(0).getImage().save(\"foo.jpg\") \" , on the screen appears the camera preview and I am not able to type other command because this preview covers the shell\nWhat Have I to do to remove the camera preview ? \nThanks a lot !\nFilippo","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3614,"Q_Id":20891900,"Users Score":3,"Answer":"Try the nopreview option\npkill uv4l\nuv4l --driver raspicam --auto-video_nr --encoding yuv420 --width 320 --height 240 --nopreview\nexport LD_PRELOAD=\/usr\/lib\/uv4l\/uv4lext\/armv6l\/libuv4lext.so\nHope that helps","Q_Score":0,"Tags":"python,linux,opencv,raspberry-pi,simplecv","A_Id":20910789,"CreationDate":"2014-01-02T21:07:00.000","Title":"How remove camera preview to raspberry pi","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There's one file which is run with Python33, it has this line of code: \n`os.startfile(r'rungame\\xsim.py')`\nThat opens up a file in Python32, called xsim.py, and that works fine. However, xsim, which uses pygame modules, does not run as it would usually run. It cannot load its images when accessed this way, the first image is 'winp.png', and it is in the same folder as xsim.py (rungame). Here is the code which loads it:\n`pygame.display.set_icon(pygame.image.load('winp.png'))`","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":56,"Q_Id":20914146,"Users Score":0,"Answer":"The problem has been fixed. The current working directory was the location of the first file, not the file in need of the pictures which was inside the folder 'rungame', so that is where it looked for winp.png when no path was specified.","Q_Score":0,"Tags":"python,path,pygame","A_Id":20914612,"CreationDate":"2014-01-03T22:50:00.000","Title":"Pygame image loading error when accessing Python through another Python file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Not sure what else to call 'active'.  Is it possible to have the scrollbar, once clicked on to remain 'active'?  Another words once I click on the scrollbar I would like to be able to move the scrollbar with the keyboard(left\/right arrow keys) or the mouse.  Is this possible?  If so what do I have to do to accomplish it?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":536,"Q_Id":20939891,"Users Score":1,"Answer":"Technically it should be possible, by giving the scrollbar the keyboard focus and then adding some custom bindings. That's a fairly unusual thing to do. Since the scrollbars are drawn with native widgets on Windows and the Mac, it might be impossible on those platforms. \nWhat you probably want to do instead is set some bindings on the application as a whole, or on some sort of widget that typically gets focus such as a canvas or text widget. Your bindings can call the xview and yview commands and give it arguments to tell it how to scroll, which is exactly what the scrollbar does.","Q_Score":0,"Tags":"python,tkinter","A_Id":20940725,"CreationDate":"2014-01-05T22:13:00.000","Title":"Python tkinter scrollbar active state","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for a PyQt5 tutorial. It is rather complicated to start GUI development with Python for the first time without a tutorial.\nI only found some PyQt4 tutorials so far, and since something changed from Qt4 to Qt5, for example the fact SIGNAL and SLOT are no more supported in Qt5, it would be nice to have specific tutorials for PyQt5.\nCan someone please provide a tutorial on how to start GUI development with PyQt5?","AnswerCount":3,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":57823,"Q_Id":20996193,"Users Score":29,"Answer":"Been looking for PyQt5 tutorials for some time? Look no further! You won't find many around the internet. \nNot really tutorials, but pretty self-explanatory basic scripts under the following path:\n\n\/python\/lib\/site-packages\/PyQt5\/examples \n\nyou will find about 100 examples in 30 folders ranging from beginner to advanced, covering basic windows, menus, tabs, layouts, network, OpenGL, etc.","Q_Score":65,"Tags":"python,user-interface,qt5,pyqt5","A_Id":21359084,"CreationDate":"2014-01-08T12:51:00.000","Title":"Is there a tutorial specifically for PyQt5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I downloaded the sources for Android NDK from the git repository, I noticed that the sources for perl and python are bundled with the other dependencies: what are this 2 interpreters for ?\nDoes this means that I can build python for Android with the NDK ? Or that if I have a python application I can port it to Android with the NDK ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":155,"Q_Id":21006620,"Users Score":2,"Answer":"Python and perl are used internally by NDK tools to make the cross-compile environment more friendly. You only need them on the host. NDK can be built for Windows, Mac, or Linux. So the git repository contains all opensource that is required to compile NDK for any of these platforms.","Q_Score":1,"Tags":"android,python,git,perl,android-ndk","A_Id":21015004,"CreationDate":"2014-01-08T21:12:00.000","Title":"Why do I get python and perl with the NDK sources?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to get the channel of wx.bitmap. I use the function GetDepth. It return 24 all the time , even if I pass a 8depth gray image","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":38,"Q_Id":21013186,"Users Score":0,"Answer":"I use PIL(python image library)'s mode to judge the channels","Q_Score":0,"Tags":"python,wxpython","A_Id":21225163,"CreationDate":"2014-01-09T06:35:00.000","Title":"How to get the channel of a image by wx.bitmap","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The question is pretty much in the title, not much to add here.  I'm trying to allow the user to dynamically size multi-line text controls just as they can re-size the panel (I set the default, but they are free to change it).  Can this be done?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":119,"Q_Id":21047039,"Users Score":2,"Answer":"Take a look at wx.lib.resizewidget and the ResizeWidget sample in the demo.","Q_Score":0,"Tags":"python,wxpython","A_Id":21067422,"CreationDate":"2014-01-10T14:37:00.000","Title":"Is there a way to allow the user to re size a text control in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am reading through \"Making games with Python & Pygame\" and I have noticed that because the author uses lots of functions with drawing in to break his code up, he uses lots of globals  such as GRIDSIZE or BACKGROUNDCOLOR. I was always told that globals were generally bad, but without them, every drawing function would have ten more, repeating parameters - and I have also been told that repetition is bad. I wondered, then, is the author is correct in using globals for parameters that appear in most (drawing) functions, or should have just used more, repetitive parameters.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":189,"Q_Id":21054775,"Users Score":1,"Answer":"Example code in books is not the same as production code\nCode in books and articles explaining things do things to keep to the point and not inundate the reader with what might be noise or tangents to the specific topic.\nThe author is taking short cuts to keep the code as specific to the problem they are explaining as possible.\nThat said, there are better ways to do what they are doing than using module level variables. Even in books and tutorials.\nHuge State Machines are Bad\nVariables that encompass too much scope, no matter what level they are at, tend to have the side effect of creating invisible side effects that manifest themselves from the huge state machine that the application becomes.\nExcessive parameters to functions is a code smell\nIt should tell you that you probably need to encapsulate your data better. Multiple related parameters should be grouped into a single data structure and just pass that single data structure as a parameter.","Q_Score":2,"Tags":"python,pygame","A_Id":21054996,"CreationDate":"2014-01-10T21:32:00.000","Title":"Globals vs Parameters for Functions with the Same Parameters","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am reading through \"Making games with Python & Pygame\" and I have noticed that because the author uses lots of functions with drawing in to break his code up, he uses lots of globals  such as GRIDSIZE or BACKGROUNDCOLOR. I was always told that globals were generally bad, but without them, every drawing function would have ten more, repeating parameters - and I have also been told that repetition is bad. I wondered, then, is the author is correct in using globals for parameters that appear in most (drawing) functions, or should have just used more, repetitive parameters.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":189,"Q_Id":21054775,"Users Score":1,"Answer":"Constant globals can be OK, despite whatever general warnings you may have heard.\nIn Python \"constant\" means \"named in capital letters as a hint that nobody should modify them\", and \"globals\" means \"module-level variables\", but the principle still applies. So hopefully GRIDSIZE and BACKGROUNDCOLOR are constant for the duration of the program, but it's possible they are not: I haven't seem the code.\nThere are plenty of examples of module-level constants in the standard Python libraries. For example errno contains E2BIG, EACCESS, etc. math contains math.pi.\nHowever, those examples are even more constant than GRIDSIZE. Presumably it could change between different runs of the same program, which math.pi will not. So you need to assess the consequences of this particular global, and decide whether to use it or not.\n\nI was always told that globals were generally bad\n\nBad things are bad for reasons, not \"generally bad\". In order to decide what to do you need to understand the reasons. Using globals (or, in Python, module-scope objects) causes certain problems:\n\ndependencies on previously-executed code: this is the worst problem, but it applies only to mutable globals.\n\nIf you use a global that can be modified elsewhere, then in order for someone reading the code to reason about its current value they might need to know about the whole program, because any part of the program might access the global. If you keep your mutables in an object that only parts of your code ever get to see, then you only have to reason about those parts of your code that interact with that object.\nThis might not sound like a big difference if your program is one file that's 100 lines long, but it becomes one eventually. Making your code easy to work with is almost all about making it easy for a reader to reason about what the code does. What else can affect it is a big part of that, so this is important. And \"a reader\" is you, next time you want to change something, so helping out \"readers\" of your code is pure self-interest. \n\ndependencies on concurrently-executing code: mutable globals + threads = needs locks = effort.\nhidden dependencies: this is applicable even for constants.\n\nYou have to decide whether it's OK for this bit of code to have some dependencies that are not supplied as parameters (\"injected\") by the caller of that code.\nAlmost always the answer to this question is \"yes\". If it is \"absolutely not\" then you're in a tight spot if you dislike lots of parameters, because you wouldn't even use Python builtins by name, let alone names from modules the code imports. Having decided that it's OK to have hidden dependencies, you have to think about the consequences of GRIDSIZE being one of them, on the way you use and especially test the code. Provided that you don't want to draw on different-sized grids in the same program you're basically fine until you want to write tests that cover lots of different values of GRIDSIZE. You'd do that to give yourself confidence now that when you change GRIDSIZE later nothing will break.\nAt that point you'd probably want to be able to provide it as a parameter. For this reason you might find it more useful to have parameters with defaults rather than global values. To prevent long repetitive parameter lists you might pass around one object that combines all of these settings rather than each separately. Just beware of creating an object with multiple unrelated purposes, because the others are distracting if you want to reason about just one.\n\nnamespace pollution: relevant in C, if you don't use static then two completely unrelated files cannot have different functions of the same name. Not so relevant in Python where everything is in namespaces.","Q_Score":2,"Tags":"python,pygame","A_Id":21056248,"CreationDate":"2014-01-10T21:32:00.000","Title":"Globals vs Parameters for Functions with the Same Parameters","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am reading through \"Making games with Python & Pygame\" and I have noticed that because the author uses lots of functions with drawing in to break his code up, he uses lots of globals  such as GRIDSIZE or BACKGROUNDCOLOR. I was always told that globals were generally bad, but without them, every drawing function would have ten more, repeating parameters - and I have also been told that repetition is bad. I wondered, then, is the author is correct in using globals for parameters that appear in most (drawing) functions, or should have just used more, repetitive parameters.","AnswerCount":5,"Available Count":4,"Score":0.0399786803,"is_accepted":false,"ViewCount":189,"Q_Id":21054775,"Users Score":1,"Answer":"In Python you don't have as big a problem with globals, because Python globals are at the module level. (So global is a bit of a misnomer anyway.) It's fine to use module-level globals under many circumstances where true globals would be inappropriate.","Q_Score":2,"Tags":"python,pygame","A_Id":21054846,"CreationDate":"2014-01-10T21:32:00.000","Title":"Globals vs Parameters for Functions with the Same Parameters","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am reading through \"Making games with Python & Pygame\" and I have noticed that because the author uses lots of functions with drawing in to break his code up, he uses lots of globals  such as GRIDSIZE or BACKGROUNDCOLOR. I was always told that globals were generally bad, but without them, every drawing function would have ten more, repeating parameters - and I have also been told that repetition is bad. I wondered, then, is the author is correct in using globals for parameters that appear in most (drawing) functions, or should have just used more, repetitive parameters.","AnswerCount":5,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":189,"Q_Id":21054775,"Users Score":0,"Answer":"It depends on the situation.\nGlobals are not generally bad, but should be avoided if not absolutely necessary.\nFor example, constants are perfectly ok as globals, while configuration data should be bundled (encapsulated) as much as possible.\nIf you concentrate all such data onto one (or few) objects, you either might want to have the named functions as methods of the objects's class(es), or you might want to access these objects from within these functions.\nAt the end, it is a matter of taste. If you think that things are handlable in a convenient way, let it be as it is. If it looks like confusion, better change it.","Q_Score":2,"Tags":"python,pygame","A_Id":21054871,"CreationDate":"2014-01-10T21:32:00.000","Title":"Globals vs Parameters for Functions with the Same Parameters","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"At the moment I'm using Visual Studio 2012 Professional with Python Tools to program application for my Raspberry Pi. For the moment this is a brilliant combination, because the application can also run on a Windows computer and debug it while in development. After I'm at a point that the application can run on my Pi then I will move the files to the Pi and run it there.\nAlthough today I received a GPIO cable and this open new possibilities to use buttons and controle lightswitches, thus fun stuff. But! Now the problem, on my Windows machine I can use the GPIO library and not see the results of the application, what happens if I push this button, what happens in the code, I really want to debug this and also when using in a bigger application. Everytime moving the files to the Pi and testing them there is not a option.\nIs there a application that can simulate the GPIO interface of the Pi on my Windows machine so I can test\/debug the application while developing?","AnswerCount":1,"Available Count":1,"Score":-0.3799489623,"is_accepted":false,"ViewCount":3513,"Q_Id":21064985,"Users Score":-2,"Answer":"The nusbio device can give 8 gpios for your Windows machine directly avaialble for .NET languages.","Q_Score":1,"Tags":"python,visual-studio,raspberry-pi,gpio","A_Id":34752703,"CreationDate":"2014-01-11T16:45:00.000","Title":"Program Raspberry PI GPIO on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a form (wx.Frame) in which the widest element is the toolbar (created with toolbar = self.CreateToolbar() and toolbar.Realize()). I want the width of the form to be such that every toolbar item is shown. I don't see the toolbar changing after creation, but I'd prefer if that could be handled. Any suggestions?\n(I'm running Python 2.7, with non-Phoenix wxPython)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":135,"Q_Id":21074285,"Users Score":0,"Answer":"You'll have to figure out what the width of a toolbar item is. Then you can take that number and multiply it by the number of toolbar items and set the frame's size appropriately. \nThen when you add or remove a toolbar item, part of that process will be to update the size of the frame (SetSize()). You will probably need to call the frame's Layout() method after adding\/removing the widget. You may also need to call Refresh().","Q_Score":0,"Tags":"python-2.7,user-interface,wxpython","A_Id":21093804,"CreationDate":"2014-01-12T11:52:00.000","Title":"Set width of wxPython Frame based on toolbar width","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a listbox on a GUI in Tkinter. I would like to implement a routine where if a listbox item is selected a function is called (based on this selection) to modify the gui (add another adjacent listbox). Then if that selection changes, the gui reverts back to its default view. Can this be done? Seems you would need to associate a function to a listbox selection, not sure how to do this or if its possible... Does anyone have the secret? \nIts possible to add \"select\" buttons to the bottom of my listbox, but I wanted to avoid this extra work for user and save space on the GUI.\nThanks to all in advance! Daniel","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1733,"Q_Id":21078720,"Users Score":0,"Answer":"The listbox will fire the virtual event <<ListboxSelect>> whenever the selection changes. If you bind to it, your function will be called whenever the selection changes, even if it was changed via the keyboard.","Q_Score":0,"Tags":"python,listbox,tkinter","A_Id":21079948,"CreationDate":"2014-01-12T18:40:00.000","Title":"Calling a function based on a Listbox current selection \"curselection()\" in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"It looks like developing GUI applications in HTML+JS with python in the background would be really nice.  I see node-webkit.  I also see that there are python bindings for webkit.  It just seems like it's an order of magnitude more difficult to set up than python\/tkinter - and I couldn't find win7 support.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1465,"Q_Id":21114655,"Users Score":2,"Answer":"Maybe what you are looking for is Pyjs, is not entirely build to do that, but that's the nearest thing to it I have found.","Q_Score":7,"Tags":"python,node-webkit","A_Id":21965786,"CreationDate":"2014-01-14T13:23:00.000","Title":"Is there a python version of node-webkit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A quick question that may seem out of the ordinary. (in reverse)\nInstead of calling native code from an interpreted language; is there a way to compile Java or Python code to a .dll\/.so and call the code from C\/C++?\nI'm willing to accept even answers such as manually spawning the interpreter or JVM and force it to read the .class\/.py files. (is this a good solution?)\nThank you.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":253,"Q_Id":21171607,"Users Score":0,"Answer":"You can also look into Lua, while not as widely used as a lot of other scripting languages, it was meant to be embedded easily into executables. It's relatively small and fast. Just another option. If you want to call other languages from your c\/c++ look into SWIG.","Q_Score":0,"Tags":"java,python,c++,c,dll","A_Id":21177883,"CreationDate":"2014-01-16T19:58:00.000","Title":"Dynamic Link Library for Java\/Python to access in C\/C++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do you get width and height of an image imported into pygame. I got the size using:\n    Surface.get_size\n, but I dont know how to get the width and height.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":7226,"Q_Id":21209496,"Users Score":5,"Answer":"There are 2 methods available for getting the width and height of a surface.\nThe first one is get_size(), it returns a tuple (width,height). To access width for instance, you would do: surface.get_size()[0] and for height surface.get_size()[1].\nThe second method is to use get_width(), and get_height(), which return the width and the height.\nI suggest going through the python tutorial, to learn more about basic data structures such as tuples.","Q_Score":1,"Tags":"python-3.x,pygame","A_Id":21209675,"CreationDate":"2014-01-18T20:31:00.000","Title":"Getting width and height of an image in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The issue:\nI have written a ton of code (to automate some pretty laborious tasks online), and have used the mechanize library for Python to handle network requests. It is working very well, except now I have encountered a page which I need javascript functionality... mechanize does not handle javascript.\nProposed Solution:\nI am using PyQt to write the GUI for this app, and it comes packaged with QtWebKit, which DOES handle javascript. I want to use QtWebKit to evaluate the javascript on the page that I am stuck on, and the easiest way of doing this would be to transfer my web session from mechanize over to QtWebKit.\nI DO NOT want to use PhantomJS, Selenium, or QtWebKit for the entirety of my web requests; I 100% want to keep mechanize for this purpose. I'm wondering how I might be able to transfer my logged in session from mechanize to QtWebKit.\nWould this work?\n\nTransfer all cookies from mechanize to QtWebView\nTransfer the values of all state variables (like _VIEWSTATE, etc.) from mechanize to QWebView (the page is an ASP.net page...)\nChange the User-Agent header of QWebView to be identical to mechanize...\n\nI don't really see how I could make the two \"browsers\" appear more identical to the server... would this work? Thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":384,"Q_Id":21221141,"Users Score":0,"Answer":"Since nobody answered, I will post my work-around.\nBasically, wanted to \"transfer\" my session from Mechanize (the python module) to the QtWebKits QWebView (PyQt4 module) because the vast majority of my project was automated headless, but I had encountered a road block where I had no choice but to have the user manually enter data into a possible resulting page (as the form was different each time depending on circumstances).\nInstead of transferring sessions, I met this requirement by utilizing QWebViews javascript functionality. My method went like this:\n\nLoad page in Mechanize, and save the downloaded HTML to a local temporary file.\nLoad this local file in QWebView.\nThe user can now enter required data into the local copy of this page.\nLocate the form fields on this page, and pull the data the user entered using javascript. You can do this by getting the main frame object for the page (QWebView->Page()->MainFrame()), and then evaluating javascript code to accomplish the above task (use evaluateJavaScript()).\nTake the data you have extracted from the form fields, and use it to submit the form with the connection you still have open with mechanize.\n\nThat's it! A bit of a work-around, but it works none-the-less :\\","Q_Score":1,"Tags":"javascript,python,asp.net,pyqt,qtwebkit","A_Id":21532850,"CreationDate":"2014-01-19T18:57:00.000","Title":"Python - Transferring session between two browsers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"How can I set a suitable fps number in pygame for any kind of monitor running my game? I know I can set fps using pygame.time.Clock().tick(fps) but how can I set suitable fps?\nPlease post example python code along with answer.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":603,"Q_Id":21234884,"Users Score":2,"Answer":"I'm not entirely sure that I understand the question being asked, but I think you will just have to experiment with different numbers and find out what works for you.  I find that around 50-100 is a good range.\nIf what you are trying to do is make game events only update a certain number of times per second while rendering happens as fast as the computer is able to handle it, this is a very complex process and probably not very easily done in pygame.","Q_Score":0,"Tags":"python-2.7,pygame,frame-rate","A_Id":21239429,"CreationDate":"2014-01-20T13:02:00.000","Title":"How to set fps in pygame in order to prevent lag?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have recently published an Android application on Google Play written in Python\/Kivy. Normally the \"build.py\" script would wrap the whole project files into one single folder that is the application package folder. But if i check the content of this package on my phone after the installation of the apk i can find the \"android.txt\" file, the \".kv\/.kv~\" file and the \".py~\"*and *\"pyo\" files.\nMy question is: is this safe to expose the source code files or is there something that i am missing in the compilation of my project ? What is annoying me more are the temporary files *.kv~ and .py~ that are exposing the whole project source code.*\nBut i should mention the gratitude and the respect i have for the Kivy project and the Kivy team. Their efforts allowed me to build and publish a nice Android application with Python that i am really proud of. Thank you so much Kivy team.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1365,"Q_Id":21252729,"Users Score":3,"Answer":"I have recently published an Android application on Google Play written in Python\/Kivy\n\nCongratulations. May I ask what app it is?\n\nMy question is: is this safe to expose the source code files or is there something that i am missing in the compilation of my project ? What is annoying me more are the temporary files .kv~ and .py~ that are exposing the whole project source code.\n\nAs TwilightSun has explained, some of these files are editor backups, which you can remove or exclude from the apk by modifying your buildozer.spec file or the equivalent python-for-android commands if using that directly.\nHowever, more generally, if you are serious about obfuscating your code you will want to take further steps. I'm no expert, but probably this would include things like moving your kv code to a python file (with Builder.load_string) and compiling your whole project with cython. The resulting binaries will be harder to decompile than the python .pyo bytecode that is included by default.","Q_Score":3,"Tags":"android,python,kivy","A_Id":21260736,"CreationDate":"2014-01-21T08:24:00.000","Title":"How to hide python code file and other related files in a kivy project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have recently published an Android application on Google Play written in Python\/Kivy. Normally the \"build.py\" script would wrap the whole project files into one single folder that is the application package folder. But if i check the content of this package on my phone after the installation of the apk i can find the \"android.txt\" file, the \".kv\/.kv~\" file and the \".py~\"*and *\"pyo\" files.\nMy question is: is this safe to expose the source code files or is there something that i am missing in the compilation of my project ? What is annoying me more are the temporary files *.kv~ and .py~ that are exposing the whole project source code.*\nBut i should mention the gratitude and the respect i have for the Kivy project and the Kivy team. Their efforts allowed me to build and publish a nice Android application with Python that i am really proud of. Thank you so much Kivy team.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1365,"Q_Id":21252729,"Users Score":1,"Answer":"Those files may be editor backups which kivy doesn't recognize. \nYou can edit the build.py and add some patterns to BLACKLIST_PATTERNS. For your issue, you should add '*~' to the black list.","Q_Score":3,"Tags":"android,python,kivy","A_Id":21253288,"CreationDate":"2014-01-21T08:24:00.000","Title":"How to hide python code file and other related files in a kivy project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"While doing a breaf research on IronPython I got confused about it's execution model and how it integrates with C#.\nCan you please point, which of these assumptions are wrong:\n\nIronPython is Not compiled Ahead of time ( into a clr exe|dll\nwith IL code) \nIronPython is distributed as script\nWhen executed, IronPython files are compiled at runtime into IL and then executed in a CLR AppDomain.\n\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":185,"Q_Id":21275131,"Users Score":3,"Answer":"You can use pyc.py to create an exe\/dll, but it's not well documented. Otherwise, you're basically right.","Q_Score":3,"Tags":"python,clr,ironpython","A_Id":21284660,"CreationDate":"2014-01-22T05:45:00.000","Title":"IronPython and Ahead-of-Time Compilation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can anyone give me a point in the right direction please?\nI've created a piece of Python code that creates a GUI.  One button opens a 'new window', but if I click on the same button again I get another 'new window', keep clicking and I've got multiple copies of the 'new window'.\nI want the original window to be unaccessible whilst the 'new window' is open, and then accessible again when I close the 'new window'.\nThanks in advance for any pointers.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":154,"Q_Id":21338613,"Users Score":2,"Answer":"You want to call grab_set() on your new window, which will prevent any events from going to the other window. When you're done, call grad_release()","Q_Score":0,"Tags":"python,user-interface,tkinter,window","A_Id":21338743,"CreationDate":"2014-01-24T17:20:00.000","Title":"Python - GUI creates new window, but the original window is still usable. How do I stop this","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a general way for zooming in\/out on a wx.Panel (all its content should be zoomed as well) ?\nIs it possible to define a new sizer type that would provide this feature ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":413,"Q_Id":21369120,"Users Score":1,"Answer":"No. The wx.Panel does not support this feature out of the box. The FloatCanvas widget does support panning and zooming though. You could use that widget instead. Of course, I think you will have to draw the items on it instead of using regular widgets.","Q_Score":0,"Tags":"python,wxpython","A_Id":21383591,"CreationDate":"2014-01-26T20:59:00.000","Title":"Zoom in\/out on a wx.Panel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've created a dynamic property in the Designer interface. How do I access this property in my code?\nI don't see any properties listed with the name I've provided. I've found a dynamicPropertyNames property that contains a QByteArray object and the name I provided, but I cannot figure out how to access the data I stored (nor do I know if this is even the correct place to be querying).\nThanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1777,"Q_Id":21395056,"Users Score":0,"Answer":"Just because I had a similar problem and the reason wasn't a wrong object: The property's content can be accessed with toString().","Q_Score":3,"Tags":"python,pyqt,qt-designer","A_Id":28092434,"CreationDate":"2014-01-28T01:12:00.000","Title":"How do I access a dynamic property in PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to display a chart that can be very large, for example the image resolution could be 100 000 x 1000. However, it seems like I am limited to 32768 x 32768 by the QImage.\nI can't reasonably redraw directly the chart at every paintEvent so I need to store it into a QImage (it could be a QPixmap that won't change anything). But then, it doesn't fit.\nMy first idea was:\n\nCreate a list of QImage\nPlot on the various QImage\nRedraw using the good QImages.\n\nThe first and last points have been done quite easily. But the second point is more complex. I'm quite confident that my approach would work but it requires to overload the basic paint methods (draw rectangle, circles, etc.) in order to be able to paint on multiple images.\nSo, before going any further, I would like to know what could be the other options.","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":622,"Q_Id":21462118,"Users Score":1,"Answer":"You can use the Qt Graphics View Framework. Create a QGraphicsView and a QGraphicsScene for it. Add items using QGraphicsScene::addPixmap (that returns QGraphicsPixmapItem which is derived from QGraphicsItem) and adjust their positions using QGraphicsItem::setPos. QGraphicsView will effectively draw your scene and handle scrolling and zooming if necessary.","Q_Score":1,"Tags":"python,c++,qt","A_Id":21467816,"CreationDate":"2014-01-30T16:33:00.000","Title":"Draw an image too big to fit into a QImage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to display a chart that can be very large, for example the image resolution could be 100 000 x 1000. However, it seems like I am limited to 32768 x 32768 by the QImage.\nI can't reasonably redraw directly the chart at every paintEvent so I need to store it into a QImage (it could be a QPixmap that won't change anything). But then, it doesn't fit.\nMy first idea was:\n\nCreate a list of QImage\nPlot on the various QImage\nRedraw using the good QImages.\n\nThe first and last points have been done quite easily. But the second point is more complex. I'm quite confident that my approach would work but it requires to overload the basic paint methods (draw rectangle, circles, etc.) in order to be able to paint on multiple images.\nSo, before going any further, I would like to know what could be the other options.","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":622,"Q_Id":21462118,"Users Score":2,"Answer":"You probably do not want to display more than one QImage of data at a time.  Few screens are more than 32k pixels wide or tall.\nSo you want an abstract type that produces QImages on request for reading, at offsets and possibly at different zoom factors.\nThe next problem is modifying this abstract type.  An easy to use, not maximally performance version consists of letting users blit QImages into your internal storage (whatever that is).\nThe user still has to \"tile\" their efforts, but can tile their efforts in ways that is convenient for them.\nA higher performance version exposes some of the underlying implementation, which we have not yet mentioned.\nA traditional implementation for large images is a tiled image.  You have a grid of image tiles that abut each other.  When someone asks for a blit from your image, you produce a temporary QImage, and blit the appropriate tiles onto it.  And when someone blits to you, you figure out what the appropriate tiles are, and write parts of that source QImage over parts of them.\nThe higher performance interface exposes these tiles.\nA low level interface lets the outside know where your tiles are, and lets them ask for them.  This is a poor interface.\nA better interface exposes a sub tile iterator.  They ask for a region, and you return a pair of iterators that describe the region.  The data in the iterators consists of either a tile and a region in that tile as well as the location this region is in the \"full image\", or a sub-tile object (with linestride, line length, etc) and the location of the sub-tile object.\nAnother good interface is a foreach style interface.  Again, the user of the big image class passes in a region they want to work with, but a callback as well.  That callback something similar to either one of the above results of the iterator dereference.\nThis approach has two large advantages over the iterator approach.  First, you can implement parallel image processing algorithms within your large image class.  Second, it is much easier to write than rolling your own iterator.\nOnce you have either of these, drawing is relatively easy.  Determine the region you are drawing on (be generous).  Iterate over the resulting tiles.  On each tile, draw after applying the offset of the tile to the drawing.","Q_Score":1,"Tags":"python,c++,qt","A_Id":21462850,"CreationDate":"2014-01-30T16:33:00.000","Title":"Draw an image too big to fit into a QImage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to display a chart that can be very large, for example the image resolution could be 100 000 x 1000. However, it seems like I am limited to 32768 x 32768 by the QImage.\nI can't reasonably redraw directly the chart at every paintEvent so I need to store it into a QImage (it could be a QPixmap that won't change anything). But then, it doesn't fit.\nMy first idea was:\n\nCreate a list of QImage\nPlot on the various QImage\nRedraw using the good QImages.\n\nThe first and last points have been done quite easily. But the second point is more complex. I'm quite confident that my approach would work but it requires to overload the basic paint methods (draw rectangle, circles, etc.) in order to be able to paint on multiple images.\nSo, before going any further, I would like to know what could be the other options.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":622,"Q_Id":21462118,"Users Score":0,"Answer":"You do realize that a 100,000 x 1000 RGBA QImage is 400MBytes? There's no point in wasting all that memory. Really, none.\nJust paint it every time, one request, in the paintEvent. Be clever about it so that you only paint what needs to be shown. I'd think one should focus on optimizing the painting process and your data structures so that it can be painted effectively.\nAt small scales (zoomed out), a lot can be gained by approximating\/decimating\/interpolating the data so that it looks the same, but you don't waste time painting the same pixel too many times.","Q_Score":1,"Tags":"python,c++,qt","A_Id":21469131,"CreationDate":"2014-01-30T16:33:00.000","Title":"Draw an image too big to fit into a QImage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was using Python to process some data (int array). It is very slow. So I put the processing function in a c++ DLL and talk with it through ctypes. The data are loaded from swig-wrapped modules (c++). I browsed almost everywhere but found nothing to convert swig object of type 'int *' pointer to ctypes int pointer. How can I do it?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":640,"Q_Id":21471470,"Users Score":0,"Answer":"It seems no solution to do that after a few attempts. A simple way to fix this problem is wrapping the c++ code with SWIG, so can pass it to other SWIG-wrapped modules.","Q_Score":0,"Tags":"python,c++","A_Id":21518936,"CreationDate":"2014-01-31T02:31:00.000","Title":"How to convert swig object of type 'int *' to ctypes int*","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Tkinter to create an application which requires a 0-9 numerical keypad to be built in to the UI.\nI plan to do this with 10 button widgets which enter the relevant number(s) into the currently selected Entry widget. \nI do not want to use one of the pre-made on-screen keyboards (e.g. Matchbox-keyboard) that are available, it needs to be bespoke to the application.\nSo essentially - how do I simulate key-press events using on-screen buttons to enter values into entry fields without taking the focus off the entry field?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1024,"Q_Id":21509623,"Users Score":0,"Answer":"You don't need to simulate keypresses if all you want to do is insert the numbers into the entry widget. Just have the buttons directly insert their value into the entry widget with the entry widget insert method.","Q_Score":0,"Tags":"python,tkinter,raspberry-pi,on-screen-keyboard","A_Id":21511280,"CreationDate":"2014-02-02T10:46:00.000","Title":"In Python (on Raspberry Pi) how do I create an embedded keypad within my Tkinter window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a PyQt program that's apart of package which is only about 9MB. This isn't much of a concern except that the Qt dependencies that get drawn in with it combined are closer to 100MB.\nSo my question is there any logical and safe way of including only portions of the Qt library that I could include in my package and then no longer include Qt as a dependency, or a smaller alternative to the enormous Qt library that would still be compatible with my code?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":223,"Q_Id":21514717,"Users Score":0,"Answer":"I can't think of a way of doing what you want, but if you are using a standard PyQt distro, standard practice is to leave it up to the user to download and install dependencies. This could be automated by having an install script part of your ISO, that determines if pyqt is needed and if not available fetches the pyqt from your site and installs it, or automatically downloads source from riverbank site and attempts to build automatically.","Q_Score":2,"Tags":"linux,qt,pyqt,size,python-2.x","A_Id":21546276,"CreationDate":"2014-02-02T18:50:00.000","Title":"Including only minimal Qt library with a program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm interested in creating my own programming language and I would like to use python. My question is, would a language written in Python using the PLY library be considerably slower than CPython or would they be about the same in terms of program execution speed?\nAlso in terms of performance how much better would it be if I implemented it in C?\nThanks,\nFrancis","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":243,"Q_Id":21540126,"Users Score":2,"Answer":"If you are implementing a compiler in PLY, the compilation may take longer - but that's irrelevant the execution speed of your program.\nFor example, you could use PLY to write a C compiler. The compiler may or may not be faster than your other C compiler, but the resulting executable should run at a similar speed (unless you miss a lot of optimisations etc.)","Q_Score":0,"Tags":"python,c,programming-languages,yacc,ply","A_Id":21540275,"CreationDate":"2014-02-03T23:39:00.000","Title":"Would a language written in Python using PLY be slow?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to draw as many as 86,000 (small circles) on a Tkinter Canvas. On average it will be more like 8,600 circles. At times as few as 400. All of the circles being drawn at once are the same (size , color). The radius of the circles is related to the number of circles being drawn (as little as 1-2px when there are many circles to draw), but a difference in radius has had little overall impact.\ncanvas.create_oval(px+r,py+r,px-r,py-r,fill='green') is quite expensive in computing time. Ideally I would pre-create the circle and paste copies of it on the canvas as needed.\nAt the moment calling canvas.create_oval(...) 86,000 times takes almost 20 seconds. (The logic that decides what circle to draw where itself runs in less than 100 msec.)\nHow would I go about copying a single circle instead of creating them all individually?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":165,"Q_Id":21556454,"Users Score":1,"Answer":"I don't think there's anything you can do to speed up the creation of circles. The canvas wasn't designed to handle 80,000 objects, and it doesn't support the ability to copy and paste items (beyond simply creating new objects with the same coordinates). It handles a few thousand OK, and even 10,000 is pretty performant on my machine, but 86,000 items is a lot.\nYou might try creating a single image of the given size (or have pre-computed images). You can have a single PhotoImage instance that you use to create all of the images on the canvas. On my machine I can create 100,000 image objects on a canvas in just a couple of seconds. deleting that many objects, however, is still quite slow.","Q_Score":1,"Tags":"python,tkinter,tkinter-canvas","A_Id":21558520,"CreationDate":"2014-02-04T15:25:00.000","Title":"Making logs of circles quickly with Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"if I am not wrong wxMenuITem does not support tooltips\nis there an easy turn around to show a popup tooltip of help upon mouse focus on a menu item for a sec or 2 ?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":225,"Q_Id":21613027,"Users Score":1,"Answer":"You need to realize that wxPython wraps the native widgets of the OS that it is running on, so if that underlying widget does not support the desired behavior, then wxPython will not either.\nIt should be noted, however, that you would normally update the StatusBar with information about the menu items. That is how the wxPython demo for the menus works. In said demo, there is a binding to wx.EVT_MENU_HIGHLIGHT_ALL that is used to update the StatusBar. You might be able to use that event to add a tooltip. \nAlternatively, you might want to check out FlatMenu, which is a pure Python implementation of the wx.Menus. As such, you can easily add new behavior compared with trying to update something that is a wrapped C++ widget.","Q_Score":1,"Tags":"python-2.7,wxpython","A_Id":21630518,"CreationDate":"2014-02-06T20:11:00.000","Title":"how to set wxTooltip or tooltip like on wxMenuItem","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I recently spent some time working out how to use a QDataStream with a QTreeWidget in PyQt.  I never found specific examples for doing exactly this, and pyqt documentation for QDataStream seems to be pretty scarce in general.  So I thought I'd post a question here as a breadcrumb trail in case someone else down the line needs a hint.  I'll wait a bit in case someone would like to jump in and take a shot at it, and I'll post back in a bit with my own efforts.\nThe question is: In PyQt, how can I use a QDataStream to save QTreeWidgetItems to a file as native QT objects, and then read the file back to restore the tree structure exactly as it was saved?\nEric","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2494,"Q_Id":21653108,"Users Score":0,"Answer":"The QTreeWidget is a red herring. What you are saving is a generic QAbstractItemModel (treeWidget->model()) - after all, a QTreeWidget is a view, and has a built-in model. Now, those model's items are simply QVariants, and those are simply Python types, but also fully supported by QDataStream::operator<<. All you need is to choose a tree traversal (depth-first, breadth-first, or something else), and dump the items and their depth in the tree to the stream. When you read the stream, that's sufficient information to reconstruct the tree.","Q_Score":4,"Tags":"python,qt,python-2.7,pyqt,pyqt4","A_Id":21654212,"CreationDate":"2014-02-08T23:30:00.000","Title":"PyQt: Saving native QTreeWidgets using QDataStream","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a text editor with autocompletion feature. What I need is somehow get the text which is selected by mouse (case #1) or just a word under cursor(case #2) to compare it against a list of word I want to be proposed for autocompletion. By get I mean return as a a string value.\nCan it be done with tkinter at all? I'm not familiar with qt but I'll try to use it if the feature can be achieved with it.","AnswerCount":2,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":1225,"Q_Id":21675320,"Users Score":-2,"Answer":"You can use QTextEdit::cursorForPosition to get a cursor for mouse position. After that you can call QTextCursor::select with QTextCursor::WordUnderCursor to select the word and QTextCursor::selectedText to get the word.","Q_Score":3,"Tags":"python,qt,autocomplete,tkinter","A_Id":21675660,"CreationDate":"2014-02-10T10:59:00.000","Title":"How do I return word under cursor in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to Qt and developing with python. \nWould a python application developed using Qt framework and PyQt require the entire Qt framework to be installed on a user's machine in order to run a \"exe\" version of the application created with something like p2exe? Or would py2exe copy the required Qt framework components into the application that it creates?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":477,"Q_Id":21699483,"Users Score":-1,"Answer":"No need for further install. \ne.g. Py2exe will copy everything needed. \nIf you have some special requirement you may have to copy other stuff manually. In my application I copy some extra ddls, some ico files and some matplotlib files.","Q_Score":1,"Tags":"python,qt,pyqt","A_Id":21699872,"CreationDate":"2014-02-11T10:39:00.000","Title":"Do Frozen PyQt applications need the Qt to be installed on client machines","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to Qt and developing with python. \nWould a python application developed using Qt framework and PyQt require the entire Qt framework to be installed on a user's machine in order to run a \"exe\" version of the application created with something like p2exe? Or would py2exe copy the required Qt framework components into the application that it creates?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":477,"Q_Id":21699483,"Users Score":1,"Answer":"I don't know what you mean by \"frozen\" but if your question is whether you can create an \"exe\" for a pyqt python script without installing python and pyqt on user machine then answer is yes. As with any other exe you don't need to install anything on user machine.\nI have created a few application using pyqt and converted them to exe using pyinstaller-2.0 and it works fine on any machine. Same is true with py2exe.","Q_Score":1,"Tags":"python,qt,pyqt","A_Id":21699917,"CreationDate":"2014-02-11T10:39:00.000","Title":"Do Frozen PyQt applications need the Qt to be installed on client machines","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Twisted application that someone else wrote. There is a file run.py which makes it run in the foreground. There is also a twistd plugin named as service.tac that makes it run in the background. Around 90% of the code is the same in both the .py and .tac file.\nIs it possible to combine the two together? Or is that a bad idea?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":441,"Q_Id":21708441,"Users Score":4,"Answer":"You can run the tac file in the foreground: twistd -n -y service.tac.\nSo perhaps you can just delete the run.py file.","Q_Score":3,"Tags":"python,twisted","A_Id":21709158,"CreationDate":"2014-02-11T17:11:00.000","Title":"Right approach for running a Twisted application in the foreground or background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using windows 8 (not yet updated to 8.1)\nThe code I am using is\n\nimport ctypes\nSPI_SETDESKWALLPAPER = 20\nctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, \"word.jpg\", 0)\nprint \"hi\"\n\nFor some reason regardless if i give it a valid image (in the same directory as program) or not, regardless of type of image (bmp, gif, jpg) the code always ends up setting my background to a black screen.\nWhy is this? How can it be fixed?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":1203,"Q_Id":21718701,"Users Score":2,"Answer":"Try passing SPIF_SENDCHANGE (which is 2) as the last parameter. You might also need to bitwise-or it with SPIF_UPDATEINIFILE (which is 1).","Q_Score":1,"Tags":"windows,python-2.7,ctypes","A_Id":21718853,"CreationDate":"2014-02-12T04:30:00.000","Title":"How to Change Windows background using Python 2.7.3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using windows 8 (not yet updated to 8.1)\nThe code I am using is\n\nimport ctypes\nSPI_SETDESKWALLPAPER = 20\nctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, \"word.jpg\", 0)\nprint \"hi\"\n\nFor some reason regardless if i give it a valid image (in the same directory as program) or not, regardless of type of image (bmp, gif, jpg) the code always ends up setting my background to a black screen.\nWhy is this? How can it be fixed?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1203,"Q_Id":21718701,"Users Score":0,"Answer":"Sorry, I know this is late, but the problem is that you need to include the path. Instead of \"image.jpg\" do r\"C:\\path to file\\image.jpg\" Otherwise python doesn't know where to look for the image.","Q_Score":1,"Tags":"windows,python-2.7,ctypes","A_Id":26006082,"CreationDate":"2014-02-12T04:30:00.000","Title":"How to Change Windows background using Python 2.7.3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to integrate a complex python application (with a custom python interpreter shipped along) for OSX. In order to handle a set of issues due to cross platform requirements, I created a .app bundle pointing at a shell script with its CFExecutable entry in Info.plist. This works, and the invoked shell script starts up the actual application binary. However, I have the following problems:\n\nThe .app icon bounces endlessly on the dock, never reaching the \"activated\" status. I guess it's because the shell script does not terminate. This dock entry has the correct \"application icon\"\nWhen the binary executable is invoked by the script, a new Dock entry appears with a generic python icon. This icon successfully starts up and stops bouncing as the application starts up.\nWhen I try to kill the first Dock entry via Force quit, the actual application still keeps running, as it's clearly controlled by the second entry on the dock.\n\nIs there a way to have this setup behave more naturally? Do I need to ditch shell script for an objective C wrapper? If I have to use a obj-C wrapper (instead of a shell script) to spawn my application, how can I prevent the same spawning of a secondary icon to happen?\nEdit: note, I am not running a python script. I am running a custom made python interpreter. py2app is not what I need.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":138,"Q_Id":21755235,"Users Score":0,"Answer":"I solved the problem, and in hindsight it was rather trivial. In the shell script, I need to invoke my binary with exec, so that the running bash process is replaced (a la execve()) rather than spawning a new process. The only problem is that my interpreter now replaces the icon with the stock one, but I have only one icon in the dock now, and behaves naturally.","Q_Score":0,"Tags":"python,macos,bundle,.app","A_Id":21756168,"CreationDate":"2014-02-13T13:11:00.000","Title":"How to have a natural MacOSX .app of a complex python application (including custom interpreter) via a shell initialization script?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am new to python programming and development. After much self study through online tutorials I have been able to make a GUI with wxpython. This GUI interacts with a access database in my computer to load list of teams and employees into the comboboxes. \nNow my first question is while converting the whole program into a windows exe file can I also include the .accdb file with it...as in I only need to send the exe file to the users and not the database..if yes how.\nMy second question is... I actually tried converting the program into exe using the py2exe (excluding the database...am not sure how to do that) and I got the .exe file of my program into the \"Dist\" folder. But when I double click it to run it a black screen (cmd) appears for less than a second and disappears. Please help me understand the above issue and resolve it.\nam not sure if I have a option of attaching files...then I could have attached my wxpython program for reference.\nThanks in advance.\nRegards,\nPremanshu","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":373,"Q_Id":21788522,"Users Score":0,"Answer":"The console could possibly appear if you used the 'console' parameter to setup(). Switch to 'windows' instead if that is the case. Can't say for sure without seeing your setup.py script. Possibly your app could also be opening console, but again hard to say without seeing source. One thing to check is to make sure you are not printing anything to stdout or stderr. You might want to redirect all of stdout and stderr to your log just in case, and do this right at the top of your start script so that if some 3rd party import was writing to stdout you'd be able to capture that.\nThe db is not part of your executable, so py2exe will not do anything with it. However, you should probably package your application with an installer, and you can make the installer include the db and install it along with the executable.","Q_Score":0,"Tags":"python,user-interface","A_Id":21789391,"CreationDate":"2014-02-14T20:01:00.000","Title":"wxpython GUI program to exe using py2exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to write a program in either python or C++ using opengl that will allow me to control different displays. Currently I have three different displays, I have the computer monitor, a LCD and a DLP all hooked up to my computer. I want to control each screen separately, and I want to full screen them all so they go black. Currently when I try to use glutfullscreen() in only makes the computer monitor black, and I can't control the other two screen.\nIn my set up I have removed the backlight from a LCD screen and I'm projecting onto it with a DLP projector to increase my dynamic range. I'm trying to write software to align the two image. I have it all working in MATLAB with mgl. But I don't know where to go with C++.\nI need to be able to control the pixels of where each image is displayed, but I can't access the other two screen.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":100,"Q_Id":21790472,"Users Score":2,"Answer":"Use something like SDL2 or GLFW3 for multimonitor support.  They'll let you query the number of monitors and their sizes, as well as let you create multiple windows to cover them.","Q_Score":2,"Tags":"python,c++,opengl,glut,pyopengl","A_Id":21790746,"CreationDate":"2014-02-14T22:14:00.000","Title":"Using different displays opengl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just recently learned Python and Pygame library. \nI noticed that the rendering and main loop is automatically paused when I click and hold on the window menu bar (the bar with the title\/icon).\nFor example, in a snake game, the snake will be moving every frame. When I click and hold (or drag) the window menu, the snake is not moving anymore and the game is \"paused\". When I release it, it resumes.\nIs there a way to let the game NOT pause when I drag the windows menu bar?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":430,"Q_Id":21895657,"Users Score":0,"Answer":"This one is pretty easy, its seems you forgot to add a event callback.\nstate 1\n        while (sate != 0):\n           for event in pygame.event.get():","Q_Score":5,"Tags":"python,pygame","A_Id":21896365,"CreationDate":"2014-02-20T00:30:00.000","Title":"Pygame built-in automatic pause?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QLineEdit, and I need to know if there is a signal which can track mouse hover over that QLineEdit, and once mouse is over that QLineEdit it emits a signal.\nI have seen the documents, and found we have the following signals: \n\ncursorPositionChanged ( int old, int new )\n  editingFinished ()\n  returnPressed ()\n  selectionChanged ()\n  textChanged ( const QString & text )\n  textEdited ( const QString & text )  \n\nHowever, none of this is exactly for hover-over. Can you suggest if this can be done by any other way in PyQt4?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1894,"Q_Id":21899681,"Users Score":1,"Answer":"You can use enterEvent, leaveEvent, enterEvent is triggered when mouse enters the widget and leave event is triggered when the mouse leaves the widget. These events are in the QWidget class, QLineEdit inherits QWidget, so you can use these events in QLineEdit. I you don't see these events in QLineEdit's documentation, click on the link List of all members, including inherited members at the top of the page.","Q_Score":2,"Tags":"python-2.7,pyqt4,mouseover,qlineedit","A_Id":21900144,"CreationDate":"2014-02-20T06:14:00.000","Title":"QLineEdit hover-over Signal - when mouse is over the QlineEdit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm embedding Python in an Objective C application using PyObjC, setting the Python environment up by hand on the ObjC side (i.e. not using py2app).  I'm starting the Python in a separate thread (on the ObjC side) with a call to PyRun_File(), and then one to PyObject_CallFunction() to start it doing something (specifically update some menus, register and handle menu callbacks).  The Python function starts the run loop for the secondary thread and the callback class instance hangs around.  All of this works.  I can pass basic data such as strings to the initial Python function without problem and menu actions work as I'd like.  \nI'd like to provide a pre-instantiated delegate instance to the Python function for ease of configuration (from the point of view of the Objective C developer).  How do I pass an Objective C instance (my delegate) to the Python function?  Is it possible?  Are there bridge functions I'm missing?  Do I need to create a suitably configured PyObject by hand?  What sort of conversion should I do on the Python side to ensure the delegate.methods() are usable from Python and proxying works as it should?  Are there any memory-management issues I should be aware of (on either side of the bridge)?\nI'm using Python 2.7, PyObjC 2.5 and targeting OSX 10.6.  Happy to consider changing any of those if the solution specifically demands it. TIA.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":853,"Q_Id":21988970,"Users Score":3,"Answer":"The easiest way to ensure problem free usage of the bridge is to ensure that the delegate methods that you use don't use C arrays as arguments or return values and don't use variadic signatures (\"...\"). Futhermore ensure that all pass-by-reference arguments (such as the commonly used \"NSError**\" argument) are marked up with \"in\", \"out\" or \"inout\" to indicate in which direction values are passed. This ensures that the bridge can get all information it needs from the Objective-C runtime.\nThere are two options to pass a preconstructed object to Python code:\n\nCreate a class method that returns the object\nUse the PyObjC API to create the python proxy for the Objective-C object.\n\nThe latter uses an internal PyObjC API (also used by the framework wrappers) and could break in future versions of PyObjC. That said, I don't have active plans to break the solution I describe here.\nFirst ensure that the right version of \"pyobjc-api.h\" and \"pyobjc-compat.h\" are available for the Objective-C compiler.\nUse #include \"pyobjc-api.h\" to make the API available.\nCall \"PyObjC_ImportAPI\" after initialising the Python interpreter, but before you use any other PyObjC function.\nUse \"pyValue = PyObjC_IdToPython(objcValue)\" to create a Python representation for an Objective-C object.","Q_Score":1,"Tags":"python,pyobjc","A_Id":22010598,"CreationDate":"2014-02-24T13:18:00.000","Title":"How do I pass an Objective C instance into a PyObjC Python function when using PyRun_File()\/PyObject_CallFunction()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed Python 2.6 from source for software testing (2.7 was preinstalled on my Linux distro). However, I cannot import Tkinter within 2.6, I suppose because it doesn't know where to find Tk. How do I either help 2.6 find the existing Tkinter install or reinstall Tkinter for 2.6?","AnswerCount":3,"Available Count":3,"Score":-0.0665680765,"is_accepted":false,"ViewCount":417,"Q_Id":22057077,"Users Score":-1,"Answer":"Have you tried using pip-2.6 install package?","Q_Score":1,"Tags":"python,linux,tkinter,tk,python-2.6","A_Id":22057396,"CreationDate":"2014-02-27T01:15:00.000","Title":"Installed Python from source and cannot import Tkinter - how to install?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed Python 2.6 from source for software testing (2.7 was preinstalled on my Linux distro). However, I cannot import Tkinter within 2.6, I suppose because it doesn't know where to find Tk. How do I either help 2.6 find the existing Tkinter install or reinstall Tkinter for 2.6?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":417,"Q_Id":22057077,"Users Score":1,"Answer":"I solved this by adding '\/usr\/lib\/x86_64-linux-gnu' to lib_dirs in setup.py, then rebuilding python","Q_Score":1,"Tags":"python,linux,tkinter,tk,python-2.6","A_Id":22058494,"CreationDate":"2014-02-27T01:15:00.000","Title":"Installed Python from source and cannot import Tkinter - how to install?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed Python 2.6 from source for software testing (2.7 was preinstalled on my Linux distro). However, I cannot import Tkinter within 2.6, I suppose because it doesn't know where to find Tk. How do I either help 2.6 find the existing Tkinter install or reinstall Tkinter for 2.6?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":417,"Q_Id":22057077,"Users Score":1,"Answer":"Install the TCL and Tk development files and rebuild Python.","Q_Score":1,"Tags":"python,linux,tkinter,tk,python-2.6","A_Id":22057115,"CreationDate":"2014-02-27T01:15:00.000","Title":"Installed Python from source and cannot import Tkinter - how to install?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using PySide in a not-so-MVC fashion, meaning, I try as much as possible not to edit the generated .ui to .py file, I put my application logic in packages (models) and I have one module (.pyw file) more like a controller for them all to initialize and perform management. Not too best of practice but I'm doing fine, all I want is I dont want to add code to the generated ui .py file (more like my view)\nNow here is the problem\nI Noticed that the generated PySide file doesn't inherit from the QDialog or QMainWindow as you have to create it when you are instantiating the class, as a result, events like closeEvent(self, event) doesn't work inside the class even when you put it there. I know hoe to write functions for QActions and widget connections, but I DONT KNOW HOW TO ADD A CLASS BASED FUNCTION TO A GENERATED PYSIDE CLASS OUTSIDE THE CLASS.\nIf I have to edit the generated view class, I can perfectly tweak it to what I want BUT i dont want to because I can make amendment in QtDesigner and compile at any time\nThis is my question, since I dont want to how do i attach say a closeEvent to the object created from the class in my controller class without touching the generated view class.\nThanks","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1710,"Q_Id":22071291,"Users Score":0,"Answer":"Monkey Patching did the job, I dont know why I didn't taught of that","Q_Score":0,"Tags":"python,events,pyqt,pyside,qt-designer","A_Id":22102393,"CreationDate":"2014-02-27T14:22:00.000","Title":"Adding Event functions outside PyQt\/PySide Generated Code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can change color of all text in label, but I want to change color of one letter.\nIs that possible? \nI use tkiner and python 3.3.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":820,"Q_Id":22071505,"Users Score":0,"Answer":"No, it is not possible to change the color of one letter in a label. However, you can use a text widget instead of a label to color just a single character. You could also use a canvas widget.","Q_Score":0,"Tags":"python,python-3.x,colors,tkinter,label","A_Id":22078545,"CreationDate":"2014-02-27T14:30:00.000","Title":"Change color of one letter in label. Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to read a HTML and I show it on a Tkinter window. I would like to know if this is possible with any module and if it's how can I do it, as I'm totally lost finding solutions.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3286,"Q_Id":22077846,"Users Score":5,"Answer":"There is no support for viewing rendered HTML in a tkinter widget. There was a project (tkhtml) to build a modern web browser using tcl\/tk (which is what powers tkinter), but the project never got past a very early alpha release and the last check-in was in 2009.","Q_Score":3,"Tags":"python,html,tkinter","A_Id":22094453,"CreationDate":"2014-02-27T18:57:00.000","Title":"Read a HTML file and show it on a Tkinter window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to build the libpython33.a file so I can create my own C extensions using MinGW. For that, I need the python33.dll file to create a .def file and then convert that to the finally libpython33.a. \nIn my Python 2.7 installation, I can see the file called python27.dll along with python.exe and pythonw.exe. But in the Python 3 folder I there's no DLLs. In the Python3\/DLLs folder there's a file called python3.dll (not python33.dll).\nIs my Python instalation damaged or that's ok?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5326,"Q_Id":22187196,"Users Score":3,"Answer":"python33.dll is found under c:\\windows\\system32","Q_Score":2,"Tags":"python,python-3.x,python-3.3","A_Id":22187241,"CreationDate":"2014-03-05T02:19:00.000","Title":"python33.dll not found in my Python installation path?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have developed a pygtk application and i need to release it to customers.\nI am using python 2.7, pygtk 2.2 in ubuntu.\nMy question is how can I bundle the required packages(python, pygtk, gobject) together with my application, so that even if these packages are not installed in client machine I can run my application.\nI tried with pyinstaller but, the executable depends on the glibc i.e executable created with higher glibc version will not work with the machine which has lower glibc version.\nSo is there any way to create a release directory which includes all the packages required so that I can run my application in any system without installing the packages.\nThanks in advance,","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":479,"Q_Id":22191409,"Users Score":0,"Answer":"Just adding the solution to my own question!\nAs suggested in the comments above installed packages by downloading the source and compiled them in a machine which had glibc2.5 then created binary executable of my pygtk app using pyinstaller\nI had tried compiling packages earlier also, but weren't checking the .\/configure output properly. The problem was, I was trying to install gtk and pygtk without installing cairo and pango. So pygtk skipped building gtk packages because it did not find any cairo package. This was mentioned in the .\/ configure script but I had not checked that.\nSummarizing:\nTo configure pygtk to python need to folow these steps\n\ninstall sqlite-devel #If sqlite needed\ninstall python(2.7)\ninstall gtk(2.24.0) -> requires glib(2.27.3), atk(1.29.2), cairo(1.8.10), pango(1.22.4), gdk-pixbuf(2.21.3)\ninstall pygtk(2.24.0) -> requires pygobject-2.28.3, pycairo(1.8.10)\n\nAll the above packages must be compiled to the same prefix, and need to set the PYTHON and PATHONPATH environment variables. The versions of packages also play major role. Added version in parenthesis that worked for me.\nThere are many dependencies while installing some of the packages so I had to install following packages using yum:\nlibxext, librender, gettext, zlib, libgtk2-devel","Q_Score":1,"Tags":"python,linux,pygtk","A_Id":22983513,"CreationDate":"2014-03-05T07:34:00.000","Title":"Releasing pygtk application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I want to write a visualization for some complex scientific data in Python. I have done a similar thing a few years ago in Objective-C\/Cocoa\/OpenGL. The visualization will contain some fancy shader programs, so at least OpenGL 3.0 is required. Also, I need to draw a window and do some mouse\/keyboard handling. Some GUI widgets would be nice, but not required. Python 3 support is highly desirable.\nI looked into:\n\nPyOpenGL, which has no window\/mouse\/keyboard handling.\nPyGlet, which only supports Python 2.7.\nPyQt, which only supports OpenGL 2.0.\nPySide, which is pretty much dead, and stuck in Qt 4.7.\nwxPython, which only supports Python 2.7.\nPyGame, which is pretty much dead.\n\nDo you know any library that can do modern OpenGL and some windowing in Python 3?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1787,"Q_Id":22195254,"Users Score":1,"Answer":"My recommendation is PyOpenGL plus PyQt. Python plus either Pyglet or wxPython are possible alternatives.\nPyOpenGL (the Mike Fletcher version, right?) is the best Python OpenGL API I know of. It has support for OpenGL 3 and 4 and is just very nice and Pythonic.\nPyQt itself only supports OpenGL 2, but PyOpenGL will run inside a PyQt context. Since PyQt does have a Python 3 version, this combination should meet your needs.\nFor the GUI stuff I prefer wxPython, but as you note that hasn't been updated for Python 3 yet. You could take a look at the wxPython Phoenix project, but that's very much a work in progress.\nPyglet is also quite nice but has less GUI functionality that wxPython or PyQt. Think of it as the equivalent of GLUT. The Python 3 version is currently in alpha, but given that it's not a complete rewrite I'd expect it to be stable very soon.\nHope this helps.","Q_Score":0,"Tags":"python,opengl","A_Id":22212424,"CreationDate":"2014-03-05T10:37:00.000","Title":"OpenGL 3+ with Python 3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Basically I want to know the libraries which can do it, preferably in C or Python.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":22207218,"Users Score":0,"Answer":"I can think of OpenCV, but it may be overkill, depending on what kind of \"manipulation\" you need. It is c\/c++ lib, but also provides python and java wrappers.","Q_Score":0,"Tags":"python,c,image,video","A_Id":22207404,"CreationDate":"2014-03-05T19:23:00.000","Title":"How to grab a frame from a video and then manipulate it and then reassemble the video with it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a lot of images i need to load into a Pygame program. Can I load all these from a separate script which I load into my main program as a module and be used from within the main program? Any help much appreciated. Thanks in advance.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":733,"Q_Id":22214989,"Users Score":0,"Answer":"After considering both answers above what I simply did was write a script where I loaded all images and created a dictionary called image_dict with the image names as the keys and saved the program as \"load_images.py\"\nThen from the second program I did a \"from load_images.py import image_dict\".\nnow the keys gave me the images.\nThank you.","Q_Score":0,"Tags":"python,pygame","A_Id":22255548,"CreationDate":"2014-03-06T04:31:00.000","Title":"Loading pygame images as a module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"so I am actually trying to get into software development and I currently have just spent a few days making a GUI in Photoshop. Now I know how to code in Java and Python but I have never implemented a GUI before. I am stuck on this because I know I can write the code and everything but how do I take what I made in Photoshop add some java or python code to it to make certain things happen? I have zero experience in this and I have only written code to accomplish tasks without the need for a GUI.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1055,"Q_Id":22215361,"Users Score":2,"Answer":"but how do I take what I made in Photoshop add some java or python code to it to make certain things happen\n\nNo, you cannot expect things to happen magically, for that you need to learn front-end technologies like HTML, CSS, JavaScript etc and manually convert the UI which is in Photoshop to corresponding code. This applies for web applications.\nIf you want to build desktop application, you need to use Swings, SWT etc to achieve the same.\n\nI have zero experience in this\n\nIf this is the case, I recommend to read some basic tutorials, then you will get idea what to do","Q_Score":0,"Tags":"java,python,user-interface,photoshop","A_Id":22215461,"CreationDate":"2014-03-06T04:57:00.000","Title":"UI Designed in Photoshop for Software","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"import sys\nsys.path.insert(1,\"C:\/Users\/ravir_000\/Desktop\/python_CS105\/python_CS105\/Python27\/Lib\/site-packages\")\nimport math\nimport random\nimport pygame\nfrom pygame.locals import *\npygame.init()\nHow do you get rid of the error? Import error: Module use of python27.dll conflicts with this version of python. I was working on this a few hours ago and it was working fine. When I got into class it started giving me this error. I have tried to install\/reinstall pyscripter and pygame but it still does not work. I am sure that my path to pygame is correct. Any ideas?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":4333,"Q_Id":22236546,"Users Score":2,"Answer":"You are trying to use a pygame distribution that is for python 2.7 with a different version of python.\nYou should download and use the appropriate version. \nIf installed correctly, there will be no need for sys.path.insert.","Q_Score":0,"Tags":"python,pygame,importerror","A_Id":22236742,"CreationDate":"2014-03-06T21:36:00.000","Title":"Import error: Module use of python27.dll conflicts with this version of python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This .ui file is made by Qt Designer. It's just a simple UI.\nAll the commands or codes for doing this on the websites I have looked through are not for windows.","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":110222,"Q_Id":22266802,"Users Score":16,"Answer":"In pyqt5 you can use:\n\nconvert to none-executable python file :\npyuic5 -o pyfilename.py design.ui\n\nconvert to executable python file :\npyuic5 -x -o pyfilename.py design.ui\n\n\nand also for resource diles(qrc):\n\nconvert qrc to python file :\npyrcc5 -o pyfilename.py res.qrc\n\n\nNote: that if you run the command in the wrong way,your ui file will be lost.So you have to make a copy of your files:)","Q_Score":22,"Tags":"python,user-interface,pyqt,qt-designer","A_Id":57951576,"CreationDate":"2014-03-08T08:06:00.000","Title":"How to convert a .ui file to .py file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This .ui file is made by Qt Designer. It's just a simple UI.\nAll the commands or codes for doing this on the websites I have looked through are not for windows.","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":110222,"Q_Id":22266802,"Users Score":15,"Answer":"To convert from .ui to .py in Windows\n\nGo to the directory where your ui file is.\nPress shift right-click your mouse.\nClick open command window here.\nThis will open the cmd, check what is the directory of your\n(pyuic4.bat) file. Usually, it is in:\nC:\\Python34\\Lib\\site-packages\\PyQt4\\pyuic4.bat.\nWrite in the cmd:\nC:\\Python34\\Lib\\site-packages\\PyQt4\\pyuic4.bat -x filename.ui -o filename.py   (hit Enter)\nthis will generate a new file .py for your .ui file\nand in the same directory\n\nNote:\nThis command for Python 3.4 version and PyQt4 version.\nIf you are using other versions you should change the numbers (e.g PyQt5)","Q_Score":22,"Tags":"python,user-interface,pyqt,qt-designer","A_Id":34833304,"CreationDate":"2014-03-08T08:06:00.000","Title":"How to convert a .ui file to .py file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I make a childWindow access and\/or modify an attribute from his MainWindow?\nI have a MainWindow that opens different childWindows, dependeing on the pressed button on the MainWindow.\nI would like any of the childWindows to be able to modify some attributes of the MainWindow, but I cannot get the good way to access them.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":82,"Q_Id":22294229,"Users Score":0,"Answer":"You could pass a reference (self) to your childwindow.","Q_Score":1,"Tags":"python,qt,parent-child,mainwindow","A_Id":30509870,"CreationDate":"2014-03-10T07:21:00.000","Title":"attributes of Mainwindow from childWindow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using PyQt4 and Qt Designer. I have a QListWidget in which I populate after loading a file in my program.\nI want to set it so that all items will be checkable, as opposed to just selectable. I have found online that this is a 'flag' of the QListWidget, however, in Qt Designer I can't see where to do this.\nIs it possible?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":14967,"Q_Id":22340514,"Users Score":0,"Answer":"The age-old question. There is an answer here, but I'll try to give some clarification: for several components there isn't enough to set item flag Qt::ItemIsUserCheckable, one needs to set item's check state for the checkbox to appear. Also, there is no widget flag to make all items checkable.\nAn excerpt from Qt documentation:\n\nNote that checkable items need to be given both a suitable set of\nflags and an initial state, indicating whether the item is checked or\nnot. This is handled automatically for model\/view components, but\nneeds to be explicitly set for instances of QListWidgetItem,\nQTableWidgetItem, and QTreeWidgetItem.","Q_Score":5,"Tags":"python,qt,pyqt,pyqt4,qt-designer","A_Id":66103178,"CreationDate":"2014-03-12T02:00:00.000","Title":"Qt Designer QListWidget checkbox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been working with Python and PyGame days ago, and i noticed that when i move the player in my game, it will blit over itself again and again while moving, leaving a tail, is there any way i can clean up all the old sprites that the player left while moving?\nI tried bliting the background again while moving to remove them, but that was frustrating in a point. Any Idea?\nThanks","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":421,"Q_Id":22361870,"Users Score":1,"Answer":"Just call window.fill([0, 0, 0]) each time in your main loop.  Where the window is your pygame.display.set_mode() main surface.  If you have any questions, just comment below.","Q_Score":1,"Tags":"python,pygame,pygame-surface","A_Id":22363605,"CreationDate":"2014-03-12T19:27:00.000","Title":"PyGame, How to clean up Old Sprites","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a third party DLL (no header file) written in C++ and I am able to get the function prototype information from the developer, but it is proprietary and he will not provide the source.\nI've gone through the SWIG tutorial but I could not find anywhere specifying how to use SWIG to access any functions with only the DLL file.  Everything on the tutorial shows that I need to have the header so SWIG knows what the function prototypes look like.\nIs SWIG the right route to use in this case?  I am trying to load this DLL in Python so I can utilize a function.  From all of my research, it looks like Python's ctypes does not work with C++ DLL files and I am trying to find the best route to follow to do this.  Boost.python seems to require changing the underlying C++ code to make it work with Python.\nTo sum up, is there a way to use SWIG when I know the function prototype but do not have the header file or source code?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1508,"Q_Id":22378590,"Users Score":0,"Answer":"To use a library (static or dynamic), you need headers and library file .a, .lib...\nIts true for c++ and I think its the same for Python","Q_Score":0,"Tags":"python,c++,dll,swig","A_Id":22378831,"CreationDate":"2014-03-13T12:25:00.000","Title":"SWIG C++ Precompiled DLL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a third party DLL (no header file) written in C++ and I am able to get the function prototype information from the developer, but it is proprietary and he will not provide the source.\nI've gone through the SWIG tutorial but I could not find anywhere specifying how to use SWIG to access any functions with only the DLL file.  Everything on the tutorial shows that I need to have the header so SWIG knows what the function prototypes look like.\nIs SWIG the right route to use in this case?  I am trying to load this DLL in Python so I can utilize a function.  From all of my research, it looks like Python's ctypes does not work with C++ DLL files and I am trying to find the best route to follow to do this.  Boost.python seems to require changing the underlying C++ code to make it work with Python.\nTo sum up, is there a way to use SWIG when I know the function prototype but do not have the header file or source code?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1508,"Q_Id":22378590,"Users Score":0,"Answer":"SWIG cannot be used without the header files. Your only option is a lib like ctypes. If you find ctypes doesn't do it for you and you can't find alternative then post a question with why ctypes not useable in your case.","Q_Score":0,"Tags":"python,c++,dll,swig","A_Id":22389172,"CreationDate":"2014-03-13T12:25:00.000","Title":"SWIG C++ Precompiled DLL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to allow wxTextEntryDialogs to accept the tab character? I'm using wxPython and would like to accept tabs so that I can ask the user for the delimiter used in a text file.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":65,"Q_Id":22419345,"Users Score":1,"Answer":"It is possible to paste it in, but this is obviously not user friendly. I'd use a custom dialog with the predefined choices (e.g. radio buttons) for TAB, comma, semicolon etc and a text control for a custom separator entry.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":22424553,"CreationDate":"2014-03-15T03:59:00.000","Title":"wxTextEntryDialog with Tabs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a really specific need : \nI want to create a python console with a Qt Widget, and to be able to have several independent interpreters.\nNow let me try to explain where are my problems and all tries I did, in order of the ones I'd most like to make working to those I can use by default\n\nThe first point is that all functions in the Python C API (PyRun[...], PyEval[...] ...) need the GIL locked, that forbid any concurrent code interpretations from C ( or I'd be really glad to be wrong !!! :D )\nTherefore, I tried another approach than the \"usual way\" : I made a loop in python that call read() on my special file and eval the result. This function (implemented as a built extension) blocks until there is data to read. (Actually, it's currently a while in C code rather than a pthread based condition)\nThen, with PyRun_simpleString(), I launch my loop in another thread. This is where the problem is : my read function, in addition to block the current thread (that is totally normal), it blocks the whole interpreter, and PyRun_simpleString() doesn't return...\nFinally I've this last idea which risks to be relatively slow : To have a dedicated thread in C++ which run the interpreter, and do every thing in python to manage input\/output. This could be a loop which creates the jobs when there is a console needing to execute a command. Seems not to be really hard to do, but I prefer ask you : is there a way to make the above possibilities to work, or is there another way I didn't think about or is my last idea the best ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1118,"Q_Id":22435352,"Users Score":0,"Answer":"If your main requirement is to have several interpreters independent from each other, you'd probably better suited doing fork() and exec() than doing multithreading.\nThis way each of the interpreters would live in it's own address space not disturbing one of the others.","Q_Score":2,"Tags":"python,c,multithreading,gil","A_Id":22435597,"CreationDate":"2014-03-16T09:50:00.000","Title":"Python & C\/C++ multithreading : run several threads executing python in the background of C","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a prototype for the tactical spaceship combat in a game I'm working on.\nThe basic idea of the part I'm working on right now is that a 'ship' object (which represents a single individual ship) contains a list of 'system' objects. When a ship is first initialized, it calls an initialize() function on each of its systems (which is not the same as the standard __init__ function called whenever an instance of an object is made) that will (among other things) call a register() function on the ship the system is a part of.\nThat register() function takes a string as a parameter, which is the name of a function that the system expects to be called on the ship object. Whenever that function is called on the ship object, the ship object will call it on all systems that registered to receive it until either one of them returns True (indicating that the system 'dealt with' the action in a final manner) or it runs out of systems that have signed up to receive the call. So far so good.\nHowever, some systems might want to get their calls before other systems do. For example, your hull system will want to be the last system to receive a hit(); the shields will want to hear it first. The simplest solution might be to implement a priority system: the shields will call myship.register(\"hit\",priority=1), and the hull will call myship.register(\"hit\",priority=0).\nBut now we imagine that there ought to be \"super-shields\" that intercept the hit before the main shields take it. Simple enough: give them priority 2. This might get annoying for the developer if a whole lot of systems want to take a certain request, but he can manage it.\nHowever, this game is intended to be highly user-extensible. If someone releases an addon that (for a stupid example) plays Full Metal Jacket sound clips every time the player's ship is hit, the developer of that addon might not be aware of the addon that adds the \"super-shields\", and give his Annoying Drill Sergeant system the same or lower priority as the super-shields, and thus may not receive hit messages before they are acknowledged by the super-shield. This is, of course, undesirable behavior.\nDoes anyone have any ideas as to how to avoid this problem? \nOthers have suggested having a way a system can request the priority level one higher than or one lower than the highest\/lowest current priority level, but that causes largely undefined behavior, since the priority levels would be based on the order in which the systems are initialized.\nI've also considered adding a \"super-priority\", where a system always receives the message before other systems but cannot acknowledge and stop it. This would be only a partial solution though; it'd fix the given example, but not a situation where there are super-shields layered under super-super-shields that need to block the message.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":112,"Q_Id":22438569,"Users Score":1,"Answer":"The issue is trying to give an absolute value to the priority. Rather you need to build a relative priority data structure for each call. This way you can say that hit() is highest priority for super-shields then shields then hull. The mod would then simply need to change the hit sound effects for the hull or add an additional sound effect to be played as well.\nThe most straightforward way to go about it would requiring that any new object's priority for a given call be linked to another object with that call. It then requires selecting if the new object's priority is lower or higher. So shields and hull are linked (hull < shields) and super-shields and shields are linked (shields < super-shields). That information would make it fairly easy to build a 2D multiple items (2D to have allow for same priority) linked list that holds the priorities for each call. Thus the register function might look like this, \"myship.register(\"hit\",shields,\"lower\",super-shields)\" and give shields a lower priority than super-shields. You could allow for additional conditions such as myship.register(\"hit\",hull,\"lower\",shields,\"lower\",super-shields) if you already had the hull and super-shields, and wanted to add shields between them. However, then you run the risk of having to deal with contradictions or violating the conditions.","Q_Score":0,"Tags":"algorithm,python-3.x,message-passing","A_Id":22452071,"CreationDate":"2014-03-16T15:06:00.000","Title":"Algorithm design for systems on a spaceship taking messages","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to use OpenGL to draw offscreen? What I want to do is this: I want to be able to use functions like glVertex, and get the result in a 2D pixel array.\nI am using Python. I tried using PyGame, but it's not working very well. The problem with PyGame is that uses a window event though i don't need it. In addition, I had to draw to scene + flip the screen twice in order to access screen pixels using glReadPixels.\nAn other problem is that I can't have more that one window at once.\nIs there any proper way to accomplish what I am trying to do?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":587,"Q_Id":22440743,"Users Score":2,"Answer":"What you are asking for seems to be two things in one... you want an off-screen buffer (FBO) and you want to get the contents of the framebuffer in client memory.\nCan you indicate which version of GL you are targeting?\nIf you are targeting OpenGL 3.0+, then you can use FBOs (Framebuffer Objects) and PBOs (Pixel Buffer Objects) to do this efficiently. However, since you are using glVertex, I do not think you need to bother with efficiency. I would focus on learning to use Framebuffer Objects for the time being.\nIf you are not using GL3 you might have access to the old EXT FBO extension, but if you do not have that even you might need a PBuffer.\nNote that PBuffers and Pixel Buffer Objects are two different things even though they sound the same. Before GL3\/FBOs, WGL, GLX, etc. had special platform-specific functionality called Pixel Buffers for drawing off-screen.","Q_Score":0,"Tags":"python,opengl,pygame,pixels","A_Id":22441324,"CreationDate":"2014-03-16T18:09:00.000","Title":"Draw with OpenGL offscreen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wondering how I can change the font of a Python Tkinter label widget so that half the displayed text is bold and half is not without having to use two labels. The text for the widget is assigned prior to the label actually being created and stored in a variable so I need some kind of flag presumably to tell it how much of the string should be bold. I don't it is possible but suggestions appreciated.","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":9774,"Q_Id":22453554,"Users Score":3,"Answer":"There is nothing you can do with the label widget -- it only supports a single font and single color for the entire label. However, you can easily substitute a canvas or text widget anywhere you need this feature. There's no reason why you can't use a text widget that is one line tall and a dozen or so characters wide.","Q_Score":2,"Tags":"python,widget,tkinter,label,styling","A_Id":22455831,"CreationDate":"2014-03-17T11:51:00.000","Title":"How to change font style for part of a tkinter label","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing some Python scripts to read\/parse\/process some .vrscene files.\nFrom others' examples, I can see that there is a Python SDK for VRay called vrayutils.\nI want to get this information from the SettingsOutput object.\nFrom a .vrscene file I want to get the total frame numbers.\nDoes anyone know where I can get that Python library or how I can call it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1560,"Q_Id":22456509,"Users Score":1,"Answer":"I was able to do some of the things by parsing the file using basic Python and then extracting the things I needed.\nThe V-Ray API has a proprietary license, and there is no open source way to access the .vrscene \nI decided to try with a trial version of the SDK, and by using the SDK you will be able to find a nice Python build wrapped with a bunch of examples within the V-Ray Application SDK.\nThe price is 1250 euro annually for a single development license (for one server node). \nSupport is included.\nThey can give you a preliminary evaluation version for 3 months under NDA (What I used).\nNo reverse engineering is permitted so if you are planning to develop over V-Ray you should buy it.","Q_Score":0,"Tags":"python,sdk,render,maya,autodesk","A_Id":22980455,"CreationDate":"2014-03-17T14:07:00.000","Title":"Getting access to VRay Python SDK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using IPython qtconsole under windows 7, and when I first write a method name and type the bracket,  a popup shows method parameters. \nWhat is the way to display that popup explicitly, once it has disappeared? This is pretty common 'show method parameters' shortcut that I'm talking about, but I've failed to find the shortcut to it after an embarrassing amount of google searches.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1486,"Q_Id":22501431,"Users Score":0,"Answer":"In Spyder, try View - Panes - Object inspector. Then type the full name of the function.","Q_Score":1,"Tags":"python,ipython","A_Id":28310783,"CreationDate":"2014-03-19T09:32:00.000","Title":"How do I display function arguments in ipython qtconsole?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"First, sorry for my language, english is not my native language :-\/\nI have some troubles using wxpython 2.8\/python 2.7 with Windows.\nMy app using wxPython is quite big now and uses a lot of widgets. My problem is : In a for loop, i open a frame as a variable (myVar = myFrame(...)), and give it some values\/variables (like -> myVar.setval('xx', 42)) . Then, it will fill some textareas, grids, etc. from some requests in my database (from the child frame). At the end of the traitment, my child frame generate a pdf file, and print it, then it closes itself with the original self.Destroy() method, not surcharged, of wx.Frame.\nA lot of frames are created, one by one, with the same variable (myVar in the example).\nBut, recently, I figured out some issues with more iterations in my loop than usual...\nWith the same configuration (same data with a dump from database), it always crashes at the exact same moment (not on particular data), after a certain number of iteration in my loop.\nWxPython uses maximum amount of GDI allowed by Windows (error 1158). In fact my GDI resources from destroyed frames are not released! I read that there's a queue of destroyed objects, waiting to be really killed when no more events are waiting in wxPython and then they are not released because of constant work (the loop). \nOn linux, there is not this issue, everything works fine (but I need it works on Windows).\nI tried wx.Yield method but nothing changed...\nI looked threads, but GUI widgets have to be used in wx main loop...\nIf one of you guys has an idea, it will be wonderful !\n[SOLVED]\nThe solution i found is to call wx.Yield() to releases unused ressources. But this only work perfectly on linux. On windows, i need to call wx.Frame.DestroyChildren().\nIt seems to be OK for now :-)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":296,"Q_Id":22511472,"Users Score":0,"Answer":"OP seemed to find the solution.\n\nThe solution I found is to call wx.Yield() to releases unused\n  ressources. But this only work perfectly on linux. On windows, i need\n  to call wx.Frame.DestroyChildren().","Q_Score":2,"Tags":"python,windows,wxpython,gdi","A_Id":23710926,"CreationDate":"2014-03-19T15:57:00.000","Title":"wxPython : GDI ressources are not release after wxFrame.destroy()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I seen the some difference when I execute the .py file. I have observed two cases,\n1) when I run the .py file using the python mypython.py\nI got the result. But .pyc file not created in my folder.\n2) when I run the .py file using the python -c \"import mypython\"\nI got the same result. But .pyc file was created in my folder.\nMy question is why first case not created .pyc file ?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":102,"Q_Id":22552304,"Users Score":0,"Answer":"Python saves the precompiled .pyc file only for imported modules, not for the main script you're running.\nRunning a program as main or importing it as a module is not the exact same thing, but very similar because in a module everything that is at top level is executed at import time.\nNote that for main program the source code is completely parsed and compiled too (so for example if you have a syntax error in last line nothing will be executed). The difference is only that the result of compilation is not saved back to disk.","Q_Score":1,"Tags":"python,compiler-construction,interpreter","A_Id":22552400,"CreationDate":"2014-03-21T07:03:00.000","Title":"Understanding python compile","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm evaluating Kivy for android development. I need to know if is it possible to create an application with multiple windows using Kivy. I dont know for sure how android works with this kind of approach.\nIn c#, windows forms, we have a main window and from that we open\/close another forms. How can I accomplish this approach using Kivy for android ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1083,"Q_Id":22563386,"Users Score":3,"Answer":"What do you mean by 'window'? In the practical sense, you can easily create different screens with kivy and switch between them, e.g. to have a menu screen, settings screen, game screen etc. Is this the kind of thing you mean? More generally, you can easily achieve any particular windowing behaviour you want within kivy.\nAndroid itself works with activities, a particular way of choosing what is displayed, how apps move between screens, and also how apps may call particular subsets of one another (plus a lot more of course). You don't need to know about this to use kivy, it works within a single activity (plus appropriate interaction with the rest of the system), but you should read up on it if you want to understand how android manages programs and how this is different to most desktop environments.","Q_Score":0,"Tags":"android,python,kivy","A_Id":22563987,"CreationDate":"2014-03-21T15:49:00.000","Title":"Kivy Multiple windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am willing to make a Terminal like QTextEdit using pyqt4, but do not know what property to edit,so that when text from a process is dumped, it should start from the bottom and goes up. \nAny help for a starting point would be really appreciated.\nCheers.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":541,"Q_Id":22574996,"Users Score":1,"Answer":"I tried similar things before. For logging. Its a pain and it is very slow for a lot of lines.\nIf you expect having a lot of lines cummulating in the terminal then consider writing an item model and attach it to a view.\nThere are lot of possibilites in tweaking the appearance of such a view and it allows showing a small portion out of a big amount of data without becoming painfully slow. Also it allows to insert data at any position quickly.","Q_Score":0,"Tags":"python,qt,terminal,pyqt,pyqt4","A_Id":22578889,"CreationDate":"2014-03-22T07:54:00.000","Title":"Loading text in QTextEdit from down up like in Terminal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What are the packages which need to be installed for writing scripts using PyJius in system ?\nIs there anyway by which i could run these python scripts on android phone ? \nWhat is K ivy Launcher for android ? Will it be helpful for executing my scripts ?\nHow actually Kivy works ( in detail say in I want to switch on Bluetooth using scripts, which are the things in the K ivy architecture gets invoked by doing so ? )\nWhat i need is to write scripts on computer and then  after sending those scripts to my phone, then i need to execute my scripts from phone. Get the results on the phone and send those results to system.","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":768,"Q_Id":22578624,"Users Score":4,"Answer":"What are the packages which need to be installed for writing scripts using PyJius in system ?\n\nI'm not sure what you mean here. To run use pyjnius, all you need is...pyjnius. It is a separate module, not part of kivy itself, though kivy uses it on android. Kivy's mobile build tools automatically package this when you build an android apk.\n\nWhat is K ivy Launcher for android ? Will it be helpful for executing my scripts ?\n\nAn app that can dynamically open kivy apps from your user data directory. You can use it to upload and run kivy scripts\/apps on your device.\nIt is most useful for quick tests, not as a way to distribute apps. For this, it's very easy to build your own apks, which gives a lot more flexibility in what you do and what you package.\n\nHow actually Kivy works ( in detail say in I want to switch on Bluetooth using scripts, which are the things in the K ivy architecture gets invoked by doing so ? )\n\nI'm not sure what you're asking here. Kivy is a graphical framework for python, using an optimised opengl interface...you write python gui applications with it.\nFor things like bluetooth on android, you can use pyjnius (or more easily, wrapper projects like plyer providing an abstracted python api, though I don't think plyer has bluetooth quite yet). This generally isn't very hard, I've seen bluetooth done before.\nKivy itself is a graphical framework, these other tools are sister projects but separate from the graphics.\n\nWhat i need is to write scripts on computer and then after sending those scripts to my phone, then i need to execute my scripts from phone. Get the results on the phone and send those results to system.\n\nYou can certainly do this with kivy, by putting the scripts in an app that you run. Network communication also isn't hard - it's separate to kivy itself, but you have access to all the normal python modules you might use.","Q_Score":1,"Tags":"android,python,kivy","A_Id":22578797,"CreationDate":"2014-03-22T14:07:00.000","Title":"Kivy for android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I finally have some idea how to build Kivy app in Xcode with help of Kivy-ios. But Xcode and mac environment is new to me. My issue is: how to compile other python modules that required for my application. There is 'build-all.sh' in 'kivy-ios\/tools' that builds standard things, but how to add some other module. In particular, I need Requests module. Maybe there's some template script to include custom python modules? Thanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":462,"Q_Id":22621259,"Users Score":3,"Answer":"I don't know how kivy-ios manages different modules, but in the absence of anything else you can simply copy the requests module into your app dir so it's included along with everything else.","Q_Score":3,"Tags":"python,ios,xcode,python-requests,kivy","A_Id":22622162,"CreationDate":"2014-03-24T21:46:00.000","Title":"Compile custom module for Kivy-ios","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to set a custom background for selected items in wxPython 2.8. I cannot figure out how to do so. I've tried SetItemBackground with no luck.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":209,"Q_Id":22624070,"Users Score":0,"Answer":"Selected items in wxListCtrl, wxListBox and so on always use the system background selection colour, it can't be changed.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":22635854,"CreationDate":"2014-03-25T01:55:00.000","Title":"Setting selection background in ListCtrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Should\/does NDK9 work with android API19?  (though it was released with API18).\nFull story:\nI was building an Android App using kivy, python-for-android and buildozer.\ncompiling with MDK9 (ie 9d) and api19 result in error:\nE\/AndroidRuntime( 1773): java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol \"wait4\" referenced by \"libpython2.7.so\"...\ncompiling with NDK9 (ie 9d) and API18 works. :)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":681,"Q_Id":22624987,"Users Score":0,"Answer":"Android SDK are released more often that NDK. It happened more than once that if you use a too recent SDK, the NDK will not have the .h for it. Now i'm not sure this would be related to your issue at all.","Q_Score":2,"Tags":"android,python,android-ndk,kivy","A_Id":22644004,"CreationDate":"2014-03-25T03:35:00.000","Title":"android nkd and sdk compatibility issue (run time linker error)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a simple GUI (wxpython) application (some static text, buttons, comboboxes etc) and made exe file with pyinstaller, but the Avast antivirus says it's a virus. How can I fix this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1891,"Q_Id":22693665,"Users Score":0,"Answer":"I have the same issue.\nIf you are using Avast, do not uninstall it.\nThis will make your computer vulnerable from threats.\nIf you are sure, you can click 'add exclusion' when the Avast Hardened Mode blocked a program thing comes up.\nIf this isn't correct, please comment or edit.","Q_Score":3,"Tags":"python,pyinstaller,antivirus","A_Id":70388992,"CreationDate":"2014-03-27T16:30:00.000","Title":"python executables alarms antivirus","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I was wondering if there is any Python package that can allow a pure Python application with a graphic interface to be embedded in a website. I have an application with a Tkinter interface that I want to make available on a website. Any way to do this without converting too much code?\nThanks!","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":74,"Q_Id":22741838,"Users Score":1,"Answer":"It's impossible. \nPython\/Tkinter app is a desktop application, which requires desktop manager, has access to file system etc.\nWeb application is a different stack of technologies (HTTP, HTML, javascript etc), it is not possible to mix them","Q_Score":0,"Tags":"python","A_Id":22741877,"CreationDate":"2014-03-30T08:22:00.000","Title":"Web Server\/Site Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"anyone know how to hide python GUI Tkinter, \nI 've created keylogger, for GUI I used python module Tkinter , I want to add button called HIDE, so when user click it it will  hide GUI , and when user press key like CTRL+E , it should unhide GUI....?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":11986,"Q_Id":22764927,"Users Score":0,"Answer":"To get rid of a GUI window I used the following in my code.\nwindow.destroy()\nand the following to bring it up again.\nnameoffunction()\nwindow.lift()","Q_Score":3,"Tags":"python,tkinter","A_Id":46719809,"CreationDate":"2014-03-31T14:55:00.000","Title":"How To Hide Tkinter python Gui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a small chat app using pyside. I want to add 'Emoticons'(smileys) options for users to chat. I haven't getting any material on internet. I will be really grateful if someone helps to solve this problem.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":114,"Q_Id":22778197,"Users Score":1,"Answer":"Qt supports a thing called SVG font. It is a font where every letter is a colored vector image. You can use these in text fields and webkit.","Q_Score":0,"Tags":"python,user-interface,pyqt,pyside","A_Id":22778301,"CreationDate":"2014-04-01T06:15:00.000","Title":"Adding Emoticons to app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using some predefined accelerators connected with certain hot keys. Is it possible to temporarily disable them? I don't want to change the hot keys, in order not to confuse users. The accelerators are activated when typing into a combo box, which really is unacceptable.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":462,"Q_Id":22782726,"Users Score":1,"Answer":"As far as I know you cannot disable them. They will receive any key stroke that is not consumed by the focused Window.","Q_Score":12,"Tags":"python,gtk","A_Id":37508137,"CreationDate":"2014-04-01T10:09:00.000","Title":"How to disable accelerators when typing text in GTK+","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am pretty new to Python and I have been pretty annoyed with this problem. I am not sure if this matters, but I run my .py file with Python 2.7.6 with python installed on my computer, not using it on any online thing or other program. Every time I come across an error, my program works fine until it comes to the error, but the window disappears right before I can possibly read whatever the error said it was... Anyways, I haven't been able to find out what is wrong with my programming, and I am tired of guessing and guessing what is wrong. How can I extend the time so I can read the error message? Or something like that? Thanks","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2813,"Q_Id":22830060,"Users Score":1,"Answer":"You should run it from command window\/terminal instead of double clicking on the file.","Q_Score":1,"Tags":"python,syntax-error,runtime-error,message","A_Id":22830091,"CreationDate":"2014-04-03T06:57:00.000","Title":"Python - I can't see my what my error is because the window disappears immediately","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Good Day All! \nI am trying to figure out how to limit the popup box shown bellow. I am not trying to trim the text, I am however trying to set the amount of characters in the popup per line.\neg: 30 Characters per line in the popup box\ntkMessageBox.showinfo(\"Results\", str(e)) \nAny suggestions, without modifying the text itself?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":157,"Q_Id":22831462,"Users Score":0,"Answer":"There is nothing you can do with the tkMessageBox. You either have to alter the text or create your own message window. The latter isn't very difficult -- a Toplevel, a Text widget with a scrollbar, and a couple of buttons is about all you need.","Q_Score":0,"Tags":"python,popup,tkinter,size,line","A_Id":22835256,"CreationDate":"2014-04-03T08:07:00.000","Title":"Tkinter Limit Size Of Popup per line","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a First Year Physics major at Goshen College. I am supposed to create a final project for my programming class. I am thinking about doing the game Battleship. I realize that I could find the complete code somewhere online but I would really like to write my own.I came up with a list of things I would like to try to implement into the game and a general idea of how I would like the program to run.   \n\nMake four 10 x 10 grids. One with stored locations for the computer's ships, one with the player's ships, and two to be displayed, keeping track of both you and the computer's guesses.\nBy using format (a,6), user\/computer can guess location. \nTells user what ship they are placing and how big it is. User gives a star\ncordinate, then gives either up, left, or right to decide which direction\nthe ship lies. This is grid one. Grid two is a stored grid of ships. That\nwill be the computer's grid. The game will keep track of your guesses, \nand put circles where\nyou miss, x's where you hit and ~'s are water(spaces you haven't guessed.\nThis is grid three. Grid four is the computer's guesses.\nRandom computer guess until hit. Then use algorithm to check all adjacent\nspaces until the ship is sunk.\nTake turns\nDisplay Grids three and four simultaneously. \n\nI really just don't know where to start. I have a general idea of the logic that I would need to create the game, I just don't know where to jump in and start defining programs. \nThanks!","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1306,"Q_Id":22837709,"Users Score":2,"Answer":"Your algorithm looks perfectly fine. As you aim for this to be implemented in Python, I'd start with creating simple PyGame (or other library of your choice) application, that only draws two of your grids. That will help you debug your other functionality, once you'll see it better than array dump in the console.\nAlternatively, you may implement everything text-mode based just for now, and later enhance it with graphics \u2014 making your application more like \"query-response\", printing two grids with plain print() and asking for move with raw_input() \u2014 that simple.","Q_Score":2,"Tags":"python","A_Id":22837881,"CreationDate":"2014-04-03T12:24:00.000","Title":"Battleship in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have to make a computer graphics project on \"Vote for better Nation\" using python in a week..I have a knowledge of pygame but don't know how to create a particular object(like small cartoon man)..And then how to make it move..So please help me if anyone knows how to make a moving object..\nSorry For The English\nThank You","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1621,"Q_Id":22884351,"Users Score":0,"Answer":"There is a series of books on Python Graphics called \"Python Graphics for Games\" (Amazon). It covers vector drawing and animation. Author Mike Ohlson de Fine.","Q_Score":0,"Tags":"python,python-2.7,graphics,pygame,turtle-graphics","A_Id":31048800,"CreationDate":"2014-04-05T17:37:00.000","Title":"Computer Graphics with python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to pygame and I am working on a distributed peer-peer multiplayer game. I tried doing the following but I was not able to figure out how. \nI have a player class and an enemy class. The player and enemies are all part of different sprite groups. Say in a 4 player game where there is one player object and 3 enemy objects, When a player fires , I use the spritecollide method to check collision with the enemy sprite group. But I want to identify in specific as to which enemy has been shot within the spritegroup. I am quite not able to figure that out. Is that even possible ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":162,"Q_Id":22897317,"Users Score":0,"Answer":"Seeing as it sounds like enemy objects and player objects can do the same thing, maybe you should have one common class for both enemy and player.\nThis could be called for example a creature class. Then based on if the creature is a enemy or player you can control it using an EnemyAI class or a UserInput class. \nAs for identifying who was hit, you can easily add a name variable within each of the creature classes that you define upon declaring a new creature. Then when you evaluate hits, you can have the function return the name of the creature who was hit.","Q_Score":0,"Tags":"python,pygame","A_Id":22897426,"CreationDate":"2014-04-06T17:19:00.000","Title":"Detecting sprite object within a sprite group on collision","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am building a file browser using Gtk.IconView in python. I am trying to find the path of an icon selected using \" selection-changed\" signal using gtk.IconView.get_path_at_pos(x,y).\nThe docs are mum on how to obtain the (x,y). How do I find them?\nusing python 2.7 and pygtk 2.24","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":84,"Q_Id":22940269,"Users Score":1,"Answer":"You don't use get_path_at_pos. It is meant for cases where you handle the button presses directly (which you should avoid unless you really have good reasons to do so).\nSimply use gtk_icon_view_get_selected_items (C) or the pygtk equivalent iconview.get_selected_items() which gives you a list (in C a GList) of currently selected Gtk.TreePaths which is what you desire.","Q_Score":0,"Tags":"python,gtk","A_Id":22942890,"CreationDate":"2014-04-08T14:35:00.000","Title":"Finding Mouse click position in IconView in GTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to have a ListCtrl cell span several columns? Or perhaps to able to append a panel \/ other element to a ListCtrl item that will contain the info I need?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":22948589,"Users Score":1,"Answer":"No. The ListCtrl does not support that functionality. There is a pure Python list control widget called the UltimateListCtrl that allows you add any widget to a cell, although it doesn't appear to allow cell spanning either. I would still try this widget and see if it works for you. If it does not, you may be able to patch it yourself because it's written in Python or you could do a feature request for it to be added to the UltimateListCtrl on the wxPython mailing list and see if anyone takes you up on it.\nYou can do spanning in a wx.Grid widget if you wanted to go that route, although it's pretty limited when it comes to embedding other widgets.","Q_Score":0,"Tags":"python-2.7,wxpython","A_Id":22968522,"CreationDate":"2014-04-08T21:30:00.000","Title":"Possible for ListCtrl Colspan, or similar functionality?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QGLWidget in which openGL objects are created. I want to get better anti-aliasing than I have now by using glutInitDisplayMode(GLUT_DOUBLE | GLUT_MULTISAMPLE | GLUT_DEPTH).\nHow can I impliment this function (in python)?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":238,"Q_Id":22961926,"Users Score":1,"Answer":"Qt is an application framework that implements the GUI event loop. GLUT is an application, that implements the GUI event loop. There can be only one GUI event loop in a process. Hence Qt and GLUT can not be mixed.\nJust configure QGLWidget with multisampling. Create a QGLFormat instance, call setSampleBuffers(true) on it, and pass it to the QGLWidget constructor.","Q_Score":1,"Tags":"python,opengl,glut,antialiasing,qglwidget","A_Id":22969282,"CreationDate":"2014-04-09T12:03:00.000","Title":"How can I use glutInitDisplayMode() in a QGLWidget, so I can get anti-aliasing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating an application in Python that uses SQLite databases and wxPython. I want to implement it using MVC in some way. I am just curious about threading. Should I be doing this in any scenario that uses a GUI? Would this kind of application require it?","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":106,"Q_Id":22999993,"Users Score":1,"Answer":"You will use multithreading to perform parallel or background tasks that you don't want the main thread to wait, you don't want it to hang the GUI while it runs, or interfer with the user interactivity, or some other priority tasks.\nMost applications today don't use multithreading or use very little of it. Even if they do use multi threads, its usually because of libraries the final programmer is using and isn't even aware that multithreading is happening there as he developed his application.\nEven major softwares like AutoCAD use very little multithreading. It's not that its poorly made, but multithreading has very specific applications. For instance, it is pointless to allow user interaction while the project he wants to work on is still loading. A software designed to interact with a single user will hardly need it.\nWhere you can see multithreading fit a really important role is in servers, where a single application can attend requests from thousands of users without interfering with each other. In this scenario the easier way to make sure everyone is happy is by creating a new thread to each request.","Q_Score":1,"Tags":"python,multithreading,model-view-controller,python-multithreading","A_Id":23000219,"CreationDate":"2014-04-10T22:08:00.000","Title":"When should I be considering using threading","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating an application in Python that uses SQLite databases and wxPython. I want to implement it using MVC in some way. I am just curious about threading. Should I be doing this in any scenario that uses a GUI? Would this kind of application require it?","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":106,"Q_Id":22999993,"Users Score":1,"Answer":"Actually, GUIs are typically single threaded implementations where a single thread (called UI thread) keeps polling for events and keeps executing them in the order they occur.\nRegarding the main question, consider this scenario. \nAt the click of a button you want to do something time consuming that takes say 5-10 seconds or more. You have got 2 options.\n\nDo that operation in the main UI thread itself. This will freeze the UI for that duration and user will not be able to interact with it.\nDo that operation in a separate thread that would on completion just notify the main UI thread (in case UI thread needs to make any UI updates based on result of the operation). This option will not block the UI thread and user can continue to use the application.\n\nHowever, there will be situations where you do not want user to be using the application while something happens. In such cases usually you can still use a separate thread but block the UI using some sort of overlay \/ progress indicator combination.","Q_Score":1,"Tags":"python,multithreading,model-view-controller,python-multithreading","A_Id":23000279,"CreationDate":"2014-04-10T22:08:00.000","Title":"When should I be considering using threading","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating an application in Python that uses SQLite databases and wxPython. I want to implement it using MVC in some way. I am just curious about threading. Should I be doing this in any scenario that uses a GUI? Would this kind of application require it?","AnswerCount":4,"Available Count":4,"Score":1.2,"is_accepted":true,"ViewCount":106,"Q_Id":22999993,"Users Score":0,"Answer":"almost certainly you already are...\nalot of wx is already driven by an asynchronous event loop ..\nthat said you should use wx.PubSub for communication within an MVC style wx Application, but it is unlikely that you will need to implement any kind of threading (you get it for free practically)\na few good places to python threading(locked by gil) use are:\n\nserial communication\nsocket servers\n\na few places to use multiprocessing (still locked by gil but at least it sends it to different cores)\n\nbitcoin miners\nanything that requires massive amounts of data processing that can be parallelized\n\nthere are lots more places to use it, however most gui are already fairly asynchronously driven by events (not entirely true, but close enough), and sqlite3 queries definitely should be executed one at a time from the same thread(in fact sqlite breaks horribly if you try to write to it in two different threads)\nthis is likely all a gross oversimplification","Q_Score":1,"Tags":"python,multithreading,model-view-controller,python-multithreading","A_Id":23000020,"CreationDate":"2014-04-10T22:08:00.000","Title":"When should I be considering using threading","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating an application in Python that uses SQLite databases and wxPython. I want to implement it using MVC in some way. I am just curious about threading. Should I be doing this in any scenario that uses a GUI? Would this kind of application require it?","AnswerCount":4,"Available Count":4,"Score":0.049958375,"is_accepted":false,"ViewCount":106,"Q_Id":22999993,"Users Score":1,"Answer":"One thing I learned from javascript\/node.js is that there is a difference between asynchronous programming and parallel programming.  In asynchronous programming you may have things running out of sequence, but any given task runs to completion before something else starts running.  That way you don't have to worry about synchronizing shared resources with semaphores and locks and things like that, which would be an issue if you have multiple threads running in parallel, with either run simultaneously or might get preempted, thus the need for locks.\nMost likely you are doing some sort of asynchronous code in a gui environment, and there isn't any need for you to also do parallel multi-threaded code.","Q_Score":1,"Tags":"python,multithreading,model-view-controller,python-multithreading","A_Id":23000216,"CreationDate":"2014-04-10T22:08:00.000","Title":"When should I be considering using threading","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to solidify my python knowledge by doing some gui development, should I try Tkinter or jump directly to PyQT for better IDE support?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2947,"Q_Id":23070926,"Users Score":2,"Answer":"If your main goal is to solidify your python knowledge, I would recommend Tkinter. It's simpler and it's already installed with Python.\nIf you want to build complex applications, I recommend PyQt, which is way more powerful.","Q_Score":2,"Tags":"python,user-interface,tkinter","A_Id":23071223,"CreationDate":"2014-04-14T21:37:00.000","Title":"Tkinter first or PyQt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I apologize in advance for this being a bit vague, but I'm trying to figure out what the best way is to write my program from a high-level perspective. Here's an overview of what I'm trying to accomplish:\n\nRasPi takes input from altitude sensor on serial port at 115000 baud.\nDoes some hex -> dec math and updates state variables (pitch, roll, heading, etc)\nUses pygame library to do some image manipulation based on the state variables on a simulated heads up display\nOutputs the image to a projector at 30 fps.\n\nNote that there's no user input (for now).\nThe issue I'm running into is the framerate. The framerate MUST be constant. I'd rather skip a data packet than drop a frame. \nThere's two ways I could see structuring this:\n\nWrite one function that, when called, grabs data from the serial bus and spits out the state variables as the output. Then write a pygame loop that calls this function from inside it. My concern with this is that if the serial port starts being read at the end of an attitude message, it'll have to pause and wait for the message to start again (fractions of a second, but could result in a dropped frame)\nWrite two separate modules, both to be running simultaneously. One continuously reads data from the serial port and updates the state variables as fast as possible. The other just does the image manipulation, and grabs the latest state variables when it needs them. However, I'm not actually sure how to write a multithreaded program like this, and I don't know how well the RasPi will handle such a program.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":73,"Q_Id":23097604,"Users Score":0,"Answer":"I don't think that RasPi would work that well running multithreaded programs.  Try the first method, though it would be interesting to see the results of a multithreaded program.","Q_Score":0,"Tags":"python,multithreading,buffer,raspberry-pi","A_Id":23097644,"CreationDate":"2014-04-16T01:51:00.000","Title":"How to structure my Python code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to ask a question on how to set a development environment for Kivy under Windows 7. Normally i work with Kivy on Linux, but i need to develop an application for a client who uses Windows. From the Kivy documents, there are two alternatives:\n1- Download and Unzip the file containing the Kivy environment plus the Python interpreter with it. I have concerns here. Will this damage my existing Python environment (2.7)? if not is it sand boxed well? Plus if i need to add other third party libraries (ex : pyodbc to run on a Kivy application on a PC) where shall they be installed ?\n2- set up Kivy for existing Python environment. Another concern here : is the \"unofficial\" windows installer a good way to get Kivy running under Windows? and same concerns as above for the Python environment.\nThank you in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":879,"Q_Id":23102090,"Users Score":2,"Answer":"I am using kivy on windows 7 . You can use option 1 . it wont damage your current python 2.7 because you can just change the path of environment to the python interpreter which comes with kivy . \nin case you need to turn back to your older python installed just change the environment variables .\nIno order to add third party libraries , most of them are already installed in kivy . for others you can find them on kivy.org :)\nIf you need to use for example pyQt4 or similar library you need to use different interpreter . I am also doing same stuff .In my case , I use pycharm and keep different configuration (i.e. python interpreter) for different programs .","Q_Score":1,"Tags":"android,windows,python-2.7,kivy","A_Id":23105151,"CreationDate":"2014-04-16T06:52:00.000","Title":"Kivy development environment on Windows 7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently in a project where a lot of 3D printing designs need to be done. They are all parameterized, so I'd like to write a python code to generate those design files (in .STL format) for me. I was wondering that, is there a python package that can do this? Because currently I am all doing those by hand using SolidWorks.\nThanks!","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":5404,"Q_Id":23123384,"Users Score":2,"Answer":"Yes, more than one.\nIn my humble experience, I tried many Open Source tools for parametric CAD modeling using Python (FreeCAD, Rhino-Grasshopper, Blender, Salome). \nAll of them are valid options and the best one is represented by your ability to either model or code.\nI recently favour SALOME (www.salome-platform.org) because of the straight forward \"dump study\" option, the continue development and the good API documentation.\nParticularly I did some 3d prints using the exportSTL command once I had a solid worthy of printing and it was ok.\nNevertheless, if you intend to work on surfaces rather than solids, I don't think you will find anything worthy Open Source (Rhino has a little price to pay).","Q_Score":4,"Tags":"python,rapid-prototyping","A_Id":36361624,"CreationDate":"2014-04-17T02:08:00.000","Title":"Is there a python library to generate STL file for 3D printing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python script that runs the GUI which is coded using Tkinter.\nProblem is when i run the script, there are 2 windows opened. One is the GUI and other is the black console window. \nI need to integrate both the windows so that when I start the script only one window appears.\nAny ideas are much appreciated.\nThanks in advance.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":780,"Q_Id":23141471,"Users Score":0,"Answer":"(I am pretty sure there is a better way, but) one way is to change the .pyc object file extension to .pyw and the console will not appear when you launch your GUI using the .pyw file.","Q_Score":0,"Tags":"python,user-interface,console,tkinter,integration","A_Id":23141544,"CreationDate":"2014-04-17T19:07:00.000","Title":"Integration of console window with GUI using TkInter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking at using Kivy to create a program that needs to display a window on each monitor, is there a way to accomplish this? I'd also prefer not to have a single window spanning across.\nIf not, is there another (good looking, windows\/linux) GUI toolkit that can accomplish this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1500,"Q_Id":23178570,"Users Score":8,"Answer":"You can have two separate windows running two separate kivy apps controlling\/communicating with each other via osc\/twisted\/... However one \"App\" instance is only limited to one App window for that process. It can launch another process(subprocess.popen) which has a new window though.","Q_Score":5,"Tags":"python,user-interface,kivy","A_Id":23179572,"CreationDate":"2014-04-20T04:53:00.000","Title":"Multiple monitors with Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to connect to a mySQL database with python, then query a number corresponding to an image, and load this image in Qt.  From what I found online, it is suggested not to use mysql database to store the image, but instead store a file location on the server.  If this is the case, can I load the image (do i have to download it?) into qt using mysql or do i have to open another connection with ftp, download the image to a folder, and then load it with qt?  If there are any resources on this type of workflow I would appreciate it.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":421,"Q_Id":23190976,"Users Score":1,"Answer":"You don't need to download the file using FTP (or the like) to load it into Qt.\nAssuming the database stores the correct file path to the image, you can just use the same functionality once you get the file path, i.e. you anyway only need the file path to load the image into Qt. There is nothing special you would do by downloading the image itself.\nIf the database is on a remote server, a possible approach is to use the JDBC API to access the database, get the image as a binary file and then serialize it, which can be transferred over the network.","Q_Score":0,"Tags":"python,mysql,pyqt","A_Id":23191497,"CreationDate":"2014-04-21T04:50:00.000","Title":"mySQL connection and loading images to Qt","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I used to have PyGame installed on my PC but formatted my PC and now need it installed again. I have followed the same process as last time and have installed Python 3.3 and PyGame 3.3.0 off of GitBucket. I install PyThon to my only HDD as Python33 and Pygame in a different file on my HDD as PythonX, but for some reason when entering import pygame but it just doesn't find the module. What am I doing wrong?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":108,"Q_Id":23250659,"Users Score":0,"Answer":"The pygame library must be in site-packages folder in Lib folder of your python folder.\nIt's better you don't personalize this kind of instalation. Why separate a language of its libraries?","Q_Score":0,"Tags":"python,pygame","A_Id":28335704,"CreationDate":"2014-04-23T16:52:00.000","Title":"Installing PyGame issues","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made a database file using SQL commands in python. i have used quite a lot of foreign keys as well but i am not sure how to display this data onto qt with python? any ideas? i would also like the user to be able to add\/edit\/delete data","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":4532,"Q_Id":23268179,"Users Score":1,"Answer":"This question is a bit broad, but I'll try answering it anyway. Qt does come with some models that can be connected to a database. Specifically classes like QSqlTableModel. If you connect such a model to your database and set it as the model for a QTableView it should give you most of the behavior you want.\nUnfortunately I don't think I can be any more specific than that. Once you have written some code, feel free to ask a new question about a specific issue (remember to include example code!)","Q_Score":1,"Tags":"python,sql,qt,pyqt","A_Id":23281662,"CreationDate":"2014-04-24T11:55:00.000","Title":"How to display data from a database file onto pyqt so that the user can add\/delete\/edit the data?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anyone know of an easy way to draw ellipses that are not aligned to the x & y axis. I am very new to pygame so please forgive my ignorance, but I cannot find anything related to it.\nIf no easy method exists, can someone help me in how I might draw this besides generating many many points on the ellipse and plotting all of them?","AnswerCount":5,"Available Count":1,"Score":-0.0798297691,"is_accepted":false,"ViewCount":7513,"Q_Id":23281952,"Users Score":-2,"Answer":"I do not know python or pygame, but depending on what you are building, it may be easier to just make an image using a program like inkscape for pc and mac, or inkpad for iPad. Both of these let you make a diagonal ellipse, and then export it as a .png and use it in your code. Again, if this is possible really depends on what you are doing with the ellipse.","Q_Score":4,"Tags":"python,pygame","A_Id":23282068,"CreationDate":"2014-04-25T00:01:00.000","Title":"drawing a diagonal ellipse with pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'll keep my question short and simple.\nAssume I have a python program which calls C++ code from a DLL compiled in C\/C++.\n\n-Will the speed\/performance of the executing code be preserved?\n\nAssume I have a python program ... has a binding to a C++ library (for example - GTK or Wx).\n\n-Is the speed going to match that of the library as if it was compiled with a C++ program?\n\nThank you.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1197,"Q_Id":23288692,"Users Score":2,"Answer":"When Python calls into C++ code, the code it executes is the machine code generated by the C++ compiler.  You will have some cost at the interface level, as you have to marshal Python types into C++ types and vice versa, but the C++ code itself will run at pretty much the same speed as if it were called from C++; any differences will be due to different locality of dynamically allocated memory due to different memory use patterns (which would cause your C++ code to run at different speeds depending on which C++ application called it as well).","Q_Score":1,"Tags":"python,c++,dll,binding,module","A_Id":23289534,"CreationDate":"2014-04-25T09:04:00.000","Title":"Python bindings; calling C code & performance","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to use the python kled module that's featured in QT Designer under ubuntu 13.10 Unity. Is it possible to use with Unity or will i need to use a KDE environment?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":637,"Q_Id":23305663,"Users Score":1,"Answer":"I use KLed in my PyQt4 gui. Originally it was developed in the Kubuntu environment, so this wasn't an issue, but we ended up having to move to Unity (Ubuntu 14.04 LTS). In order to still use KLed I found that I needed to apt-get install the python libraries from kde (didn't want to install Kubuntu as it interfered with operation). \nThe fix was:\nsudo apt-get install python-kde4\nSO the summary answer is:\nYes, you can use KLed in Unity, as long as you have the libraries installed.","Q_Score":0,"Tags":"python,pyqt,qt-designer","A_Id":25923294,"CreationDate":"2014-04-26T01:50:00.000","Title":"PyQt kled in Unity enviornmet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i build my GUI with wxGlade. I think it is very comfortable but i\u00b4m looking for a widget\/button which open a frame to chose a directory or file..\nCan u help me?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1034,"Q_Id":23310229,"Users Score":0,"Answer":"WxGlade does not directly support a adding a wx.FileDialog to your GUI. As someone answer you have to create and event linked to a button,menu,or toolbar then in your code enter the programming to open a filedialog and return text from it. What I normally do is use the toolbox button to create a generic dialog box and then name it open or save or something that will remind me that I will need to edit that piece of the wxGlade generated python code into and actual filedialog. That saves me a bit of time of typing ALL the code for a filedialog into the program.","Q_Score":0,"Tags":"python,wxpython,wxglade","A_Id":28642528,"CreationDate":"2014-04-26T11:31:00.000","Title":"wxGlade - Button to chose directory and file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A friend and I are making a game in pygame. We would like to have a pygame window embedded into a tkinter or WxPython frame, so that we can include text input, buttons, and dropdown menus that are supported by WX or Tkinter. I have scoured the internet for an answer, but all I have found are people asking the same question, none of these have been well answered. \nWhat would be the best way implement a pygame display embedded into a tkinter or WX frame? (TKinter is preferable)\nAny other way in which these features can be included alongside a pygame display would also work.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":31504,"Q_Id":23319059,"Users Score":1,"Answer":"According to the tracebacks, the program crashes due to TclErrors. These are caused by attempting to access the same file, socket, or similar resource in two different threads at the same time. In this case, I believe it is a conflict of screen resources within threads. However, this is not, in fact, due to an internal issue that arises with two gui programs that are meant to function autonomously. The errors are a product of a separate thread calling root.update() when it doesn't need to because the main thread has taken over. This is stopped simply by making the thread call root.update() only when the main thread is not doing so.","Q_Score":24,"Tags":"python,tkinter,wxpython,pygame,embed","A_Id":23683962,"CreationDate":"2014-04-27T03:30:00.000","Title":"Embedding a Pygame window into a Tkinter or WxPython frame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to this so sorry it if doesn't make much sense.\nI'v created a simple 2d game with Python 3.4 and Pygame and I want to create an exe file that includes python 3.4, the pygame module, the game files and launches the python game file when opened.\nThanks.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":271,"Q_Id":23319956,"Users Score":1,"Answer":"If you're using Python 3.x, you can use cx_Freeze.","Q_Score":2,"Tags":"python,file,pygame,directory,exe","A_Id":23372498,"CreationDate":"2014-04-27T06:00:00.000","Title":"How do I turn a Pygame Folder into an application (eg .exe)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a trainee novice programmer.\nI have \/ am creating simple programs, generally around screen scraping, data caption (postrgres), various processing methods and now a GUI via wxpython\nI find a lot of these programs overlap - ie use same techniques, and get some very long copied and pasted programs!\nOvertime I improve these techniques and find myself having to backtrack over multiple programs to update these.\n\nHow? Can I? Create a more dynamic, systematic process. \nOne where all programs \/ procedures \/ classes are shared?\nHas it got a name?\n\nMy logical thought is that like 'procedures' and 'classes' I have would have smaller low level programs and mid level programs that called upon these - the GUI being the top program! but this would mean passing data to and from! Can Classes and Procedures be separate programs?\nMany thanks\nCameron","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":152,"Q_Id":23362560,"Users Score":1,"Answer":"There is a range of techniques you can use : \n\nShared modules - A set of modules with well defined interfaces - functions, classes etc. These modules sit in a folders which every application you use can get to - i.e. the path to the folder is added to PYTHON_PATH environment variable. These interfaces should be engineered so when you add functionality to them they don't break the old applications.\n\n Design patterns - Design your applications with a good design pattern - MVC (Master View Controller) is a useful one for GUI programs. V is your GUI - and exposes only a few methods, which aren't actually dependent on the GUI itself (for instances methods such as display_foo). The Master is your data access functionality - again with well defined interfaces. Controller interfaces between View and Master. There may be other patterns which apply to your application too.","Q_Score":1,"Tags":"python,class,sharing","A_Id":23362812,"CreationDate":"2014-04-29T10:51:00.000","Title":"How do I go make my Python code more efficient and dynamic?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to use the data collected by a form I to a sqlite query. In this form I've made a spin button which gets any numeric input (ie. either2,34 or 2.34) and sends it in the form of 2,34 which python sees as str.\nI've already tried to float() the value but it doesn't work. It seems to be a locale problem but somehow locale.setlocale(locale.LC_ALL, '') is unsupported (says WinXP).\nAll these happen even though I haven't set anything to greek (language, locale, etc) but somehow Windows does its magic.\nCan someone help?\nPS: Of course my script starts with # -*- coding: utf-8 -*- so as to have anything in greek (even comments) in the code.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":48,"Q_Id":23388647,"Users Score":1,"Answer":"AFAIK, WinXP supports setlocale just fine.\nIf you want to do locale-aware conversions, try using locale.atof('2,34') instead of float('2,34').","Q_Score":0,"Tags":"python,sqlite,pygtk","A_Id":23389055,"CreationDate":"2014-04-30T12:53:00.000","Title":"pygtk spinbutton \"greek\" floating point","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I do not have any code to show with this question because I am just seeking advice.  I have a functional piece of code and through the execution of which I create approx 20 - 30 unique panels.  I only use one at any given time (with a few small exceptions) and I use show\/hide to manage which panels are displayed at a given time.\nMy question is this:  Is it best that I create all 30 panels at the inception point of the code, hide the 29 that are not needed and move on, and then show\/hide between the 30 panels as the code runs, or should I only create the one or two that are needed at the start and create the others as they are called for and then hide\/destroy the ones that have served their purpose.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":16,"Q_Id":23415765,"Users Score":0,"Answer":"There are a couple of approaches. The first is to just create all of the panels that you need and hide them as you've been doing. Another approach would be to create the sizers with the widgets laid out appropriately and just hide the sizers as needed. This way you would only ever have one or two panels, but different layouts.","Q_Score":0,"Tags":"wxpython,panel","A_Id":23416753,"CreationDate":"2014-05-01T20:10:00.000","Title":"wxpython create multiple panels at start or as the program progresses","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I encountered Error: 'module' object has no attribute 'copy' while running a pygame program. In my code, I never referred to a copy attribute, so I don't understand where the error is coming from.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":11076,"Q_Id":23418949,"Users Score":21,"Answer":"I think there is a python file named \"copy\" in your directory. I had the same problem, after I delete the \"copy\" file, the error has gone.","Q_Score":6,"Tags":"module,pygame,python-2.5,attributeerror,traceback","A_Id":31551977,"CreationDate":"2014-05-02T00:33:00.000","Title":"Pygame AttributeError: 'module' object has no attribute 'copy'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I make a PyQt5 application to look like the same when run on Windows, and Linux?\nI would prefer the Windows style on both systems.\nThanks","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1984,"Q_Id":23427939,"Users Score":3,"Answer":"You can call QApplication::setStyle(\"windows\") before creating QApplication object to set a style by name. However, Qt on Linux is usually built without modern Windows styles, so it's possible that the best you will accomplish is the classic (old) Windows style, which is not very attractive. You can also try to use \"fusion\" style or other values that QStyleFactory::keys() returns.","Q_Score":0,"Tags":"python,qt,pyqt","A_Id":23436083,"CreationDate":"2014-05-02T12:14:00.000","Title":"Make PyQt application look like the same on Windows and Linux","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I make a PyQt5 application to look like the same when run on Windows, and Linux?\nI would prefer the Windows style on both systems.\nThanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1984,"Q_Id":23427939,"Users Score":0,"Answer":"You can use existing styles mentioned above\nor you can specify the styles of your widgets using Stylesheet, which is quite powerful.","Q_Score":0,"Tags":"python,qt,pyqt","A_Id":23474604,"CreationDate":"2014-05-02T12:14:00.000","Title":"Make PyQt application look like the same on Windows and Linux","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I finally managed to write a little app that reads from a sqlite database and show the results to a treeview. Another form (in another module) gives the ability to write new or update existing records. After writing to the database it closes the window\nWhat I'm trying to do now is to update the \"main\" window (containing the treeview) to show the new dataset. I have managed so far to do this but a) the initial mainwindow stays there while a new instance of it opens on top of it showing the desired (new) dataset.\nHow would I make this work? Can someone give me suggestions\/example?\nPerhaps I need to say that the __init__ function of my mainwindow module does everything upon running: creates the gui, reads from the database and show all. I suspect that this may be the problem but having tryed almost any combination of breaking it into pieces (functions), I had no success\n--EDIT--\nOK I have many different functions __init__ now creates the main gui while others read the data from the DB and place it on a treeview.\nI tried to use a timer but also this option doesn't seem to be apropriate as gtk.TreeView doesn't have such a method.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3427,"Q_Id":23428618,"Users Score":8,"Answer":"Finally I managed to figure this out, so I post this answer to my own question in case someone finds it helpful:\nAll I had to do was to .clear the list_store, rebuild it and use set_model to the TreeView.\nThe refresh function goes as below:\nliststore.clear()\ncreate_model_checks() # re-create liststore\ntreeView.set_model(liststore)","Q_Score":6,"Tags":"python,sqlite,treeview","A_Id":23489182,"CreationDate":"2014-05-02T12:49:00.000","Title":"pygtk treeview contents update\/refresh","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a scene, and I need to be able to overlay the scene with translucent polygons (which can be done easily using pygame.gfxdraw.filled_polygon which supports drawing with alpha), but the catch is that the amount of translucency has to fade over a distance (so for example, if the alpha value is 255 at one end of the polygon, then it is 0 at the other end and it blends from 255 to 0 through the polygon). I've implemented drawing shapes with gradients by drawing the gradient and then drawing a mask on top, but I've never come across a situation like this, so I have no clue what to do. I need a solution that can run in real time. Does anyone have any ideas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":948,"Q_Id":23439474,"Users Score":0,"Answer":"It is possible that you have already thought of this and have decided against it, but it would obviously run far better in real time if the polygons were pre-drawn. Presuming there aren't very many different types of polygons, you could even resize them however you need and you would be saving CPU.\nAlso, assuming that all of the polygons are regular, you could just have several different equilateral triangles with gradients going in various directions on them to produce the necessary shapes.\nAnother thing you could do is define the polygon you are drawing, than draw an image of a gradient saved on your computer inside that shape.\nThe final thing you could do is to build your program (or certain, CPU intensive parts of your program) in C or C++. Being compiled and automatically optimized during compiling, these languages are significantly faster than python and better suited to what you are trying to do.","Q_Score":2,"Tags":"python,pygame,alpha","A_Id":23485047,"CreationDate":"2014-05-03T02:08:00.000","Title":"Gradient alpha polygon with pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have very complicated problem. I\u00b4ve search whole internet and tried everything, but nothing worked. I want get string from listbox and than delete line in file with word from listbox. Can please somebody help me? Here is code: \ndef OnDelete(self, event):\n        sel = self.listbox.GetSelection()\n        if sel != -1:\n            self.listbox.Delete(sel)\n            subor = open(\"Save\/savegame.txt\", \"r\")\n            lines = subor.readlines()\n            subor.close()\n            subor = open(\"Save\/savegame.txt\", \"w\")\n            selstring = self.listbox.GetString(self.listbox.GetSelection())\n            for line in lines:\n                if line!=selstring:\n                    subor.write(line)\n            subor.close() \nAnd this is code for saving file:\n    def OnNewGame(self,event):\n        nameofplr = wx.GetTextFromUser('Enter your name:', 'NEW GAME')\n        subor=open(\"Save\/savegame.txt\",\"a\")\n        subor.write( \"\\n\" + nameofplr)\n        subor.close()\n        savegame=open(\"Save\/\" + nameofplr + \".prjct\", \"w+\")\n        savegame.close()  \nIt shows this error:  \nTraceback (most recent call last):\n  File \"D:\\Python\\Python Projects\\Project\\Project.py\", line 106, in OnDelete\n    selstring = self.listbox.GetString(self.listbox.GetSelection())\n  File \"D:\\Python\\lib\\site-packages\\wx-3.0-msw\\wx_core.py\", line 12962, in GetString\n    return core.ItemContainer_GetString(*args, **kwargs)\nwx._core.PyAssertionError: C++ assertion \"IsValid(n)\" failed at ....\\src\\msw\\listbox.cpp(387) in wxListBox::GetString(): invalid index in wxListBox::GetString  \nThank you very much for help!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":817,"Q_Id":23448140,"Users Score":0,"Answer":"Than you very much! I have fixed it! If somebody will have the same problem you must change  OnDelete code (The first code in question) for this:  \ndef OnDelete(self, event):\n        sel = self.listbox.GetSelection()\n        f = open(\"Save\/savegame.txt\", \"r\")\n        read = f.readlines()\n        f.close()\n        name = self.listbox.GetStringSelection()\n        newfile = \"\"\"\"\"\"\n        for i in read:\n            if name in i:\n                pass\n            else:\n                newfile += i\n        n = open(\"Save\/savegame.txt\", \"w\")\n        one = str(newfile)\n        n.write(one)\n        n.close\n        self.listbox.Delete(sel)","Q_Score":0,"Tags":"string,listbox,wxpython","A_Id":23455859,"CreationDate":"2014-05-03T18:11:00.000","Title":"How to get string from listbox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using wxPython for a board game. And want to drag chessman over positions.\nWhat is the container I should use? Should I put image for chessman in its own panel or as button or somewhere?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":68,"Q_Id":23464220,"Users Score":1,"Answer":"I think you could use a wx.Panel without any issues. There is a CustomDragAndDrop example in the wxPython demo that shows how to drag and drop images from one wx.Window to another. A wx.Panel is a type of wx.Window and I would think it would be better to use anyway. I would give that a try.","Q_Score":0,"Tags":"image,drag-and-drop,wxpython","A_Id":23479767,"CreationDate":"2014-05-05T03:13:00.000","Title":"wxPython -- Drag and Drop image between position-fixed containers, what is the suitable container?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working with an embedded python system which requires a C++ frontend using OpenSceneGraph for rendering visualizations.  My question is:\nIs there any possible way to perform this task? I need to modify C++ osg nodes from Python. Would it be an option to create wrappers for this osg nodes? If this is the answer could you provide some guidance?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":741,"Q_Id":23467814,"Users Score":0,"Answer":"Finally I managed to solve this issue by creating a new python type (python extension) and using Node Visitors to assign node references upon creation.","Q_Score":0,"Tags":"python,c++,openscenegraph","A_Id":23624458,"CreationDate":"2014-05-05T08:12:00.000","Title":"How can I use C++ OSG objects from Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm implementing an algorithm into my Python web application, and it includes doing some (possibly) large clustering and matrix calculations. I've seen that Python can use C\/C++ libraries, and thought that it might be a good idea to utilize this to speed things up. \nFirst: Are there any reasons not to, or anything I should keep in mind while doing this?\nSecond: I have some reluctance against connecting C to MySQL (where I would get the data the calculations). Is this in any way justified?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1084,"Q_Id":23491608,"Users Score":1,"Answer":"Not the answer you expected, but i have been down that road and advise KISS:\n\nFirst make it work in the most simple way possible.\nOnly than look into speeding things up later \/ complicating the design.\n\nThere are lots of other ways to phrase this such as \"do not fix hypothetical problems unless resources are unlimited\".","Q_Score":4,"Tags":"python,c++,mysql,c","A_Id":23493503,"CreationDate":"2014-05-06T10:04:00.000","Title":"Using C\/C++ for heavy calculations in Python (Also MySQL)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm implementing an algorithm into my Python web application, and it includes doing some (possibly) large clustering and matrix calculations. I've seen that Python can use C\/C++ libraries, and thought that it might be a good idea to utilize this to speed things up. \nFirst: Are there any reasons not to, or anything I should keep in mind while doing this?\nSecond: I have some reluctance against connecting C to MySQL (where I would get the data the calculations). Is this in any way justified?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1084,"Q_Id":23491608,"Users Score":1,"Answer":"Use the ecosystem.\nFor matrices, using numpy and scipy can provide approximately the same range of functionality as tools like Matlab. If you learn to write idiomatic code with these modules, the inner loops can take place in the C or FORTRAN implementations of the modules, resulting in C-like overall performance with Python expressiveness for most tasks. You may also be interested in numexpr, which can further accelerate and in some cases parallelize numpy\/scipy expressions.\nIf you must write compute-intensive inner loops in Python, think hard about it first. Maybe you can reformulate the problem in a way more suited to numpy\/scipy. Or, maybe you can use data structures available in Python to come up with a better algorithm rather than a faster implementation of the same algorithm. If not, there\u2019s Cython, which uses a restricted subset of Python to compile to machine code.\nOnly as a last resort, and after profiling to identify the absolute worst bottlenecks, should you consider writing an extension module in C\/C++. There are just so many easier ways to meet the vast majority of performance requirements, and numeric\/mathematical code is an area with very good existing library support.","Q_Score":4,"Tags":"python,c++,mysql,c","A_Id":23497013,"CreationDate":"2014-05-06T10:04:00.000","Title":"Using C\/C++ for heavy calculations in Python (Also MySQL)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm implementing an algorithm into my Python web application, and it includes doing some (possibly) large clustering and matrix calculations. I've seen that Python can use C\/C++ libraries, and thought that it might be a good idea to utilize this to speed things up. \nFirst: Are there any reasons not to, or anything I should keep in mind while doing this?\nSecond: I have some reluctance against connecting C to MySQL (where I would get the data the calculations). Is this in any way justified?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1084,"Q_Id":23491608,"Users Score":1,"Answer":"cython support for c++ is much better than what it was. You can use most of the standard library in cython seamlessly. There are up to 500x speedups in the extreme best case. \nMy experience is that it is best to keep the cython code extremely thin, and forward all arguments to c++. It is much easier to debug c++ directly, and the syntax is better understood. Having to maintain a code base unnecessarily in three different languages is a pain. \nUsing c++\/cython means that you have to spend a little time thinking about ownership issues. I.e. it is often safest not to allocate anything in c++ but prepare the memory in python \/ cython. (Use array.array or numpy.array). Alternatively, make a c++ object wrapped in cython which has a deallocation function. All this means that your application will be more fragile than if it is written only in python or c++: You are abandoning both RAII \/ gc.\nOn the other hand, your python code should translate line for line into modern c++. So this reminds you not to use old fashioned new or delete etc in your new c++ code but make things fast and clean by keeping the abstractions at a high level.\nRemember too to re-examine the assumptions behind your original algorithmic choices. What is sensible for python might be foolish for c++.\nFinally, python makes everything significantly simpler and cleaner and faster to debug than c++. But in many ways, c++ encourages more powerful abstractions and better separation of concerns. \nWhen you programme with python and cython and c++, it slowly comes to feel like taking the worse bits of both approaches. It might be worth biting the bullet and rewriting completely in c++. You can keep the python test harness and use the original design as a prototype \/ testbed.","Q_Score":4,"Tags":"python,c++,mysql,c","A_Id":23497054,"CreationDate":"2014-05-06T10:04:00.000","Title":"Using C\/C++ for heavy calculations in Python (Also MySQL)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do you go about selecting a specific line in a QTextEdit and changing say... The font colour to green\nI am using a QTextEdit widget to display the content of a file, a sequence of commands being sent over rs232. I would like to provide some visual feedback as to what line is being executed, say change the text colour.\nI am able to change the text file of text being appended to a QTextEdit (for a log I display) but that doesn't work.\nI have been looking into Qcursors but am a bit lost","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":2307,"Q_Id":23550613,"Users Score":1,"Answer":"I think that you can afford generating a new TextEdit content from the relevant data, every time something changes. That should be very easy to implement. QCursors and stuff like that is good for editable QTextEdits which is not true in your case. And there is no guarantee that it will be faster at all.","Q_Score":0,"Tags":"python,pyqt4","A_Id":23551836,"CreationDate":"2014-05-08T19:14:00.000","Title":"format a specific line in a QtextEdit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a multi-threaded (via pyqt) application which plots realtime data (data is processed in the second thread and passed to the gui thread to plot via a pyqt-signal). If I place the mouse over the application it continues to run at full speed (as measured by the time difference between calls to app.processEvents()). As soon as I begin moving the mouse, the update rate slows to a crawl, increasing again when I stop moving the mouse. \nDoes anyone know how I can resolve this\/debug the issue?  \nThe code is quite lengthy and complex so I'd rather not post it here. Thanks!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":742,"Q_Id":23567726,"Users Score":2,"Answer":"It's likely you have items in the scene that accept their own mouse input, but it's difficult to say without seeing code. In particular, be wary of complex plot lines that are made clickable--it is very expensive to compute the intersection of the mouse cursor with such complex shapes. \nThe best (some would say only) way to solve performance issues is to profile your application: run python -m cProfile -s cumulative your_script.py once without moving the mouse, and again with mouse movement (be sure to spend plenty of time moving the mouse), and then compare the outputs to see where the interpreter is spending all of its time.","Q_Score":0,"Tags":"python,qt,pyqt,pyqtgraph","A_Id":23572444,"CreationDate":"2014-05-09T14:53:00.000","Title":"PYQTGraph application slows down when mouse moves over application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm preparing exercises for school classes involving Python's turtle library.\nThe students are already drawing terrific pictures, but I want them to be able to detect existing pictures and colours in order to modify the behaviour of their program.\nFor example I would like to provide them with code which draws a maze using turtle, and then they can write the code to navigate the turtle around the maze (don't worry, I'll start simpler).\nIs there a way to detect the colour of the pixels already drawn by the turtle?\nThanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3154,"Q_Id":23579631,"Users Score":0,"Answer":"I would use an array keep all x and y that is used for the maze in an array like stated above.  Then have a size of a box around the turtle defined for detecting purposes.","Q_Score":3,"Tags":"python,turtle-graphics","A_Id":51011317,"CreationDate":"2014-05-10T09:57:00.000","Title":"How to read pixel colours using Python turtle.py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a static library I created from C++, and would like to test this using a Driver code.\nI noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.\nI would like to take this approach, but I realized that this is a library and doesn't have a main function; that would mean I should either create a Driver.cpp class, or wrap the library into python using SWIG or boost python.\nI\u2019m planning to do the latter because it seems more fun, but logically, I feel that there is going to be more bugs when trying to wrap a library to a different language just to test it, rather than test it in its native language.\nIs testing programs in a different language an accepted practice in the real world, or is this bad practice?","AnswerCount":5,"Available Count":5,"Score":0.1973753202,"is_accepted":false,"ViewCount":4198,"Q_Id":23622923,"Users Score":5,"Answer":"It really depends on what it is you are trying to test. It almost always makes sense to write unit tests in the same language as the code you are testing so that you can construct the objects under test or invoke the functions under test, both of which can be most easily done in the same language, and verify that they work correctly. There are, however, cases in which it makes sense to use a different language, namely:\n\nIntegration tests that run a number of different components or applications together.\nTests that verify compilation or interpretation failures which could not be tested in the language, itself, since you are validating that an error occurs at the language level.\n\nAn example of #1 might be a program that starts up multiple different servers connected to each other, issues requests to the server, and verifies those responses. Or, as a simpler example, a program that simply forks an application under test as a subprocess and verifies that it produces the expected outputs for a given input.\nAn example of #2 might be a program that verifies that a certain piece of C++ code will produce a static assertion failure or that a particular template instantiation which is intentionally disallowed will result in a compilation failure if someone attempts to use it.\nTo answer your larger question, it is not bad practice per-se to write tests in a different language. Whatever makes the tests more convenient to write, easier to understand, more robust to changes in implementation, more sensitive to regressions, and better on any one of the properties that define good testing would be a good justification to write the tests one way vs another. If that means writing the tests in another language, then go for it. That being said, small unit tests typically need to be able to invoke the  item under test directly which, in most cases, means writing the unit tests in the same language  as the component under test.","Q_Score":28,"Tags":"python,c++,unit-testing","A_Id":23623089,"CreationDate":"2014-05-13T04:40:00.000","Title":"Is it acceptable practice to unit-test a program in a different language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a static library I created from C++, and would like to test this using a Driver code.\nI noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.\nI would like to take this approach, but I realized that this is a library and doesn't have a main function; that would mean I should either create a Driver.cpp class, or wrap the library into python using SWIG or boost python.\nI\u2019m planning to do the latter because it seems more fun, but logically, I feel that there is going to be more bugs when trying to wrap a library to a different language just to test it, rather than test it in its native language.\nIs testing programs in a different language an accepted practice in the real world, or is this bad practice?","AnswerCount":5,"Available Count":5,"Score":0.1586485043,"is_accepted":false,"ViewCount":4198,"Q_Id":23622923,"Users Score":4,"Answer":"Why not, it's an awesome idea because you really understand that you are testing the unit like a black box. \nOf course there may be technical issues involved, what if you need to mock some parts of the unit under test, that may be difficult in a different language.\nThis is a common practice for integration tests though, I've seen lots of programs driven from external tools such as a website from selenium, or an application from cucumber. Both those can be considered the same as a custom python script.\nIf you consider the difference between integration testing and unit testing is the number of things under test at any given time, the only reason why you shouldn't do this is tool support.","Q_Score":28,"Tags":"python,c++,unit-testing","A_Id":23623087,"CreationDate":"2014-05-13T04:40:00.000","Title":"Is it acceptable practice to unit-test a program in a different language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a static library I created from C++, and would like to test this using a Driver code.\nI noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.\nI would like to take this approach, but I realized that this is a library and doesn't have a main function; that would mean I should either create a Driver.cpp class, or wrap the library into python using SWIG or boost python.\nI\u2019m planning to do the latter because it seems more fun, but logically, I feel that there is going to be more bugs when trying to wrap a library to a different language just to test it, rather than test it in its native language.\nIs testing programs in a different language an accepted practice in the real world, or is this bad practice?","AnswerCount":5,"Available Count":5,"Score":0.1586485043,"is_accepted":false,"ViewCount":4198,"Q_Id":23622923,"Users Score":4,"Answer":"I would say it depends on what you're actually trying to test. For true unit testing, it is, I think, best to test in the same language, or at least a binary-compatible language (i.e. testing Java with Groovy -- I use Spock in this case, which is Groovy based, to unit-test my Java code, since I can intermingle the Java with the Groovy), but if you are testing results, then I think it's fair to switch languages.\nFor example, I have tested the expected results when given a specific set of a data when running a Perl application via nose in Python. This works because I'm not unit testing the Perl code, per se, but the outcomes of that Perl code.\nIn that case, to unit test actual Perl functions that are part of the application, I would use a Perl-based test framework such as Test::More.","Q_Score":28,"Tags":"python,c++,unit-testing","A_Id":23623031,"CreationDate":"2014-05-13T04:40:00.000","Title":"Is it acceptable practice to unit-test a program in a different language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a static library I created from C++, and would like to test this using a Driver code.\nI noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.\nI would like to take this approach, but I realized that this is a library and doesn't have a main function; that would mean I should either create a Driver.cpp class, or wrap the library into python using SWIG or boost python.\nI\u2019m planning to do the latter because it seems more fun, but logically, I feel that there is going to be more bugs when trying to wrap a library to a different language just to test it, rather than test it in its native language.\nIs testing programs in a different language an accepted practice in the real world, or is this bad practice?","AnswerCount":5,"Available Count":5,"Score":1.0,"is_accepted":false,"ViewCount":4198,"Q_Id":23622923,"Users Score":9,"Answer":"A few things to keep in mind:\n\nIf you are writing tests as you code, then, by all means, use whatever language works best to give you rapid feedback. This enables fast test-code cycles (and is fun as well). BUT.\nAlways have well-written tests in the language of the consumer. How is your client\/consumer going to call your functions? What language will they be using? Using the same language minimizes integration issues later on in the life-cycle.","Q_Score":28,"Tags":"python,c++,unit-testing","A_Id":23623093,"CreationDate":"2014-05-13T04:40:00.000","Title":"Is it acceptable practice to unit-test a program in a different language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a static library I created from C++, and would like to test this using a Driver code.\nI noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.\nI would like to take this approach, but I realized that this is a library and doesn't have a main function; that would mean I should either create a Driver.cpp class, or wrap the library into python using SWIG or boost python.\nI\u2019m planning to do the latter because it seems more fun, but logically, I feel that there is going to be more bugs when trying to wrap a library to a different language just to test it, rather than test it in its native language.\nIs testing programs in a different language an accepted practice in the real world, or is this bad practice?","AnswerCount":5,"Available Count":5,"Score":1.2,"is_accepted":true,"ViewCount":4198,"Q_Id":23622923,"Users Score":28,"Answer":"I'd say that it's best to test the API that your users will be exposed to. Other tests are good to have as well, but that's the most important aspect.\nIf your users are going to write C\/C++ code linking to your library, then it would be good to have tests making use of your library the same way.\nIf you are going to ship a Python wrapper (why not?) then you should have Python tests.\nOf course, there is a convenience aspect to this, as well. It may be easier to write tests in Python, and you might have time constraints that make it more appealing, etc.\nI guess what I'm saying is: There's nothing inherently wrong with tests being in a different language from the code under test (that's totally normal for testing a REST API, for instance), but make sure you have tests for the public-facing API at a minimum.\n\nAside, on terminology:\nI don't think the types of tests you are describing are \"unit tests\" in the usual sense of the term. Probably \"functional test\" would be more accurate.\nA unit test typically tests a very small component - such as a function call - that might be one piece of larger functionality. Unit tests like these are often \"white box\" tests, so you can see the inner workings of your code.\nTesting something from a user's point-of-view (such as your professor's commandline tests) are \"black box\" tests, and in these examples are at a more functional level rather than \"unit\" level.\nI'm sure plenty of people may disagree with that, though - it's not a rigidly-defined set of terms.","Q_Score":28,"Tags":"python,c++,unit-testing","A_Id":23623088,"CreationDate":"2014-05-13T04:40:00.000","Title":"Is it acceptable practice to unit-test a program in a different language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've a strange issue. pserve --reload has stopped reloading the templates. It is reloading if some .py-file is changing, but won't notice .mak-file changes anymore. \nI tried to fix it by:\n\nChecking the filepermissions\nCreating the new virtualenv, which didn't help.\nInstalling different version of mako without any effect.\nChecking that the python is used from virtualenv\nplaying with the development.ini. It has the flag: pyramid.reload_templates = true\n\nAny idea how to start debugging the system?\nVersions:\n\nPython 2.7\npyramid 1.5\npyramid_mako 1.02\nmako 0.9.1\n\nYours\nHeikki","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":216,"Q_Id":23646485,"Users Score":1,"Answer":"Oh my,\nI found the thing... I had <%block cached=\"True\"  cache_key=\"${self.filename}+body\"> and the file inclusion was inside of that block.\nCheerious:)","Q_Score":0,"Tags":"python,pyramid,mako,waitress","A_Id":23654584,"CreationDate":"2014-05-14T05:42:00.000","Title":"Pyramid Mako pserver --reload not reloading in Mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am developing a simple standalone, graphical application in python. My development has been done on linux but I would like to distribute the application cross-platform.\nI have a launcher script which checks a bunch of environment variables and then sets various configuration options, and then calls the application with what amounts to python main.py (specifically os.system('python main.py %s'% (arg1, arg2...)) )\nOn OS X (without X11), the launcher script crashed with an error like Could not run application, need access to screen. A very quick google search later, the script was working locally by replacing python main.py with pythonw main.py.\nMy question is, what is the best way to write the launcher script so that it can do the right thing across platforms and not crash? Note that this question is not asking how to determine what platform I am on. The solution \"check to see if I am on OS X, and if so invoke pythonw instead\" is what I have done for now, but it seems like a somewhat hacky fix because it depends on understanding the details of the windowing system (which could easily break sometime in the future) and I wonder if there is a cleaner way.\nThis question does not yet have a satisfactory answer.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":933,"Q_Id":23659248,"Users Score":0,"Answer":"Firstly, you should always use .pyw for GUIs. \nSecondly, you could convert it to .exe if you want people without python to be able to use your program. The process is simple. The hardest part is downloading one of these:\n\nfor python 2.x: p2exe\nfor python 3.x: cx_Freeze\n\nYou can simply google instructions on how to use them if you decide to go down that path.\nAlso, if you're using messageboxes in your GUI, it won't work. You will have to create windows\/toplevels instead.","Q_Score":1,"Tags":"python,user-interface,cross-platform","A_Id":23660787,"CreationDate":"2014-05-14T15:40:00.000","Title":"python or pythonw in creating a cross-platform standalone GUI app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am developing a simple standalone, graphical application in python. My development has been done on linux but I would like to distribute the application cross-platform.\nI have a launcher script which checks a bunch of environment variables and then sets various configuration options, and then calls the application with what amounts to python main.py (specifically os.system('python main.py %s'% (arg1, arg2...)) )\nOn OS X (without X11), the launcher script crashed with an error like Could not run application, need access to screen. A very quick google search later, the script was working locally by replacing python main.py with pythonw main.py.\nMy question is, what is the best way to write the launcher script so that it can do the right thing across platforms and not crash? Note that this question is not asking how to determine what platform I am on. The solution \"check to see if I am on OS X, and if so invoke pythonw instead\" is what I have done for now, but it seems like a somewhat hacky fix because it depends on understanding the details of the windowing system (which could easily break sometime in the future) and I wonder if there is a cleaner way.\nThis question does not yet have a satisfactory answer.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":933,"Q_Id":23659248,"Users Score":0,"Answer":"If you save the file as main.pyw, it should run the script without opening up a new cmd\/terminal. \nThen you can run it as python main.pyw","Q_Score":1,"Tags":"python,user-interface,cross-platform","A_Id":23659489,"CreationDate":"2014-05-14T15:40:00.000","Title":"python or pythonw in creating a cross-platform standalone GUI app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"So I've been making a game using Python, specifically the PyGame module. Everything has been going fairly well (except Python's speed, am I right :P), and I've got a nice list of accomplishments from this, but I just ran into a... speedbump. Maybe a mountain. I'm not to sure yet. The problem is:\n\nHow do I go about implementing a Camera with my current engine?\n\nThat probably means nothing to you, though, so let me explain what my current engine is doing: I have a spritesheet that I use for all images. The map is made up of a double array of Tile objects, which fills up the display (800 x 640). The map also contains references to all Entity's and Particles. So now I want to create a a camera, so that the map object can be Larger than the display. To do this I've devised that I'll need some kind of camera that follows the player (with the player at the center of the screen). I've seen this implemented before in games, and even read a few other similar posts, but I need to also know Will I have to restructure all game code to work this in? My first attempt was to make all object move on the screen when the player moves, but I feel that there is a better way to do this, as this screws up collision detection and such.\nSo, if anyone knows any good references to problems like this, or a way to fix it, I'm all ears... er.. eyes. \nThanks","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2049,"Q_Id":23666333,"Users Score":0,"Answer":"Since I can't have a look into your code, I can't assess how useful this answer will be for you.\nMy approach for side scroller, moveable maps, etc. is to blit all tiles onto a pygame.Surface spanning the dimensions of the whole level\/map\/ etc. or at least a big chunk of it. This way I have to blit only one surface per frame which is already prepared.\nFor collision detection I keep the x\/y values (not the entire rect) of the tiles involved in a separate list. Updating is then mainly shifting numbers around and not surfaces anymore.\nFeel free to ask for more details, if you deem it useful :)","Q_Score":0,"Tags":"python,camera,pygame,2d-games","A_Id":23671391,"CreationDate":"2014-05-14T22:38:00.000","Title":"2D Game Engine - Implementing a Camera","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just used py2exe to compile my python app that uses pyqt. The size of it is 23MB.\nThe Pyqt libraries (PyQt4.QtCore.pyd, PyQt4.QtGui.pyd, QtCore4.dll and QtGui4.dll) sum more than 17MB.\nIs there a way to use QT with a reduced size?\nThank you!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":475,"Q_Id":23678753,"Users Score":0,"Answer":"PyQt is essentially a wrapper around Qt.\nIn theory it should be possible to use Qt without PyQt, but you'd have to make the bindings yourself.","Q_Score":0,"Tags":"python,pyqt,py2exe","A_Id":23681056,"CreationDate":"2014-05-15T12:51:00.000","Title":"Reduce Size py2exe and pyqt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a tkinter program written in python 3.3.3. I see myself in the need of making the the program get focus when the user unlocks the computer. I don't really know how to go ahead and start with this, users have a .exe version of the program that I created with cxfreeze. I f i need to modify the .py and create another .exe, that wouldn't be a problem. \nAfter some research I found that one can use the ctypes module to lock the computer, but it's not very helpful because i need to know if it is locked or unlocked. I also saw commands from win32com, but i can't seem to be able to find a way to trigger a command when it gets unlocked.\nWhat is the best way to get focus on my program after the computer is unlocked??\nAny help is greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":100,"Q_Id":23691819,"Users Score":0,"Answer":"I cannot answer this specifically for 'unlock' event (if there even is one in the GUI; I can't find one by cursory search.).  \nBut I think the real answer is to change the question.  Having a program simply take focus when user unlocks the display is very un-Windows-ish behavior.  The Windows user expects to see the desktop just as s\/he left it before the display was locked -- why does s\/he want to see your program on top when unlocking, regardless of why Windows might have locked the display?  \nMaybe you want to recast your program as something that runs in the background and pops up a notification (in the notification area on the right side of toolbar) when it wants user to do something?","Q_Score":0,"Tags":"python,python-3.x,tkinter","A_Id":23704276,"CreationDate":"2014-05-16T02:43:00.000","Title":"Get focus on tkinter program after pc is unlocked","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can i compile files like:\n- Images,\n- sounds,\n- fonts,\n- etc..  \nFor example if I have \"click.wav\" and i dont want to let users play it themself.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":416,"Q_Id":23715822,"Users Score":0,"Answer":"From what I've done, no, you cannot. The best ways imo are as follows:\nMaking folders (files>images) to make it less desirable to look for them.\n(Not sure how well this would work with pygame) but hidden folders might work. I used hidden folders for file writing in python.\nOtherwise I think that it wouldn't be so bad if someone were to just play a sound file or look at your artwork, is there a specific problem with it?","Q_Score":1,"Tags":"python,compilation,pygame,exe,cx-freeze","A_Id":28030394,"CreationDate":"2014-05-17T20:32:00.000","Title":"Compiled my Game made in pygame to .exe. Is there any way to compile all files?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"so I trying to build project for cocos2d-x. I'm currently at cmd and when I type python android-build.py -p 19 cpp-tests it start making project but then I get error that build failed. Problem is bescause it can't find javac compiler. \n\n\"Perhaps JAVA_HOME does not point to the JDk. It is currently set to\n  \"c:\/Program Files\/Java\/jre7\"\n\nProblem is bescause in system variables I made new variable called JAVA_HOME and it is pointed to C:\\android\\Java\\jdk1.8.0_05\\bin but still I getting that error. What to do guys?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":90,"Q_Id":23716064,"Users Score":0,"Answer":"You have to point JAVA_HOME to this path: \n\nC:\\android\\Java\\jdk1.8.0_05","Q_Score":1,"Tags":"java,android,python,c++","A_Id":31828819,"CreationDate":"2014-05-17T21:04:00.000","Title":"JAVA_HOME \"bug\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am working on my Python project using PySide as my Ui language. My projet is a game which require an internet connection to update the users'score and store in the database.\nMy problem is how can I store my database in the internet. I mean that all users can access this information when they are connected to an internet (when they are playing my game) and the information\/database must be updated all the time.\nI am not sure which database is the most appropriate, how to store this information\/database in the internet, how to access this information.\nI am using Python and PySide.\nFor the database, I currently use PySide.QtSql .\nThank you for answer(s) or suggestion(s).","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":193,"Q_Id":23754108,"Users Score":0,"Answer":"I'm not familiar with PySide .. but the idea is \nyou need to build a function that when internet connection is available it should synchronize your local database with online database and in the server-side you need to build a script that can handle requests ( POST \/ GET ) to receive the scores and send it to database and I suggest MySQL .. \nHope that helps","Q_Score":0,"Tags":"python,database,sockets,pyside,qtsql","A_Id":23754331,"CreationDate":"2014-05-20T07:59:00.000","Title":"Using Database with Pyside and Socket","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Current conditions:\n\nC code being rewritten to do almost the same type of simulation every time (learning behavior in mice)\nMatlab code being written for every simulation to plot results (2D, potentially 3D graphs)\n\nHere are my goals:\n\nDesign GUI (wxPython) that allows me to build a dynamic simulator\nGUI also displays results of simulation via OpenGL (or perhaps Matplotlib)\nUse a C wrapper (CFFI) to run the simulation and send the results (averages) to OpenGL or Matplotlib\n\nQuestion:\n\nIn order to have this software run as efficiently as possible, it makes sense to me that CFFI should be used to run the simulation...what I'm not sure about is if it would be better to have that FFI instance (or a separate one?) use an OpenGL C binding to do all the graphics stuff and pass the resulting graphs up to the Python layer to display in the GUI, or have CFFI send the averages of the simulations (the data that gets plotted) to variables in the Python level and use PyOpenGL or Matplotlib to plot graphs.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":461,"Q_Id":23819504,"Users Score":1,"Answer":"It would help to know what the turnaround time for the simulation runs is and how fast you want to display and update graphs. More or less realtime, tens of milliseconds for each? Seconds? Minutes?\nIf you want to draw graphs, I'd recommend Matplotlib rather than OpenGL. Even hacking the Matplotlib code yourself to make it do exactly what you want will probably still be easier than doing stuff in OpenGL. And Matplotlib also has \"XKCD\" style graphs :-)\nPyOpenGL works fine with wxPython. Most of the grunt work in modern 3D is done by the GPU so it probably won't be worth doing 3D graphics in C rather than Python if you decide to go that route.\nHope this helps.","Q_Score":1,"Tags":"python,c,opengl,interop,python-cffi","A_Id":23861390,"CreationDate":"2014-05-23T01:04:00.000","Title":"Interoperability advice - Python, C, Matplotlib\/OpenGL run-time efficency","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to download\/install Light Table. I want it to show up in the start menu.\nWhen downloading light table, it shows up as a Zip folder in the TEMP file. I've extracted the files and am unable to get it to show up in the start menu.\nNormally the programs I download have an installer that does this automatically. Light Table doesn't seem to have this.\nI'm sure I can use it from the TEMP folder, but would really like it in the start menu, program files folder or C drive.\nI've only done basic use of PCs (gaming, web browsing, MS Office).","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":2589,"Q_Id":23846899,"Users Score":3,"Answer":"It's pretty easy to do.\n\nUnzip to where ever \nMove the LightTable directory (from inside LightTableWin) to your Program Files (x86) directory.  \n2.1 If you are using Windows Explorer, you'll need to start windows explorer as an administrator (found by right clicking the program icon) \nopen your Program Files (x86)\\LightTable directory, right click\nand drap the LightTable.exe file into the same directory and select\nCreate Shortcut \nLeft Click your short cut and drag it to\nyour start menu.  When it asks if you want to pin it to your start\nmenu, select yes. \nClick on Start, and then click on the light table short cut. \nUse Light Table","Q_Score":2,"Tags":"python,windows-7,installation,lighttable","A_Id":29813451,"CreationDate":"2014-05-24T15:45:00.000","Title":"Install Light Table editor on Windows 7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have searched a lot and I know how to open a directory dialog window. \nBut what I am looking for is the method to open a directory folder under windows OS, just like you right click one of your local folder and select open. \nAny suggestions?","AnswerCount":6,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":21145,"Q_Id":23859613,"Users Score":4,"Answer":"You may simply try this:\nos.startfile(whatever_valid_filename)\nThis starts the default OS application for whatever_valid_filename, meaning Explorer for a folder name, default notepad for a .txt file, etc.","Q_Score":4,"Tags":"python,pyqt,pyqt4","A_Id":41981238,"CreationDate":"2014-05-25T20:22:00.000","Title":"PyQt - How to open a directory folder?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a mediaplayer-gui fitting some needs of a medialibrary containing classical music only.\nLanguage is python3\/tkinter.\nOne backend is gstreamer1.0, playbin (seems to be the only one, playing gapless).\nWhen playbin gets the uri of a file with 5.0 channels\n(FRONT_LEFT,FRONT_RIGHT,FRONT_CENTER,REAR_LEFT,REAR_RIGHT)\nit gives following warning:\n** (python3:13745): WARNING **: Unpositioned audio channel position flag set but channel positions present\nand plays the file downmixed to stereo.\n5.0 is most common in classical-music media(LFE is mostly unwanted).\nWhich gstreamer-object is the one, i can tell about channel-layout and what signal do i have to connect to, to get that object?\nAdditional info:\n5.1 gives the same warning, but plays without downmixing; \n5.0 using gstplay-1.0 from commandline gives warning & downmixing; \nusing gst123 based on gstreamer0.1 plays everything right","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":193,"Q_Id":23884156,"Users Score":1,"Answer":"I'd suggest to file a bug and ideally make your test files available.\nIf you want to track this down yourself take a look at the GST_DEBUG=\"*:3\" .\/your-app output to see which element is emitting the warning.","Q_Score":0,"Tags":"python,gstreamer","A_Id":23921536,"CreationDate":"2014-05-27T08:08:00.000","Title":"how to make playbin of gstreamer1.0 playing multichannel-audio 5.0 playing without downmixing to stereo","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Kivy-based Python project that I'm trying to build. It uses the NavigationDrawer component from Kivy Garden, through an import:\n\nfrom kivy.garden.navigationdrawer import NavigationDrawer\n\nI have a PyInstaller spec file for it which builds a distributable version. This version works well on my machine, but unfortunately not on other machines. Running the interpreter in the 'dist' version with the -v switch, it appears that when I run the distributable on my machine, the navigationdrawer component is not actually coming from inside my build folder. All the other imports show something like:\n\nimport kivy.graphics.gl_instructions # dynamically loaded from C:\\Users\\me\\myapp\\dist\\RACECA~1\\kivy.graphics.gl_instructions.pyd\n\nBut the navigationdrawer import says:\n\nimport kivy.garden.navigationdrawer\n\"\"\"directory C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\n  C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.pyc matches C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.py\n  import kivy.garden.navigationdrawer # precompiled from C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.pyc\"\"\"\n\nBut noo! I don't want you to import them from c:\\users. I want them to get nicely copied into my dist folder like all the other imports. I've tried adding c:\\users\\me to PyInstaller's pathex, the system PATH and PYTHONPATH without any joy. Anyone have any ideas?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":2433,"Q_Id":24048350,"Users Score":0,"Answer":"I had a similar issue with garden modules.  When I install like the following:\nstart cmd \/C \"garden install --kivy roulettescroll\"\nstart cmd \/C \"garden install --kivy roulette\"\nstart cmd \/C \"garden install --kivy tickline\"\nstart cmd \/C \"garden install --kivy datetimepicker\"\nI add PyInstaller ... --hidden-import=kivy.garden.tickline --hidden-import=kivy.garden.roulette --hidden-import=kivy.garden.roulettescroll --hidden-import=kivy.garden.datetimepicker ...\nI'm able to install and have no problems with Python picking up the modules.  Unfortunately, the datetimepicker shows up as white rectangles.  I have no idea what I might be missing.. But atleast I got past the import issue.","Q_Score":4,"Tags":"python,kivy,pyinstaller","A_Id":39481035,"CreationDate":"2014-06-04T22:00:00.000","Title":"Kivy Garden in PyInstaller - stuck trying to trace import","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Kivy-based Python project that I'm trying to build. It uses the NavigationDrawer component from Kivy Garden, through an import:\n\nfrom kivy.garden.navigationdrawer import NavigationDrawer\n\nI have a PyInstaller spec file for it which builds a distributable version. This version works well on my machine, but unfortunately not on other machines. Running the interpreter in the 'dist' version with the -v switch, it appears that when I run the distributable on my machine, the navigationdrawer component is not actually coming from inside my build folder. All the other imports show something like:\n\nimport kivy.graphics.gl_instructions # dynamically loaded from C:\\Users\\me\\myapp\\dist\\RACECA~1\\kivy.graphics.gl_instructions.pyd\n\nBut the navigationdrawer import says:\n\nimport kivy.garden.navigationdrawer\n\"\"\"directory C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\n  C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.pyc matches C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.py\n  import kivy.garden.navigationdrawer # precompiled from C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.pyc\"\"\"\n\nBut noo! I don't want you to import them from c:\\users. I want them to get nicely copied into my dist folder like all the other imports. I've tried adding c:\\users\\me to PyInstaller's pathex, the system PATH and PYTHONPATH without any joy. Anyone have any ideas?","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":2433,"Q_Id":24048350,"Users Score":2,"Answer":"You could just copy the navigationdrawer code from C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer to your app directory, call the folder 'navigationdrawer' and replace the import with from navigationdrawer import NavigationDrawer.\nIt's not quite the 'right' way to do it (there's probably some way to make pyinstaller copy it in), but it should work fine.","Q_Score":4,"Tags":"python,kivy,pyinstaller","A_Id":24048458,"CreationDate":"2014-06-04T22:00:00.000","Title":"Kivy Garden in PyInstaller - stuck trying to trace import","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Kivy-based Python project that I'm trying to build. It uses the NavigationDrawer component from Kivy Garden, through an import:\n\nfrom kivy.garden.navigationdrawer import NavigationDrawer\n\nI have a PyInstaller spec file for it which builds a distributable version. This version works well on my machine, but unfortunately not on other machines. Running the interpreter in the 'dist' version with the -v switch, it appears that when I run the distributable on my machine, the navigationdrawer component is not actually coming from inside my build folder. All the other imports show something like:\n\nimport kivy.graphics.gl_instructions # dynamically loaded from C:\\Users\\me\\myapp\\dist\\RACECA~1\\kivy.graphics.gl_instructions.pyd\n\nBut the navigationdrawer import says:\n\nimport kivy.garden.navigationdrawer\n\"\"\"directory C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\n  C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.pyc matches C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.py\n  import kivy.garden.navigationdrawer # precompiled from C:\\Users\\me\\.kivy\\garden\\garden.navigationdrawer\\__init__.pyc\"\"\"\n\nBut noo! I don't want you to import them from c:\\users. I want them to get nicely copied into my dist folder like all the other imports. I've tried adding c:\\users\\me to PyInstaller's pathex, the system PATH and PYTHONPATH without any joy. Anyone have any ideas?","AnswerCount":4,"Available Count":3,"Score":-0.049958375,"is_accepted":false,"ViewCount":2433,"Q_Id":24048350,"Users Score":-1,"Answer":"Go to your python site packages there is a folder named garden, look in __init__.py. There is a explanation how to install navigationdrawer.","Q_Score":4,"Tags":"python,kivy,pyinstaller","A_Id":35244089,"CreationDate":"2014-06-04T22:00:00.000","Title":"Kivy Garden in PyInstaller - stuck trying to trace import","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a database table (created using the SQLite3 library) and would like to be able to open a new window (in a program that I am writing) which will simply display the contents of the table (*.db) with a scroll bar to the user (perhaps on a grid like you would find in a spreadsheet).\nAre there any easy ways of achieving this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1409,"Q_Id":24118765,"Users Score":1,"Answer":"I think you would use \n\n.grid() in a Frame or\nmultiple Listboxes with as many scrollbars as you like.","Q_Score":0,"Tags":"python,sqlite,tkinter","A_Id":24123191,"CreationDate":"2014-06-09T10:53:00.000","Title":"Is there a tkinter widget to easily display a table (SQLite) in a window (canvas)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently working on a project to import a Matlab program to python for integration into ImageJ as a plugin. The program contains Mex files and the source code was written in C++. Is there a way to call the C++ functions without having to rewrite them in python. Thanks!!!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1339,"Q_Id":24153503,"Users Score":1,"Answer":"If you can build your program as a shared library, then you can use the ctypes foreign-function interface to call your functions.\nThis is often less work (and less complex) than wrapping the functions with Cython or writing your own C-API extension, but it is also more limited in what you can do. Therefore, I recommend starting with ctypes, and moving up to Cython if you find that ctypes doesn't suit your needs.\nHowever, for simple libraries, ctypes will do just fine (I use it a lot).","Q_Score":0,"Tags":"python,c,matlab,mex","A_Id":24154260,"CreationDate":"2014-06-11T01:54:00.000","Title":"Call C\/C++ code from Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a windows app which runs a python script. I'm able to capture the output of the script in textbox.\nNow i need to pass a shared object to python script as an argument from my app.\nwhat type of shared object should i create so that python script can accept it and run it or in simple words how do i create shared object which can be used by python script.\nthanks","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":912,"Q_Id":24237335,"Users Score":1,"Answer":"Since python is running as another process. This is no way for python to access object in c# directly since process isolation.\nA way of marshal and un-marshal should be included to communicate between processes.\nThere are many way to communicate between processes. Share memory, file, TCP and so on.","Q_Score":3,"Tags":"c#,python,.net,share,shared-objects","A_Id":24281523,"CreationDate":"2014-06-16T05:54:00.000","Title":"shared object in C# to be used in python script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a windows app which runs a python script. I'm able to capture the output of the script in textbox.\nNow i need to pass a shared object to python script as an argument from my app.\nwhat type of shared object should i create so that python script can accept it and run it or in simple words how do i create shared object which can be used by python script.\nthanks","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":912,"Q_Id":24237335,"Users Score":1,"Answer":"5.4. Extending Embedded Python \nwill help you to access the application object.\nIn this case both application and python running in single process.","Q_Score":3,"Tags":"c#,python,.net,share,shared-objects","A_Id":32651105,"CreationDate":"2014-06-16T05:54:00.000","Title":"shared object in C# to be used in python script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Pretty self-explanatory from the title.  I'm using PyQt4 to crawl pages and I occasionally get a SegFault error.  \nThe overall program seems to still be working regardless though, so all I want to do is prevent that \"Segmentation Fault (core dumped)\" error from being shown on the console.  How is this done?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":205,"Q_Id":24268634,"Users Score":2,"Answer":"Segmentation Fault is an system error, which occurs when your program tries to access wrong memory address. It is internal program problem and you cannot continue process. It could be possible, but believe me, you should not. So, you should fix it.\nTo fix it, you should dig into Qt internals, but I'd like to suggest you to install fresh library version and make sure you have latest packages.","Q_Score":1,"Tags":"python","A_Id":24268970,"CreationDate":"2014-06-17T16:11:00.000","Title":"\"Segmentation Fault\" being thrown by third party package. How to prevent it from displaying on console?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying to add separator lines between rows in my grid. I tried using wx.Menu() with the AppendSeparator() method, however the wx grid can't add objects of type Menu. Is there any other way?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":160,"Q_Id":24287228,"Users Score":1,"Answer":"This is not supported by the grid widget. You could size a column or row such that it is skinnier than usual and change all the cells in that row or column to have a different background color. You might also be able to utilize a custom label renderer or cell renderer. See the wxPython demo for examples.","Q_Score":0,"Tags":"python-2.7,wxpython","A_Id":24311759,"CreationDate":"2014-06-18T13:43:00.000","Title":"How do I add a separator in a grid in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having this error flood my terminal and make it impossible to debug. Is there a way to silence this warning? This error only generated when I included a scrollToBottom() on my TableWidget.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":7241,"Q_Id":24289418,"Users Score":0,"Answer":"It would be much better if some of your actual code would have been available.\nThe reason you are seeing this is that you are using a different type of threading than QThreads . That is in general not advisable, but it is not illegal. There are three things that you will have to take care\n\nAll calls should end up being executed from calls within a QThreads object\nAll data passed through the signal-slots mechanism should be made such that there are no references\/pointers to objects owned from a non-QThread.\nSetup connections between object that receive call from non-QThreads to emit signal that are received with either Qt::QueuedConnection or Qt::BlockingQueuedConnection connection type.","Q_Score":3,"Tags":"python,qt,error-handling,pyqt,suppress-warnings","A_Id":33542567,"CreationDate":"2014-06-18T15:23:00.000","Title":"How to suppress warning QPixmap: It is not safe to use pixmaps outside the GUI thread","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having this error flood my terminal and make it impossible to debug. Is there a way to silence this warning? This error only generated when I included a scrollToBottom() on my TableWidget.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":7241,"Q_Id":24289418,"Users Score":0,"Answer":"You should better design your code to avoid displaying this message. If you created the pixmap in another thread and \"use\" it in the GUI thread this might work now, tomorrow or forever ... or will not. Don't do that.\nYou cannot suppress the output of this warning without changing the Qt sources or installing a message handler.","Q_Score":3,"Tags":"python,qt,error-handling,pyqt,suppress-warnings","A_Id":24291464,"CreationDate":"2014-06-18T15:23:00.000","Title":"How to suppress warning QPixmap: It is not safe to use pixmaps outside the GUI thread","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been looking for ways to make a GUI with a .py file, and have so far only found frameworks and modules like Tkinter. However, my ultimate goal is for this code to run on a lot of computers that don't necessarily have these modules installed. The machines are only guaranteed to have Python on them. Does anyone know a way to make a GUI under these restrictions?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":57,"Q_Id":24295681,"Users Score":3,"Answer":"The best way to do this would be to ship your application with those modules as a part of it; the user's computer doesn't need to have the GUI framework installed if you provide it.\nWhat you're asking would essentially require you to write an entire GUI framework, which would give a result that would be similar or worse - with a LOT more work.","Q_Score":1,"Tags":"python,user-interface","A_Id":24295727,"CreationDate":"2014-06-18T21:57:00.000","Title":"Can I make a GUI with Python without any extraneous software?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm packaging a GUI app for MacOS with Pyinstaller, using --windowed flag. Is it possible to package it so that it would show a console in addition to the GUI? When I tried to set console=True, the GUI part fails.\nIn other words, when I start the App from the terminal by typing \"open My.App\/Contents\/MacOS\/myapp\", then I do get both GUI and console. I'd like to get similar behaviour by just double-clicking on the App without starting the terminal. Is there a way to do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":425,"Q_Id":24333323,"Users Score":0,"Answer":"while you create application don't add those options\n\n--windowed and --noconsole","Q_Score":6,"Tags":"python,macos,pyinstaller","A_Id":53956162,"CreationDate":"2014-06-20T18:15:00.000","Title":"How to package a Mac OS app with Pyinstaller that shows both a console and a GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"It seems to me the buffer protocol is more for exposing Python buffer to C.\nI couldn't find a way to create a bytes object using existing buffer without copying in C.\nBasically what I want is to implement something similar to PyBytes_FromStringAndSize() but without copying, and with a callback to free the buffer when the object is released. I don't know how big the buffer is before I receive the buffer returned from a C API. So creating bytes object in Python first and later fill it in is not an option.\nI also looked into memoryview, PyMemoryView_FromMemory() doesn't copy but there is no way to pass a callback to free my buffer. And I'm not suse Python lib (e.g. Psycopg) can use memoryview object or not.\nDo I have to create my own object to achieve these 2 requirements? Any other shortcut?\nIf I have to, how can I make sure this object works same as bytes so I can pass it to Python lib safely?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":444,"Q_Id":24336655,"Users Score":1,"Answer":"The only way to do this is to create a new object with PyBufferProcs* PyTypeObject.tp_as_buffer. I checked cpython source code thoroughly, as of 3.4.1, there is no out-of-box (so to speak) solution.","Q_Score":7,"Tags":"python-3.x,python-c-api,python-c-extension","A_Id":26024351,"CreationDate":"2014-06-20T22:38:00.000","Title":"python c-api: create bytes using existing buffer without copying","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project that requires user generated images to be applied to various 3D models (mugs, t-shirts etc). I've explored numerous applications, (Pyglet, Blender, Panda to name a few), and am looking for ideas \/ guidance as to the best approach.\nAppears to me that the world of 3D modelling has quite a steep learning curve (looking at you GL), just looking to invest my time wisely.\nThoughts?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":87,"Q_Id":24367286,"Users Score":0,"Answer":"In the case where you're interested in replacing textures on-the-fly, you should render your objects as UV maps. \nUV maps specify the pixel offset within the texture so that once a texture is chosen, it is a simple process of table lookup for filling in the texture. \nYou might consider rendering at double the resolution and after applying reduce the image size. This will anti-alias any discontinuities.","Q_Score":2,"Tags":"python,image-processing,3d","A_Id":24371384,"CreationDate":"2014-06-23T13:32:00.000","Title":"Looking for advice on applying textures to 3D models at run time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning wxpython and have a question. \nWhen I create a treectrl within framework and call framework.show(), the first item in the treectrl is automatically selected (i.e., EVT_TREE_SEL_CHANGED event is fired). However, when I create a treectrl in a panel, add the panel to a notebook and add the notebook to  framework, the EVT_TREE_SEL_CHANGED event is not fired when the framework.show() is called. Instead, when I select an item in the treecontrol later after the initial rendering, two EVT_TREE_SEL_CHANGED are fired (one for the first item which is supposed to be fired during the initial rendering and the other one for the selected item). \npanel.SetFocus() in the bottom of framework.__init__() fix this problem -- i.e., fires EVT_TREE_SEL_CHANGED to select the first item during the initial rendering. But, I wonder why this is happening. Does anybody know why EVT_TREE_SEL_CHANGED is blocked in the initial rendering when the tree control is contained in the panel of notebook?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":291,"Q_Id":24442775,"Users Score":0,"Answer":"I don't know why exactly does this happen but this looks like a bug in wxWidgets. In practice, this means that it you shouldn't rely on this behaviour because it might (and in fact I'm pretty sure it does) behave differently under other platforms and also could change in future wxWidgets versions.","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":24454132,"CreationDate":"2014-06-27T01:42:00.000","Title":"wxpython: EVT_TREE_SEL_CHANGED event in treectrl in notebook when created","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My goal is to create a window that has a variable level of transparency and no standard border. On top of that area I would like to display opaque items, especially text, that might need to be made transparent. I have tried using SetTransparency methods, SetBackgroundColor and wx.TRANSPARENT_WINDOW styles but haven't had any luck in essentially keeping the children transparency level independent from the parent window's. I have started looking into the graphic and draw methods but not sure if this result is even possible to implement in wxPython. Should I be using a different tool or can this be achieved in wxPython?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":328,"Q_Id":24457479,"Users Score":1,"Answer":"wxPython does not support this behavior. You might be able to fake it by creating lots of custom widgets or by drawing everything, but it will be a lot of work. You would be better off switching to a different toolkit that has this sort of thing builtin. wxPython is for developers that want to make applications that look native on the target OS.","Q_Score":0,"Tags":"wxpython","A_Id":24457910,"CreationDate":"2014-06-27T17:18:00.000","Title":"Is it possible to have a transparent window while having opaque children?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hi I am trying to make a punny cookie clicker type game called py clicker and made an invisible circle over the sprite which is a pie. How do I detect if the mouse is within the circle so when the user clicks it checks if it is in the circle and adds one to the counter?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":127,"Q_Id":24473156,"Users Score":0,"Answer":"you can use the graphics library and use the method called getMouse.","Q_Score":0,"Tags":"python,pygame","A_Id":24473291,"CreationDate":"2014-06-29T04:27:00.000","Title":"Python 2.7.7\/Pygame - How to detect if the mouse is within a circle?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How the hell to install tkinter on to my PC ?\nI tried for week to install it. I can not figure it out. Please, Help.\nHow does it work ? Is there a site you install it from or what ?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":10084,"Q_Id":24499602,"Users Score":0,"Answer":"Just change your code to\nfrom tkinter import *\nIn python3, the issue is with capitalization, so you should use tkinter instead of Tkinter.","Q_Score":3,"Tags":"python,tkinter,installation","A_Id":57996033,"CreationDate":"2014-06-30T21:59:00.000","Title":"How to install Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm considering attempting a game built using Panda3D where no objects are built using a 3D editor. It would all be made and rendered using geometric functions. This includes multiple characters running around, spells being cast and buildings and other objects being around.\nHow viable of an idea is this? Would rendering all of that in real-time be too inefficient?\nI have a very vague idea myself of what the game will consist of at this point or else I'd give more details, but I'm really just wondering if the general idea is possible.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":344,"Q_Id":24523468,"Users Score":0,"Answer":"Have a look at other games made with Panda3D. see the tutorials, demos, etc. That will give you a good overview of what can be possibly made. Check for the keyword technologies that you need - SSAO, Skeletal-Animation, Physics, etc.\nIn general, you might want to detalise your idea and see how other games implement parts of it. If there are some unique things that nowhere to be found - then ask about how to make them. Otherwise they are certainly viable (as someone already made them)\nWithout much more info in the original question, the answer can be only this detailed.","Q_Score":0,"Tags":"python,3d,render,panda3d","A_Id":25160655,"CreationDate":"2014-07-02T05:27:00.000","Title":"Real-time Geometry Rendering with Panda3D -- Efficient?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing an app in kivy which does cpu-heavy calculations at launch. I want the app to display what it's doing at the moment along with the progress, however, since the main loop is not reached yet, it just displays empty white screen until it finishes working. Can I force kivy to update the interface?\nBasically I'm looking for kivy's equivalent of Tkinter's root.update()\nI could create a workaround by defining a series of functions with each calling the next one through Clock.schedule_once(nextFunction, 1), but that would be very sloppy.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2011,"Q_Id":24529197,"Users Score":1,"Answer":"Leaving aside the question of whether you should be using threading or something instead (which possibly you should), the answer is just that you should move your cpu calculations to somewhere else. Display something simple initially (i.e. returning a simple widget from your build method), then do the calculations after that, such as by clock scheduling them.\nYour calculations will still block the gui in this case. You can work around this by doing them in a thread or by manually breaking them up into small pieces that can be sequentially scheduled.\nIt might be possible to update the gui by manually calling something like Clock.tick(), but I'm not sure if this will work right, and even if so it won't be able to display graphics before they have been initialised.","Q_Score":1,"Tags":"python,kivy","A_Id":24530629,"CreationDate":"2014-07-02T10:47:00.000","Title":"Force update GUI in kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have code as follows\nlog = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100),\n                          style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL|wx.TE_DONTWRAP)\nI'm writing logs into this box by redirecting stdout.\nHow do I make the cursor dissappear for the TextCtrl because it appends logs based on the position of the cursor right now. I dont want to give the user the privilage to place the cursor at a particular spot in the box basically","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3622,"Q_Id":24538053,"Users Score":0,"Answer":"But if you use log.Disable, the scrollbar won't work","Q_Score":1,"Tags":"python,wxpython","A_Id":44200976,"CreationDate":"2014-07-02T18:05:00.000","Title":"Disable cursor in TextCtrl - wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using glutBitmapCharacter of pyOpenGL in Python, but the only fonts I can choose to use are helvetica and times_new_roman. Is it possible to add more fonts?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":571,"Q_Id":24563337,"Users Score":0,"Answer":"Not without modifying your GLUT implementation to add additional enums and font bitmaps.","Q_Score":0,"Tags":"python,opengl,text,fonts,pyopengl","A_Id":24563549,"CreationDate":"2014-07-03T21:09:00.000","Title":"python more fonts in glut (glutBitmapCharacter)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Basically if I drag a cell I can size it to whatever size I want. Is there functionality in wxPython where cells expand automatically to fit the size of the text inside of them?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2930,"Q_Id":24609197,"Users Score":1,"Answer":"The Grid class has AutoSizeColumn\/AutoSizeRow and AutoSizeColumns\/AutoSizeRows methods that do a fairly good job of generically resizing rows or cols to be large enough for the contents of the row or col.  They can be fairly expensive operations for large grids however, so they should be used with care.","Q_Score":1,"Tags":"python,wxpython,wxgrid","A_Id":24620168,"CreationDate":"2014-07-07T11:09:00.000","Title":"How to make text fit in cells in a wxPython grid?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am planning on using IronPython to develop a GUI interface for some python code. Do I need to know any other programming languages other than python. Also if not are there any other GUI packages\/addon's to python that only use python to implement and get the final product working?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":134,"Q_Id":24635660,"Users Score":2,"Answer":"You don't need to know any other languages - modulo a few implementation differences, Python is Python is Python. You will, however, need to know the Microsoft windowing library, with which I believe you will have to interface to build a GUI.","Q_Score":2,"Tags":"python,ironpython","A_Id":24636635,"CreationDate":"2014-07-08T15:20:00.000","Title":"Does IronPython just use Python or to use IronPython do I need to know other programming languages other than python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have used img2py to convert an image into a .py file. But how to use that converted file in pygame. Is there any specific code for it?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":748,"Q_Id":24639577,"Users Score":2,"Answer":"The PyEmbeddedImage class has a GetData method (or Data property) that can be used to fetch the raw data of the embedded image, in PNG format.","Q_Score":1,"Tags":"wxpython,pygame","A_Id":24644067,"CreationDate":"2014-07-08T18:52:00.000","Title":"How to use\/decompress the file made by img2py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python code that needs to be able to execute a C++ code. I'm new to the idea of creating libraries but from what I have learned so far I need to know whether I need to use static or dynamic linking.\nI have read up on the pros and cons of both but there is a lot of jargon thrown around that I do not understand yet and since I need to do this ASAP I was wondering if some light can be shed on this from somebody who can explain it simply to me.\nSo here's the situation. My C++ code generates some text files that have data. My Python code then uses those text files to plot the data. As a starter, I need to be able to run the C++ code directly from Python. Is DLL more suitable than SL? Or am I barking up   the completely wrong tree?\nExtra: is it possible to edit variables in my C++ code, compile it and execute it, all directly from Python?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2081,"Q_Id":24650785,"Users Score":5,"Answer":"It depends on your desired deployment. If you use dynamic linking will need to carefully manage the libraries (.so, .dll) on your path and ensure that the correct version is loaded. This can be helped if you include the version number in the filename, but then that has its own problems (security... displaying version numbers of your code is a bad idea).\nAnother benefit is that you can swap your library functionality without a re-compile as long as the interface does not change.\nStatically linking is conceptually simpler and practically simpler. You only have to deploy one artefact (an .exe for example). I recommend you start with that until you need to move to the more complicated shared library setup.\nEdit: I don't understand your \"extra credit\" question. What do you mean by \"edit values\"? If you mean can you modify variables that were declared in your C++ code, then yes you can as long as you use part of the public interface to do it.\nBTW this advice is for the general decision. If you are linking from Python to C\/C++ I think you need to use a shared library. Not sure as I haven't done it myself.\nEDIT: To expand on \"public interface\". When you create a C++ library of whatever kind, you specify what functions are available to outside classes (look up how to to that). This is what I mean by public interface. Parts of your library are inaccessible but others (that you specify) are able to be called from client code (i.e. your python script). This allows you to modify the values that are stored in memory.\nIf you DO mean that you want to edit the actual C++ code from within your python I would suggest that you should re-design your application. You should be able to customise the run-time behaviour of your C++ library by providing the appropriate configuration.\nIf you give a solid example of what you mean by that we'll be able to give you better advice.","Q_Score":3,"Tags":"python,c++,dll,static-libraries","A_Id":24650884,"CreationDate":"2014-07-09T10:07:00.000","Title":"Advise needed for Static vs Dynamic linking","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Alright so this is a specific question about data transfer using different windows in pyqt4. Basically I have 3 windows, each with its own class definition, that I have designed for a project but I'm confused about how to properly arrange these windows. \nIdeal Functionality:\nLet's say I have 3 windows; A, B, and C. Window A gives me two lists. When I click a button in Window A, window B pops up and gets me a number. After it gives me this number I want window C to open and window B to close but I want window C to have the two lists and the number.\nProblems I have:\nCurrently I make a function in the class for window A to open window B and once I get the number from window B, then window C is created with the information, but it closes since I close window B. Previously I tried keeping window A opening window B and C but it opens the windows at the same time but I need window B to open for its data to then create window C.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":33,"Q_Id":24708697,"Users Score":0,"Answer":"C have to be child of A than you can close B. B can call function in parent A to open C and then B can close itself.","Q_Score":0,"Tags":"python-3.x,pyqt4","A_Id":24714113,"CreationDate":"2014-07-12T01:20:00.000","Title":"Controlling Windows\/Information PYQT4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hello I am developing easy space invaders clone game and i need to figure out a way how to detect collision of the bullet and the alien when i shoot. Any suggestions ? Thanks","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":6110,"Q_Id":24713228,"Users Score":1,"Answer":"Use Pygame in place of Tkinter (eventually in place of Canvas) - there are functions to check collisions.\nTo check collision you have to get position both elements and check distance between them:\na2 + b2 = c2\na = x1 - x2  , b = y1 - y2 , c = distance between objects A(x1,y1) and B(x2,y2)\nIf distance is smaller then some value then you have collision - distance doesn't have to be zero to have collision. This way you check collision in circle around object.\nBut you can check collision in square area around the object - it wil be easer for you to calculate it\nObject A (x1,y1) has square area x1-10 ... x1+10, y1-10 ... y1+10. You have to check whether object B (x2,y2) is in that square.","Q_Score":0,"Tags":"python,tkinter","A_Id":24713651,"CreationDate":"2014-07-12T13:04:00.000","Title":"How to detect collisions of two canvas object Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a text view and a web view, each inside a scrolled window of their own and I'm trying to achieve synchronized scrolling between the two but I can't seem to get it to work.\nThe web view is basically taking the text from the text view and rendering it as marked up HTML via webview.load_html_string(). I think the problem could be the delay in loading the HTML as every time the web view is refreshed it is scrolled back to the very start.\nRight now I call a function every time the content of the text view is changed and then modify the vadjustment.value of the scrolled window containing the web view.\nBut this doesn't work. Is it because of the delay? I can't think of any way to solve this issue.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":221,"Q_Id":24718142,"Users Score":0,"Answer":"why do you want sync those scrollbars? You can achieve this by using the same Gtk.Adjustment (number of pages sets to 0). \nI haven't use much of webkit but it essentialy a widget. so maybe a workaround would be disconnect a signal \"value-changed\" from Gtk.Adjustment until \"load-status\" signal from WebKitView reached Webkit.LoadStatus.FINISHED (if that's the correct syntax).\nIf that doesn't work, maybe you use WebKitView.move_cursor () (if i remember the function properly) based on Gtk.Adjustment on your text view (we use 2 adjustments this time)","Q_Score":0,"Tags":"python,webkit,gtk,pygtk","A_Id":24722441,"CreationDate":"2014-07-12T23:15:00.000","Title":"pygtk TextView and WebKit.WebView synchronized scrolling","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"When I open a site with the webkit webview, the entire window resizes to fit the page not allowing scrollbars. The window's height exceeds my screen height. Also, when a webview is in the window, I can resize the window outward, but I can't resize it inward. A webview won't show at all in a VBox if I do: MyVBox.pack_start(MyWebview, True, True, 0)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":118,"Q_Id":24729658,"Users Score":0,"Answer":"you have to put the Gtk.WebKitView inside a Gtk.ScrolledWindow. since it implement a Gtk.Scrollable you need not using a Gtk.Viewport. and put the window inside your Gtk.Box","Q_Score":0,"Tags":"python,webkit,gtk,pygtk,webkitgtk","A_Id":24751754,"CreationDate":"2014-07-14T04:46:00.000","Title":"PyWebkitGTK loads a website fully vertical into window and will not resize inward","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm drawing a map of a real world floor with dimensions roughly 100,000mm x 200,000mm.\nMy initial code contained a function that converted any millimeter based position to screen positioning using the window size of my pygame map, but after digging through some of the pygame functions, I realized that the pygame transformation functions are quite powerful.\nInstead, I'd like to create a surface that is 1:1 scale of real world and then scale it right before i blit it to the screen.  \nIs this the right way to be doing this?  I get an error that says Width or Height too large.  Is this a limit of pygame?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":1634,"Q_Id":24743758,"Users Score":2,"Answer":"I dont fully understand your question, but to attempt to answer it here is the following.\nNo you should not fully draw to the screen then scale it. This is the wrong approach. You should tile very large surfaces and only draw the relevant tiles. If you need a very large view, you should use a scaled down image (pre-scaled). Probably because the amount of memory required to draw an extremely large surface is prohibitive, and scaling it will be slow.\nConvert the coordinates to the tiled version using some sort of global matrix that scales everything to the size you expect. So you should also filter out sprites that are not visible by testing their inclusion inside the bounding box of your view port. Keep track of your view port position. You will be able to calculate where in the view port each sprite should be located based on its \"world\" coordinates.","Q_Score":1,"Tags":"python,graphics,pygame","A_Id":24744048,"CreationDate":"2014-07-14T18:57:00.000","Title":"Pygame Large Surfaces","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm drawing a map of a real world floor with dimensions roughly 100,000mm x 200,000mm.\nMy initial code contained a function that converted any millimeter based position to screen positioning using the window size of my pygame map, but after digging through some of the pygame functions, I realized that the pygame transformation functions are quite powerful.\nInstead, I'd like to create a surface that is 1:1 scale of real world and then scale it right before i blit it to the screen.  \nIs this the right way to be doing this?  I get an error that says Width or Height too large.  Is this a limit of pygame?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1634,"Q_Id":24743758,"Users Score":0,"Answer":"If your map is not dynamic, I would suggest draw a map outside the game and load it in game.\nIf you plan on converting the game environment into a map, It might be difficult for a large environment. 100,000mm x 200,000mm is a very large area when converting into a pixels. I would suggest you to scale it down before loading.\nAs for scaling in-game, you can use pygame.transform.rotozoom or pygame.transform.smoothscale.\nAlso like the first answer mentions, scaling can take significant memory and time for very large images. Scaling a very large image to a very small image can make the image incomprehensible.","Q_Score":1,"Tags":"python,graphics,pygame","A_Id":24744442,"CreationDate":"2014-07-14T18:57:00.000","Title":"Pygame Large Surfaces","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to visualize a Control Flow Graph in Python using pyqtgraph. I have the following two problems.\n\nHow can I visualize the edges with a direction?\nHow can I visualize a self edge?\n\nI tried looking into the documentation, but couldn't find. Obviously, I didn't get time to read it all!","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":375,"Q_Id":24760322,"Users Score":1,"Answer":"While pyqtgraph is awesome, for my use case I found a much better tool to do this. \ngraphviz is a nice tool to develop Control Flow Graphs quite conveniently, and has a large number of features for this particular problem.","Q_Score":0,"Tags":"python,pyqtgraph","A_Id":25269345,"CreationDate":"2014-07-15T14:03:00.000","Title":"Edges with Direction in pyqtgraph GraphItem","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to visualize a Control Flow Graph in Python using pyqtgraph. I have the following two problems.\n\nHow can I visualize the edges with a direction?\nHow can I visualize a self edge?\n\nI tried looking into the documentation, but couldn't find. Obviously, I didn't get time to read it all!","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":375,"Q_Id":24760322,"Users Score":0,"Answer":"For direction, you might add a pg.ArrowItem at the end of each line (although this could have poor performance for large networks), and for self connections, QtGui.QGraphicsEllipseItem combined with an arrow.","Q_Score":0,"Tags":"python,pyqtgraph","A_Id":24763543,"CreationDate":"2014-07-15T14:03:00.000","Title":"Edges with Direction in pyqtgraph GraphItem","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"No i don't ask about spritesheets.\nI'm working on a game in pygame and I want to know if it's possible to divide sprite into parts like body parts and then use it in collision-detection with pygame.sprite.groupcollide?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":357,"Q_Id":24763949,"Users Score":2,"Answer":"The default Sprite class has no notion of separate parts of a sprite; the whole thing is assigned a single bounding box. If you plan on using pygame.sprite.groupcollide it seems like you don't want an individual sprite anyway, you want them packaged together in their own group. Keep in mind that the pygame.sprite.Group.add method can take either a single sprite OR an iterable of sprites. So you can nest sprite groups if necessary.","Q_Score":3,"Tags":"python,pygame,collision-detection,sprite","A_Id":24764544,"CreationDate":"2014-07-15T16:55:00.000","Title":"How to divide sprite into smaller parts in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My question is about QDial. It can make the full tour around. When the value is 0 it jumps to 100 and if the value is 100 and you turn it a little more it passes to 0 suddenly.\nHow can I disable this?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":351,"Q_Id":24776767,"Users Score":1,"Answer":"Actually @Trilarion , setWrapping to false does not fix his problem.\nThe Dial still jumps from end to beginning and vice-versa. This is not cool in some applications.\nThe only solution, I believe, is to hardly not allowing the Dial to do this in a slot. For example, in value changed. Considering you stored the previous value, you can prevent the user from jumping with the dial around by setting the value again.","Q_Score":1,"Tags":"python,qt,slider,pyqt,limit","A_Id":34220799,"CreationDate":"2014-07-16T09:12:00.000","Title":"QDial disabling full tour","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have terrible doubts regarding python config file approach.\nI am creating a program with a GUI (PyQt). The program loads some settings from a .cfg file using the configparser module. And the user can edit these settings from the GUI with the user preferences widget. When the preferences widget is closed the .cfg file is saved but I don't know how to update the  rest of the program using the updated settings values.\nI will try to explain with an example:\n\nI launch the program. It create a ConfigParser() named config and read settings.cfg.\nThe program retrieve the value of the option 'clock_speed' (let's say it is 5) from config and set clkSpd = 5.\nI click on Edit -> Preferences and change the clock speed via a QSpinBox to 8.\nI close the Preferences windget, settings.cfg is saved, the value of the option 'clock_speed' is now 8.\nBUT in its module, clkSpd is still 5.\n\nI know I can just load the settings, edit them, save them and reload all settings each time I close the Preferences window. It's simple but not very beautiful.\nIs there a classic and effficiant approach for config files in read\/write mode ?\nThanks by advance.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":699,"Q_Id":24785121,"Users Score":0,"Answer":"Updating the state of your application may not be a trivial thing if you are somewhere in the middle. Just an example:\n\nYour app = A car\nYou launch your app = You start your car\nYou set in the preferences the variable type_tyre to Winter\nYour running app still has type_tyre equals Sommer\nYou attempt to change tyres while driving on the highway\nCrash\n\nAnd this while changing the tyres before starting the car might be a trivial and safe thing to do.\nSo you just have to write a routine that adjusts the state of your application according to the change in preferences but this is in general different from initializing the app and depends on the current state of the app. But otherwise just write such a routine and call it.","Q_Score":0,"Tags":"python,pyqt,updating,configparser","A_Id":24871124,"CreationDate":"2014-07-16T15:45:00.000","Title":"Python - update configparser between modules","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an application made up of Frames, Frames in Frames and Labels in Frames. There is quite a lot of them and I am looking for a way to modify some of the default values.\nI am particularly interested in modifying .columnconfigure() since I call .columnconfigure(0, weight=1) on each of the columns, in each frame. This does not help with the code cleanness. \nIs there a way to set this behavior (ability to expand) globally?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":207,"Q_Id":24806713,"Users Score":3,"Answer":"No, there is no way to change the defaults. You can easily write your own grid function to automatically configure the weight of each column. You could do this by subclassing Frame, for instance.","Q_Score":0,"Tags":"python,tkinter","A_Id":24814914,"CreationDate":"2014-07-17T14:46:00.000","Title":"how to change default values for .columnconfigure() in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two questions that I can not answer to myself:\n\nHow can I change the size of my window, if I do not know the exact size of the phone screen? I.e. my aim is to fit all screen sizes.\nIs there any difference between clicking with mouse and touching with fingers in the code? If I write code for clicking, will it work with touch?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":399,"Q_Id":24830313,"Users Score":2,"Answer":"On mobile, your app should automatically fill the phone screen. You don't need to worry about it. On desktop, you can use the --size=WxH option to test a specific screen size, or use the screen module (-m screen:nexus7 for example - run kivy with -m screen to see the available options).\nNo. All mouse\/touchscreen interactions are considered touches in Kivy. So using on_touch_down\/on_touch_move\/on_touch_up will work regardless of the input device. The only difference is that with touchscreen you could have multi-touch - but if you write your app assuming single-touch it will work the same on both mobile and desktop.","Q_Score":1,"Tags":"android,python,kivy","A_Id":24830380,"CreationDate":"2014-07-18T17:02:00.000","Title":"Kivy: how to change window size properties and the difference between click and touch","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Good afternoon,\nI'm using a QTableview+QAbstractTableModel to display a potentially large amount of data (20k+ rows) were each row consists of cells holding text of various length, including newlines, displayed using a custom delegate. The data resides in memory (no database, stream or similar) and might be changed from outside the table. To adapt the row height to changes of the text, I set the Resize Mode of the TableView's vertical header to \"ResizeToContents\" which correctly uses the sizeHint of my delegate to set the height.\nThis works well and all, however depending on the size of the table the performance is abysmal (several minutes to load a large table). Once I turn off the resize mode, loading is as fast as lightning but of course the row height is incorrect (causing text with newlines to overlap rows, etc.). It seems that when using the auto-resize mode, every cell in every row is queried for the size hint, which takes a lot of time (confirmed by printing a debug msg in the sizeHint function of my delegate).\nI wonder if this is the intended behaviour of the ResizeToContents mode, as I would assume that it would only be necessary to query the actually visible rows of the TableView - not all rows (as given by the rowCounts() call). As only a fraction of the rows are displayed at any one time, this would of course improve the performance noticeably. Is this a bug\/shortcoming in the resize code or do I misunderstand something about this functionality? By the way, I'm using PyQt 4.10 so maybe this behaviour changed in newer versions?\nThanks in advance for all hints.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":772,"Q_Id":24864255,"Users Score":1,"Answer":"If you set verticalHeader.sizeHint to ResizeToContents, on any row update ALL table will be processed to obtain new column width. This behaviour is life saver for most of us, if we don't have a large table that frequently update. \nFirst, don't use resizeToContents size hint!\nBasic solution: use fixed size for columns with stretch option. (i think, it is not for you)\nSolution, i use: i have timer to call resizeColumnsToContents() slot at intervals of 2 seconds. \nSolution, optimized: You can optimize my solution to your case. Such as, you can wait until all row data updated to call resize slot.\nAnswer for your suggestion(resize for just visible items): it is not useful.","Q_Score":2,"Tags":"python,qt,pyqt4","A_Id":24951937,"CreationDate":"2014-07-21T11:42:00.000","Title":"QTableview - ResizeToContents queries every row?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am pretty new to python, my background is with VB visual studios, I am trying to develop a app in which I want to consume WCF service. Found Suds is the required python module.\nI am using Kivy 1.8.0 and Eclipse with pydev on Windows 7 64bit.  Could you please point me in correct direction on how to instal the package, found no exe, I have run the setup.py from suds but did not work.\nAny advice\/direction towards tutorial is of great help.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":396,"Q_Id":24954106,"Users Score":0,"Answer":"Are you by any chance running the Python 3 version of Kivy? Suds looks like it is abandondonware (last release in 2010) and likely does not have a Python3 port. You may have luck with the Python2.7 version of Kivy and pip installing suds, but keep in mind you will be relying on an apparently unsupported module (suds) for your project.","Q_Score":1,"Tags":"python,installation,kivy,suds","A_Id":25000617,"CreationDate":"2014-07-25T10:53:00.000","Title":"Kivy with suds - module installation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I get raw base64 PNG data from a PyQt4.QtGui.QImage object? The only method I can find that seems like it would help is bits(), but that just returns a sip.voidptr object and I have no idea where to go from there.","AnswerCount":2,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":1434,"Q_Id":24965646,"Users Score":-2,"Answer":"You have the right method if you want to directly access the data in memory. It is a C array, and has no python object associated, so it's a little tricky. You need: the start address from bits(), the depth() and the byteCount(). ctypes.string_at would give you access to the data there, which you would pass to a numpy array using the known bits-per-pix and image shape. \nI won't write more, because this kind of thing is likely to cause a crash (and I have no test data right now) - can you not load the image in the usual way?","Q_Score":0,"Tags":"python,qt,python-3.x,pyqt","A_Id":24965943,"CreationDate":"2014-07-25T22:52:00.000","Title":"Convert PyQt4.QtGui.QImage object to base64 PNG data","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was playing Terraria the other day and in a new update they make the game pause when it's minimized. Obviously it's written in a different programme to python, but I was wondering if it was possible to replicate the effects.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1031,"Q_Id":24966803,"Users Score":0,"Answer":"You can use the pygame.APPACTIVE event. From the documentation for the pygame.display.iconify:\nThen the display mode is set, several events are placed on the pygame event queue. pygame.QUIT is sent when the user has requested the program to shutdown. The window will receive pygame.ACTIVEEVENT events as the display gains and loses input focus [This is when the window is minimized]. If the display is set with the pygame.RESIZABLE flag, pygame.VIDEORESIZE events will be sent when the user adjusts the window dimensions. Hardware displays that draw direct to the screen will get pygame.VIDEOEXPOSE events when portions of the window must be redrawn.\nLook at the second example in furas' answer below, but don't use the polling approach of the first example for something like this, you don't want to spend time every frame trying to check if the window has been minimized.","Q_Score":1,"Tags":"python-3.x,pygame","A_Id":24967111,"CreationDate":"2014-07-26T02:01:00.000","Title":"Is there a way in pygame to make a programme pause when it's minimized?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to visualize a computing process in kivy. The problem is that kivy freezes when the python function runs. Any ideas how to manage that problem.\nIt is like a progress bar. The computation is running and the user should see that his PC did not hang up.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":330,"Q_Id":25032656,"Users Score":1,"Answer":"Run your computationally intensive stuff in one or more threads or separate sub-processes and have them periodically post some updates to the GUI to say how they are doing, (and the results at the end of course).","Q_Score":0,"Tags":"python,kivy","A_Id":25033218,"CreationDate":"2014-07-30T08:59:00.000","Title":"manual update kivy screen when a user function is doing heavy computation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Got a bit of weird request here, however it's one which I can't really figure out the answer to.\nI'm writing a python application that displays web pages and locally stored images. \nWhat I need is a way of displaying a web page using python that is really lightweight and quite fast. The reason for this is that it is running on a Raspberry Pi.\nOf course I have many options, I can run it through web browser installed on the Raspbian distribution and run it as a separate process in python, I can download an Arch-Linux compatible browser and run it as a separate process in python and finally I can write my own native python file using Gtk or PyQt. \nAll of these approaches have their downsides as well as serious overheads. The web browser must also be full screen when I have a web page to display, and minimised when I'm displaying an image. \nThe main issue I have had with Gtk and PyQt is the way they have to be executed on the main thread - which is impossible as it doesn't align with my multithreaded architecture. The downside to using the web browsers that are pre-installed on raspbian, is that from python you lack control and it's slow. And finally, the issue with using an Arch-Linux browser is that it ends up being messy and hard to control.\nWhat I would Ideally need is a web browser that loads a web page almost instantaneously, or a multithreaded web browser that can handle multiple instances. This way I can buffer one web page in the background whilst another browser is being displayed.\nDo you guys have any advice to point me in the right direction? I would've thought that there would be a neat multithreaded python based solution by now, and I would think that's either because no one needs to do what I'm doing (less likely) - or I'm missing something big (more likely)!\nAny advice would be appreciated.\nJames.","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":1135,"Q_Id":25045924,"Users Score":-1,"Answer":"i have written winks-up in vala.\nIt's small and fast and compile well on raspbian.\nAll the code was optimize to reduce memory occupation.\nisn't perfect but was better like nothing","Q_Score":0,"Tags":"python,multithreading,web,browser,python-webbrowser","A_Id":31276859,"CreationDate":"2014-07-30T20:04:00.000","Title":"Lightweight Python Web Browser","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Got a bit of weird request here, however it's one which I can't really figure out the answer to.\nI'm writing a python application that displays web pages and locally stored images. \nWhat I need is a way of displaying a web page using python that is really lightweight and quite fast. The reason for this is that it is running on a Raspberry Pi.\nOf course I have many options, I can run it through web browser installed on the Raspbian distribution and run it as a separate process in python, I can download an Arch-Linux compatible browser and run it as a separate process in python and finally I can write my own native python file using Gtk or PyQt. \nAll of these approaches have their downsides as well as serious overheads. The web browser must also be full screen when I have a web page to display, and minimised when I'm displaying an image. \nThe main issue I have had with Gtk and PyQt is the way they have to be executed on the main thread - which is impossible as it doesn't align with my multithreaded architecture. The downside to using the web browsers that are pre-installed on raspbian, is that from python you lack control and it's slow. And finally, the issue with using an Arch-Linux browser is that it ends up being messy and hard to control.\nWhat I would Ideally need is a web browser that loads a web page almost instantaneously, or a multithreaded web browser that can handle multiple instances. This way I can buffer one web page in the background whilst another browser is being displayed.\nDo you guys have any advice to point me in the right direction? I would've thought that there would be a neat multithreaded python based solution by now, and I would think that's either because no one needs to do what I'm doing (less likely) - or I'm missing something big (more likely)!\nAny advice would be appreciated.\nJames.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1135,"Q_Id":25045924,"Users Score":0,"Answer":"I'd use PyQT to display the page but if the way PyQT use threads does not fit within you application, you may just write a minimalist (I'm speaking of ~10 lines of code here) web browser using PyQT, and fork it from your main application ?","Q_Score":0,"Tags":"python,multithreading,web,browser,python-webbrowser","A_Id":25051761,"CreationDate":"2014-07-30T20:04:00.000","Title":"Lightweight Python Web Browser","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a combobox in wxpython but I cant figure out how to align the text it contains to the right?\nI have tried to use wx.ComboBox(self, choices=[\"1\",\"2\",\"3\"], style=wx.TEXT_ALIGNMENT_RIGHT) but that didnt work.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":835,"Q_Id":25057937,"Users Score":1,"Answer":"The widget probably doesn't support text alignment. If you want complete control over how it displays its contents, then you should probably switch to a custom drawn control, such as ComboCtrl.","Q_Score":0,"Tags":"wxpython,wxwidgets","A_Id":25059718,"CreationDate":"2014-07-31T11:38:00.000","Title":"How do I right align the text in a wx.ComboBox?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have 2 widgets, I need to copy all attributes (pos, size, canvas, etc.) from one widget to another somehow (and then move the last to new pos). Probably I can copy attributes one by one, but is there some built-in function?\nIt seems Python's copy makes only shell copy (I can't move duplicate etc.) and deepcopy fails.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":1181,"Q_Id":25090620,"Users Score":2,"Answer":"One thing you can do is to make use of the copy function in python.\nThis does not copy all the pos\/size values but you will have all the attributes. \nEx:\nfrom copy import copy\nnew_box = copy(self.current_box)\nHope this helps.","Q_Score":0,"Tags":"python,widget,kivy,python-3.4","A_Id":32950247,"CreationDate":"2014-08-02T00:59:00.000","Title":"Can I copy attributes from one widget to another in Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have 2 widgets, I need to copy all attributes (pos, size, canvas, etc.) from one widget to another somehow (and then move the last to new pos). Probably I can copy attributes one by one, but is there some built-in function?\nIt seems Python's copy makes only shell copy (I can't move duplicate etc.) and deepcopy fails.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":1181,"Q_Id":25090620,"Users Score":2,"Answer":"I'm not aware of a pre-existing way to do this in general, but you could probably fairly easily make a function to do it. You can get a list of the widget properties through the properties() method of EventDispatcher, though you'd also need to manually keep track of any non-kivy-property attributes you want to copy, and might need to check to make sure it's safe to copy them all.\nDepending on the situation, there may also be other possibilities. For instance, if the widget is instantiated from a set of arguments in the first place and never really modified much, you could just save the argument list and use it to construct a new widget. There might also be more efficient alternatives - if you don't need to interact with the 'copy', you don't need to make a new widget at all, but could draw the original one to a Fbo and simply re-use its texture. This would be a more advanced use of kivy, but isn't that hard, let me know if you're interested in it but don't know how to do it.","Q_Score":0,"Tags":"python,widget,kivy,python-3.4","A_Id":25102895,"CreationDate":"2014-08-02T00:59:00.000","Title":"Can I copy attributes from one widget to another in Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I have been doing a lot of reading about execution environments (Python's, JVM...) and I am starting to implement one on my own. It is a register-based environment written in C. I have a basic byte code format defined and the execution is going pretty smooth so far. My question is how does VEs render GUIs. In a more detailed description about my work so far, my VE has a screen buffer (experimenting with it). Every time I poke it, I output the screen buffer completely to know the output.\nSo far so good with basic calculations and stuff but I hit a bump when I wanted to understand how to render GUIs. I am nowhere with this. Any help would be appreciated. Even if I am thinking completely wrong about this, any pointers as a start in the right direction would be really great. Thanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":357,"Q_Id":25129311,"Users Score":1,"Answer":"All GUI toolkits on Python are a wrapper around C\/C++ code. On Java there a some \"pure\" Java toolkits like Swing, but a the lowest level they depend on C code to do the drawing and handle user input. There's no special support for things like graphics in the Java VM.\nAs for how the GUI gets rendered at the lowest level, it depends. On Windows, user mode software isn't allowed direct access the video hardware. Ultimately any C\/C++ GUI code has to go through either GDI or Direct3D to do the rendering. The kernel mode GDI code is able to do all the rendering itself by writing to the framebuffer, but also supports acceleration by passing operations to display driver. On the other hand, the Direct3D kernel code passes pretty much everything to the driver which in turn passes everything on to the GPU. Almost all of the kernel mode code is written in C, while code running on the GPU is a mixture of hand coded assembly from and code written in higher level shading languages. \nNote that GPU assembly language is very different from Intel x86 assembly language, and varies considerably between manufacturers and GPU generations.\nI'm not sure what current practice is on Linux and other Unix type operating systems, but it used to be common to give the X server, which is a user mode process, direct access to the framebuffer. C code in the X server was ultimately responsible for rendering. Presumably this has changed at least somewhat now that GPU acceleration is more common.","Q_Score":0,"Tags":"python,c++,user-interface,jvm,pyc","A_Id":25132319,"CreationDate":"2014-08-04T23:58:00.000","Title":"How do virtual machines render GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a Kivy app for iOS and Android and need help with keeping the user persistently logged in, even after the app is closed or killed. I am using Parse to store user credentials.\nI've already added an on_pause method to the App class, but this only keeps the user logged in if the app is closed but not killed. Is there a best practice for securely allowing persistent user login with Kivy, even after an app is killed?\nEdit: I prefer a single Kivy solution that works for both an Android app and an iOS app, without the need to edit\/add iOS or Android specific code.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5234,"Q_Id":25147323,"Users Score":0,"Answer":"The answer is essentially that you must simply save the data somewhere. The details will depend on your requirements, and aren't specific to kivy - you can look up normal android or python practices.\nI'm not sure exactly what android guarantees about permissions, but storing stuff in your app directory (on the main partition, not 'external' storage) should be inaccessible to other apps, though anything with root can view them. You can use normal python tools if you want to encrypt the data, and manage your own kivy gui for getting a decryption key\/password from the user.","Q_Score":3,"Tags":"android,python,ios,parse-platform,kivy","A_Id":25147496,"CreationDate":"2014-08-05T20:02:00.000","Title":"Saving login screen username and password for Kivy app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I wrote a program in Python, then created a GUI using Tkinter. When I use programs on my computer (like Microsoft Word), I don't need to access the GUI from the command line I just click the application icon.\nHow do I put my program (the program itself is in the same .py file as the GUI) into an application icon that will start my program?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2183,"Q_Id":25152287,"Users Score":0,"Answer":"If you're using Windows, you can create a shortcut. Or you can just put your .py file on your desktop.\nIf you want to make an .exe file I would suggest installing py2exe. I've compiled Tkinter Python scripts into .exes with py2exe many  times.","Q_Score":0,"Tags":"python","A_Id":25152320,"CreationDate":"2014-08-06T04:33:00.000","Title":"how to create an icon for my python application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't find a way to hide QComboBox items. So far the only way to filter its items out is to delete the existing ones (with .clear() method). And then to rebuild the entire QComboBox again using its .addItem() method.\nI would rather temporary hide the items. And when they are needed to unhide them back.\nIs hide\/unhide on QCombobox items could be accomplished?","AnswerCount":7,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":10685,"Q_Id":25172220,"Users Score":1,"Answer":"You can use the removeItem() method to remove an item from the QComboBox.\n\nvoid QComboBox::removeItem ( int index )\nRemoves the item at the given index from the combobox. This will update the current index if the index is removed.\nThis function does nothing if index is out of range.\n\nIf you don't know the index, use the findText() method.\nThere are no hide\/unhide methods for QComboBox items.","Q_Score":4,"Tags":"python,pyqt","A_Id":25172853,"CreationDate":"2014-08-07T00:03:00.000","Title":"How to hide QComboBox items instead of clearing them out","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to set the withdrawed tk window to the top level, i.e. the active window, even though its withdrawed?\nIts so it will listen to keys.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":246,"Q_Id":25176025,"Users Score":1,"Answer":"It can only respond to keyboard events if it has the focus. If it is withdrawn it cannot have the keyboard focus. So, no, you cannot have a withdrawn window be the active window.","Q_Score":0,"Tags":"python,tkinter","A_Id":25183356,"CreationDate":"2014-08-07T06:57:00.000","Title":"TKinter Python - Set active window when withdrawed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have main Layout and some Popups, I want keys to do some functions when main Layout is focused, some another functions for one Popup when it's opened, some another for another Popup etc. How can I do that the best way?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":435,"Q_Id":25177236,"Users Score":1,"Answer":"I have done something similar, however I did not use popups. My application has a ScreenManager with many Screens, each screen has sub-menu's and each sub-menu of each screen requires it's own key mappings.\nTo better handle the switching of these sets of key mappings, I created a KeyboardManager class and a KeyboardLayout class:\nThe KeyboardManager class has the keyboard_handler() function which you give to the Window.\nThe KeyboardLayout class would contain a dictionary of all the bindings, i.e. {'a': a_key_callback, 'esc': esc_key_callback}\nEach sub-menu in my app would have a KeyboardLayout instance, and in it I would define my key mappings into it's dictionary. When the sub-menu is brought up, I would attach the KeyboardLayout to the KeyboardManager (save a reference to the KeyboardLayout in the KeyboardManager). The KeyboardManager.keyboard_handler method then intercepts key events, looks up the function to be called in the currently attached KeyboardLayout and then calls that function. In the keyboard_handler you can decide what to do if a key mapping is not there.\nIn your case, you would need one KeyboardLayout for the main layout and one for the popup. When the popup is opened, attach it's KeyboardLayout to the KeyboardManager, when you leave the popup, attach the main layout's KeyboardLayout back to the KeyboardManager.\nThis is the method I applied and it worked very well for me. Very easy to manager once the classes are set up.","Q_Score":0,"Tags":"python,keyboard,kivy,python-3.4","A_Id":25405116,"CreationDate":"2014-08-07T08:04:00.000","Title":"How can I use keyboard for different layouts in Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QLineEdit with a PlaceholderText.\nI want to clear the PlaceholderText only when a person starts typing, else the blinking cursor and PlacehoderText both should be there in that QLineEdit.\nIt is the first field of the page, so I have set the focus to this QLineEdit, but the PlaceholderText disappears as soon as this page is displayed.\nPlease suggest if I'll have to add a SIGNAL\/SLOT for this QLIneEdit, so that the PlaceholderText doesn't get cleared off.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":256,"Q_Id":25187640,"Users Score":1,"Answer":"In PyQt4 it's not a bug but a feature. You can't edit this behaviour. In PyQt5, the placeholder text is shown until the text is not empty.\nA simple way to solve problem is to focus some way before QLintEdit. When the user press TAB button, next focus is QLintEdit.","Q_Score":2,"Tags":"python,python-2.7,qt4,pyqt4","A_Id":25195595,"CreationDate":"2014-08-07T16:28:00.000","Title":"How to keep both cursor and PlaceholderText displayed at the same time in a QLineEdit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made a desktop application in kivy and able to make single executable(.app) with pyinstaller. Now I wanted to give it to customers with the trial period of 10 days or so. \nThe problem is how to make a trial version which stop working after 10 days of installation and even if the user un-install and install it again after trial period get over it should not work.\nGiving partial feature in trial version is not an option.\nEvnironment\nMac OS and Python 2.7 with Kivy","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2478,"Q_Id":25269845,"Users Score":4,"Answer":"You need a web server and a database to get this working.\n\nCreate a licenses table in your database.\nEach time a new client pays for your software or asks for a trial, you generate a new long random license, insert it in the licenses table, associate it to the client's email address and send it to the client via email.\nEach time a client tries to install the software on their computers, you ask for a license and contact the webserver to ensure that the license exists and is still valid.\n\nUsing that, people can still just create multiple emails and thus potentially get an infinite amount of trial versions. \nYou can then try to add a file somewhere in the person's computer, a place where nobody would ever look for, and just paste the old license there so that when the app starts again (even from a new installation), it can read the license from there and contact the webserver without asking for a license. With this method, when your app contacts the server with an expired trial license, your server can reply with a \"license expired\" signal to let your app know that it has to ask for a non-trial license now, and the server should only accept non-trial licenses coming from that app from now on. This whole method breaks if your clients realize that your app is taking this information from a local file because they can just delete it when found.\nAnother idea that comes to mind is to associate the MAC address of a laptop (or any other unique identifier you can think of) to one license instead of an email address, either at license-creation time (the client would need to send you his MAC address when asking for a trial) or at installation time (your app can check for the MAC address of the laptop it's running on).","Q_Score":7,"Tags":"python,kivy,setup-deployment","A_Id":61918928,"CreationDate":"2014-08-12T16:52:00.000","Title":"How to make trial period for my python application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made a desktop application in kivy and able to make single executable(.app) with pyinstaller. Now I wanted to give it to customers with the trial period of 10 days or so. \nThe problem is how to make a trial version which stop working after 10 days of installation and even if the user un-install and install it again after trial period get over it should not work.\nGiving partial feature in trial version is not an option.\nEvnironment\nMac OS and Python 2.7 with Kivy","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2478,"Q_Id":25269845,"Users Score":0,"Answer":"My idea is\n\nMake a table in database\nUse datetime module and put system date in that table  as begining date\nUse timedelta module timedelta(15)( for calculating the date that program needs to be expired here i used 15 day trial in code) and store it  in  table of database as expiry date\nNow each time your app start put this logic that it checks on if current date is matches with expiry if it does show error it is expired of your explicit logic\n\nNote:- make sure begining and expiry runs only once instead date will be changed again and again.","Q_Score":7,"Tags":"python,kivy,setup-deployment","A_Id":69546902,"CreationDate":"2014-08-12T16:52:00.000","Title":"How to make trial period for my python application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a script that is dependent on knowing the geometry type of the loaded shapefile.\nbut I've looked in the pyqgis cookbook and API and can't figure out how to call it. \ninfact, I have trouble interpreting the API, so any light shed on that subject would be appreciated. \nThank you","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":8852,"Q_Id":25273987,"Users Score":1,"Answer":"QgsGeometry has the method wkbType that returns what you want.","Q_Score":7,"Tags":"python,shapefile,qgis","A_Id":29585421,"CreationDate":"2014-08-12T21:03:00.000","Title":"How to get shapefile geometry type in PyQGIS?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using python to parse an Excel file and am accessing the application COM using excel = Dispatch('Excel.Application') at the beginning of a restart the code will find the application object just fine and I will be able to access the active workbook.  \nThe problem comes when I have had two instances of Excel open and I close the first.  From then on every call to excel = Dispatch('Excel.Application') provides an application object that is different from the open instance of Excel.  If I try excel.Visible=1 it opens a new Excel instance rather than showing the already open instance of excel.  How do I get the COM object of the already open instance of Excel rather than creating a new instance?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1075,"Q_Id":25298281,"Users Score":2,"Answer":"When an application registers itself, only the first instance gets registered, until it dies and then the very next instance to register gets registered.\nThere's no registration queue, so when your first instance dies, the second keeps unregistered, so any call to Excel.Application will launch a third instance and they'll keep using it until it dies too.\nIn summary, the instances launched in between registered instances never get registered.\nIf you need to reuse an instance, you must keep a pointer to it.\nThat said, if you get an instance of an open Excel file, you might obtain a link to an unregistered Excel instance.  For instance, if Excel 1 (registered) has workbook 1 open, and Excel 2 (unregistered) has workbook 2 open, if you ask for workbook 2, you'll get Excel 2's instance (e.g. through Workbook.Application).","Q_Score":3,"Tags":"python,excel,com,win32com","A_Id":25308893,"CreationDate":"2014-08-14T00:26:00.000","Title":"win32com dispatch Won't Find Already Open Application Instance","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyGame on a Raspberry Pi, so I only have 512mb of RAM to work with. I have to load and display a lot of images in succession, though. I can't naively load all of these images into RAM as PyGame surfaces - I don't have enough RAM. The images themselves are fairly small, so I assume that PyGame surfaces are fairly big, and this is why I run out of RAM. I've tried loading from the disk every time I want to display an image, but that's obviously slow (noticeably so).\nIs there a reasonable way to display lots of images in succession in PyGame with limited RAM - either by keeping the size in memory of the PyGame surface as low as possible, or some other way?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":595,"Q_Id":25349639,"Users Score":0,"Answer":"If you change your files to bmp, it should help. If you have really that little ram, then you should lower the resolution of your files using an image editor such as Preview or Paintbrush. Also, space might be saved through more efficient programming, such as putting objects in a list and just calling a list update.","Q_Score":1,"Tags":"python,pygame","A_Id":25518175,"CreationDate":"2014-08-17T13:32:00.000","Title":"Loading many images in PyGame with limited RAM","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently tasked with the difficult problem of figuring out how to efficiently pack an image and some text within a single file. In doing so, I need to make the file relatively small (it shouldn't be much bigger than the size of the image file alone), and the process of accessing and saving the information should be relatively fast.\nNow, I have already found one way that works - converting the image to a string using pygame, storing it (and the text I need) within an python object, and then pickling the object. This works fine, but the file ends up being much MUCH larger than the image, since it's not being compressed. So to help with this, I then take the pickled object and compress it using gzip. Now I have another problem - the whole process is just a tad bit too slow, since I'll need to do hundreds of these files at a time, which can take several minutes (it shouldn't take longer than a 1\/2 second to load a single file, and this method takes up to 2 seconds per file).\nI had an idea to somehow put the two separate files, as they are, into one file like how someone would with a .zip, but without the need to further compress the data. As long as the image remains in it's original, compressed format (in this case, .png), simply storing it's data with some text should theoretically be both fast and wouldn't use much more memory. The problem is, I don't know how I would go about doing this.\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":49,"Q_Id":25351113,"Users Score":0,"Answer":"Alex Reynolds idea to use tar archives seems to be a perfect match.","Q_Score":0,"Tags":"python,python-2.7,pygame","A_Id":25352369,"CreationDate":"2014-08-17T16:18:00.000","Title":"How would I go about serializing multiple file objects into one file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python script that works fine on my computer (Python 2.7 32 bit installed). It has the following imports :\n\n\n    import mechanize\n    from bs4 import BeautifulSoup\n    from Tkinter import *\n    import json\n    import webbrowser\n\n\nI wanted to distribute this to others so I found that we can create exe files using py2exe. I wrote a script like this:\n\n\n    from distutils.core import setup\n    import py2exe\n\n    setup(console=['notification.py'],\n        options = {'py2exe' : {\n            'packages' : ['bs4', 'mechanize','Tkinter', 'json', 'webbrowser']\n        }})\n\n\nThis works fine on my computer but when I run it on Windows XP, I get this error - \n\n\n    Traceback (most recent call last):\n      File \"notification.py\", line 3, in \n      File \"Tkinter.pyc\", line 38, in \n      File \"FixTk.pyc\", line 65, in \n      File \"_tkinter.pyc\", line 12, in \n      File \"_tkinter.pyc\", line 10, in __load\n    ImportError: DLL load failed: %1 is not a valid Win32 application.\n\n\nI tried searching other threads but found none that has the same problem. So please help me fix this issue.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":579,"Q_Id":25368320,"Users Score":1,"Answer":"Well, I had installed both versions of Python 32 bit and 64 bit in my machine. When I was making it a stand alone probably some dlls were copied from the wrong library. So I completely uninstalled both versions and then installed 32 bit and it worked fine.","Q_Score":0,"Tags":"python,tkinter,py2exe","A_Id":25370162,"CreationDate":"2014-08-18T16:56:00.000","Title":"exe generated from a python script with Py2exe does not work on xp","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make an OpenGL in python\/pygame but I don't know how to add shadow. I don't want to make a lot of darker images for my game. Can someone help me?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":933,"Q_Id":25373895,"Users Score":1,"Answer":"I am no expert in Python but you could try:\nMultiply the color of the image by a value like 0.1, 0.2, 0.3 (anything less that 1) which will give you a very dark texture. This would be the easiest method as it involves just reducing the color values of that texture.\nOr you could try a more complex method such as drawing a transparent black quad over the original image to give it the illusion of being in a shadow.","Q_Score":0,"Tags":"python-2.7,opengl,pygame","A_Id":25383333,"CreationDate":"2014-08-19T00:12:00.000","Title":"How can you edit the brightness of images in PyGame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking for an efficient and smart way to send data between a C++-program and a Python-script. I have a C++ program which calculates some coordinates in-real-time 30Hz. And I wanna access these coordinates with a Python-script. My first idea was to simply create a .txt-file and write the coordinates to it, and then have Python open the file and read. But I figured that it must be a smarter and more efficient way using the RAM and not the harddrive. \nDoes anyone have any good solutions for this? The C++ program should write 3coordinates (x,y,z) to some sort of buffer or file, and the Python program can open it and read them. Ideally the C++-program overwrites the coordinates every time and there's no problem with reading and writing to the file\/buffer at the same time.\nThank you for your help","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":20489,"Q_Id":25383624,"Users Score":2,"Answer":"I think we can use Named Pipes for communication between a python and C++ program if the processes are on the same machine.\nHowever for different machines sockets are the best option.","Q_Score":13,"Tags":"python,c++,cross-platform,buffer,communication","A_Id":34848899,"CreationDate":"2014-08-19T12:37:00.000","Title":"Communication between C++ and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a treeiter created with the treeiter = self.devices_treestore.append(parent_treeiter, column_values_list) call.\nHow can I move it to another parent (with the whole subtree it holds)?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":102,"Q_Id":25388571,"Users Score":0,"Answer":"Assuming the new parent is at the same level of the tree, you could use treestore.swap, otherwise you may have to just remove all the rows in the subtree and reinsert them at the new position","Q_Score":0,"Tags":"python,gtk,gtk3,pygobject","A_Id":25463540,"CreationDate":"2014-08-19T16:32:00.000","Title":"GTK+: Move tree element to another parent","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a time series monitoring program.\n\nI'd like to change the color of a plot starting at half the range of the x-axis.\nFor a 100 x 20 plot widget I would like to change last 50 data points to another color.\nHow can I draw a custom vertical grid whenever every xx items of data are passed?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1047,"Q_Id":25397840,"Users Score":2,"Answer":"For (1), you will have to break your data into two separate lines, and assign the colors individually. PyQtGraph does not yet support multiple colors per line.\nFor (2), consider using pg.InfiniteLine or pg.VTickGroup.","Q_Score":2,"Tags":"python,plot,widget,pyqt,pyqtgraph","A_Id":25578618,"CreationDate":"2014-08-20T06:12:00.000","Title":"How can I obtain a pyqtgraph plotwidget with variable colors and grids depending on the data?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can python embedded into c++ allow you to run n python scripts concurrently?\nI am currently dealing with the dread which is the GIL. My project requires concurrency of at least 2 threads and the easy typing in Python would really help with code simplicity.\nWould embedding my Python code in a C++ script which deals with the threading circumvent the problems the GIL causes?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1020,"Q_Id":25400493,"Users Score":0,"Answer":"Only if you spawn separate interpreters.\nGIL is one-per-interpreter policy to protect interpreter internals. One interpreter will run one line at a time.\nThe only other way is to program at least one of your threads in pure C++ and offer a communication queue API to your python script or any way to communicate asynchronously really.","Q_Score":1,"Tags":"python,c++,multithreading,cpython,gil","A_Id":25400635,"CreationDate":"2014-08-20T08:50:00.000","Title":"Python GIL: concurrent C++ embed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way of somehow putting a QGraphicsTextItem so that the text is always displayed undistorted and in the same size with respect to the user?\nImagine a scene that is zoomed in and out, but has points that are marked with a dot and some text. If the texts is part of the scene it is zoomed with the scene and will be unreadable the most of the time.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":74,"Q_Id":25408726,"Users Score":1,"Answer":"You need to set QGraphicsItem::ItemIgnoresTransformations flag for text items. See the documentation:\n\nThis flag is useful for keeping text label items horizontal and unscaled, so they will still be readable if the view is transformed.","Q_Score":1,"Tags":"python,qt,qgraphicsview","A_Id":25409718,"CreationDate":"2014-08-20T15:28:00.000","Title":"Qt display text in QGraphicsView undistorted, even in IgnoreAspectRatio views","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This seems to be a dumb question, but how do I ssh into the kivy-remote-shell?\nI'm trying to use buildozer and seem to be able to get the application built and deployed with the command, buildozer -v android debug deploy run, which ends with the application being pushed, and displayed on my android phone, connected via USB.\nHowever, when I try ssh -p8000 admin@127.0.0.1 from a terminal on the ubuntu machine I pushed the app from I get Connection Refused.\nIt seems to me that there should be a process on the host (ubuntu) machine in order to proxy the connection, or maybe I just don't see how this works?\nAm I missing something simple, or do I need to dig in a debug a bit more?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1540,"Q_Id":25419510,"Users Score":0,"Answer":"Don't know you found the answer or not. But what i have understood is that you are trying to connect android device from Ubuntu. If I am right then (go on reading) you are following wrong steps.\nFirst :- Your Ubuntu does not have ssh server by default so you get this error message.\nSecond :- You are using 127.0.0.1 address i.e your Ubuntu machine itself.\nMethod to do this shall be\nGive your android machine a static address or if it gets dynamic its OK.\nknow the IP address of android and then from Ubuntu typessh -p8000 admin@IP_Of_andrid_device and this should solve the issue.","Q_Score":1,"Tags":"android,python,ssh,kivy","A_Id":41788451,"CreationDate":"2014-08-21T06:23:00.000","Title":"How to connect to kivy-remote-shell?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"This seems to be a dumb question, but how do I ssh into the kivy-remote-shell?\nI'm trying to use buildozer and seem to be able to get the application built and deployed with the command, buildozer -v android debug deploy run, which ends with the application being pushed, and displayed on my android phone, connected via USB.\nHowever, when I try ssh -p8000 admin@127.0.0.1 from a terminal on the ubuntu machine I pushed the app from I get Connection Refused.\nIt seems to me that there should be a process on the host (ubuntu) machine in order to proxy the connection, or maybe I just don't see how this works?\nAm I missing something simple, or do I need to dig in a debug a bit more?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1540,"Q_Id":25419510,"Users Score":1,"Answer":"127.0.0.1\n\nThis indicates something has gone wrong - 127.0.0.1 is a standard loopback address that simply refers to localhost, i.e. it's trying to ssh into your current computer.\nIf this is the ip address suggested by kivy-remote-shell then there must be some other problem, though I don't know what - does it work on another device?","Q_Score":1,"Tags":"android,python,ssh,kivy","A_Id":25423631,"CreationDate":"2014-08-21T06:23:00.000","Title":"How to connect to kivy-remote-shell?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"This seems to be a dumb question, but how do I ssh into the kivy-remote-shell?\nI'm trying to use buildozer and seem to be able to get the application built and deployed with the command, buildozer -v android debug deploy run, which ends with the application being pushed, and displayed on my android phone, connected via USB.\nHowever, when I try ssh -p8000 admin@127.0.0.1 from a terminal on the ubuntu machine I pushed the app from I get Connection Refused.\nIt seems to me that there should be a process on the host (ubuntu) machine in order to proxy the connection, or maybe I just don't see how this works?\nAm I missing something simple, or do I need to dig in a debug a bit more?","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":1540,"Q_Id":25419510,"Users Score":2,"Answer":"When the app is running, the GUI will tell you what IP address and port to connect to.","Q_Score":1,"Tags":"android,python,ssh,kivy","A_Id":25426085,"CreationDate":"2014-08-21T06:23:00.000","Title":"How to connect to kivy-remote-shell?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am trying to port my code from pywin32 to openpyxl. But I can't find the way to change the color style on partial characters in the cell. In pywin32, I can use:\nRange(Cell).GetCharacters(Start, Length).Font.ColorIndex to do this. But it seems there is no such method like that in openpyxl?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1007,"Q_Id":25439007,"Users Score":1,"Answer":"The simple answer is that a cell is the smallest item to which you can apply styles to. You can work around this restriction by embedding formatting within the text but this is even messier than it sounds.","Q_Score":3,"Tags":"python,excel,openpyxl","A_Id":25486431,"CreationDate":"2014-08-22T03:16:00.000","Title":"openpyxl - style on characters","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two screens and want to change the SlideTransition from my second to first screen to direction: 'right' while keeping the first to second transition the default. The docs only show how to change the transition for every transition. How would I make a transition unique to one screen, done in the kv file?\nNote: I have declared my screen manager screens in the kv file also.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":249,"Q_Id":25459285,"Users Score":0,"Answer":"There isn't a property that lets you simply do this - the transition is a property of the screenmanager, not of the screen.\nYou could add your own screen change method for the screenmanager that knows about the screen names and internally sets the transition.","Q_Score":0,"Tags":"python,kivy","A_Id":25461440,"CreationDate":"2014-08-23T06:55:00.000","Title":"Making unique screen transitions - kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an existing PyQt5\/Python3.4 application that works great, and would now like to add \"real-time\" data graphing to it.  Since matplotlib installation specifically looks for Python 3.2, and NumPhy \/ ipython each have there own Python version requirements, I thought I'd use a python distribution to avoid confusion.   \nBut out of all the distros (pythonxy, winpython, canopy epd) Anaconda is the only one that supports Python 3.4, however it only has PyQt 4.10.4.   Is there a way I can install Anaconda, and use matplotlib from within my existing PyQt5 gui app?\nWould I be better off just using another charting package (pyqtgraph, pyqwt, guiqwt, chaco, etc) that might work out of the box with PyQt5\/Python3.4?","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":15580,"Q_Id":25468397,"Users Score":1,"Answer":"I use Anaconda and with Python v2.7.X and qt5 doesn't work. The work-around I found was \nTools -> Preferences -> Python console -> External modules -> Library: PySlide","Q_Score":8,"Tags":"matplotlib,anaconda,python-3.4,pyqt5","A_Id":44932618,"CreationDate":"2014-08-24T03:57:00.000","Title":"Using Anaconda Python 3.4 with PyQt5","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got an Android app written in Kivy (Python), which stores local files that should survive an app update (adb install -r).\nIf the files are stored in a subdirectory of the current directory (\"data\/data\/app_name\/files\"), I see that they are deleted after update.\nHowever after some experiments I could \"solve\" this by storing the files in the \"data\/data\/app_name\/shared_prefs\" directory, which seems to be persistent after updates. By the way, I didn't check but maybe the \"data\/data\/app_name\/databases\" also is.\nIs there a cleaner way of doing things ?\nI need to test if I can create a new folder not called shared_prefs nor databases under \"data\/data\/app_name\", and if it is persistent.\n(this seems kind of a hack because those directories have another dedicated purpose, even though my app is not using them for this dedicated purpose right now)\n(NB: I don't want to keep the files outside the app private directory)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1291,"Q_Id":25469151,"Users Score":0,"Answer":"There is not a simple way (as in a build hook or similar) right now, but it's something we've specifically discussed in the last few days as the current situation has become a direct problem. I'm not sure what the resolution was, but there will probably be a change in python-for-android to fix it fairly soon.\nIf you want to keep up to date with this, ask on the kivy mailing list or irc. In particular, knapper_tech was making these changes.","Q_Score":0,"Tags":"android,python,local-storage,updates,kivy","A_Id":25471205,"CreationDate":"2014-08-24T06:38:00.000","Title":"Kivy on Android : keep local storage files after app updates","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been trying something like this in VB.\nPrivate Sub python_Click()\n    Shell \"C:\\Python25\\python.exe \"\"C:\\rowcount.py\"\nEnd Sub\nThis python script just creates a text file and this script works fine. But how to run a python script from vb button_click event as if the python script accepts run-time arguments.\nSomething like the following\ne.g:  Shell \"C:\\Python25\\python.exe \"\"C:\\rowcount.py -e -w -v COM6\"","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":415,"Q_Id":25479018,"Users Score":0,"Answer":"If you're on Windows just call the Python file by itself. If you're on Mac or *Nix then make it executeable with chmod a+x pythonfile.py, then call it.\nYou may need to add python to the Path environment variable but that is always a convenient thing to have.","Q_Score":0,"Tags":"python,vba,button","A_Id":25479346,"CreationDate":"2014-08-25T04:24:00.000","Title":"How to pass arguments to a python script on a button press from vb","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Here is what I want to do:\n1)Open an application with username\n2)Give some inputs \n3)Open 2nd window for the application with different username\n4)Give some inputs again \n5)Switch to first application window, do somethg\n6)Switch to second application\nI am programming in python using the win32gui library.\nI have tried using the ShowWindow and SetForegroundWindow , but it doesnt work correctly, can someone please explain me what would be the way to do it in a very simple way?","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":2967,"Q_Id":25535893,"Users Score":-1,"Answer":"Call BringWindowToTop and SetActiveWindow functions.","Q_Score":3,"Tags":"python,win32gui,showwindow,setforegroundwindow","A_Id":28421442,"CreationDate":"2014-08-27T19:55:00.000","Title":"How to use ShowWIndow() and SetForegroundWindow Correctly?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Edit<<<<<<<\nThe question is:  \n-How do you launch C code from python? (say, in a function)\n-How do you load Java code into python? (perhaps in a class?)\n-Can you simply work with these two in a python program or are there special considerations?\n-Will it be worth it, or will integrating cause too much lag?  \nBeing familiar with all three languages (C, Java and Python) and knowing that Python supports C libraries, (and apparently can integrate with Java also) I was wondering if Python could integrate a program using both languages? \nWhat I would like is fast flexible C functions while taking advantage of Java's extensive front-end libraries and coordinating the two in Python's clean, readable syntax.\nIs this possible?\nEDIT---->\nTo be more specific, I would like to write and execute python code that integrates my own fast C functions. Then, call Java libraries like swing to create user interface and handle networking. Probably taking advantage of XML as well to aid in file manipulation.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":152,"Q_Id":25577470,"Users Score":1,"Answer":"For C, you can use ctype module or SWIG.\nFor Java, Jython is a good choice.","Q_Score":0,"Tags":"python,c,language-interoperability","A_Id":25577983,"CreationDate":"2014-08-29T23:24:00.000","Title":"How do you use Python with C and Java simultaneously?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"How can I efficiently detect collision between image layers and generated shapes?\nI need a fast and comprehensive method to detect collision between rotatable image layers and generated shapes. \nSo far I have just been dividing images into a series of circles that contain the majority of the pixels and then testing each circle against other shapes. To enhance performance I created perimeter circles around each structure and only test these larger circles until two structures are close enough to collide.\nThe real problem is that it is very difficult to collide a rotatable rectangle, for example, into one of these image structures. Filling a rectangle with circles also just does not seem efficient. Not to mention that I'm getting combinatoric explosions that make looping very complex and poor performance.\nAnyone know a better way to handle this type of collision? I write in Java, Python and C. I am willing to use C++ also.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":170,"Q_Id":25587180,"Users Score":0,"Answer":"Normally, sphere collisions are just filter for real collision tests.\nYou can either:\n\ndecide to limit collisions to that, for example if it's a game.\nimplement real collisions and do the full math. You're basically intersecting the rotated edges of the two rectangles (16 cases). Intersect two edges as if they were lines, there will be only one point of intersection (unless they're parallel), if that point is inside the segment there's a collision.\n\nTo limit complexity, you can use a quadtree\/octree. Divide your space into four rectangles, then those rectangles into four etc ... until they're too small to contain an object or are empty. Put your collidable objects into the most specific part of the tree that will contain them. Two objects can only collide if they are in the same sub rectangle or one is in any parent of the other.\nNot sure that helps, but they're ideas.","Q_Score":0,"Tags":"java,python,c,algorithm,collision-detection","A_Id":25588001,"CreationDate":"2014-08-30T22:10:00.000","Title":"Collision detection between image layers and shapes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"my platform: ubuntu14.04\npython 3.4.0\nI moved my project from pyqt4 to pyqt5 and fond that I could not enable my IME in my program powered by pyqt5...\nSince there is no error raised, I could not focus to where the problem is.\nThis problem is quite like \"enable IME in Sublime on Linux\".\nAnyone meet the same problem or have already fixed it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":382,"Q_Id":25621349,"Users Score":0,"Answer":"The problem is caused by fcitx not QT5.\nInstall libfcitx-qt5 and it will fix the problem.","Q_Score":0,"Tags":"python,pyqt5","A_Id":25676913,"CreationDate":"2014-09-02T10:35:00.000","Title":"How to use IME(Input Method Editor) with pyqt5","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created a analog rpm gauge using the canvas widget of Tkinter and I want to import it in a wx GUI application (as a panel, maybe). Is there any way to do it or I must rewrite this widget in wx?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":408,"Q_Id":25622764,"Users Score":2,"Answer":"There is no (simple) way to do that - WxWidgets is an abstraction over different toolkits in different systems, and use different mainloop functions, while Tkinter has its own mainloop - that is to start with.\nSo  making that work would at leas require:\n\nthat you'd setup different threads able to run both mainloops in\nparalell,  \nfinding a way to get Tkinter to render the widget to an\nin memory bitmap \ncreate a custom widget in wx which would render\nthat bitmap to the screen\nand map events on it back to Tkinter, if\nit is supposed to respond events\n\nSo you are definitely better of writting the widget again.","Q_Score":2,"Tags":"python,user-interface,tkinter,wxpython","A_Id":25622901,"CreationDate":"2014-09-02T11:52:00.000","Title":"import a tkinter widget in wxpython application as a panel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to install Pygame and it returns me the following error \"Python version 3.4 required which was not found in the registry\". However I already have the Python 3.4.1 installed on my system. Does anyone know how to solve that problem? \nI've been using Windows 8.1\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":1096,"Q_Id":25625097,"Users Score":3,"Answer":"Are you using a 64-bit operating system? Try using the 32-bit installer.","Q_Score":2,"Tags":"python-3.x,pygame","A_Id":25628838,"CreationDate":"2014-09-02T13:51:00.000","Title":"Error installing Pygame \/ Python 3.4.1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to install Pygame and it returns me the following error \"Python version 3.4 required which was not found in the registry\". However I already have the Python 3.4.1 installed on my system. Does anyone know how to solve that problem? \nI've been using Windows 8.1\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1096,"Q_Id":25625097,"Users Score":0,"Answer":"Tips I can provide:\n\nAdd Python to your Path file in the Advanced settings of your Environmental Variables (just search for it in the control panel)\nSomething may have gone wrong with the download of Python, so re-install it. Also don't download the 64-bit version, just download the 32-bit version from the main pygame website\nOnce that's sorted out, transfer the entire Pygame file to the site packages in the Python directory and open up the pygame file and go to this directory in command prompt. Finally, run the Pygame setup from the command prompt which should be something like:\npython setup.py\n\nBut this will only work if the pygame setup file is called setup.py (it's been a while since I downloaded it), you added Python to the Path file and you're currently in the correct directory in command prompt.\nTo test if it worked try importing pygame and see if you got an error or not.","Q_Score":2,"Tags":"python-3.x,pygame","A_Id":25628949,"CreationDate":"2014-09-02T13:51:00.000","Title":"Error installing Pygame \/ Python 3.4.1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How I can remove or hide the default minimize or maximize button of a window created with kivy.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1674,"Q_Id":25639073,"Users Score":0,"Answer":"I'm not aware of a simple way to do this - it's not exposed in the kivy window api, and may not even be exposed in pygame (which is likely the backend you're using on desktop).\nMaybe you can look up the right way to do it on each system you target, e.g. I think you can hint it to X11, but I don't know if this is really plausible or nice.\nWe're developing a new sdl2 backend, which is more flexible about some of these kinds of things, but I don't know if it would make this possible.","Q_Score":5,"Tags":"python-2.7,user-interface,kivy","A_Id":25639632,"CreationDate":"2014-09-03T07:53:00.000","Title":"How to hide\/remove the default minimize\/maximize buttons on window developed with Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Comically enough, I was really annoyed when tkinter windows opened in the background on Mac. However, now I am on Linux, and I want tkinter to open in background.\nI don't know how to do this, and when I google how to do it, all I can find are a lot of angry Mac users who can't get tkinter to open in the foreground.\nI should note that I am using python2.7 and thus Tkinter not tkinter (very confusing).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":184,"Q_Id":25648912,"Users Score":0,"Answer":"I am using Linux Mint. In order to make a program not show up in the foreground (i.e. be hidden behind all of the other windows), one should use root.lower() as aforementioned in the comments. However, please note (and this seems to happen on multiple platforms) that root.lower() will not change the focus of the window. Therefore, even if you use .lower() and run the script, and if you press [alt] + [F4], for example, the Tkinter window that was just opened (even though you cannot see it) will be closed.\nI noticed, however, that it is prudent to place the root.lower() after attributes for the Tkinter root. For example, if you use root.attributes(\"-zoomed\", True) to expand the window, be sure to place root.lower() after the root.attributes(..). Moreover, it did not work for me when I put root.lower() before root.attributes(..).","Q_Score":0,"Tags":"python-2.7,tkinter","A_Id":25689654,"CreationDate":"2014-09-03T16:04:00.000","Title":"Start Tkinter in background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Basically, I have a large existing code base and I want to wrap all of the .h files in one particular directory using SWIG. Many of the classes in these .h files inherit from other classes defined elsewhere in the directory tree, and it would be a pain to track down each one of them by hand. Is there any way to get SWIG to automatically include these or to at least automate the creation of the .i file? I don't want to wrap any classes outside of my own code (such as the standard library), but these would end up being included if I used the -importall option.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":734,"Q_Id":25671624,"Users Score":0,"Answer":"There isn't a builtin way to generate the .i file automatically, or to populate the .i with all .h in a folder and all \"other .h to make it work properly\"\nPart of the reason is that \"working properly\" is completely arbitrary: if A is in that set of headers you want to export, and A derives from B, do you need to export B \"for it to work properly\"? Not at all. But you might want to. And even if A returns an instance of B, do you need to export B? No (so don't need import B.h in .i), the object returned by SWIG will be an opaque handle to the B instance, and although you won't be able to call any methods on it, you will be able to give it as argument to functions that accept B as a parameter. \nThe most practical is to write a batch or python script to find a base set of the .h you want (a one liner if all in same folder), copy\/paste into your .i, and manually cleanup so .i only contains what files you really want to export to target language, and add any missing ones to get certain features you want (like instantiate base classes etc). You can say \"no I don't want to have to customize\" all you want, you don't have a choice.","Q_Score":3,"Tags":"python,c++,include,swig","A_Id":25690665,"CreationDate":"2014-09-04T17:30:00.000","Title":"How can I wrap many .h files with SWIG and include any dependencies?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have installed it using the executable file downloaded from its webpage. \nI tried finding %AppData%\\skins\\ as suggested by blogs but I just couldn't find it. Has anybody been stuck here?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2831,"Q_Id":25725702,"Users Score":0,"Answer":"Click on the windows logo, write %appdata%, then open \"Roaming\"","Q_Score":1,"Tags":"python,pyscripter","A_Id":30013579,"CreationDate":"2014-09-08T13:43:00.000","Title":"Changing theme in Pyscripter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am working with a GIS problem using a single input of a polygon shapefile. \nConsider an irregular polygon. I want to draw vertical lines across the extent of the polygon at equal spacing. \nHow I intend to proceed is:\n\nIdentify the bounding box (done using PyShp)\nDraw vertical Lines parallel to the left edge of the bounding box at equal spacing (How?)\nClip the lines to the extent of the polygon (How, without using ArcPy?)\n\nNote: They are required to be only vertical, and not a graticule. Also, I do not intend to use ArcPy, and intend to perform the coding completing in Python (2.7) as this segment of code needs to go into a tool generated from PyQt.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1014,"Q_Id":25742903,"Users Score":0,"Answer":"Find the points\/vertices that describe the line at the left edge - (x1, y1), (x2, y2)\nAdd a constant to the x values - (x1+k, y1), (x2+k, y2)\nFind the y values on the polygon at the new x values - (x1+k, y3), (x2+k, y4)\nDraw the line between those two points.","Q_Score":0,"Tags":"python,python-2.7,shapefile,bounding-box","A_Id":25744305,"CreationDate":"2014-09-09T10:58:00.000","Title":"Vertical lines in a polygon shapefile","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is pretty simple.\nI have a label along the bottom of my app. As a user scrolls through a treeview, the content of that label changes. Sometimes, the content is multiple lines long.\nPreviously, the label would grow\/shsrink to accommodate content. I didn't like this, so I wrapped the label in a frame, gave said frame a fixed height, and set grid_propagate(0). It looks great, but now my text has disappeared.\nHow can I give the label a fixed size and retain the ability to update its text?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":296,"Q_Id":25793355,"Users Score":0,"Answer":"Rather then a Label use a Text inside the Frame and add a vertical scrollbar with the Text.  Pack both the Text and the Scrollbar in the Frame, using examples online, and connect them up.  Once you cancel propagate for the Frame it won't resize.  You can then set the Frame to whatever size you want, even set the Text for a specific number of lines and columns of text before you cancel propagate for the Frame, and then you can display as much text as you want at the bottom allowing the user to scroll through if it is too big.","Q_Score":0,"Tags":"python,tkinter,resize","A_Id":47625796,"CreationDate":"2014-09-11T17:12:00.000","Title":"Tkinter, enclosing_frame.grid_propogate(0) to prevent resizing also prevents updating label text","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using android version 4.4.2 and python 2.7 for UI automation.\nwhen I tried to capture view using UI automator\/culebra\/dump, I'm not able to capture QWERTY keypad view. Please help me on this\nI need to touch and type on qwerty keypad and I should be able to type alpha-numeric text and smileys. Also once typed, you should verify if what is displayed on the screen is what you intended to type.\nThanks in advance.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":849,"Q_Id":25841900,"Users Score":0,"Answer":"QWERTY keyboard is webview and UiAutomator does not support webview at present. AndroidViewClient is based on UiAutomator and therefore does not capture the keyboard.\nIf your objective is to just type the text, you can first detect if the focus is on the text field and then use device.type('your_text').","Q_Score":2,"Tags":"android,python-2.7,dump,android-uiautomator,androidviewclient","A_Id":25967652,"CreationDate":"2014-09-15T06:19:00.000","Title":"In android view client I'm not able to capture qwerty keyboard in message","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to use the OS module in python to save a jpeg created by the screenshot() function in Kivy? I am on Android so I want to find a way to make it so that the screenshot() gets saved in \/sdcard\/Pictures.\nIf I don't have to use the OS module, how would I do it?\nPlease use examples and add code snippets that other users and I can use for future reference.\nI have been stuck on this issue for a long time.\nThanks in advance!!!!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":77,"Q_Id":25858087,"Users Score":1,"Answer":"I want to find a way to make it so that the screenshot() gets saved in \/sdcard\/Pictures.\n\nThe argument to screenshot is the filepath to save at, just write Window.screenshot('\/sdcard\/Pictures').","Q_Score":0,"Tags":"android,python,python-2.7,kivy","A_Id":25858139,"CreationDate":"2014-09-15T22:52:00.000","Title":"How to use os module to save a jpeg to a cretin path- Using kivy screenshot()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The Studio app that is served on port 18010 shows with no theme. It only shows black text on a white background and with no images... that happens while the other counterpart LMS (on port 80) app shows fine.\nWhere shall I start troubleshooting this problem?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":276,"Q_Id":26011567,"Users Score":0,"Answer":"port 18010 is forwaded via nginx, So you have to run studio collectstatic.\nie..update_assets for cms(studio) in edx.","Q_Score":0,"Tags":"python,django,django-templates,mako,edx","A_Id":26646633,"CreationDate":"2014-09-24T07:59:00.000","Title":"Edx Studio not showing with a theme","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"The goal is to have an application that runs on top of all other applications and windows in the desktop, and display a clickable control (say, an image button) that moves around the screen.\nThe application must run as a service in the background and show thebutton (let's say) each hour, once clicked it disappears until the next hour.\nThis application has to be written in Python.\nIt looks like PyQt is one of the better options, but I'm not sure if it does support this sort of functionality and if it is a good alternative for modern Windows applications.\nWhat packages or frameworks are appropriate for this scenario? I have seen Pygl and PyGame but they seem to be limited to a window, is this correct?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":127,"Q_Id":26026865,"Users Score":1,"Answer":"You actually don't need to create the program as a service. You can just start the application and not show the window immediately. You can use PyQt or wxPython. I'm more familiar with wxPython, so if you went that route, you could use a wx.Frame style flag such as wx.STAY_ON_TOP to get the functionality you want.\nI have created applications that load up in the system tray with just an icon. When you click the icon, it shows the frame. The rest of the time, the frame is hidden. I would try that route before looking at doing a service.","Q_Score":1,"Tags":"python,windows,user-interface,desktop-application","A_Id":26043694,"CreationDate":"2014-09-24T21:30:00.000","Title":"How to make a clickable control that is always on top, in Windows using Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does anyone know if it is possible to run python-gui apps, like wxPython, on a c9.io remote server? I have my home server set up with c9 via SSH, and no issues logging in and running apps in the terminal on the VM. However, when I try to run GUI apps, I get the following error message. \nUnable to access the X Display, is $DISPLAY set properly?\nAfter searching and searching, I can't seem to find a guide or anything in the docs that detail how to set $DISPLAY in the script. X display is installed and active on my server, but I don't know how to configure the c9 script to access it properly. Any assistance would be appreciated!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":686,"Q_Id":26050414,"Users Score":1,"Answer":"I don't know if Cloud9 supports it but normally to run a remote GUI application you would have ssh forward the X11 communication over the ssh connection via a tunnel.  So basically the application is running on the remote system and it is communicating with a local X11 server which provides you with the display and handling of the mouse and keyboard.  \nIf you run ssh with the -X parameter then it will attempt to set up the X11 tunnel and set $DISPLAY in the remote shell so any GUI applications you run there will know how to connect to the X11 tunnel.  Bw aware however that this is something that can be turned off on the remote end, so ultimately it is up to Cloud9 whether they will allow you to do this.","Q_Score":0,"Tags":"python-2.7,wxpython","A_Id":26051264,"CreationDate":"2014-09-26T00:53:00.000","Title":"Running Python GUI apps on C9.io","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"When creating a TextItem to be added to a plotItem in PyQtGraph, I know it is possible to format the text using html code, however I was wondering how to format the text (i.e. change font size) when updating the text through TextItem.setText()? or do I need to destroy\/re-create a TextItem?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1991,"Q_Id":26116350,"Users Score":5,"Answer":"It is not documented, but the method you want is TextItem.setHtml().","Q_Score":1,"Tags":"python,text,plot,formatting,pyqtgraph","A_Id":26129313,"CreationDate":"2014-09-30T08:39:00.000","Title":"How to set font size using TextItem.setText() in PyQtGraph?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I have a QGridLayout and stack two widgets on top of each other, then they take up 50% of the layout each. However, if one of the widgets is a QLineEdit widget, then that widget takes up a much smaller portion of the layout than 50%.\nHow do I add two widgets to a QGridLayout, then set the initial portions to something other than 50%\/50%?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3186,"Q_Id":26128828,"Users Score":0,"Answer":"The default vertical size policy of QLineEditis QSizePolicy.Fixed. That means it will always have the same height and other widgets might take available space in the layout.\nSo you might have to adjust the size policies of your widgets as Fenisko already demonstrated.\nHowever if you have two or more expanding widgets in your layout, all will have equal size.\nYou can use QGridLayout.setRowStretch(int column, int stretch) and\nQGridLayout.setColumnStretch(int column, int stretch) of your layout to adjust proportions of rows and columns.\nAlterantively use QSizePolicy.setVerticalStretch(int stretch) and QSizePolicy.setHorizontalStretch(int stretch) of your widget's size policies.","Q_Score":1,"Tags":"python-3.x,pyqt,pyside","A_Id":26194380,"CreationDate":"2014-09-30T19:43:00.000","Title":"What's the proper way to resize widgets in a layout?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make a GUI in python using pyqt4 which incorporates a waterfall sink which is connected with an USRP. The problem is that the data should be shown in waterfall sink continuously which makes the GUI to freeze and I can not use the other buttons in meanwhile. I was checking to use threads, but till now what I understood is that in threads I can put just functions which will give an result at the end, but not the functions which will give results continuously and I want to see it in the main GUI.\nAny idea how to make it possible to see the continuous results from waterfall sink and not to freeze the main GUI.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":352,"Q_Id":26138460,"Users Score":0,"Answer":"There are several ways to do this, but basically either\n\nBreakup your waterfall sink into chunks of work, which the GUI can execute periodically. For example, instead of continuously updating the waterfall sink in a function that GUI calls, have only a \"short\" update (one \"time step\"), and have the function return right after; make the function called periodically via QTimer. \nMake the waterfall sink execute in a separate thread by using a QObject instantiated in a QThread instance; and make the sink function emit a signal at regular interval, say at every \"time step\" of the waterfall update.","Q_Score":0,"Tags":"python,multithreading,pyqt,pyqt4,usrp","A_Id":26153975,"CreationDate":"2014-10-01T09:43:00.000","Title":"Using threads with python pyqt?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have install Anaconda 2.0.1 on KDE desktop. When I run python and would see all modules installed, I have this message \"Cannot mix incompatible Qt library (version 0x40801) with this library (version 0x40805)\",\nCan I fix the problem if I unintall Qt library (version 0x40801)? \nHow I do that? \nOr if someone have another suggestion,please help me, \nThx very much","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3076,"Q_Id":26155448,"Users Score":0,"Answer":"QT aggressively tries to find other QT installations on the system. It is likely finding the one installed by Linux. You likely can't remove this, as there are probably several programs that come with Linux that use QT, but is it possible to update it to the same version?","Q_Score":4,"Tags":"python,qt,anaconda","A_Id":26186264,"CreationDate":"2014-10-02T06:26:00.000","Title":"Cannot mix incompatible Qt library (version 0x40801) with this library (version 0x40805)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I create an exe executable of my application made \u200b\u200bin pyqt, and everything went well, but when I run the exe in windows before opening the application opens a console and while the application is open that console is also.\nI need someone to tell me how to make the console does not come out, or at least not visible.\nI've seen some answers to this problem but with C ++ with Python I have not seen anything","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":50,"Q_Id":26199115,"Users Score":0,"Answer":"The best solution is in the post linked to in a comment to your post, but on Windows you can also set a property on a shortcut that starts the app, to have the console minimized. It still shows in taskbar, there id you need it, can be handy in some situations(like during dev to use same script as user will, but not have to bother evrytime start the app to manually minimize the console). In general best to use pythonw.exe or use .pyw extension for your script.","Q_Score":0,"Tags":"python,windows,console,pyqt,exe","A_Id":26208237,"CreationDate":"2014-10-05T02:35:00.000","Title":"The exe executable of my application, also opens a console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to do some basic audio-signalprocessing in kivy. For example, I would like to convolve a .wav file with an impulse response. I use SoundLoader.load('file.wav') to load the audio files.\nMy question is: is it possible to convert an audio object into a list, so I can access each sample? Or does the SoundLoader class offer any possibilities of convolution, or any other audio processing?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1453,"Q_Id":26201740,"Users Score":0,"Answer":"Kivy is not really obviously designed for Audio or Signal Processing and doesn't need to be thats why you have python and its massive collections of libraries, you can use 'numpy', 'scipy', 'librosa', and so on....\nwith numpy you could get an array of the signal","Q_Score":1,"Tags":"python,audio,kivy,convolution","A_Id":54000026,"CreationDate":"2014-10-05T10:28:00.000","Title":"Audio processing in kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to find Qt designer app on Mac. I installed anaconda package and conda reports that qt, sip, and pyqt are installed. Still I couldn't find the designer app in any of the folders. My Python app that uses pyqt works perfectly. I'm very new to macs and probably missing something very simple.\nI did search folder tree for anything named designer. I found QtDesigner.so (supposed to be executable?) at\n\/Users\/XXXX\/anaconda\/pkgs\/pyqt-4.10.4-py27_0\/lib\/python2.7\/site-packages\/PyQt4 but it won't even run saying \"cannot execute binary file\"\nanaconda\/bin doesn't have it.\nThere's a folder anaconda\/include\/QtDesigner but noting I can run\n\/anaconda\/pkgs\/qt-4.8.5-3\/bin - no designer. I'm totally confused now.","AnswerCount":9,"Available Count":4,"Score":0.0444152037,"is_accepted":false,"ViewCount":36375,"Q_Id":26226730,"Users Score":2,"Answer":"I found it in this location in my mac \n\/Users\/ramakrishna\/Qt\/5.11.1\/clang_64\/bin\/Designer.app \ncommand \"open -a designer\" also works on mac shell\ncommand + space bar and invoke spot light search and typing designer also find the designer app","Q_Score":13,"Tags":"python,macos,qt,pyqt,anaconda","A_Id":51688988,"CreationDate":"2014-10-07T00:16:00.000","Title":"Where is Qt designer app on Mac + Anaconda?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to find Qt designer app on Mac. I installed anaconda package and conda reports that qt, sip, and pyqt are installed. Still I couldn't find the designer app in any of the folders. My Python app that uses pyqt works perfectly. I'm very new to macs and probably missing something very simple.\nI did search folder tree for anything named designer. I found QtDesigner.so (supposed to be executable?) at\n\/Users\/XXXX\/anaconda\/pkgs\/pyqt-4.10.4-py27_0\/lib\/python2.7\/site-packages\/PyQt4 but it won't even run saying \"cannot execute binary file\"\nanaconda\/bin doesn't have it.\nThere's a folder anaconda\/include\/QtDesigner but noting I can run\n\/anaconda\/pkgs\/qt-4.8.5-3\/bin - no designer. I'm totally confused now.","AnswerCount":9,"Available Count":4,"Score":0.1106561105,"is_accepted":false,"ViewCount":36375,"Q_Id":26226730,"Users Score":5,"Answer":"OSX Yosemite 10.10.5\nQt 5.6\nQtCreator 3.6.1\nQtDesigner is part of my QtCreator.  To use QtDesigner:\n\nLaunch QtCreator, and from the menu bar (outside QtCreator), click on:\nFile>New File or Project \nYou will be presented with a New File or Project dialog window.  In the Files And Classes section, select Qt.  In the middle pane, select QtDesigner Form.  Then click on the Choose button in the lower right corner.\nYou will be presented with a QtDesigner Form dialog window.  Then you can select Main Window or Dialog with Buttons Bottom, etc. Then click on the Continue button in the lower right corner.\nIn the Location dialog window, use a name like mainwindow1.ui, and for the path you might want to step aside and create a directory called forms, e.g. $ mkdir \/Users\/7stud\/qt_projects\/forms, then enter that as the path.\nEnter any other details and click on Done.   That will land you in QtCreator with the Design button selected (which I guess means you are in QtDesigner), and you will be able to drag and drop widgets onto your window.\nTo convert the .ui file to a .py file that you can import into your python program:\n$ pyuic5 mainwindow1.ui -o mainwindow1.py\n-o => output file (default is stdout)\n\nThat command converts the .ui file mainwindow1.ui to a .py file named mainwindow1.py.\nTo re-open the file: File>Open File or Project.  If you select a file with a .ui extension, it will be opened with QtCreator's Design button pre-selected, i.e. you will be inside QtDesigner.","Q_Score":13,"Tags":"python,macos,qt,pyqt,anaconda","A_Id":36830816,"CreationDate":"2014-10-07T00:16:00.000","Title":"Where is Qt designer app on Mac + Anaconda?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to find Qt designer app on Mac. I installed anaconda package and conda reports that qt, sip, and pyqt are installed. Still I couldn't find the designer app in any of the folders. My Python app that uses pyqt works perfectly. I'm very new to macs and probably missing something very simple.\nI did search folder tree for anything named designer. I found QtDesigner.so (supposed to be executable?) at\n\/Users\/XXXX\/anaconda\/pkgs\/pyqt-4.10.4-py27_0\/lib\/python2.7\/site-packages\/PyQt4 but it won't even run saying \"cannot execute binary file\"\nanaconda\/bin doesn't have it.\nThere's a folder anaconda\/include\/QtDesigner but noting I can run\n\/anaconda\/pkgs\/qt-4.8.5-3\/bin - no designer. I'm totally confused now.","AnswerCount":9,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":36375,"Q_Id":26226730,"Users Score":0,"Answer":"I can't answer you question definitively as I don't have OSX installed anywhere, but perhaps I can help lead you in the right direction.\n1) you are going to want to be looking for Designer, not QT Creator, as Designer is what comes bundled with PyQt4 (PyQt4 is what Anaconda comes packaged with)\n2) in linux when you install Anaconda 2.1 to the default location, designer is going to be placed in home\/user_name\/anaconda\/bin\/\n3) typing 'designer' from a terminal launches designer in linux, so you may not have to bother searching around for it.\nHopefully there is some consistency between linux and osx (windows designer is located in \\Anaconda\\Lib\\site-packages\\PyQt4).  \nBest of luck.","Q_Score":13,"Tags":"python,macos,qt,pyqt,anaconda","A_Id":27385758,"CreationDate":"2014-10-07T00:16:00.000","Title":"Where is Qt designer app on Mac + Anaconda?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to find Qt designer app on Mac. I installed anaconda package and conda reports that qt, sip, and pyqt are installed. Still I couldn't find the designer app in any of the folders. My Python app that uses pyqt works perfectly. I'm very new to macs and probably missing something very simple.\nI did search folder tree for anything named designer. I found QtDesigner.so (supposed to be executable?) at\n\/Users\/XXXX\/anaconda\/pkgs\/pyqt-4.10.4-py27_0\/lib\/python2.7\/site-packages\/PyQt4 but it won't even run saying \"cannot execute binary file\"\nanaconda\/bin doesn't have it.\nThere's a folder anaconda\/include\/QtDesigner but noting I can run\n\/anaconda\/pkgs\/qt-4.8.5-3\/bin - no designer. I'm totally confused now.","AnswerCount":9,"Available Count":4,"Score":1.0,"is_accepted":false,"ViewCount":36375,"Q_Id":26226730,"Users Score":18,"Answer":"You can try open -a Designer from your terminal to launch Qt Designer that comes with Anaconda (version 4.x).\nIf you have Qt5.x, you may want to launch a newer version of Designer by open -a Designer-qt5.","Q_Score":13,"Tags":"python,macos,qt,pyqt,anaconda","A_Id":41113866,"CreationDate":"2014-10-07T00:16:00.000","Title":"Where is Qt designer app on Mac + Anaconda?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm attempting to embed a python module within a larger c++ program (Relevant details:VS2005, WinXP Python 2.7). When I create a new instance of the class that includes 'python.h' and attempt to run my program I get the error message \"The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.ll\".\nI've read online that this happens because GetTickCount64 doesn't exist in XP so I made sure to add the correct windows headers to all of my files. However I still get the error and it occurs even if I comment out everything in the offending class except the include for Python.h. \nSo to get to an actual question. I was wondering if Python itself could be calling or including GetTickCount64 and if so how to stop it from doing so.\nThanks for any help!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":505,"Q_Id":26285393,"Users Score":0,"Answer":"Guess I posted to fast since I think I've got it sorted myself. For anyone else in the same position I downloaded the Python source and compiled with Windows XP flags in VS2005 and all seems well with the world.","Q_Score":0,"Tags":"c++,python-2.7,windows-xp,gettickcount","A_Id":26286120,"CreationDate":"2014-10-09T18:19:00.000","Title":"GetTickCount64 error using Python and C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have inherited a wxPython app (story of my life of late) and you cannot make the window any smaller (but you can make it larger). What could be preventing it from being resized smaller? What could I grep for to find what is causing this? The window contains a Notebook with 2 tabs. One tab has a Grid and the other has a Panel and 3 Grids.","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":193,"Q_Id":26290757,"Users Score":0,"Answer":"Well then, I would suppose that the code is handling the resize event, allowing you to make the window larger, but not smaller.\nLook for something like void handlerFuncName(wxSizeEvent& event)\nAlso look for wxEVT_SIZE","Q_Score":1,"Tags":"wxpython,wxwidgets","A_Id":26307804,"CreationDate":"2014-10-10T01:54:00.000","Title":"wxPython: what is preventing me from making a window smaller?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have inherited a wxPython app (story of my life of late) and you cannot make the window any smaller (but you can make it larger). What could be preventing it from being resized smaller? What could I grep for to find what is causing this? The window contains a Notebook with 2 tabs. One tab has a Grid and the other has a Panel and 3 Grids.","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":193,"Q_Id":26290757,"Users Score":0,"Answer":"It is likely a call to SetMinSize for your Dialog\/Frame.","Q_Score":1,"Tags":"wxpython,wxwidgets","A_Id":26292854,"CreationDate":"2014-10-10T01:54:00.000","Title":"wxPython: what is preventing me from making a window smaller?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a GUI for a script in Python, using PySide Qt. I have a couple of checkboxes in the main window and I was wondering if it is possible to make them dependant to each other. What I mean is that, if I check one of them, all the others should become unchecked. So only one can be checked at a time.\nIs there a comfortable way to do this? Otherwise I would just write a function to uncheck the others.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2086,"Q_Id":26293638,"Users Score":1,"Answer":"use QButtonGroup to make them as a group and you might want to derive a class from this and override the basic check\/uncheck depending on how you want the checkboxes to behave","Q_Score":0,"Tags":"python,checkbox,pyqt,pyqt4,pyside","A_Id":26311689,"CreationDate":"2014-10-10T07:00:00.000","Title":"How to allow only one checkbox checked at a time?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know this is probably something trivial, but I cannot seem to find the answer. I have just completed a fresh install of Scientific Linux 6.5 - which ships with Python 2.6 and Qt 4.6.2. I wish to use the Python interpreter python2.7.8 so downloaded this and installed. I use the QtDesigner for ease when making guis, so then need the PyQt bindings to go with it. I therefore downloaded SIP-4.16.3, configured with: \npython2.7 .\/configure (in the sip download directory)\nto make the bindings for the newer version of python. Everything works fine so far.\nI then try to install PyQt4.11.2 in the same way:\npython2.7 .\/configure --qmake=\/usr\/lib\/qt4\/bin\/qmake -g (to pick up the qt4 version of qmake with static qt libraries)\nthe configure script completes fine, but I get the following error during 'make':\nerror: \u2018PrintCurrentPage\u2019 is not a member of \u2018QAbstractPrintDialog\u2019\n....\/Downloads\/PyQt-x11-gpl-4.11.2\/QtGui\/sipQtGuiQAbstractPrintDialog.cpp:1787: error: too many initializers for \u2018sipEnumMemberDef\u2019\nmake[1]: * [sipQtGuiQAbstractPrintDialog.o] Error 1\nmake[1]: Leaving directory `....\/Downloads\/PyQt-x11-gpl-4.11.2\/QtGui'\nmake: * [all] Error 2\nI am at this point a little lost and have been bashing my head for a while, it must be something simple I have missed, any help would be great.\nThanks in advance","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1861,"Q_Id":26301635,"Users Score":2,"Answer":"Search string 'PrintCurrentPage' in files of your PyQt-package. You will find it in 4 files.\nRemove corresponded lines with string 'PrintCurrentPage'","Q_Score":5,"Tags":"python,linux,qt,installation,pyqt4","A_Id":27922827,"CreationDate":"2014-10-10T14:21:00.000","Title":"Installing PyQt4.11.2 on Scientific Linux 6.5","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I am writing a program for school, and I have to make a maths quiz, the quiz needs to be out of 10 questions.  I have made a button that is defined with a command that generates a new questions, clears the text box, get the answer from the dictionary, and inserts the new question into the textbox.  At the moment the user can press the button as many times as they want.  I dont actually know how to count or monitor the amount of times a button in tkinter has been pressed.  I would be very grateful if someone could provide me with some code for Python(3.1.4) that I could use to count the amount of times the button has been pressed.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":17843,"Q_Id":26315848,"Users Score":1,"Answer":"You need a variable in a global or class instance scope and a function that has access to the scope of the variable that increments the variable when called.  Set the function as the command attribute of the Button so that the function is called when the button is clicked.","Q_Score":0,"Tags":"python,button,user-interface,python-3.x,tkinter","A_Id":26315912,"CreationDate":"2014-10-11T14:44:00.000","Title":"How to count the number of times a button is clicked Python(tkinter)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new developer in QPython (experienced with python), I want to open an url with user's default browser.\nI tried AndroidBrowser().open(\"...\") but, to my surprise, I got Segmentation Fault!\nSo I said OK, let's try to open it manually as activity, then I tried to import jnius and got Segmentation Fault as well.\nAny suggestion how to fix it or other ways to open the browser?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1277,"Q_Id":26318326,"Users Score":1,"Answer":"Apparently, this happens just in console mode, so in other QPython mods it works fine.","Q_Score":3,"Tags":"android,segmentation-fault,android-browser,qpython,pyjnius","A_Id":26428421,"CreationDate":"2014-10-11T19:16:00.000","Title":"Open a URL with default broswer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm trying to adequate the FontSize of my text into a width-height specific context. For instance, if I got a image (512x512 pixels) and I got for instance 140 characters. What would be the ideal FontSize? \nIn the above case, a 50 pixels Fontsize seems to be ok but what happened if there's a lot more text? the text will not fit into the picture so it needs reduction. I've been trying to calculate this on my own without success.\nWhat I've tried is this:\nget total pixels, with a picture 512x512 = 262144 and divide into the length of the text. But that gives a big number. Even if I divided that number by 4 (thinking about a box-pixel-model for the font).\nDo you have any solutions for this?\nPS. I've been using truetype (if this is somehow useful)\nI've been using python for this purpose, and PIL for image manipulation.\nThank you in advance.","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":376,"Q_Id":26319382,"Users Score":3,"Answer":"It's pretty tricky to do analytically.\nOne way is trial and error. Choose a large font size and render the layout to see whether it fits\nUse bisection algorithm to converge on the largest font that fits","Q_Score":0,"Tags":"python,fonts,truetype","A_Id":26319577,"CreationDate":"2014-10-11T21:22:00.000","Title":"Calculate fontsize","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a severe glitch after accidentally running an infinite loop in sublime text 3 with python.\nI was forced to kill the program (force quit) as it became unresponsive. I subsequently tried to reopen Sublime Text 3, however the application became stuck once more in what I can only assume to be an infinite loop, even though I did not build the file again.\nI am running Mac OS X version 10.9.5. I believe the problem may be with the fact that OS X reopens closed windows exactly to the state they were and this conflicts with IDEs, but even after unchecking the \"Close open windows\" option in System Preferences, ST3 remains broken. Any help? Because at this moment, ST3 is completely unusable for me.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":421,"Q_Id":26321861,"Users Score":1,"Answer":"You can try to edit the session file and start removing references to the offending code and see if that helps.\nOn a mac it should be found here:\n~\/Library\/Application Support\/Sublime Text 2\/Settings\/Session.sublime_session\nThis is just a guess, it might be in another file but it might point you in the right direction.","Q_Score":0,"Tags":"python,macos,sublimetext3","A_Id":26322148,"CreationDate":"2014-10-12T04:26:00.000","Title":"Sublime text 3 refuses to load after executing infinite loop in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was thinking of making a text-based game about detectives, case-solving, with complete freedom, loads of variables, etc. \nBut before I get serious with it I need to know how to make rooms. E.g. you start in the hall and you type in \"Go kitchen\" and you go to the kitchen. \nI have achieved this by using import file when you type in \"Go kitchen\"  (the file is the kitchen file), but if I want to go back and forth between them it gives an error. \nIs there something I am missing about this method? Is there a better way to do it? The simpler, the better, please.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":486,"Q_Id":26323942,"Users Score":3,"Answer":"Do not use import to implement application logic.\nIn your use case, a room is the classic example of an object in object-oriented programming. You should have a class Room which defines the functionality for rooms. Individual rooms are instances of that class (later you can add subclasses, but I would not worry about that initially).\nYour application will have a \"current room\" as a variable. It will ask the room about its description and display that to the user. When the user types \"go Kitchen\", your application will ask the current room \"hey, do you have a room named 'Kitchen' as a neighbor?\" This method will return the appropriate room object, which your application then can set as the current room.\nFrom the above, you can see two functionalities (methods) rooms should have: \"Give me your description\" and \"give me the adjacent room named 'X', if any\".\nThis should get you started.","Q_Score":0,"Tags":"python","A_Id":26324214,"CreationDate":"2014-10-12T10:03:00.000","Title":"How best to implement rooms for a text-based game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I have 2 processing units, one runs on Python and the other runs of C++. The first one will generate a set of data of around 3 - 5 values, either as a list of ints or a string. I want this value to be passed to C++, what is the best method? Like do I have to create a file in python then load it in C++? or there are an another way? This process would repeat every second\uff0c so I wish the transmission to be fast enough.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":76,"Q_Id":26379658,"Users Score":0,"Answer":"I'd suggest using python's struct to pack your values in python which could be viewed as a 'struct' in c++, then send it from python to c++ using zeromq.","Q_Score":0,"Tags":"python,c++","A_Id":26379890,"CreationDate":"2014-10-15T09:59:00.000","Title":"Transmitting data from Python to C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing long running program with simple GUI, the 99% of time I would like the program to work only as process, however sometimes I want to check the status, so is it possible to capture the keypress event in python?\nFor example I want to show the program window when I press Ctrl+Shift+Alt+Q, I expect to use app on Windows\nThank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":145,"Q_Id":26439428,"Users Score":0,"Answer":"There are tutorials on how to create a key-logger with Python. They should help. But I do not know if that is the right way to go. \nAlso you could register shortcuts under a key combination on Windows.\nYou should be aware that Ctrl+Shift+Alt are handled independent of the keyboard layout and Q changes with the language. \nWith pywin32 you should be able to do that using Ctrl+Shift+Alt+F1 for example.","Q_Score":0,"Tags":"python,keypress","A_Id":26440943,"CreationDate":"2014-10-18T11:49:00.000","Title":"Python 3, capturing key combinations","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have some python scripts which are doing image processing work using its own numpy and scipy libraries. How can I use\/call these scripts in Android application providing image input from camera captures and saving the images after processed. Is there some native support for Python like C++. What performance implications would be there if I compare with using C++ as a native support. Any help would be greatly appreciated.","AnswerCount":3,"Available Count":1,"Score":-0.1325487884,"is_accepted":false,"ViewCount":3179,"Q_Id":26480009,"Users Score":-2,"Answer":"You need a Python Interpreter to run Python scripts,Pydroid Gives you access to compile  Python scipts and comes with pip,So you could Install new Python Modules,it's the only app that gives a real Experience of Programming using python.","Q_Score":1,"Tags":"android,python","A_Id":44345713,"CreationDate":"2014-10-21T06:12:00.000","Title":"Using Python scripts in Android for image processing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I've been playing around with IDLE. Then the Lesson2 tells me to open the editor window, not the shell window. I'm not sure which is Editor? I have EDLE, Python Launcher (downloaded from python.org) and TextWranger...maybe I misunderstood about sth? :'(","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":26572932,"Users Score":0,"Answer":"IDLE combines several functionalities. It contains an interactive interpreter (the window where the >>> appears in, and in which you can bring code to execution immediately), and it's a small-scale IDE (integrated development environment), which means you can load, edit and save python-files, and launch them conveniently. This functionality is meant with \"Editor\". Probably just go to the Menu and pick something like \"New File\".","Q_Score":0,"Tags":"python-3.x","A_Id":26572955,"CreationDate":"2014-10-26T12:21:00.000","Title":"Python Launcher is Editor?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I have a QMessageBox that is not closable by the user. I want it to stay active until some work is done, and then close automatically.\nI tried MsgBox.close(), but it doesn't work. How do I close that MsgBox?\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3442,"Q_Id":26627776,"Users Score":5,"Answer":"Finally found an answer. Just used MsgBox.done(1) instead of close.\nThanks","Q_Score":2,"Tags":"python,pyqt,qmessagebox","A_Id":26627916,"CreationDate":"2014-10-29T10:20:00.000","Title":"PyQt close QMessageBox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project that I'm compiling with py2exe. After compiling, everything seems to be working fine except for the sound, which for some reason isn't playing anything except a single pop sound in place of the actual sound. \nI know that relative paths are working, since all my other files (images, data-files, etc) are being loaded without any problems relative to the location of the application, and I'm not getting any error messages in the console (I compile with it showing, rather than with just the Pygame window alone).\nThis is likely a path problem more than a Pygame problem, or possibly I'm missing a .dll but I don't know what the exact cause of this problem is.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":64,"Q_Id":26665058,"Users Score":1,"Answer":"Changing the sounds to .wav seemed to fix the problem. I tested many different other solutions, but this was the only one that seemed to actually work.","Q_Score":1,"Tags":"python,python-2.7,pygame","A_Id":26694657,"CreationDate":"2014-10-30T23:16:00.000","Title":"Why do sounds work with Pygame before compiling with py2exe, but not after?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a program that gets the users index position when they are typing in a Text Widget in Tkinter and saves it into a variable. But when ever the index is 1.20 it ends up turning into 1.2 Is there a way to make sure the variable with the index 1.20 in it will stay 1.20?\nI have tried using float(). But that did not seem to work.\nAny ideas?\nAnd thank you in advance.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":91,"Q_Id":26737396,"Users Score":2,"Answer":"The solution is simple: don't ever treat the index as a number, because it is not a number. It is a string that happens to look like a number. If you have code that is rounding the value (or truncating trailing zeros), somewhere you're treating it as a number.","Q_Score":0,"Tags":"python,variables,indexing,tkinter,text-widget","A_Id":26738506,"CreationDate":"2014-11-04T14:18:00.000","Title":"How to prevent a number from being rounded down Python Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Context:\nIn Python a main thread spawns a 2nd process (using multiprocessing module) and then launches a GUI (using PyQt4). At this point the main thread blocks until the GUI is closed. The 2nd process is always processing and ideally should emit signal(s) to specific slot(s) in the GUI in an asynchronous manner.\nQuestion:\nWhich approach\/tools are available in Python and PyQt4 to achieve that and how? Preferably in a soft-interrupt manner rather than polling.\nAbstractly speaking, the solution I can think of is a \"tool\/handler\" instantiated in the main thread that grabs the available slots from the GUI instance and connects with the grabbed signals from the 2nd process, assuming I provide this tool some information of what to expect or hard coded. This could be instantiated to a 3rd process\/thread.","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":11747,"Q_Id":26746379,"Users Score":1,"Answer":"I had the same problem in C++. From a QApplication, I spawn a Service object. The object creates the Gui Widget but it's not its parent (the parent is QApplication then). To control the GuiWidget from the service widget, I just use signals and slots as usual and it works as expected. \nNote: The thread of GuiWidget and the one of the service are different. The service is a subclass of QObject.\nIf you need multi process signal\/slot mechanism, then try to use Apache Thrift or use a Qt-monitoring process which spawns 2 QProcess objects.","Q_Score":20,"Tags":"python,pyqt,multiprocessing,signals,pyside","A_Id":30091826,"CreationDate":"2014-11-04T22:37:00.000","Title":"How to signal slots in a GUI from a different process?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Tkinter and I am using the text widget with the wrap set to WORD. Which wraps the word when it hits the end if you are still typing it. But when it does do this the row index stays 1 until you hit the enter key. When it should be 2 because it is the second row.\nDoes anyone know why it does this?\nOr\nHow to fix it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":226,"Q_Id":26763250,"Users Score":0,"Answer":"This is just how the tkinter text widget works. The index values are based on logical lines -- lines that end with a newline. Even though the line may wrap visually on the screen, the index won't switch from 1.x to 2.x until the first newline. \nNote that when computing an index relative to some other index, you have the option of counting lines by logical lines or display lines. For example, the relative index \"1.0 + 2 display lines\" may result in a different answer than \"1.0 + 2 lines\" depending on if the text is wrapped or not.","Q_Score":0,"Tags":"python,indexing,tkinter,text-widget","A_Id":26766737,"CreationDate":"2014-11-05T17:20:00.000","Title":"Python Tkinter text widget index acting weird","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a local directory full of geotiff files which make up a map of the UK. \nI'm using mapnik to render different images at various locations in the UK. \nI'm wondering what is the best way to approach this?\nI can create a single RasterSymbolizer then loop through the tiff directory and add each tiff as a seperate layer, then use mapniks zoom_to_box to render at the correct location.\nBut would this cause the rendering time to be unnecessarily slow? I have no information on how the tiles fit together (other than the data in each individual tiff of course).\nI imagine there may be a way to setup some kind of vector file defining the tiff layout so I can quickly query that to find out which tile I need to render for a given bounding box?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":636,"Q_Id":26801277,"Users Score":0,"Answer":"You can either generate a big tiff file from the original tiffs with gdal_merge.py (you can find it in the python-gdal package on Debian or Ubuntu) or create a virtual file that mixes them all with gdal_merge-vrt. This second option saves space but probably is slower.","Q_Score":0,"Tags":"python,mapnik,geotiff","A_Id":27091092,"CreationDate":"2014-11-07T12:29:00.000","Title":"mapnik and local tiff tiles","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"To achieve sense of nativeness in my Pyinstaller packaged Kivy Python application, I would like to create menu item in OSX menu bar. If using PyQt, I can easily achieve this. But as I am using Kivy, it seems like I have to resort to other ways.\nAny suggestion? I guess it will be in the range of PyObjc or AppleScript. Not sure though.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1781,"Q_Id":26815360,"Users Score":1,"Answer":"If using PyQt, I can easily achieve this. But as I am using Kivy, it\n  seems like I have to resort to other ways\n\nI don't see why you can't just use the PyQt method. Create a separate file that runs the icon that is called by your main Kivy app.\n Like PyQt I am sure that Kivy has an exit function that you could override and have it kill the icon thread on exiting the application. \nOnly potential downside (that I can think of off the top of my head) is that it might run slower than implementing in PyObjC.","Q_Score":3,"Tags":"python,macos,kivy,pyinstaller","A_Id":28491679,"CreationDate":"2014-11-08T08:45:00.000","Title":"How to create menu item in OSX Menubar using Pyinstaller packaged Kivy Python application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"guys,\nI am trying to find a python GUI library that can show and process 16bit greyscale image easily. I need to modify pixels. I have tried wxpython. It can show the images. But when I tried to convert a numpy array with single channel 16bit data to a string and loaded it in wxImage, it showed me that invalid buffer size. What's more, I have tried to decode the first element of data string in a wxImage instance that load the same image directly. Its value wasn't equal to the pixel (0,0) in numpy array. \nCould someone tell me how wxPython format its data string or introduce a better GUI library that can fix this? I know wxImage normally formats its pixel data with RGB. But I just need grey image. And I need to create a sophisticated UI. I think opencv can't meet my need.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":377,"Q_Id":26831593,"Users Score":0,"Answer":"You can use pyqt or pyside, but I would recommend pyqtgraph which is excellent for this sort of thing. You can build your ui in pyside and use pyqtgraph to manage image output","Q_Score":0,"Tags":"python,numpy,wxpython","A_Id":26832062,"CreationDate":"2014-11-09T18:20:00.000","Title":"Python GUI library to show 16bit greyscale image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am getting the following \"error: only position independent executables (PIE) are supported.\" when trying to run scripts.\nDoes QPython run on Android 5.0? Is it an issue with the 64bit version of Lollipop?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":493,"Q_Id":26869746,"Users Score":0,"Answer":"I think QPython doesn't support  PIE yet.","Q_Score":1,"Tags":"android-5.0-lollipop,qpython","A_Id":26902933,"CreationDate":"2014-11-11T16:32:00.000","Title":"QPython on Nexus 9: PIE error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When discovering Sublime 3 plugin API I found out the function show_quick_panel() that shows some panel implemented as view. Is there any method to construct a custom view by my own and then add it to the window?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":61,"Q_Id":26891117,"Users Score":1,"Answer":"No  , one of the biggest limitation of Sublime Text right now is the ability to create a custom interface or packages\/plugins - you have to use the quickPanel list or an input at the bottom of the screen.","Q_Score":1,"Tags":"python,plugins,window,sublimetext","A_Id":26892999,"CreationDate":"2014-11-12T15:53:00.000","Title":"sublime add view to the window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Even after calling sdl2.mouse.SDL_ShowCursor(0), which effectively hides the cursor during runtime, when doing lengthy iterations (for my purposes, loading a large volume of images into RAM), the beachball cursor nonetheless appears.\nIt is critical that this doesn't happen because what I'm writing is an experiment for coginitive psychology on visual attention\u2014this kind of visual distraction absolutely cannot occur.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":90,"Q_Id":26894623,"Users Score":0,"Answer":"Solved this myself by calling sdl2.SDL_PumpEvents() once per loop.","Q_Score":0,"Tags":"python,sdl,sdl-2,pysdl2","A_Id":28871678,"CreationDate":"2014-11-12T19:07:00.000","Title":"Pysdl2 on OSX How to prevent beachball cursor during long iteration loops","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to game development and am trying to develop a game with panda3d. Can we directly use  Pygame modules along with Panda3d ones?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1355,"Q_Id":26906023,"Users Score":0,"Answer":"Yes.  Both Panda3D and PyGame are Python modules that can be used in any (compatible) Python installation.  There is (at least to my awareness) nothing about either library that prevents you from importing other Python modules.\nDepending on what you're trying to do, though, the answer may be more tricky.  For instance, presumably both PyGame and Panda3D have their own main game loops, and using them together would require making one game loop run as a part of the other library's game loop.\nSharing resources or graphics contexts would also be tricky, as both libraries manage their own graphics state.  It would be a lot more tricky (but not necessarily impossible) if your question included, for example, drawing PyGame elements into a Panda3D window or vice versa.","Q_Score":0,"Tags":"python,pygame,panda3d","A_Id":26997383,"CreationDate":"2014-11-13T09:59:00.000","Title":"How to use Panda3d and Pygame together","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a kivy app that uses a kv file, main.py, and a py class that handles the database. Everything works fine in windows.  When I run linux (ubuntu) I get a black window with the correct title, but there are no widgets in the window.\nWhat do I need to do different to run a kivy app, that was put together and runs windows, in Ubuntu? I am using the most current available version of kivy on both systems.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":268,"Q_Id":26942909,"Users Score":3,"Answer":"It sounds like your kv file isn't being loaded. Does it have the correct name, and is in the right directory? You can check the output in the terminal to see whether the file is loaded.\nEdit: One possibility is case sensitivity - windows is not case sensitive, linux generally is. Make sure the kv filename is all lowercase.","Q_Score":1,"Tags":"python,ubuntu,kivy","A_Id":26946523,"CreationDate":"2014-11-15T05:33:00.000","Title":"Kivy app works on Windows 7 but not on ubuntu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have some code that is running in the python console reading out text lines. \nIs it possible to feed the output of the python console to my Unity3D game script so that it can trigger some actions in my game?\nin other words:\npython console running in the background outputs commands that need to feed to my Unity game.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1040,"Q_Id":27006173,"Users Score":1,"Answer":"An efficient solution would be to use TCP sockets in both the Python script and the Unity-side script. Since the Python-side is serving the data, then designate it as the server socket and make the socket on the Unity-side the client. This solution will be much faster than writing and reading to a shared file.","Q_Score":0,"Tags":"python,unity3d,unityscript","A_Id":27021007,"CreationDate":"2014-11-18T23:29:00.000","Title":"Feed Python output to Unity3D","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently using Cheetah Templates with my python code and I'm passing in a number of floating point numbers. I'd like to truncate these floats to only two decimal places within the template, e.g. 0.2153406 would become 0.21\nIs it possible to do this within the Cheetah template of do I have to pass in already truncated strings?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":525,"Q_Id":27009879,"Users Score":3,"Answer":"I just discovered a solution via output from complex expressions using #echo:\n\n#echo '%.2f' % $my_float_var#\n\nThis prints out my float in the variable $my_float_var with only two decimal places.","Q_Score":1,"Tags":"python,templates,cheetah","A_Id":27010118,"CreationDate":"2014-11-19T05:49:00.000","Title":"How do I truncate floats to two decimal places in cheetah templates?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Have to make a program that given the option to input square or circle, user inputs width and a center x,y coordinate. \nWhat I don't understand is how to write code for if there are two shapes on a plane and how to identify if one is inside the other\nI'm super helpless, and have no background in computer science. Thank you!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":420,"Q_Id":27033206,"Users Score":0,"Answer":"You have to address Circle in Circle, Circle in Square, Square in Circle, and Square in Square.  I suggest drawing some pictures with the centers marked, and observe their relationships.\nCircle in Circle: the distance between the centers has to be less than the difference in radius's.   \nCircle in Square: Same as circle in circle I think\nSquare in Circle: The radius of the circle must be larger than the distance from the center of the square to a corner PLUS the distance between centers\nSquare in Square: you got this! solve yourself ;)","Q_Score":0,"Tags":"python","A_Id":27036097,"CreationDate":"2014-11-20T06:31:00.000","Title":"Python Shapes on grid","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to embed wxPython in a wxWidgets application and I get the following error:\n..\/src\/common\/object.cpp(251): assert \"classTable->Get(m_className) == NULL\" failed in Register(): Class \"wxCommandEvent\" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?\nI've traced this up to:\nwxPyCoreAPIPtr = (wxPyCoreAPI*)PyCObject_Import(\"wx.core\", \"_wxPyCoreAPI\");\nSo I'm guessing that this is failing because its trying to dlopen a .so that has already been loaded (the core wxwidgets library that is needed both by C and Python code). I can get the handle to the opened .so via dlopen's RTLD_NOLOAD flag.\nIs there any way to give that handle to Python and tell it to \"load\" that handle into the interpreter's context?\nEdit: just noticed, this problem is reproducible in the \"embedded\" sample in wxPython, using wxWidgets origin\/WX_3_0_BRANCH, Python 2.7, wxPython origin\/master.\nAlso, it may be specific to gtk3 configurations... it seemed to be working when I compiled with gtk2.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":280,"Q_Id":27112799,"Users Score":0,"Answer":"The problem is that wxPython is compiled with gtk2 flag, wxWidgets gtk3.\nYou can determine this in gdb by dumping one of the symbols near the assertion:\ninfo symbol __static_initialization_and_destruction_0\n__static_initialization_and_destruction_0(int, int) in section .text of \/usr\/lib\/libwx_gtk2u_core-3.0.so.0\nTo rebuild wxPython, you need to manually move the build directory somewhere else (or the reinstall will seem to work but in fact won't rebuild anything).\nthen use: python setup.py build_ext WXPORT=gtk3\nYou should see that .so files are being build against gtk3:\nc++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build\/temp.linux-x86_64-2.7\/src\/gtk\/wizard_wrap.o -L\/usr\/X11R6\/lib -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 -o build\/lib.linux-x86_64-2.7\/wx\/_wizard.so -pthread\n(note the wx_gtk3u_xxx files, vs: wx_gtk2u_xxx)\nthen:\npython setup.py install WXPORT=gtk3\nworks!","Q_Score":0,"Tags":"python,wxpython,wxwidgets,embedding,dlopen","A_Id":27114219,"CreationDate":"2014-11-24T19:38:00.000","Title":"Embedding Python -- loading already loaded module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to use the PyDEV console in eclipse for a demonstration of some Python code. For this demonstration I need to resize the default font size used in the PyDev console window.\nSome googling led me to change the  'General\/Appearance\/Colors and Fonts\/Debug\/Console Font', but that didn't work. I tried changing all candidates I could identify in the Colors and Font settings, but none of them influences the font size in the PyDev console window.\nIs there any way to achieve this?\nThis is in eclipse 4.3.2 (kepler) with Pydev 3.8","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2839,"Q_Id":27122732,"Users Score":1,"Answer":"Solution:\nHelp > Preferences > General > Appearance > Colors And Fonts > Structed Text Editors > Edit","Q_Score":1,"Tags":"python,eclipse,fonts","A_Id":55985898,"CreationDate":"2014-11-25T09:18:00.000","Title":"How to change the console font size in Eclipse-PyDev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have a random problem with Orange. I developed a widget and I have a button who opens a new window for some settings. The program works fine, but, at a some point, totally randomly, pythonw.exe stops working. It's only when I use the window for settings. The problem happens totally randomly, but more often when I open the window. I tried to make my window with OWW.OWBaseWidget, OWW.OWWidget and OWW.QDialog. I tried too with pythonw.exe and python.exe. I did the same thing that Set Colors of the widget Data Table in Data. But this one crashed too after a moment.\nSo where is the problem? Orange? Python? Anything else? I have no error message.\nI have Windows 8.1, python 2.7 and Orange 2.7.8.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":632,"Q_Id":27125275,"Users Score":0,"Answer":"Is this helpful? I am on a french version of windows:\nDescription\nChemin d\u2019acc\u00e8s de l\u2019application d\u00e9faillante :   C:\\Python27\\pythonw.exe\nSignature du probl\u00e8me\nNom d\u2019\u00e9v\u00e9nement du probl\u00e8me\u00a0:   APPCRASH\nNom de l\u2019application:   pythonw.exe\nVersion de l\u2019application:   0.0.0.0\nHorodatage de l\u2019application:    4df4b9cc\nNom du module par d\u00e9faut:   QtCore4.dll\nVersion du module par d\u00e9faut:   4.7.0.0\nHorodateur du module par d\u00e9faut:    4cbe7403\nCode de l\u2019exception:    c0000005\nD\u00e9calage de l\u2019exception:    000c7f03\nVersion du syst\u00e8me: 6.3.9600.2.0.0.768.101\nIdentificateur de param\u00e8tres r\u00e9gionaux: 4108\nInformation suppl\u00e9mentaire n\u00b0\u00a01:    5861\nInformation suppl\u00e9mentaire n\u00b0\u00a02:    5861822e1919d7c014bbb064c64908b2\nInformation suppl\u00e9mentaire n\u00b0\u00a03:    84a0\nInformation suppl\u00e9mentaire n\u00b0\u00a04:    84a09ea102a12ee665c500221db8c9d6\nInformations compl\u00e9mentaires sur le probl\u00e8me\nID de compartiment\u00a0:    3a2b179ef07f0847bf9f72213260bff5 (-1296411611)","Q_Score":0,"Tags":"python,orange","A_Id":27127480,"CreationDate":"2014-11-25T11:20:00.000","Title":"Orange Canvas: pythonw.exe has stopped working crashing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to change the interface of a written application. this application is written in python and GTK . I don't want to change the codes manually by myself but although  I need an interface designer so I can import this application to it and the graphically  apply my intended changes to it . I tried Glade and QTdesigner but they produce .ui file and I couldn't find a tool to convert back a .ui file to python code. plus that the don't open python files directly and didn't have import options. \nany solution will be appreciated. \nthanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":285,"Q_Id":27127430,"Users Score":0,"Answer":"It really depends on the application.\nIf the application uses *.glade or *.ui files you can - depending on how well it is designed re-arrange certain elements and swap out container types.\nIf there are no such files, you are out of luck. Then the ui is \"hard\"-coded (as hard as python code can get..) and you have to modify the widget hirarchy by modifying python code yourself.\nThere is no such editor being able to extract a layout\/ui file from code itself.\n\ngtkinspector or formerly known as gtkparasite can modify properties of widgets on the fly but nothing that really modifies the python code of the running application. They sneak around the application code and modify the widget tree from back behind through means of the gtk module lib interface (correct me if I am wrong here, not totally sure).","Q_Score":0,"Tags":"python,gtk","A_Id":27137234,"CreationDate":"2014-11-25T12:58:00.000","Title":"load an already written GTK python codes into a GUI designer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to change the interface of a written application. this application is written in python and GTK . I don't want to change the codes manually by myself but although  I need an interface designer so I can import this application to it and the graphically  apply my intended changes to it . I tried Glade and QTdesigner but they produce .ui file and I couldn't find a tool to convert back a .ui file to python code. plus that the don't open python files directly and didn't have import options. \nany solution will be appreciated. \nthanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":285,"Q_Id":27127430,"Users Score":0,"Answer":"You can't. Glade had code generation features removed years ago, because that leads to unmaintainable code when it's patched by hand after generation, to add the program's internal logic. So either you:\n\nuse Glade to generate a ui file, and have to change the python code anyway to use it\nor you'll have manually write some code to change the user interface\n\nIn either way, you'll have some code to write. If you have lots of changes in the user interface, then convert your program to use Glade ui files. It will take some time, but changes will be easier afterwards. If you only have a couple of changes to do, just do them in the code, it will be faster to do.","Q_Score":0,"Tags":"python,gtk","A_Id":27154752,"CreationDate":"2014-11-25T12:58:00.000","Title":"load an already written GTK python codes into a GUI designer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to generate a uniformly random coordinate that is inside a convex bounding box defined by its (at least) 4 vertices (for the case of a tetrahedron).\nCan someone suggest an algorithm that I can use?\nThanks!\n\nIf a point is generated in a bounding box, how do you detect whether or not it is outside the geometry but inside the box?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1463,"Q_Id":27192467,"Users Score":3,"Answer":"There's a lot that's unspecified in your question, such as what distribution you want to use. For the sake of this answer, I'll assume a uniform distribution.\nThe straightforward way to handle an arbitrary volume uniform distribution is to choose three uniformly random numbers as coordinates in the range of the bounding rectilinear solid enclosing your volume, then check to see if the chosen coordinate lies within the volume. If the coordinate is not within the volume, discard it and generate a new one.\nIf this is not sufficient, due to its non-constant performance or whatever other reason, you'll need to constrain your problem (say, to only tetrahedra) and do a bunch of calculus to compute the necessary random distributions and model the dependencies between the axes.\nFor example, you could start with the x axis and integrate the area of the intersecting shapes between the volume and the plane where x = t. This will give you a function p(x) which, when normalized, is the probability density function along the X axis. (If you want nonuniform distribution, you need to put that in the integrated function, too.)\nThen you need to do another set of integrals to determine p(y|x0), the probability distribution function on the Y axis given the chosen x coordinate. Finally, you'll need to determine p(z|x0,y0), the probability distribution function on the z axis.\nOnce you have all this, you need to use whatever random number algorithm you have to choose random numbers in these distributions: first choose x0 from p(x), then use that to choose y0 from p(y|x0), then use those to choose z0 from p(z|x0,y0), and you'll have your result (x0, y0, z0).\n\nThere are various algorithms to determine if a point is outside a volume, but a simple one could be:\n\nFor each polygon face:\n\nCompute its characteristic planes.\n\nUse cross product to compute plane normals.\nOne vertex of the face and the plane normal are sufficient to define the plane.\nRemember the right-hand rule and choose the points so that the plane normal consistently points into or out of the polyhedron.\n\nCheck that the random point lies on the \"inside\" half-space of that plane.\n\nA half-space is the set of all points on one side of the plane.\nCompute the vector from the plane vertex to the random point.\nCompute the dot product between the plane normal and this vector.\n\n\nIf you defined the plane normals to point out of the polyhedron, then all dot products must be negative.\nIf you defined the plane normals to point into the polyhedron, then all dot products must be positive.\n\nNote that you only have to recompute characteristic planes when the volume moves, not for each random point.\nThere are probably much better algorithms out there, and their discussion is outside the scope of this question and answer. This algorithm is what I could come up with with no research, and is probably as good as a bubble sort.","Q_Score":0,"Tags":"python,random,spatial,coordinate","A_Id":27192613,"CreationDate":"2014-11-28T16:11:00.000","Title":"Generate a random point in space (x, y, z) with a boundary","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"With QPython on Kindle fire .. I use QEdit to write & save a .py file .. say bob.py ..\nBut when I switch to Console, I can't IMPORT from bob ..\nCan someone tell me how to do this?\nJohn (new to QPython)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1136,"Q_Id":27193835,"Users Score":0,"Answer":"The comment from Yulia V got me thinking, maybe I just needed to append the location of \"Scripts\" to the sys.path,  and Yep, that worked fine!!\nThanks Yulia!","Q_Score":0,"Tags":"qpython","A_Id":27197253,"CreationDate":"2014-11-28T17:56:00.000","Title":"How to import from saved QPython file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"With QPython on Kindle fire .. I use QEdit to write & save a .py file .. say bob.py ..\nBut when I switch to Console, I can't IMPORT from bob ..\nCan someone tell me how to do this?\nJohn (new to QPython)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1136,"Q_Id":27193835,"Users Score":0,"Answer":"I think you can save the module file into the same directory which you script locates or  \/sdcard\/com.hipipal.qpyplus\/lib\/python2.7\/site-packages\/","Q_Score":0,"Tags":"qpython","A_Id":27209867,"CreationDate":"2014-11-28T17:56:00.000","Title":"How to import from saved QPython file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to implement syntax highlighting for text in a Text widget. \nI use an external library to lexically analyse the text and give me the tokenised text. After that I go over all the words in the text and apply tag to their position in the text widget so that I can style each word. \nMy concern now is how do I deal with changes. Every time the user presses a key, do I tokenise the entire text again and add style tags to the text widget for the entire text. This is proving to be quite slow. \nI then transitioned to only doing the highlighting process for the line the insert character was to make it faster but this is giving faulty results and the highlighting is not perfect now. \nWhat would be an ideal compromise between fast and perfect? What is the best way to do this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":228,"Q_Id":27207643,"Users Score":1,"Answer":"One possible answer is to do something like Idle does.  As a user hits each key, its custom incremental parser tags identifiers that are a keyword, builtin, or def\/class name*.  It also tags delimited char sequences that are a string or comment. I does what can be done quickly enough.\nFor example, if one types printer not in a string or comment, Idle checks if the word is a keyword or builtin name after each key.  After t is hit, print is tagged.  After e (or any other identifier char) is entered, printe is untagged. \nI believe some of the code is in idlelib\/Hyperparser.py and some in ColorDelegator.py.  You are free to copy and adapt code, but please do not use it directly, as the API may change.  I presume the parser does the minimum needed according to the current state (after def\/class, in an identifier, comment, string, etc.)\nIdle has an re-based function to retag the entire file.  I 'think' this is separate from the incremental colorizer, but I have not read all the relevant code. If one edits a long enough file, such as idlelib\/EditorWindow.py (about 3000 lines), and changes font size, Idle retags the file (I am not sure why).  There is a noticeable delay between the file turning all black and its being recolorized.  You definitely would not want that delay with each keystroke.\n\nClass\/functions names with non-ascii chars are not yet properly recognized in 3.x, but should be.  The patch is stuck on deciding the faster accurate method. Recognizing an ascii-only (2.x) indentifier is trivial by comparison.\n\nPS  I am correctly in guessing that you are interested in tagging something other than Python code?","Q_Score":0,"Tags":"python,performance,tkinter,syntax-highlighting,lexical-analysis","A_Id":27210959,"CreationDate":"2014-11-29T22:02:00.000","Title":"Efficiently applying text widget tags in tkinter text widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to debug separate pieces of my application in Visual Studio 2012.\nI have C# executable which works with Oracle.DataAccess dll. It works fine.\nWithin it IronPython runtime is invoked and it works fine too.\nWithin these IronPython modules object from main C# application is invoked and it works fine with Oracle dll.\nIf IronPython script is invoked standalone then it works fine and uses C# object fine as well. \nHowever in this case C# object doesn't see Oracle dll.\nTo debug IronPython scripts I have to create separate Python solution so I cannot configure my C# solution. So I do not have control of C# references. GAC has right Oracle dll but how to tell C# dll to use it?\nVise versa if I'm in C# solution where I can manage the references then I cannot add py files and debug them.\nIn what way can I configure VS to be able to run\/debug my application with dual entry C# or IronPython separately?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":390,"Q_Id":27208926,"Users Score":1,"Answer":"You can try replicating what \"works for me\". Create a solution containing:\n\npython project (ironpython)\nC# project\n\nAdd a reference to desired oracle library (Oracle.DataAccess.dll) to C# project using the standard VS mechanism. C# project should also contains a post build step to copy the resulting dll and pdb into the place where python script can find it. In my case root of the python project.\nYour python project is selected as Startup Project.\nI use Ctrl-F5 and F5 to start it. In both cases things work as expected.\nIn debug mode I am able to set and hit breakpoint in python and in referenced C# module. I can see the oracle library being loaded (Output window of debugger).\nHowever:\n\nThe stack traces are C# only.\nVisual Studio 2013 Update 4 together with PTVS 2.1 crashes on occasions when debugging.","Q_Score":0,"Tags":"c#,.net,dll,ironpython","A_Id":27233826,"CreationDate":"2014-11-30T01:01:00.000","Title":"DLL loading (C#\/IronPython\/C#) in VS2012","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I don't find how to force the window size with the kivy language. (ex: 800x600p)\nCan you help me ?\nThanks for reading.\nPITO2901","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1505,"Q_Id":27234386,"Users Score":2,"Answer":"Set kivy.core.window.Window.size to (800, 600).\nYou can't set it directly in kv, but you could bind it to a button or similar. You would also need to import the Window to kv, using the #:import statement explained in the doc.","Q_Score":1,"Tags":"python,kivy","A_Id":27235194,"CreationDate":"2014-12-01T18:02:00.000","Title":"Force Window Size Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QGraphicsView in a QTabWidget with its tabs on the left. I want to move the location of the vertical scrollbar of my QGraphicsView to the left side, directly underneath the tabs. Is this possible?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":476,"Q_Id":27243455,"Users Score":0,"Answer":"I found I can do this by creating separate QTabBar and QScrollBar widgets that are attached to a QTabWidget and QAbstractScrollArea (I'm using a QListWidget now but I'm sure it'll work for QGraphicsView too) and then putting those widgets in a QVBoxLayout, and then putting the QVBoxLayout next to the QTabWidget\/QAbstractScrollArea via a QHBoxLayout.","Q_Score":0,"Tags":"python,layout,pyqt,scrollbar","A_Id":30058134,"CreationDate":"2014-12-02T06:48:00.000","Title":"PyQt move vertical scrollbar location in QGraphicsView","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to add a feature where a user can record a video of the game that they're playing. How do I do this?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":2016,"Q_Id":27264051,"Users Score":2,"Answer":"I have not implemented the solution to this particular problem personally, but I will try to suggest one. Of course any of the solutions will slow down your programm cardinally, but technically it is possible. So what is probably worth trying, that you could use pygame.image.tostring() on you current frame, then just write (append) every frame to a file. So that will be actually your video in a raw format. Now if you want some particular video format, you should just convert it, best way is to use ffmpeg (you can call it before game exit with certain parameters from your game with subprocess.Popen(\"ffmpeg ...\")). The only problem here is that the user, who want to record in such a way, must have ffmpeg installed in the system, so that ffmpeg is callable from the shell commandline. Advantage of this approach - it should be quite fast and does not use much extra memory, since you encode only once (for example when the user stops recording or exits the game) from the binary stream. \n\nEdit: that is just a broad description, of course you should find out also the wright parameters for ffmpeg, such as frame count, size and so on, and of course delete the raw data, since it can be really big file.","Q_Score":7,"Tags":"python,python-3.x,tkinter,pygame","A_Id":27306611,"CreationDate":"2014-12-03T05:06:00.000","Title":"How do you record a \"game\" (PyGame or Tk) into a video?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know this is possible to do using additional libraries such as win32com or python-pptx, but I wasn wondering if anyone knew of a way to insert an image into a powerpoint slide using the standard libraries. Lots of googling has indicated that the best solution is probably win32com, but since I can guarantee that every system this script will be deployed to will have win32com, I am looking for an implemention leveraging libraries all systems with a standard python 2.7 install will have.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":507,"Q_Id":27297668,"Users Score":0,"Answer":"It is probably possible to modify a .pptx file with the standard library without much effort: these new generation of files are meant to be zip-compressed XML + external images files, and can be handled by ziplib and standard xml parsers.\nLegacy .ppt files however are a binary closed format, with little documentation, and hundrededs of corner cases. It would alwasys \"be possible\"  to change them, since they are still just bytes, but it would take considerable effort.\nThat said, starting with Python 3.4, the Python installer \"PIP\" comes default with the language install: probably the best way to go would be to script the installation of external libraries based on the built-in PIP - that way one would not have to all external library usage.","Q_Score":0,"Tags":"python,powerpoint","A_Id":27297868,"CreationDate":"2014-12-04T15:24:00.000","Title":"Insert Image into PPT using Standard Libraries","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am binding to ListBoxSelect and i want to implement a function which recognizes an alphabetical key-press and uses this to jump to the corresponding place in an alphabetically sorted list.\nIs there a way to tell what type of event is flagged by ListBoxSelect? I see something in the documentation about getting event \"keysym\" but i dont know how to access this.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":27304973,"Users Score":0,"Answer":"No, there isn't a way to tell what type of event is flagged by <<ListboxSelect>>. Using <<ListboxSelect>> is useless for binding to a letter key, however. It only will fire for mouse clicks and using the arrow keys to navigate the listbox. \nYou can bind to <KeyPress>. That binding will tell you what key was pressed, and in that binding you can change the widget's selection. You can get that information from event.keysym","Q_Score":0,"Tags":"python,tkinter","A_Id":27305312,"CreationDate":"2014-12-04T22:01:00.000","Title":"How to determine the type of event flagged by <> in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to move the coordinates on a tkinter canvas so that the bottom left corner is (0, 0), meaning that the top right corner is (height, width).\nHow would I do this?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":85,"Q_Id":27323228,"Users Score":0,"Answer":"You can't. You'll have to do math on all of your coordinates to translate them from one coordinate system to another.","Q_Score":0,"Tags":"python,python-2.7,tkinter,tkinter-canvas","A_Id":27324242,"CreationDate":"2014-12-05T19:25:00.000","Title":"Move base coordinates Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to move the coordinates on a tkinter canvas so that the bottom left corner is (0, 0), meaning that the top right corner is (height, width).\nHow would I do this?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":85,"Q_Id":27323228,"Users Score":0,"Answer":"Simplest way is to write a function that inverts your vertical coordinate, given the canvas height and desired element height passed in.","Q_Score":0,"Tags":"python,python-2.7,tkinter,tkinter-canvas","A_Id":27323269,"CreationDate":"2014-12-05T19:25:00.000","Title":"Move base coordinates Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I'm trying to figure out how to make a bullet class move from character to mouse click and if it hits a monster it will do damage to a monster. I've figured out how to calculate the mouse position and character position. It has been a while since ive been in a math class.\ni'm using pygame, python 3.4","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":276,"Q_Id":27332961,"Users Score":0,"Answer":"A possible solution could be to find the slope of the line between the point of origin(where you are shooting the bullet from) and the location of the mouse click. If you are storing the bullet's x and y values you can then use the slope to change those values every clock tick depending on the speed of the bullet or however you've got it working.\nEx. If the slope of the line is 2\/5, every tick you change the bullet's y by 2 and the bullet's x by 5.\nI think this may work, or at least may be close to what you are looking for.","Q_Score":0,"Tags":"python,pygame,mouse","A_Id":28238371,"CreationDate":"2014-12-06T15:01:00.000","Title":"Python, Shooting from Character Position to Mouse position on Mouseclick","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a tool that creates installers from the source code of a Kivy game for all the different supported platforms with a single button press?\n\nLinux: .deb, .rpm or just a portable .zip file that contains a .sh script\nWindows: .exe (installer or portable executable)\nMac: .app (installer or portable executable)\nand possibly Android and iOS\n\nIf not, is it possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":464,"Q_Id":27347356,"Users Score":2,"Answer":"All are possible, but I'm not sure what people are recommending right now - the Kivy website has instructions for pyinstaller (specifically on windows as I remember, but it works well on other platforms too), with the disadvantage that pyinstaller only supports python2 right now. You can use other tools too, I've seen some activity with e.g. nuitka, but I don't know the current state. Your best bet may be to ask on the kivy mailing list or irc, where some of the people using these tools are most likely to be around to comment.\nI haven't seen anyone do .deb or .rpm. I'm fairly sure it shouldn't be too hard, though you'd need to do some stuff yourself to make it work since you'd quite likely be forging new ground.\nAndroid and iOS are covered only by kivy's own build tools. These are fine on android, I can't comment on iOS.","Q_Score":3,"Tags":"python,python-3.x,packaging,kivy","A_Id":27349249,"CreationDate":"2014-12-07T20:20:00.000","Title":"Creating installers or executables on Linux for every supported platform for a Kivy game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I made a Python game using Pygame. I try to make it so when it starts, it loads the shell, and entering a raw input would display the pygame window and start the game so that I can make the game playable without having to close the shell. It works, however, the window starts minimized. The game is a simple \"dodge the object\" and has no pause what so ever. The game still runs in the background, possibly having the player hit multiple projectiles before the user realizes it. Is there a way to focus on the window?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2019,"Q_Id":27351387,"Users Score":0,"Answer":"As I understood you, you don't want the game to start, before the window is in fullscreen-mode, right?\nWhen I try you attempt (starting through rawinput), my display is fullscreen from the start. Have you set everything correctly?\nI suggest that you stop the game until there is an actual key-input (whatever controls you have set). Like this the player has the time to arrange everything to his liking before starting the game. Because, even if you figure out how to analyse the focus-issue: When the game starts, the window HAS focus, therefore this approach wouldn't work anyway.","Q_Score":2,"Tags":"python,window,pygame","A_Id":27357511,"CreationDate":"2014-12-08T04:22:00.000","Title":"How to focus on a window with pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In my app I need to know how big the canvas is in pixels.\nInstead calling canvas.size returns [100,100] no matter how many pixels the canvas is wide.\nCan you please tell me a way to get how many pixels the canvas is wide and high?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5156,"Q_Id":27358870,"Users Score":3,"Answer":"There is no position nor size in a Canvas. Canvas act just as a container for graphics instructions, like Fbo that draw within a Texture, so it have a size.\nIn Kivy, Canvas.size doesn't exists, but i guess you called your widget a canvas. By default, a Widget size is 100, 100. If you put it into a layout, the size will be changed, when the layout will known its own size. Mean, you need to listen to the changes of the Widget.size, or use a size you known, like Window.size.","Q_Score":2,"Tags":"python,kivy","A_Id":27380669,"CreationDate":"2014-12-08T13:15:00.000","Title":"Size of canvas in kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to send some data from a Python program to a C++ program. The current design is such that the C++ program executes the python program in a separate thread. I wish to pass some result from the python program back to the C++ program.\nWhat I have found so far includes:\n\nSending over sockets\nSending via a pipe\nUsing a temporary file\nEmbedding the python interpreter in the C++ program\nUsing boost.python\n\nMy data (to be passed back to the C++ program) is essentially a python dictionary, and a few files. (I am sending email details, and the attachments). What strategy should I use?\nIs there anything I can do to make my work easier? Or can I improve my program design?\nEDIT: Added boost.python to the list of options found.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":622,"Q_Id":27384091,"Users Score":0,"Answer":"I ended up altering the the modules such that the C++ part and the Python part can work more or less independently of each other. But if passing data was necessary, I guess I would have gone via the socket route.","Q_Score":0,"Tags":"python,c++,c,sockets","A_Id":27401759,"CreationDate":"2014-12-09T16:37:00.000","Title":"Strategies to send data from a Python program to a C++ program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a project that uses COM and 'Python' scripting. Earlier we were using 'ComTypes' now we use Win32Com. To keep backward compatibility I need to change name of some of the interfaces. So here is what I do \n1) Use the 'makepy' utility to create a python file from my .tlb file, this creates a .py file at ..\\Lib\\site-packages\\win32com\\gen_py folder\n2) I change the name of the interface that I am interested in changing in the created python file.\n3) When I load my application a corresponding .pyc file gets created and everything works fine.\nNow I don't want to repeat this exercise on every machine where my software is deployed. So through the installer I copy the .py and .pyc files to ..\\Lib\\site-packages\\win32com\\gen_py\nBut when my application is launched it does not recognize the changed interface. Behaves as if there is no .py or .pyc file. All other interfaces work, but the changed name one does not work. It dynamically seem to create compiled python behind the scene, ignoring the .pyc file. \nIf I delete the .dat file and .pyc file at those locations, it does create the .pyc file again when the application is launched. However its not utilized, because my changed interface does not work.\nIf I use the steps 1,2 and 3 everything works again !! I am puzzled. \nPlease help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":190,"Q_Id":27385373,"Users Score":0,"Answer":"OK. I found out what is the problem. When you create a python file using makepy tool it updates the dicts.dat file in gen_py directory. So you need to copy over that file as well to other machines.","Q_Score":0,"Tags":"python,win32com,typelib","A_Id":27413739,"CreationDate":"2014-12-09T17:44:00.000","Title":"python .pyc file with win32com","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"On scrollable tkinter objects in Python, when you call .yview(), it returns their current 'position'. I can't make heads or tails of what it returns, though. For example, when scrolled to the beginning of one of my elements, it returns (0.0, 0.4662309368191721), and when at the end, (0.5337690631808278, 1.0).\nWhat do these numbers mean? Why are there two of them? It seems to me like it'd make more sense if there was only a single number, from 0(beginning) to 1(end).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":267,"Q_Id":27413547,"Users Score":1,"Answer":"The two numbers represent the fractional part of the data that is visible. A value of 0 (zero) means you are at the top (or left, in the case of xview), and a value of 1 (one) means bottom (or right). So, for example, if the very middle of the document were at the top of the screen, the first number would be .5. If a document that is three times as long as the screen was perfectly centered, the numbers would be something like (.333,.666) meaning the top one third is scrolled off of the screen, and the bottom one third is scrolled off the screen.","Q_Score":0,"Tags":"python,scroll,tkinter","A_Id":27414982,"CreationDate":"2014-12-11T00:46:00.000","Title":"What do the values in obj.yview() mean?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"while developing qpython scripts, it would be much easier to develop them on a pc and only transfer them to the android device for testing.\nWhat is the easiest way to do such a transfer? (Development might require to do this very frequently)\nThanks in advance for all your feedback.\ntfv","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1287,"Q_Id":27438448,"Users Score":0,"Answer":"QPy for android has built in FTP. Just enter the local address it provides into an ftp program (like bareftp for ubuntu)","Q_Score":1,"Tags":"qpython","A_Id":42170785,"CreationDate":"2014-12-12T06:57:00.000","Title":"How to easily transfer qpython scripts from windows to android for development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"while developing qpython scripts, it would be much easier to develop them on a pc and only transfer them to the android device for testing.\nWhat is the easiest way to do such a transfer? (Development might require to do this very frequently)\nThanks in advance for all your feedback.\ntfv","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":1287,"Q_Id":27438448,"Users Score":1,"Answer":"In linux with ADB installed, in terminal you can use \nadb push pcprojectfolder \/sdcard\/com.hipipal.qpyplus\/projects\/androidprojectfolder\nYou do need to manually end the task on the phone before pushing though.","Q_Score":1,"Tags":"qpython","A_Id":29536167,"CreationDate":"2014-12-12T06:57:00.000","Title":"How to easily transfer qpython scripts from windows to android for development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"while developing qpython scripts, it would be much easier to develop them on a pc and only transfer them to the android device for testing.\nWhat is the easiest way to do such a transfer? (Development might require to do this very frequently)\nThanks in advance for all your feedback.\ntfv","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1287,"Q_Id":27438448,"Users Score":0,"Answer":"There is a ftp service in setting part which can help you to translate files between android device and pc.","Q_Score":1,"Tags":"qpython","A_Id":27445725,"CreationDate":"2014-12-12T06:57:00.000","Title":"How to easily transfer qpython scripts from windows to android for development?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I came across a feature in some programming languages to call methods in other programming languages. Its called the Foreign Function Interface. For example, I would be able to call a C Language function inside a Python program. Or I could I write a wrapper for some C library in Python language for other Python users to use those.\nOne simple example is the ctypes in Python. So using this, I can access the time function in libc. I understand to this level. However, I couldn't get a clear picture of how this ctypes itself is implemented and other 'behind the scene' things!\nThe questions that arise for me here are:\n\nWhat kind of features do a compiler for this language require to use the Foreign Function Interface. Because it should also compile the foreign language as well.\nSo if the host language is object oriented, and foreign language is not, then I need some kind of mapping to and from objects. How is this handled?\nWhat if the host language runs on a Virtual Machine? The Instruction Set would be different in that case, right?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":185,"Q_Id":27449735,"Users Score":3,"Answer":"Because it should also compile the foreign language as well.\n\nNo. ctypes, and the like, only need to be able to link to object code. This depends on the target foreign language having appropriate conventions for name mangling inside the object code, which C does.\n\nif the host language is object oriented, and foreign language is not, then I need some kind of mapping to and from objects. How is this handled?\n\nThe C code needs to expose appropriate interfaces for the host language; or equivalently, use some C-language libraries to do so. CPython is written in C, so this is broadly speaking easy in that case.\n\nWhat if the host language runs on a Virtual Machine? The Instruction Set would be different in that case, right?\n\nThe VM has to have the appropriate facilities to load compiled object code.","Q_Score":1,"Tags":"python,c,cross-language","A_Id":27449816,"CreationDate":"2014-12-12T18:20:00.000","Title":"Wrappers for C API in programming languages","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would I draw a simple partially transparent rectangle in python. I would like to not download anything from the internet and purely use python 2.7.3. I would like to also control where the rectangle starts and ends and control its width and height. The end goal of this is to have a map (of michigan and its great lakes) and have color coded rectangles pop up along the coast to visually show what the expected weather will be like based of buoys data from the NDBV. So in short, a map that i can place color coded rectangles on, that will be oriented along the coast of western michigan.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":7565,"Q_Id":27465157,"Users Score":0,"Answer":"Check out \nsvgfig or svgwrite for svg\nreportlab for pdf\npyglet for drawing to a window","Q_Score":0,"Tags":"python,python-2.7,graphics,geometry","A_Id":27465376,"CreationDate":"2014-12-14T00:37:00.000","Title":"Drawing basic shapes in python 2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Protobuf with pure python performance 3x slowly on pypy than CPython do.\nSo I try to use c++ implementation for pypy.\nThese are two error (PyFloatObject undefined and const char* to char*) when I compile protobuf(2.6.1 release) c++ implementation for pypy.\nI compile successfully after I modify python\/google\/protobuf\/pyext\/message.c,But I get 'Segmentation fault' error finally when I use protobuf with c++ implementation on pypy.\nI don't know how to fix it, help me please!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":567,"Q_Id":27517939,"Users Score":1,"Answer":"So this is a happy non-answer using my experience. The pure-python bindings for google protobuf are a terrible port of C\/C++ stuff. However, I had quite a bit of success wrapping C google protobuf generated bindings using cffi. Someone should go ahead and create a more generic binding, but that would just a short consulting stint.","Q_Score":2,"Tags":"python,c++,protocol-buffers","A_Id":27687619,"CreationDate":"2014-12-17T03:40:00.000","Title":"Is there any way to use Google Protobuf on pypy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I want to create some GTK+2 applications using Python 3. I searched many places, but can only find tutorials for using GTK+2 together with Python 2, using PyGtk, or GTK+3 together with Python 3, using PyGobject. Is there any way to create GTK+2 applications using Python 3?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":824,"Q_Id":27542828,"Users Score":2,"Answer":"Technically, it is possible, but not advisable.\nIf you compile GTK 2.24 yourself with GObject introspection turned on, and don't have GTK 3.x installed, then you should be able to use from gi.repository import Gtk to access the GTK 2 API.\nHowever, this is not supported in any way, and even prints out a warning message to that effect. I don't even know if it still works. Even if it does work, it's still a bad idea; if your application only works on an unsupported configuration like this, then how are you going to distribute it?","Q_Score":1,"Tags":"python-3.x,gtk2","A_Id":27592574,"CreationDate":"2014-12-18T09:08:00.000","Title":"Is it possible to create GTK+2.x applications using Python 3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made a small program in Python that involves tkinter, and I made it a pyw file because it has a shortcut on the desktop and I do not want the command prompt to get in the way. I used py2exe following the sentdex tutorial on youtube, and I got an output file, but the output file shows an error and exits before I can read it. The pyw file on its own works fine, but I don't know how to get the exe output file to work correctly.\nInformation:\nPython - 3.4.2;\nOS - Windows 8.1;\nFolder - Multiple items (photos and audio for the program);\nProgram - A simple animation in tkinter\nIf you need the program, tell me and I can upload the folder containing the program.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":216,"Q_Id":27586108,"Users Score":0,"Answer":"As far as I understand there is not a version of py2exe for python3.x\nYou'd be best of going for cx_freeze (Sentdex also has a tutorial on that on that)","Q_Score":0,"Tags":"python-3.x,tkinter,exe,py2exe","A_Id":29677578,"CreationDate":"2014-12-21T02:02:00.000","Title":"Python py2exe with tkinter (pyw file)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have create some custom dialogs in wxpython that I am very happy with.  I can execute pretty much anything I want based on user interaction and then once \"OK\" is selected collect the information from whatever functions I have run.\nWhat I am wondering is there a way to execute a final function at the time \"OK\" is selected.  I do not have any sample code because I am not sure where to start and the demo does not do this, if it did my question would be answered by that.\nSo lets say that in the dialog I have calculated A and B and when \"OK\" is selected I want to execute C = str(A) + \"whatever\" + str(B)\nSo that upon exit I can dlg.C.GetValue() =","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":237,"Q_Id":27615219,"Users Score":0,"Answer":"Just create self.C in your custom dialog's __init__ method. Then bind your OK button to a handler and update it as you mentioned. Then you should be able to get its value just as you stated: value = dlg.C.GetValue().\nOne thing to keep in mind is that when you create the OK button, do not set its id to wx.OK. If you do, it may not call your custom event handler as wx.OK is a special id that has a special default handler.","Q_Score":1,"Tags":"wxpython,customdialog","A_Id":27622152,"CreationDate":"2014-12-23T06:33:00.000","Title":"WXPYTHON CUSTOM DIALOG","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im using Qpython3 on Android 4.2.2. Im currently able to list the latest sms from a particular contact and extract a 10 digit phone number. I want to update a contact's phone number with this number. \nHow should I do this ?\nTo be more precise, I want to be able to:\n\nAccess the contact list.\nUpdate contact phone number with this phone number\n\nIs this possible with Qpython3 ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":90,"Q_Id":27642293,"Users Score":0,"Answer":"Try to run it in console because you can communicate with the interpreter directly","Q_Score":0,"Tags":"android,qpython3","A_Id":27642399,"CreationDate":"2014-12-24T21:26:00.000","Title":"How do I add a phone number to a contact using Qpython3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How could I hide an existing Label when a button is clicked in Python(Tkinter)?","AnswerCount":3,"Available Count":1,"Score":0.3215127375,"is_accepted":false,"ViewCount":29265,"Q_Id":27654494,"Users Score":5,"Answer":"Use can use grid_remove() to hide the label.\nlike self.myLabel.grid_remove(). If you want to show it again then use self.myLabel.grid(). This will show widget on its original position on grid.","Q_Score":4,"Tags":"python,python-3.x,tkinter,label","A_Id":32515869,"CreationDate":"2014-12-26T08:06:00.000","Title":"Hide label when a button is clicked in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Versions\nPython 3.4 with Pygame 1.9.2\nQuestion\nHow can I pass the name of a function\/method from one module, where this function does NOT exist, to the module containing it without having to resort to making it a string and evaluating it by eval()?\nBackground\nI have a simple MVC pattern for training purposes. For simplicity's sake let's just presume we pressed a button in the menu. Here's what happens:\nThe controller sends our event, the click as ClickEvent (containing position, mouse button and if the button was pressed or released), to the currently running logic, the menu. The menu then evaluates the click depending on its position and if it happened on a button, it returns a ModelEvent containing the name of a method of the model. The model then receives said ModelEvent and evaluates it. If any visible changes happen, it creates a new ViewEvent (this would go beyond my question).\nApproaches\nI approached the problem in three ways so far, once by lambda (which doesn't seem to fit my needs at all or I horribly misunderstood it) and twice by using strings with eval(). The shortcomings of the latter approach are obvious: The name of the function has to be passed between the instances as a string and then evaluated by eval() which takes its time.\nWhat would be an efficient way to pass the names of methods and functions from one module, where they don't exist, to another, where they are to be executed, without having to use strings and eval()?\nOr, if you see any grave mistakes in my general approach, I'd be glad to hear about it as I'm still learning.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":116,"Q_Id":27744155,"Users Score":0,"Answer":"When I understand you correctly, you are mixing Callbacks with Events.Perhaps this makes the problem so problematic.\nIn Python functions are objects, and can be passed as any other object like strings. So there is no need to pass names and evaluate them.","Q_Score":0,"Tags":"python,lambda,pygame,eval","A_Id":27744281,"CreationDate":"2015-01-02T15:03:00.000","Title":"Python: Passing a function name as an argument between modules","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"-I'm using python and cocos2D\nI have the file loading a tmx-map but now I want to change a specific tile to display an image from another file, I have saved the specific tile that I want to change in a variable but changing it I don't know how.\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":266,"Q_Id":27761448,"Users Score":1,"Answer":"All I had to do was\ncell.tile.image = image","Q_Score":0,"Tags":"python,tile,tmx,tiled,cocos2d-python","A_Id":27761506,"CreationDate":"2015-01-04T01:27:00.000","Title":"python cocos2d change tile's image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"TextInput class \nIs there any way to append or edit text ???\nProblem:\nI created TextInput object and accessed text method to print strings.\nBut every time I access text method, it prints new string and it doesn't retain previous value.\nHow to fix the issue?\nwhat is alternative for TextInput?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1054,"Q_Id":27776107,"Users Score":1,"Answer":"Just replace the text with some function of the original string, e.g. textinput.text = ''.join('something ', textinput.text.replace('a', 'b'), ' and something else').","Q_Score":2,"Tags":"python,kivy","A_Id":27779076,"CreationDate":"2015-01-05T08:56:00.000","Title":"edit or append text (TextInput class) in kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running QPython on my Android device. Whenever I try to import Tkinter, it says, \"no modules found\". What is the package name for Tkinter in PyPI? Or where can I download the Tkinter package for QPython?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":6218,"Q_Id":27804805,"Users Score":1,"Answer":"Tkinter is not installed with QPython, unlike SL4A and Kivy.  You'll have to install it yourself.  There is a pip console among the scripts, so I'd try using that first.","Q_Score":1,"Tags":"tkinter,pypi,qpython","A_Id":30358514,"CreationDate":"2015-01-06T18:26:00.000","Title":"QPython on Android doesn't get imported","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python wrapper (to a C lib) generated by Swig. \nHave unittest run happy within PyDev.\nProject structure follow PyBuilder suggested setup:\n\n   |-src\n      |-main\n          |-python\n                |-A.py\n                |-_A.so\n      |-unittest\n          |-python\n                |-A_tests.py\n\nwhen try run pyb, got following error:\n\nFatal Python error: PyThreadState_Get: no current thread\nAbort trap: 6\n\nNOTE: \n If I change A to a pure Python module, everything works.\nMust be something (step) missing related to load that .so file.\nSorry for a newbie question like this. Any help will be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":53,"Q_Id":27807343,"Users Score":0,"Answer":"is it possible you build the .so library for another python version?\nPyBuilder does not do anything special about shared objects, especially not when running unit tests.\nSo try running ldd _A.so and see if that matches the interpreter you're using with pyb?","Q_Score":0,"Tags":"python,swig,pybuilder","A_Id":27814800,"CreationDate":"2015-01-06T21:18:00.000","Title":"PyBuilder broken for Swig-Python generated wrapper project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been having problems importing Tkinter. I have done research here and found that it's because I have had both 64 bit and 32 bit python on my machine. I currently use 32 bit but Tkinter is pointing to the 64 bit version. I think the easiest fix is to uninstall python and reinstall it. Will I loose all my downloaded libraries and code I've written if I do this?\nIt's python 2.7 on Windows 7.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2920,"Q_Id":27810710,"Users Score":1,"Answer":"All the downloaded libraries are in the C:\\Python27\\Lib\\site-packages. You can check this folder before you uninstall a version of Python.\nI agree with Rinzler, for Python, both versions will have its own Tkinter. Maybe it's just a problem of interpreter choice of your IDE.","Q_Score":0,"Tags":"python,python-2.7","A_Id":27810779,"CreationDate":"2015-01-07T02:46:00.000","Title":"Uninstalling Python - Do I loose my installed packages and code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"community!\nMy problem:\nI have an item, namely gi.repository.Gtk, marked as \"Unresolved reference: Gtk\".\nThe Gtk module did not exist at the moment of setting up Python SDK in Idea, however I've installed it little bit later.\nI can't get how do I force re-sync of classpath for python?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":93,"Q_Id":27813209,"Users Score":0,"Answer":"Normally the binary modules for a Python interpreter are rescanned on IntelliJ IDEA restart. Please try restarting the IDE.","Q_Score":0,"Tags":"python,intellij-idea","A_Id":27828457,"CreationDate":"2015-01-07T05:52:00.000","Title":"intellij: update classes in classpath for python plug-in","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I had created an application in Python and then I tried to make an executable from it.\nWorks well in Ubuntu and Windows but only when on this system I have Python installed.\nIn other case (Tried only for Win) I get the error that \"The application can't start because python34.dll is missing\"\nWhat I do (filename is curr.py, also I have icon.res for icon):\n\npython C:\\Python34\\Scripts\\cython-script.py --embed curr.py\nin curr.c replace wmain by main (without doing it app won't be compiled at all)\ngcc curr.c -o curr.exe -IC:\\Python34\\include -LC:\\Python34\\libs icon.res -lpython34 -mwindows --static\n\nOf course, If I copy python34.dll to the app's folder everything is OK. \nDo I have another way?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":13987,"Q_Id":27850953,"Users Score":0,"Answer":"Just installed PyInstaller - it has the option to compile to one file.","Q_Score":2,"Tags":"python,dll,cython","A_Id":34793148,"CreationDate":"2015-01-08T22:48:00.000","Title":"Python34.dll is missing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I've designed a desktop app using PyQt GUI toolkit and now I need to embed this app on my Django website. Do I need to clone it using django's own logic or is there a way to get it up on website using some interface. Coz I need this to work on my website same way it works as desktop. Do I need to find out packages in django to remake it over the web or is there way to simplify the task?\nPlease help.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1730,"Q_Id":27879952,"Users Score":2,"Answer":"I'm not aware of any libraries to port a PyQT desktop app to a django webapp. Django certainly does nothing to enable this one way or another. I think, you'll find that you have to rewrite it for the web. Django is a great framework and depending on the complexity of your app, it might not be too difficult. If you haven't done much with web development, there is a lot to learn!\nIf it seemed like common sense to you that you should be able to run a desktop app as a webapp, consider this: \nAlmost all web communication that you likely encounter is done via HTTP. HTTP is a protocol for passing data between servers and clients (often, browsers). What this means is that any communication that takes place must be resolved into discrete chunks. Consider an example flow:\n\nYou go to google in your browser.\nYour browser then hits a DNS server (or cache) that resolves the name google.com to some IP address.\nCool, now your browser makes a request to that IP address and says \"get me some stuff\". \nGoogle decides to send you back a minimal amount of HTML and lots of minified JavaScript in the page. \nYour browser realizes that there are some image links in the HTML and so it makes additional requests  to google to get each of the images so that it can display them.\nNow all the content is loaded on your browser so it starts to execute the JavaScript code, and that code needs some more data from google so it starts sending requests to google too.\n\nThis is just a small example of how fundamentally different a web application operates than how a desktop application does. On a desktop app you have the added convenience that any operation doesn't need to be \"packaged up\" and sent, then have an action taken, etc (unless you're using a messaging architecture, but that's relatively uncommon outside of enterprise apps).","Q_Score":1,"Tags":"django,python-2.7,pyqt4","A_Id":27880120,"CreationDate":"2015-01-10T18:52:00.000","Title":"Cloning PyQt app in django framework","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a PyFloatObject that I want to convert to a C float. However, PyObjectFloat only provides a conversion to double. Can I safely cast a double to a float, or is there a function to convert PyObject to float i.e. PyObject_AsFloat.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2614,"Q_Id":27951419,"Users Score":0,"Answer":"sprintf into a buffer followed by atoi seems to do the trick","Q_Score":0,"Tags":"python,c,python-c-api,python-c-extension","A_Id":27969486,"CreationDate":"2015-01-14T20:01:00.000","Title":"convert PyFloatObject to float","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to hide the IDLE (or not making it run at all), with a command, when launching a tkinter application, without having to build the application?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":155,"Q_Id":27955957,"Users Score":0,"Answer":"Execute it directly from the command line with python script.py.","Q_Score":0,"Tags":"python-3.x,python-idle","A_Id":27956444,"CreationDate":"2015-01-15T02:38:00.000","Title":"Is there a way to hide the IDLE when running a tkinter application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running Paraview 4.2 on Linux. Here's what's happening:\n\nI load my XDMF\/hdf5 data into PV, which contains vector data.\nI apply a glyph filter to the loaded data, and hit apply (thereby using the default mode of Uniform Spatial Distribution).\nNo glyphs appear on screen, and the information tab shows that the filter has no data (0 points, etc.).\nIf I switch to All Points, or Every Nth Point, it works fine and displays the glyphs oriented correctly.\n\nAnnoyingly, if I then make a cone source, and change the input of the glyph to the cone, Uniform Spatial Distribution works fine for the cone.\nNo errors come up anywhere when I do this, whether in the PV gui or through pvpython.\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":653,"Q_Id":27977626,"Users Score":0,"Answer":"Uniform distribution works by picking a set of random locations in space and finding data points closet to those locations to glyph. Try playing with the Seed to see if that helps pick different random locations that yield better results.\nIf you could share the data, that'd make it easier to figure out what could be going on here, as well.","Q_Score":1,"Tags":"python,paraview","A_Id":27987246,"CreationDate":"2015-01-16T05:07:00.000","Title":"Paraview glyph uniform distribution does not work on my dataset","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a pygame project at the moment and I'm wondering if there is an easy way to delete all sprites in a class. I have all the sprites in a group called self.spritegroup, so I couldn't just delete all objects in a group. Is there a simple shortcut to delete all objects in a class?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1778,"Q_Id":28006100,"Users Score":0,"Answer":"Well you could always just re-assign a new group object to your old group.\nyour_old_group = new_group\nI'm not entirely sure but it seems kill is meant to delete specific sprites.","Q_Score":1,"Tags":"python,class,pygame","A_Id":50237749,"CreationDate":"2015-01-18T01:01:00.000","Title":"Pygame delete all objects in class","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"In a wxpython Combobox, long strings get left-truncated in the dropdown portion.  This can result in some values looking identical when they aren't. I'd like to provide better information to the user than that.\nThe following options occur to me:\n\nInsert elipses in the middle of the string before adding it to the combobox's dropdown choices and expanding it back before placing back in the edit portion. \nShow a tooltip of the full string when the user mouses\/hovers over a value in the dropdown.\n\nProblem is, the Combobox class does not expose events that enable either of the above. \nHow can I intercept the events corresponding to either of the above?  Any other ideas for making long combobox strings visible to the user?\nThanks,\nRichK","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":172,"Q_Id":28012863,"Users Score":0,"Answer":"I would recommend using the ComboCtrl instead of the ComboBox. The benefit is that the ComboCtrl is a custom widget, so it allows more flexibility. For example, the ComboCtrl provides a scrollbar for long strings. Check out the wxPython demo for some good examples.","Q_Score":1,"Tags":"combobox,wxpython","A_Id":28027478,"CreationDate":"2015-01-18T17:52:00.000","Title":"Showing long strings in wxpython Combobox dropdown","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a trick to show the grid layout cells (or the borders of the cells) when using it, in order to have a visual idea of what is going on behind the scenes?\nI have searched a little bit, but have not found nothing yet.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":17747,"Q_Id":28025666,"Users Score":15,"Answer":"If you give the containing frame a color, and use options to put padding between cells, the background will bleed through the gaps. This only works where there are widgets. If you have spans that are empty, you won't see grid lines. \nIt's important to realize that you aren't creating a grid object. \"grid\" is not a thing, it's just instructions for how to lay out a set of widgets. If there is nothing in a row or column, that column won't show up. You don't create a grid per se, you tell a widget to display inner widgets using conceptual rows and columns.\nAnother trick to learning to work with grid is to give each frame you're trying to use in a grid a distinctive color so you can see where one frame ends and another begins. \nThe best thing to do when struggling with a layout is to get out pencil and paper. Draw out your UI, and natural borders should be evident. You can then use that as a guide to decide what the grid options should be.","Q_Score":15,"Tags":"python-3.x,tkinter","A_Id":28027692,"CreationDate":"2015-01-19T13:24:00.000","Title":"Show grid layout cells in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have tried multiple times to use PyInstaller to bundle my Python2 programs, but it never seems to work with the Pygame module. I have seen many other issues on this topic, but I couldn't find any useful answers. Does anybody know a solution to this?\nI am trying to do this on Ubuntu 14.10.\n-Edit-\nTo be more specific:\n\"never seems to work\" means that when I run PyInstaller and build the application it appears to work and makes the application. When you try to run the application nothing happens.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":9558,"Q_Id":28033003,"Users Score":0,"Answer":"i suggest trying another program like py2exe to bundle python programs i currently have not had any issues with it. Their are lots of good youtube videos on the process which is cmd based. I have had some personal problems using pyinstaller and think it is just buggy assuming your program is not flawed.","Q_Score":6,"Tags":"python,pygame,pyinstaller","A_Id":28058867,"CreationDate":"2015-01-19T20:30:00.000","Title":"Pyinstaller with pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do you customize the kivy logo for a kivy app? \nI am using Buildozer in Ubuntu 14.04.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":448,"Q_Id":28063099,"Users Score":1,"Answer":"These variables can be set in the buildozer.spec, e.g. icon.filename in the [app] section.","Q_Score":1,"Tags":"python-2.7,customization,kivy","A_Id":28068266,"CreationDate":"2015-01-21T08:58:00.000","Title":"Customizing a kivy app logo using Buildozer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using PyQt5 to make the user interface. Now I have set up a tab widget, and I want to trigger the event at such a time when a specific tab is selected. In other words, for example, I have tab A and tab B, and I want to execute the function every time user is switching from tab A to tab B.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5574,"Q_Id":28121876,"Users Score":7,"Answer":"When a new tab is selected currentChanged(int index) signal of the QTabWidget is emitted. Just connect that signal to some slot and check the index of the newly selected tab which is passed as argument.","Q_Score":8,"Tags":"python,qt,pyqt,qtabwidget","A_Id":28122425,"CreationDate":"2015-01-24T03:07:00.000","Title":"How to connect event when tab widget is selected?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I have this little problem. When I try to install PyGame for Python 3.4 I download a .whl (wheel?) file and don't know how to use it. Some guys told me something about pip but don't know how to use\/install it.","AnswerCount":9,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":64844,"Q_Id":28127730,"Users Score":3,"Answer":"14 y\/o? Good for you! You can put the file into your python\/scripts folder and run pip install *file* (where *file* is your filename).","Q_Score":9,"Tags":"python,pygame,pip,python-3.4","A_Id":28127786,"CreationDate":"2015-01-24T16:40:00.000","Title":"How to install PyGame on Python 3.4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Pygame 1.9.2 with Python 3.4 to create a control program for a robot.  The controller is a new Xbox One controller connected via USB which is working fine with pygame. The problem is that the trigger buttons are considered Axes which give values from -1 to 1 depending on how hard you press.  Is there a way to change this to a range from 0 to 1 or any other range that does not include negative numbers?\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1152,"Q_Id":28132156,"Users Score":0,"Answer":"(x + 1.0) \/ 2.0 where x is whatever you get from the controller should give you a range of 0..1 (the + 1.0 is to get you in the range 0..2)","Q_Score":0,"Tags":"python,linux,arduino,pygame,raspberry-pi","A_Id":28132200,"CreationDate":"2015-01-25T01:13:00.000","Title":"How can I set the range for Xbox One controller Triggers using Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to run a simple Turtle Graphics file, but no drawing shows up and IDLE asks me what background color you want?\nWhat's wrong with my Python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":197,"Q_Id":28144261,"Users Score":0,"Answer":"I was asked this question by a friend, and re installation solved the problem","Q_Score":0,"Tags":"python,turtle-graphics","A_Id":28177122,"CreationDate":"2015-01-26T03:04:00.000","Title":"Drawing not shown using Python Turtle Graphics","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Pythonscript where I want to import pygameui. When I perform:\nsudo pip install pygameui \nin the terminal, I get the following message:\n\nDownloading\/unpacking pygameui   Running setup.py egg_info for package\n  pygameui\n       Requirement already satisfied (use --upgrade to upgrade): setuptools in\n  \/usr\/local\/lib\/python2.7\/dist-packages\/setuptools-12.0.4-py2.7.egg\n  (from pygameui) Downloading\/unpacking pygame>=1.9.1 (from pygameui)\n  Could not find a version that satisfies the requirement pygame>=1.9.1\n  (from pygameui) (from versions: ) No distributions matching the\n  version for pygame>=1.9.1 (from pygameui) Storing complete log in\n  \/root\/.pip\/pip.log\n\nI am struggling to solve this issue. Can somebody help me?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1630,"Q_Id":28150201,"Users Score":1,"Answer":"There is no \"solution\", only workarounds here.\nTo have working environment I install system package with pygame (i.e. pacman -S python2-pygame in Arch Linux) then create virtualenv with --system-site-packages switch. Pygame has not been updated for more than 5 years so it's highly unlikely that any changes will come in foreseable future. Later in this virtualenv I can install PygameUI with --no-deps switch to skip dependency checks - Pygame is already installed in required version.","Q_Score":2,"Tags":"python,pygame,raspberry-pi","A_Id":32603009,"CreationDate":"2015-01-26T12:32:00.000","Title":"Trouble with PyGameUI - RaspberryPi","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know if Tkinter.Canvas is a classic or modern Python class, because super does not work as expected (for me).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":58,"Q_Id":28174683,"Users Score":3,"Answer":"All Tkinter classes in python 2.x are old style classes.","Q_Score":1,"Tags":"python,python-2.7,tkinter,tkinter-canvas","A_Id":28174950,"CreationDate":"2015-01-27T15:59:00.000","Title":"Is Tkinter.Canvas a classic class?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have just started using twillio. Im not sure if its the right tool for what I am trying.\nCurrently if I dial my number, there is no ring, it just picks up straight away. The reason I am mentioning this is because I would like it to first ring before it picks up. So my user can actually put down the phone before the call is connected and the person is billed.\nIs this possible? My number is new, nothing has been setup or done to it.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":91,"Q_Id":28222797,"Users Score":1,"Answer":"This is where Twilio gets tricky. Technically the call is picked up instantly, so there is no timeout to let it ring.\nWhat you can do, is initialize the phone call with a timeout, and using the Play verb, use an MP3 recording of the standard ring before letting the program do it's thing.","Q_Score":0,"Tags":"python,rest,twilio","A_Id":28222877,"CreationDate":"2015-01-29T19:17:00.000","Title":"Letting twillio ring before it picks up","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a pygame program where there's a face in the center. What I want the program to do is have a bunch of objects on the screen, all irregular. Some would be circles, others would be cut-out pictures of objects like surf boards, chairs, bananas, etc. The user would be able to drag the objects around, and they'd collide with each other and the face in the center, and so be unable to pass through them. Could anyone show me how I would do this? Thanks!\n-EDIT- And by not be able to pass through, I mean they'd move along the edge of the object, trying to follow the mouse.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":123,"Q_Id":28228431,"Users Score":0,"Answer":"What you are looking for is functionality usually provided by a so-called physics engine.  For very basic shapes, it is simple enough to code the basic functionality yourself.  (The simplest case for 2D shapes is the collision detection between circles). \nCollision detection gets pretty hard pretty quickly, especially if you want to do it at a reasonably fast rate (such as you would need for the sort of project you are describing) and also especially if you are dealing with arbitrary, non-regular shapes (which your description seems to indicate).  So, unless you are interested in learning how to code an optimized collision detection system, I suggest you google for python physics engines.  I have never used any, so I can't personally recommend one.  \nGood luck!","Q_Score":0,"Tags":"python,pygame,collision","A_Id":28228513,"CreationDate":"2015-01-30T02:48:00.000","Title":"Pygame image collision","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an aplication in IronPython where I load my xaml with wpf: \"wpf.LoadComponent(....xaml)\"\nI have a Button and a TextBox in my app and when I push the button, the app start doing a 2 minute work, I need to update the textbox of the aplication during this work.\nBut I can\u00b4t do it. My textBox only update it when the 2 minute work finish.\nAny help?\nThank you","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2205,"Q_Id":28233768,"Users Score":0,"Answer":"Following snippet might help you.\nXAML :\n<Label Content=\"\" HorizontalAlignment=\"Left\" Margin=\"62,163,0,0\" VerticalAlignment=\"Top\" Height=\"472\" Width=\"880\" Foreground=\"Black\" FontSize=\"18\" Background=\"White\" x:Name=\"label1\"\/>\nIronPython :\ndef Button_Click1(self, sender, e):\n        self.label1 = self.FindName('label1')\n        self.label1.Content = \"Test Succeeded\"\n        pass","Q_Score":0,"Tags":"wpf,xaml,textbox,ironpython","A_Id":53803083,"CreationDate":"2015-01-30T10:24:00.000","Title":"How to update TextBox using wpf, IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am embedding Python in C++.\nI have a working C++ Python extension object.\nThe only thing wrong is that if I set tp_dealloc to a custom function it never gets called.\nI would have thought Py_Finalize() would trigger this, or maybe terminating the program.  But no.\nCould anyone suggest why tp_dealloc isn't getting hit?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":290,"Q_Id":28266847,"Users Score":1,"Answer":"I believe the problem here was one of reference counting.\nPyType_Ready() fills various tp_* fields depending on the bases of your type.\nOne of these is tp_alloc, which I have set to 0.\nIts doc says the refcount is set to 1 and the memory block is zeroed.\nEvery instance Python creates of this type, a new PyObject get added to the appropriate Python Dictionary. If it is a module level variable, this is the module's dictionary.\nWhen the dictionary is destroyed, it DECREF-s contained objects.  Now the refcount will be 0, and tp_dealloc will get run.\nIt appears that in my code I was performing an extra INCREF somewhere and the object was never getting garbage collected.\nIt seems that (unless you compile with the specific flag) Python has no linked list that would allow it to track all of its objects. So we can't assume that Py_Finalize() will clear up. It won't!\nInstead, every object is held in the dictionary for its containing scope, and so on back to the module dictionary. When this module dictionary is destroyed, the destruction will creep outwards through all the branches.","Q_Score":1,"Tags":"dealloc,python-c-api","A_Id":28297671,"CreationDate":"2015-02-01T19:28:00.000","Title":"tp_dealloc not getting hit upon exit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a program in python(Tkinter) which takes username and password as input and a button which, when pressed, goes through a function which checks the username and password and further runs the program. I want that, rather than clicking the button, user presses the 'Enter' key and that does the function of the button. please help.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":8809,"Q_Id":28282005,"Users Score":0,"Answer":"I believe you'll want to bind the  key to your handler: frame.bind('<Return>', some_handler).","Q_Score":1,"Tags":"python,tkinter","A_Id":28283243,"CreationDate":"2015-02-02T16:16:00.000","Title":"Getting values by pressing 'Enter' key rather than clicking a button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a program in python(Tkinter) which takes username and password as input and a button which, when pressed, goes through a function which checks the username and password and further runs the program. I want that, rather than clicking the button, user presses the 'Enter' key and that does the function of the button. please help.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":8809,"Q_Id":28282005,"Users Score":0,"Answer":"For me, the normal binding to a function did not work. Probably because I am using it inside a class, I used the Lambda function and it worked. Here's the code:\ninp.bind('', lambda _: show())","Q_Score":1,"Tags":"python,tkinter","A_Id":37026723,"CreationDate":"2015-02-02T16:16:00.000","Title":"Getting values by pressing 'Enter' key rather than clicking a button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've installed Python 2.7.6 (32-bit) on Windows 7 (64-bit). This works fine in Windows Power Shell. I set the PATH to C:\\Users\\name\\Python27\\Scripts, and that didn't seem to be a problem either. I then downloaded a pygame install file, pygame-1.9.2a0-cp27-none-win32.whl, from:\nhttp:\/\/www.lfd.uci.edu\/~gohlke\/pythonlibs\/#pygame\nI put the .whl file into the Python27\\Scripts directory, and tried using pip install pygame-1.9.2a0-cp27-none-win32.whl in Windows Power Shell (command line, not Python interpreter), and the error message is this:\nThe term 'pip' is not recognized as the name of cmdlet, function, script file, or operable program.\nI tried using Python 2.7.8 (the later version of Python 2.7, if I'm not wrong) with an .msi install of pygame, but I experienced other errors with this that I thought could be fixed with a fresh install. I am very new to programming and using the command line; any help is appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":559,"Q_Id":28310782,"Users Score":0,"Answer":"you must not have set the path variable in windows..it's the same mistake that i made..\nset the environment variable in windows by doing fallowing steps:\n\nright click 'My Computer'\ngo to properties\nAdvanced System Settings\nEnvironment Variables\nand set Path there..\n\nif this doesn't help then try another method :\n\nopen your python installation directory\ngoto Tools\nScripts\nRun \"win_add2path.py\"\n\nNow try to run  $) pip install, commd..\nif it still doesn't work .. restart your console or restart the PC\n@shub1493biswas@gmail.com","Q_Score":0,"Tags":"python,pygame,pip","A_Id":28639628,"CreationDate":"2015-02-03T23:30:00.000","Title":"can't install pygame using pip, Python 2.7.6 on Win7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently use Cython to build a module that is mostly written in C. I would like to be able to debug quickly by simply calling a python file that imports the \"new\" Cython module and test it. The problem is that I import GSL and therefore pyximport will not work. So I'm left with \"python setup.py build; python setup.py install\" and then running my test script.\nIs this the only way? I was wondering if anyone else uses any shortcuts or scripts to help them debug faster?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":87,"Q_Id":28489542,"Users Score":0,"Answer":"I usually just throw all the commands I need to build and test into a shell script, and run it when I want to test. It's a lot easier than futzing with crazy Python test runners.","Q_Score":4,"Tags":"python,cython","A_Id":29159267,"CreationDate":"2015-02-12T23:01:00.000","Title":"Better Way of Debugging Cython Packages","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm going through some PyQt4 GUI tutorials and often see strings such as \"&File\" or \"&Exit\" in menus and the like.\nMy question is what is the purpose of the \"&\" symbol in this string? I can't see a difference when I miss it out. I've not come across it in other Python tutorials - is it somehow unique to PyQt?\nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":784,"Q_Id":28502910,"Users Score":3,"Answer":"The & causes PyQT to display an underscore under the letter that serves as a shortcut key for the menu item.","Q_Score":1,"Tags":"python,string,pyqt4","A_Id":28502943,"CreationDate":"2015-02-13T15:25:00.000","Title":"What is the purpose of an ampersand (&) in a PyQt4 string?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making an first-person open-world game in Blender Game Engine(bge), and intend to have the terrain be generated procedurally. I have looked around from website to website, and have only found various ways for the game to generate terrain in the \"edit\" mode, but not a way to generate it in blender game engine, eg. I would like it so that every time you play, the terrain is different. Is there any way to do this with python code, or at all?\nThanks in advance for your help!\nNote: When I say procedual, I do not mean for the world to be infinitely large, eg Minecraft(although acquiring a solution that supported that would be awesome)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":519,"Q_Id":28507678,"Users Score":0,"Answer":"Procedurally generating terrain on the fly is not that easy, but it is possible. You must create the terrain mesh with its triangles and textures during runtime and then dynamically load\/unload the parts the player can see.\nSo you would not create a single big landmass, but rather divide your terrain in smaller chunks than you can load and unload as needed. To create the actual terrain you could use a height-map or a noise algorithm.","Q_Score":0,"Tags":"python,python-3.x,game-engine,blender","A_Id":28684387,"CreationDate":"2015-02-13T19:53:00.000","Title":"Procedualy Generateing Terrain in Blender Game Engine","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I already tried to google it but I couldn't find anything ...\nI created tkinter canvas with width 800, height 600\napparently, the left upside will be (0,0) \nI want to change left downside to (0,0) \nHow can I do this???","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":209,"Q_Id":28510010,"Users Score":0,"Answer":"You cannot change the coordinate system of the canvas. You can scroll the canvas so that 0,0 is in the bottom left, but the y coordinates will be negative going up.","Q_Score":0,"Tags":"python,tkinter,coordinates","A_Id":28510642,"CreationDate":"2015-02-13T22:43:00.000","Title":"How can I convert coordinate in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im fairly new to python. I creating a game similar to asteroids, and so far I've gotten the spaceship to move around with the arrow keys. can someone explain what i would do to make the spaceship rotate in the direction its moving? thanks in advance!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":774,"Q_Id":28553439,"Users Score":0,"Answer":"Each of your sprites should have velocity attributes. If your velocity is negative, turn one way. If your velocity is positive, turn the other. Because velocity indicates the direction of movement, this can be used to determine angular direction.","Q_Score":0,"Tags":"python,pygame","A_Id":28553503,"CreationDate":"2015-02-17T01:52:00.000","Title":"python\/pygame: how would i get my sprite to rotate in the direction it's moving?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When dealing with C extensions with Python, what is the best way to move data from a C++ array or vector into a PyObject\/PyList so it can be returned to Python? \nThe method I am using right now seems a bit clunky. I am looping through each element and calling Py_BuildValue to append values to a PyList. \nIs there something similar to memcpy?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":983,"Q_Id":28560045,"Users Score":1,"Answer":"You have to construct a PyObject from each element prior to adding it to a sequence.\nSo you have to either add them one by one, or convert them all, then pass to a constructor from PyObject[].\nI guess the 2nd way is slightly faster since it doesn't have to adjust the sequence's member variables after each addition.","Q_Score":0,"Tags":"python,c++,c","A_Id":28560741,"CreationDate":"2015-02-17T10:40:00.000","Title":"Best way to copy C++ buffer to Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to open a file, remove some characters (defined in dic) and then save it to the same the file.\nI can print the output and it looks fine, but I cannot save it into the same file that the original text is being loaded from.\n\nfrom tkinter import *\nfrom tkinter.filedialog import askopenfilename\nfrom tkinter.messagebox import showerror\nimport sys\nimport fileinput\n\ndic = {'\/':' ', '{3}':''};\n\n\ndef replace_all(text, dic):\n    for i, j in dic.items():\n        text = text.replace(i, j)\n    return text\n\nclass MyFrame(Frame):\n    def __init__(self):\n        Frame.__init__(self)\n        self.master.title(\"Example\")\n        self.master.rowconfigure(5, weight=1)\n        self.master.columnconfigure(5, weight=1)\n        self.grid(sticky=W+E+N+S)\n\n        self.button = Button(self, text=\"Browse\", command=self.load_file, width=10)\n        self.button.grid(row=1, column=0, sticky=W)\n\n    def load_file(self):\n        fname = askopenfilename(filetypes=((\"Napisy\", \"*.txt\"),\n                                           (\"All files\", \"*.*\") ))\n        if fname:\n            try:\n                with open (fname, 'r+') as myfile: #here\n                    data = myfile.read()           #here\n                    data2 = replace_all(data, dic) #here\n                    print(data2)                   #here\n                    data.write(data2)              #and here should it happen\n\n            except:\n                showerror(\"Open Source File\", \"Failed to read file\\n'%s'\" % fname)\n            return\n\n\nif __name__ == \"__main__\":\n    MyFrame().mainloop()\n\n\nI have tried several commands but either I am receiving python errors or it is simply not working.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":649,"Q_Id":28582037,"Users Score":1,"Answer":"This is often implemented by writing to a temp file and then moving it to the original file's name.","Q_Score":0,"Tags":"python-3.x","A_Id":49924334,"CreationDate":"2015-02-18T11:06:00.000","Title":"How can I save output tho the same file that I have got the data from, in Python 3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python(2.7)\/wxpython program developed on windows, which I am trying to migrate to mac but am encountering some problems.\nThe bit I am having problems with consists of two panels:\nPanel A consists of a tree control containing key=value pairs and with user editing disabled.\nPanel B consists of a set of controls of various types (filePicker, textCtrl, valueCtrl, choice, checkbox, comboBox, and spinEdit), all of which are initially disabled\nWhen the user selects a tree node the program checks the key and decides which control on panel B should be used to edit the tree node's value.  Panel A then sends the relevant info to panel B using pubsub which initializes and enables the relevant control.  Each control on panel B has a EVT_KILL_FOCUS event so that when the user moves away from the control, the controls value is sent back to panel A using pubsub and the tree node's value is updated and the editing control on panel B is disabled.  This works fine on windows.\nOn mac I have the following problems:\n\nThe filepicker and spinCtrl can not be disabled  - this could lead to incorrect information being sent back to the treeCtrl if either of these controls inappropriately receives focus\nthe spinctrl, choice, checkbox, and comboctrl appear not be be triggering EVT_KILL_FOCUS events and so no information is sent back to the treeCtrl.  I fixed this on the choice control by binding the EVT_CHOICE.  Using non-focus events for the other controls doesn't work as well and creates undesired behaviors.\n\nSo my questions are:\n1:  is it possible to disable the filepicker and spinCtrl on OSX?\n2:  is there a way to use the kill focus events of the spinctrl, choice, checkbox, and comboctrl controls on mac?\n3:  if fill focus events can not be used, is there an alternate event that would be triggered after editing is complete, for each of these controls?\nThanks\nRob","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":68,"Q_Id":28702522,"Users Score":2,"Answer":"Which version of wxPython are you using?  Disabling those kinds of widgets seems to be working fine for me with current builds.\nFor some reason Apple thought that it was a good idea to never give the keyboard focus to some types of controls, because apparently nobody would ever want to use them with anything but a mouse or trackpad.  So if the widget never gets the focus, then it can never lose it and so there won't be any EVT_KILL_FOCUS for it either.  You can change this in the Keyboard panel in System Preferences by setting \"Full Keyboard Access\" to \"All Controls\"","Q_Score":0,"Tags":"python,macos,wxpython","A_Id":28724680,"CreationDate":"2015-02-24T17:35:00.000","Title":"wxpython control problems when migrating from win to mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have some problems with an App, which I wrote with kivy an packaged with buildozer is always crashing when I try to run in on my phone. On my PC I use Ubuntu 14.10 and I don't get any error when compiling it (buildozer android debug). Then I send it on my SmartPhone and I install and run it, but it just loads and after a few seconds it crashes. By the way the kivy program is not very big. \nCould someone help me, please? And sorry for my bad grammar ;)","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2562,"Q_Id":28722273,"Users Score":0,"Answer":"If you are using kivy and your app loads some images, then there is no problem. But if you are using some other packages like pygame to load images, it will crash. Or if you are working in some files like reading or writing a text file, it will crash. Because when you package your app with buildozer, It will move the additional files of your app (.txt, .png) to a different location. So your python file fails to find the additional files in your specified location.\nTo solve this, do some corrections in your python file like changing the path of the additional file from the current directory of the python file to the path that is referred below.\nPATH = \"\/data\/data\/#package domain#.#package name#\/files\/app\"\nIn the above path change #package domain# with the domain of your package and #package name# with your package name.\nAll the additional files of any app that is installed in an android device will go to this location.\nTry out this. All the best.","Q_Score":1,"Tags":"python-2.7,kivy","A_Id":63775920,"CreationDate":"2015-02-25T14:58:00.000","Title":"Android App created with Kivy (Buildozer) crashes on phone, but why?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been trying to get a program I wrote in PyQt to work being called from a CUPS backend on OS X.\nThe problem is that CUPS sandboxing keeps the program from being able to access the PyQt python modules which I have brewed in \/usr\/local\/Cellar.\nIs there any way to grab those files, as well as the Qt files in the Cellar, and put them all in one contained folder?\nIt is simple for other modules, but PyQt depends on a lot itself.\nI tried using pyinstaller and cx_freeze, but with no luck.\nHow can I round up all my applications dependencies into one location?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":191,"Q_Id":28723232,"Users Score":1,"Answer":"I got around the CUPS sandboxing by having the backend send the information to a listening server on localhost that then processed the job as I needed it. I made sure that the server listening would only accept connections from localhost.\nI never was able to get pyinstaller or cx_freeze to work with PyQt, but this workaround was a better alternative.","Q_Score":0,"Tags":"python,qt,pyqt,cups","A_Id":30196277,"CreationDate":"2015-02-25T15:42:00.000","Title":"Rounding up Dependencies for PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"First off please do not mark this topic as a duplicate. All the relevant threads are years old. I would like updated information.\nWhat are the pros and cons of the following libraries? \nI am aware of:\n\nPyGame, seems to be the most popular but the website is full of\nbroken links and no news in awhile.\nCocos2D Python, Seems good as cocos2D is all the rage right now.\nAlmost no support though and the stack overflow pages only seem to\nget a post every couple weeks.\nPyglet, This is the only one I never tried as Cocos2D seems to use\nPyglet. Seems to update more then the cocos2D python stack overflow\nbut less then the pygame.\nOther? Rate a better library!\n\nI am looking for information on ease of use, preferably pythonic and up to date. But perhaps most importantly active.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1029,"Q_Id":28733056,"Users Score":2,"Answer":"Pygame and Pyglet are definitely on the radar.\nPygame\nGreat, popular game engine. No support for a variety of file types. But it's no longer maintained.\nPyglet\nVery powerful, high support for many files. Thorough documentation. OpenGL support, intuitive.\nCocos2D\nI really feel that Coco2D is just an unnecessary medium to use the underlying Pyglet engine.","Q_Score":2,"Tags":"python,pygame,pyglet,cocos2d-python","A_Id":28733171,"CreationDate":"2015-02-26T01:42:00.000","Title":"Python Game Libraries","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using a combination of Python and Squish for Qt to write tests on a Qt GUI, but I have noticed when I copy and paste tests from a suite I have and move them to another suite or computer with Squish the file will run, but when it runs anytime it sees an object name it does not recognize it and throws an exception. Most of the time I use the picker tool to go get the object name and place it where the old object name was and it works (I might add that the object names haven't changed I'm literally copying and pasting a string over THE SAME EXACT string). I must be doing something wrong. Has anyone seen this or have a way of resolving the issue so I don't have to re-record?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":246,"Q_Id":28749243,"Users Score":3,"Answer":"... but I have noticed when I copy and paste tests from a suite\n  I have and move them to another suite or computer with Squish the file\n  will run, but when it runs anytime it sees an object name it does not\n  recognize it and throws an exception ...\n\nFor your test script, Squish creates this suite folder you mention.\nInside this folder, you also have besides the test.py file, a object.map file (in which squish stores all the objects that you use inside the test).\nAlso, besides those 2 files you have a suite.conf file.\nInstead of copy\/paste your test script file, you could move the suite folder on the other computer, and there open it in SquishIDE. Or along with the test script, copy also the object.map file.","Q_Score":0,"Tags":"python,qt,squish","A_Id":30211284,"CreationDate":"2015-02-26T17:45:00.000","Title":"Has anyone seen Squish that you must re-record after moving?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to tkinter and I was wondering if there is a way to clear whole root (window). I tried with root.destroy() , but I want to have a chance to undo(to callback some widgets). I also tried .pack_forget() and .grid_forget() , but it takes a lot of time and later may cause many bugs in program.\nThank you for help.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4266,"Q_Id":28752446,"Users Score":2,"Answer":"If you plan on literally destroying everything in the root window, my recommendation is to make a single frame be a child of the root window, and then put everything inside that frame. Then, when you need to clear the root window you only have to delete this one widget, and it will take care of deleting all of the other widgets.\nIf instead of destroying the widgets you want to merely hide them, the best solution is to use grid, so that you can use grid_forget to remove them from view, and grid to make them visible again. You can use pack and pack_forget, but pack doesn't remember where the widget was, making it more difficult to restore them without a lot of work.\nIf your program is made of logical groups of widgets, use frames to create the groups, and then you can destroy or call grid_forget on the entire frame at once, rather than having to do that for each individual widget.","Q_Score":1,"Tags":"python,tkinter","A_Id":28753245,"CreationDate":"2015-02-26T20:46:00.000","Title":"Clear whole root","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to ask a ObjectListView object if and which of its columns\n(index would be enough) are sorted and in which direction (asc or desc).\nI know\n  ObjectListView.GetSortColumn()\nwhich return a ColumnDef object.\nBut I can not see a way how to ask about the index of the ColumnDef.\nIn wx.ListCtrl I can not found anything about sorting.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":81,"Q_Id":28777882,"Users Score":0,"Answer":"There is no real getter.\nUse ObjectListView.sortColumnIndex for that.\nIt will be '-1' if none of the columns are used for sorting.\nbtw: How can I add code here? The \"code snipped\" symbol just come up with a ugly un-understandable dialog.","Q_Score":0,"Tags":"python,objectlistview","A_Id":28974102,"CreationDate":"2015-02-28T03:45:00.000","Title":"How to ask a ObjectListView which column is ordered and in which direction?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Pygame to get values from a Simraceway steering wheel, which is just seen as a joystick. There are three axes on the joystick -- one for steering, one for the left paddle, and one for the right paddle. \nWhen I do the Pygame command get_numaxes(), I correctly get back 3 axes. But when I do the command get_axis(1), which should return the value for the left paddle, I do not get the correct value. I do get the correct values for get_axis(0) (the steering) and get_axis(2) (the right paddle). \nIn Windows, the left paddle shows up as Z-rotation rather than a normal axis. I'm not sure if that has anything to do with it. \nWhy is get_axis(1) not getting the position of the left paddle? Is there any program other than Pygame that will work better at getting a Z-rotation axis from this joystick, like Windows does?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":542,"Q_Id":28780611,"Users Score":0,"Answer":"I was not able to figure out why get_axis(1) did not get the position of the left paddle.\nHowever, I was able to use evdev to get all the information I need from the steering wheel. It's not very high level, unlike Pygame, but it does work.","Q_Score":0,"Tags":"python,pygame,joystick","A_Id":28937815,"CreationDate":"2015-02-28T10:20:00.000","Title":"Pygame.not getting value for one of axes on the joystick","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I Debug my Python C extension using Visual Studio the program abort with the message: \"PyThreadState_Get: no current thread\".\nIn Release the program works fine and if I add debugging information it still works fine.\nHow to solve the problem?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":304,"Q_Id":28805401,"Users Score":0,"Answer":"If NDEBUG is defined you have to use the Debug version of the interpreter python_d.exe.\nFurthermore if the name of the extension is myextension the name of the Dll in Release must be myextension.pyd but in Debug the name of the Dll must be myextension_d.pyd","Q_Score":0,"Tags":"python,pycxx","A_Id":28805402,"CreationDate":"2015-03-02T08:30:00.000","Title":"Debugging my Python C extension lead to \"PyThreadState_Get: no current thread\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a window with two grids in it. Example for using:\nMaking some operations on grid1. When making operations on another object in this window(like the other grid) I want to do final operation on grid1. What is the right event for this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":28807448,"Users Score":0,"Answer":"You can use focus events. Either catch wx.EVT_KILL_FOCUS which fires when you leave the grid widget or catch wx.EVT_SET_FOCUS when you enter a new widget. Then you can do something in your event handler to update grid1.","Q_Score":0,"Tags":"python,wxpython","A_Id":28818633,"CreationDate":"2015-03-02T10:25:00.000","Title":"wxpython event on deactivating a grid","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to use gtk table in one of my projects(GUI based) to show a pair of columns and its values. Since gtk table doesn't have borders by default, my GUI is not coming up well.\nSo,\nIs there anyway I can add borders to gtk table and its cells?\nIf no can I create a customized widget with borders by extending gtk Table?\nHow can I create a customized widget in pygtk?\nP.S: I have tried gtk Treeview and gtk Frames and thats not what I want. Also I have created a gtk treeview for each pair of columns and its values but the GUI works very very slow.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1159,"Q_Id":28811104,"Users Score":0,"Answer":"Assuming you want five pixels of spacing, if you would like to have space between the different cells of your table, you can try table.set_row_spacings(5); table.set_col_spacings(5);  If you would like to have space around the entire table, you can do table.set_padding(5).","Q_Score":1,"Tags":"python,gtk,pygtk","A_Id":34956262,"CreationDate":"2015-03-02T13:34:00.000","Title":"Add border to table in pygtk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible that when a Tkinter window is made bigger or larger, everyhting in the window is scaled?\nSo all the proportions stay the same but their sizes vary.\nNow when the window is resized all the buttons etc stay the same so I disabled resize because there is no point, it just looks bad.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":569,"Q_Id":28811202,"Users Score":0,"Answer":"No, it is likely not possible, depending on what you mean by \"everything\" and what you mean by \"scaled\". Any widget can be made to stretch to fill its allotted space. Text widgets and canvas widgets, for example, scale nicely. A button or label will fill the space it's in, but the text inside the widget won't change (that is also true of text and canvas widgets).\nIt's possible to organize your GUI so that when the window resizes, everything remains in its proper place at its original size. Having buttons that automatically scale is not something most people would expect. Disabling resizing usually results in a poor user experience -- users should have the ability to make a window larger or smaller.","Q_Score":0,"Tags":"python,tkinter,ttk","A_Id":28813514,"CreationDate":"2015-03-02T13:39:00.000","Title":"Tkinter - scale all components on resize?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Python C Api to embed a python in our application. Currently when users execute their scripts, we call PyRun_SimpleString(). Which runs fine.\nI would like to extend this functionality to allow users to run scripts in \"Debug\" mode, where like in a typical IDE, they would be allowed to set breakpointsm \"watches\", and generally step through their script.\nI've looked at the API specs, googled for similar functionality, but did not find anything that would help much.\nI did play with PyEval_SetTrace() which returns all the information I need, however, we execute the Python on the same thread as our main application and I have not found a way to \"pause\" python execution when the trace callback hits a line number that contains a user checked break point - and resuming the execution at a later point.\nI also see that there are various \"Frame\" functions like PyEval_EvalFrame() but not a whole lot of places that demo the proper usage. Perhaps these are the functions that I should be using?\nAny help would be much appreciated!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":179,"Q_Id":28817249,"Users Score":2,"Answer":"PyEval_SetTrace() is exactly the API that you need to use. Not sure why you need some additional way to \"pause\" the execution; when your callback has been called, the execution is already paused and will not resume until you return from the callback.","Q_Score":1,"Tags":"python,python-c-api","A_Id":28817512,"CreationDate":"2015-03-02T18:49:00.000","Title":"How to implement breakpoint functionality in a embedding of Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having trouble posting an erase background event to draw to the screen. In my full code, I want to draw a bitmap (DC.DrawBitmap()) when a button is clicked. I do that by posting an EVT_ERASE_BACKGROUND event which is caught by a custom bound method. However, once it is in that method, the event.GetDC() method that normally works fails.\nHere is a simplified code that has the same result:\n\nimport wx\n\nclass Foo(wx.Frame):\n    def __init__(self, parent, title):\n        wx.Frame.__init__ (self, parent, -1, title, size=(500,300))\n        self.panel = wx.Panel(self, -1)\n\n        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)\n        self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter)\n\n        self.Show()\n\n    def OnEraseBackground(self, e):\n        DC = e.GetDC()\n\n    def onEnter(self, e):\n        wx.PostEvent(self, wx.PyCommandEvent(wx.wxEVT_ERASE_BACKGROUND))\n\napp = wx.App()\nFoo(None, 'foo')\napp.MainLoop()\n\nThis raises:\nAttributeError: 'PyCommandEvent' object has no attribute 'GetDC'\n\nHow can I solve this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":499,"Q_Id":28824286,"Users Score":0,"Answer":"Worked on it for an hour without success before posting, then solved it myself five minutes later...\nHere's my solution, creating a ClientDC if the event doesn't have its own DC:\n\nimport wx\n\nclass Foo(wx.Frame):\n    def __init__(self, parent, title):\n        wx.Frame.__init__ (self, parent, -1, title, size=(500,300))\n        self.panel = wx.Panel(self, -1)\n\n        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)\n        self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter)\n\n        self.Show()\n\n    def OnEraseBackground(self, e):\n        try:\n            DC = e.GetDC()\n        except:\n            DC = wx.ClientDC(self)\n        DC.Clear()\n\n    def onEnter(self, e):\n        wx.PostEvent(self, wx.PyCommandEvent(wx.wxEVT_ERASE_BACKGROUND))\n\napp = wx.App()\nFoo(None, 'foo')\napp.MainLoop()","Q_Score":0,"Tags":"python,wxpython","A_Id":28824375,"CreationDate":"2015-03-03T04:47:00.000","Title":"wxpython Post Erase Background with DC","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a GUI with Tkinter, and I need to find a way to know if a widget (let's call it l = Label(root, text=\"test\")) is packed or not. I know I can do if l in Tk.pack_slaves(root):..., but this seems inefficient.\nIs there any way of adding a \"line\" to the widget.pack() method, such as telling it to set an attribute to widget.is_packed = True? Or is there a way of telling a class, On_method_call(pack()) do this?\nCheers.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":473,"Q_Id":28856501,"Users Score":2,"Answer":"No, there is no built-in way to do it. It's your code doing the packing, so you can store a flag in a dictionary, or create your own pack function to do that automatically.","Q_Score":0,"Tags":"python,macos,oop,tkinter","A_Id":28856654,"CreationDate":"2015-03-04T14:06:00.000","Title":"Tkinter \"on-pack\" method or \"is-packed\" attribute","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I create a QMainWindow without explicitly specifying its dimensions, PyQt will give it a -let's say- \"standard size\" which is not the minimum that the window can get.\nCan I set this size at will in any way?\nMy goal is to get this \"standard size\" according to the currently visible widgets, when I set the visibility of some widgets on\/off.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1830,"Q_Id":28915681,"Users Score":1,"Answer":"QWidget.sizeHint holds the recommended size for the widget. It's default implementation returns the layout's preferred size if the widget has a layout. So if your dialog has a layout, just use sizeHint to get the recommended size which is the default one.","Q_Score":0,"Tags":"python,qt,pyqt","A_Id":28923741,"CreationDate":"2015-03-07T14:04:00.000","Title":"how to get the default size of a window in pyqt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have this game which I have coded in python with pygame.\nWhen I launch my game through the renpy launcher, it works just fine. \nWhen I emulate my game through the renpy android emulator, it works just fine.\nWhen I go through each of the build steps (install sdk, configure, build package, install package) it completes successfully.\nThe package is installed on my connected android device. \nWhen I open the game on my android device, it says:\n\"ImportError: No module named renpygame.\"\nWhen I build the game and play it on my desktop I don't have this problem.\nI'm guessing somehow renpygame is not getting included in the package when I go through the build process in renpy for Android, but I don't know why or how to fix it. I'm not even getting an error message, I don't know where to start.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1556,"Q_Id":28921997,"Users Score":1,"Answer":"I e-mailed PyTom, the creator of Ren'py, and he responded back instantly:\n\"Edit the rapt\/blacklist.txt file, and delete the line that says **.py. \"\nIt worked! Thanks, PyTom.","Q_Score":0,"Tags":"python,android,pygame,renpy","A_Id":28922150,"CreationDate":"2015-03-08T01:11:00.000","Title":"Ren'Py with Renpygame for Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Notebook and add two panels to it.  When I try to get the usable area of one of the panels, it returns (20,20) -- I imagine this is its size before stuff is put in.  I want to get this size before I put stuff in because some proportions depend on it and I'd prefer not using absolutes.  \nI haven't set an actual size, I just sized everything with a boxsizer and set proportions.  I'd like to get the actual pixel width of the area allotted to the panel (it doesn't take up the entire program window area).\nI've tried calling Layout before GetSize, I've tried GetVirtualSize and Get ClientSize and any other available size returns, still (20, 20) or sometimes (10,40).  I've tried getting the parent size, no go.  I get the grandparent size and it shows correctly, but this is the size of the entire program window.  Is there a way to get the potentially usable area of a panel?  If need be, I can post the layout, but it's long.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":172,"Q_Id":28931533,"Users Score":1,"Answer":"It sounds like you are trying to do this at the time of the creation of the window, before the initial layout and sizing is done, so everything still has its initial size.  There are some alternative ways to deal with this situation.  You could delay creating the content of the panel until the first size event.  Or you could design your sizer layout to be adaptable to any (resonable) size.  Or you could adjust\/redo the sizer layout later if needed.  \nOr perhaps the easiest would be to send a fake size event to the parent or top-level parent so they will do what their normal layout resizing the child windows, which will cascade to your panel.  This may not work in all situations, but it is common enough that there is a window method for it, SendSizeEvent.","Q_Score":0,"Tags":"user-interface,wxpython","A_Id":28946737,"CreationDate":"2015-03-08T20:30:00.000","Title":"wxPython -- GetSize doesn't return actual size","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There's a method to set the \"letter spacing\" for a wx.TextCtrl? (or another widget where I can show a small phrase)\nOr is a property of the wx.Font?\nOr is a inherent property of the font face I'm using?\nA work-around I could implement is to write my custom control (maybe derived from RichTextCtrl) where I draw each character one by one, and add the selected spacing between them. But then it would be a lot less efficient to calculate (giving an example) the area of the text. This is rather simple with a ClientDC.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":83,"Q_Id":28972266,"Users Score":0,"Answer":"No, I don't believe this is a feature of any of the text controls or their variants. You could set the wx.Font to a monospace font, but that's probably about as good as you can get going the \"automatic\" way. I would recommend drawing it yourself if that's really what you need.","Q_Score":0,"Tags":"fonts,wxpython,label,spacing","A_Id":28973871,"CreationDate":"2015-03-10T19:17:00.000","Title":"Letter spacing in wxpython widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is the situation I have:\nI created an installer. It has python scripts, executable, and other file types. In the installer, I run a C# executable as a custom action, after registering the product. The C# executable moves the files into different locations (i.e. a text document will be moved to My Documents). I understand I can do this without the custom actions, but I was not aware of that when I created the installer.\nNow, after I have distributed the software, users are running into small bugs. For instance, there is a bad if check in one of the python scripts. \nQuestion Is there a way to fix the portion of the python script\/executable\/text document that is broken, and simply update those files (without having to redistribute the software to the users, and having them reinstall it)?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":28972637,"Users Score":0,"Answer":"A patch probably won't help you. If the locations are fixed within the install, a minor upgrade could do the trick, if you make all the files that need to stay the same \"never overwrite\" (unless the custom action ignores this, then things might get difficult).\nIf the locations are determined during the execution of the custom action, or the locations are based on user input during the install, then you have a problem if you haven't saved the location paths (in the registry, for example). I don't think you want a custom action to scan all the drives of the computer just to find the files.\nIf the files are put in their new locations by the custom action, windows installer probably won't see them as key files and probably won't \"repair\" them in any scenario. If the fixes are few, you might be better of distributing the files separately with a clear instruction, in stead of spending many hours on a difficult new custom action.\nCheers, B.","Q_Score":0,"Tags":"c#,python,installshield,patch,software-distribution","A_Id":28975982,"CreationDate":"2015-03-10T19:38:00.000","Title":"Upgrading Application using InstallShield","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Sorry, thought i edited to say i am on windows 64 bit\nWhen trying to install Pygame using pip, I get the following error:\n\n\"requirement 'pygame.whl' looks like a file name, but the file does not exist pygame.whl is not a valid wheel filename.\"\n\nI have my file paths right and pip is working. I have attempted to install 32 bit and 64 bit pygame but neither is working. In the command prompt I enter \"pip install pygame.whl\" (I renamed the file which I don't think should matter and it is saved under downloads).\nHow can I resolve this error?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2022,"Q_Id":28997501,"Users Score":0,"Answer":"Thankyou so much for your help ventsyv, i finally figured it out. i believe it was an issue with the installer from pygames site. i found another site with a link to pygame and specifically for python 3.4.2. i now have no error messages and its working great. Thanks for putting up with me haha.","Q_Score":1,"Tags":"python,installation,pygame,pip","A_Id":29056557,"CreationDate":"2015-03-11T21:15:00.000","Title":"Error while installing pygame using pip for python 3.4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to run scripts on qpython3, android 5.0.1 and when executing the scripts nothing happens. Even the example scripts that are installed with the app. Interactive mode\/running commands in console does work, only scripts don't. What could be the reason?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1329,"Q_Id":29031089,"Users Score":1,"Answer":"I had that issue on 4.4.4. Hit Run in the editor, then in the console it brings up you can cd to the directory the program is in and use the command 'python file.py' to start the program. It's a little annoying, but it's better than not being able to run programs at all. This problem disappeared for me on 5.1.1.","Q_Score":0,"Tags":"python,python-3.x,qpython,qpython3","A_Id":30599421,"CreationDate":"2015-03-13T11:29:00.000","Title":"Scripts won't run on QPython3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm programming python + Gtk3.\nI have a Gtk.TreeView with a Gtk.ListStore as model.\nAt some point of the program I need to destroy the treeview in order to put a fresh one on it's place.\nHowever I don't know what happens with the model. Should I destroy it, clear it, or just leve it there and let python to eat it?\nI've also thinked in recycle the same model to the new treeview, but I'd prefer not: too much trouble...\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":79,"Q_Id":29044228,"Users Score":1,"Answer":"You can leave it to Python's garbage collector, the same way it would go if you'd close the application (it will call g_object_unref on both).\nThat said, remember that the idea behind the separation of models and views, is that you can mix them the way you like, i.e. display the same model in different views or even alternatively displaying different models in the same view. That you need to replace both may indicate problems in the way you are designing your UI.","Q_Score":1,"Tags":"python,treeview,gtk3,treemodel","A_Id":29044826,"CreationDate":"2015-03-14T00:51:00.000","Title":"Should I 'destroy' a liststore (model of treeview) when destroy treeview?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to add colorless icons to menu items. To look reasonably, the icons should have the same color as the text used in the menu. It works everywhere except Ubuntu. The problem is that the default Ubuntu Unity theme uses different colors for the main menu and for other text (e.g. popup menus) in the application. I need the color specifically used by the main menu.\nQApplication.palette().color(QPalette.Text) returns the dark gray color used by text in the application. It's almost invisible on the dark gray menu background.\nI tried the palette() method on a QMenu descendant, but it returns the same value as QApplication.palette().","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":332,"Q_Id":29045905,"Users Score":0,"Answer":"It turns out QMainWindow.menuBar().palette() has colors matching the Unity menu on top of the screen (I just learned it's called appmenu). That makes it possible to use the same color as the menu text.\nBut there is a problem. The version of the icon for the QtIcon.Active mode is not used for the active menu item. That can be seen in the high contrast mode. The text color changes, but the icon color doesn't. The icon \"disappears\" when the menu item is selected. That's not good enough for a polished program.\nI tried many workarounds, such as adding extra pixmaps to the icon with QIcon.addPixmap(). Nothing works. The appmenu operates in a separate process and doesn't want to our \"Active\" icon. So I'm going to draw real icons that look good on any reasonable background and don't need to change color with the widget.\nToo bad. I expected that the QIcon mode and state were made specifically for such tasks.","Q_Score":1,"Tags":"python,qt,ubuntu,pyqt,themes","A_Id":29109067,"CreationDate":"2015-03-14T05:49:00.000","Title":"PyQt: How to find menu text color in that works with Ubuntu Unity?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As we all know, when developing an Android app in native Java, we use activities. I was wondering that, in developing Android apps in Python(with Kivy), does Kivy implements activities for the apps in itself or not? because I don't see any activity implementation on the sample codes.\nIf it doesn't implement activities, Do we lose performance or any functionality in the application compared to coding in native Java?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1092,"Q_Id":29058419,"Users Score":2,"Answer":"Simply put, you can use Activities (starting them using pyjnius), but not really define them, at least, it's not usually the way one work with kivy.\nKivy doesn't adjust its way of working for targetted platform, it uses its own systems, and make them work there. For what i know the advantages of separating Activities on android is just a way to make your code more neatly organized, and doesn't imply performance changes. It can allow you to start your app in various ways (from a share, for example) but you can do that with p4a\/buildozer too, by dispatching messages about the intent, if you need to. With kivy, you'll organise your code like you would do for any python project, using modules.","Q_Score":5,"Tags":"android,python,kivy","A_Id":29059931,"CreationDate":"2015-03-15T07:48:00.000","Title":"Python - Does Kivy implements activities in the Android apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As we all know, when developing an Android app in native Java, we use activities. I was wondering that, in developing Android apps in Python(with Kivy), does Kivy implements activities for the apps in itself or not? because I don't see any activity implementation on the sample codes.\nIf it doesn't implement activities, Do we lose performance or any functionality in the application compared to coding in native Java?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1092,"Q_Id":29058419,"Users Score":1,"Answer":"Kivy is a great tool for developing Android Apps. The best advantage of using Kivy is that it is cross platform and the same project can be used to publish apps on mutti-platforms.\nHowever , it has some performance related disadvantages(as do most cross-platform tools like unity , cocos etc). If you're developing only for Android , I'd suggest taking a look into development tools which use Java. This will help create a smaller APK file which in turn helps in better user retention.\nI guess you are real loyal fan of Python, but I have to tell you about its advantage and disadvantage.\nAdvantages\n\nPure python and its almightiness is in your hand.\nRelatively simple to deploy with buildozer without any need to dive too deep into the details of particular platform.\nYou can run your app on desktop also, so there is no need to install some extra emulators\/VMs to get it work\n\nDisadvantages\n\nNot that much information in Internet, even on stackoverflow\nPretty messy documentation\nNo obvious way to test the application\nNot obvious machanisms of placing widgets, especially in built in layouts, which causes situations like: you want place widget in the center of it's parent, but kivy places it anywhere but not where you want it to be.\nOfficial examples are quite ugly, so you may get false vision of how your application could look like.","Q_Score":5,"Tags":"android,python,kivy","A_Id":29058632,"CreationDate":"2015-03-15T07:48:00.000","Title":"Python - Does Kivy implements activities in the Android apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I recently used homebrew to install pyqt (along with qt & sip), but get an import error whenever I try to import PyQt4 in Python 3 (which was also installed using homebrew). To confuse matters more, I am able to import PyQt4 on Python 2 via the terminal.\nI'm totally new to working with Python packages and, with that, totally confused. Any thoughts on how I might be able to undo what I did and reinstall so that I can access PyQt via the usr\/local\/python3 installation?\nThanks in advance!","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":562,"Q_Id":29069364,"Users Score":2,"Answer":"brew reinstall pyqt --with-python3 will get you sorted!","Q_Score":0,"Tags":"python,homebrew","A_Id":29091698,"CreationDate":"2015-03-16T03:47:00.000","Title":"Python 3 can't find homebrew pyqt installation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm using wxpython.\nI'd like to solve a simple problem for a GUI that consists of a button \"Add\", which when pressed creates a new button called \"Remove\". You can press \"Add\" as many times as you like and many remove buttons are created and added to the panel.\nWhat I would like is for when you press one of the remove buttons, that remove button itself is removed from the panel.\nThe problem is when you bind a function to a button with this:\nself.Bind(wx.EVT_BUTTON, self.remove_function, button_name)\nyou can't pass an argument to the function telling it which button to remove. (Or can you?)","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":2124,"Q_Id":29100233,"Users Score":1,"Answer":"If your trouble is to pass an argument to the function, consider following:\nself.Bind(wx.EVT_BUTTON, lambda e: otherFunction(arg1, arg2), button_name)","Q_Score":1,"Tags":"wxpython","A_Id":29101131,"CreationDate":"2015-03-17T13:23:00.000","Title":"A simple example for adding and removing buttons in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am coding a Tkinter GUI for a senior research project at school.\nI need to, at some point in the code, reset the counter used to create id values for new additions.  Does anyone know if this is possible beside replacing the entire canvas?  Basically, after adding a bunch of lines and ovals, I need to delete them all and restart the counter at 1 for new ones.\nSecond, I have taken the path of replacing the entire canvas, and afterwards, nothing EVER shows up in the winfo_get() method.  Why could this be?  I know I'm trying to do something that TKinter isn't supposed to do, but it must be possible.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":813,"Q_Id":29107842,"Users Score":2,"Answer":"It is not possible to reset the id numbers generated by a canvas. \nYour solution of deleting and recreating the canvas is a reasonable alternative, though it may not be necessary. There are probably better ways to do whatever it is you think is solved by resetting canvas ids. For example, you could generate your own ids, and associate each id with each canvas item as a tag. You can then reset the ids any time you want.","Q_Score":2,"Tags":"python,tkinter,tkinter-canvas","A_Id":29107985,"CreationDate":"2015-03-17T19:18:00.000","Title":"Tkinter Canvas reset ID's","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a Python module designed to solve the Tetris cube tiling puzzle, and it contains a lot of code, but it doesn't want to run, when I press f5 to run the program, the shell restarts, but then stops working, even when I enable debugging nothing happens still. I put a print statement at the very start of the program, yet it is not executed, and I cannot terminate the program using ctrl-c. I was able to fix this problem by putting some of the functions I had defined into a separate module, and now it works fine, but if I create a new function, and add enough print statements, the problem reappears, but can be fixed by just removing one statement.\nThe version of Python I am using is Python 2.7.8","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":118,"Q_Id":29111073,"Users Score":0,"Answer":"The problem seems to have been an issue with the version of python I had installed. A new installation is able to run long modules fine, without any noticeable delay even from pressing f5 to first print statement.","Q_Score":0,"Tags":"python,module,compilation","A_Id":31042764,"CreationDate":"2015-03-17T22:40:00.000","Title":"Does python have a limitation on the amount of code in a module?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any form to set a 100% of horizontal size for TextCtrl in Toolbar?\nBecause I have been looking for about this in the documentation and I did not found anything.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":20,"Q_Id":29112631,"Users Score":0,"Answer":"You probably can't do that in a normal toolbar. However, you can easily just roll your own toolbar by using a horizontally oriented BoxSizer and adding the necessary widgets to it. Then you can add the text control with the correct proportion and the wx.EXPAND flag.","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":29130791,"CreationDate":"2015-03-18T01:20:00.000","Title":"Is there any form to set a 100% of horizontal size for TextCtrl in Toolbar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'am trying to build an e-commerce website using turbogears. Initially I modified the tgapp-photos to make the items come on the page properly. But then I find it difficult to make cart from the scratch and hence thought to use stroller. However, when I'am plugging it in the config.py file, all of a sudden my app stops. And moreover it is not showing any error too, it just stops. Could someone please tell me what wrong am I doing. \nCan I use satchless or shoppingCart in the turbogears framework?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":56,"Q_Id":29116195,"Users Score":0,"Answer":"Stroller is a pretty old project that is not maintained anymore. The reason why it was not working for you is that it was still pending some changes required to make it compatible with TG2.3+, it was compatible only with <=2.2. And so was looking for some Pylons imports.\nTo solve your problem I just released stroller 0.5.1 which is now compatible with TG2.3, please keep in mind that as it is a pretty old project it depends on ToscaWidgets1 and doesn't work with TW2 so you should:\n\nRemove tw2.forms dependency from your project setup.py\nUninstall tw2.core and tw2.forms from your virtualenv (if they are available sprox will use tw2 and some forms in stroller won't work)\nchange base_config.prefer_toscawidgets2 in base_config.use_toscawidgets = True\n\nThose are the required step to disable ToscaWidgets2 in your project and revert back to ToscaWidgets1 which is required by stroller.","Q_Score":0,"Tags":"python-2.7,e-commerce,shopping-cart,turbogears2,satchless","A_Id":29133585,"CreationDate":"2015-03-18T07:20:00.000","Title":"stroller (turbogears) not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been working really hard trying to find a solution to this for the past few weeks. I have committed to a direction now, but I am still not entirely satisfied with what I have come up with. Asking this now purely out of curiosity and for hope of a more proper solution for next time.\nHow on earth do I keep multiple QAbstractItemModel classes in sync that are referring to the same source data but displaying in different ways in the tree view?\nOne of the main reasons for using model\/view is to keep multiple views in sync with one another. However, if each of my views requires different data being displayed at the same column, as far as I can tell I need to then subclass my model to two different models with different implementations that will then cater to each of those unique view displays of the same items.\nUnderlying source items are the same, but data displayed is different. Maybe the flags are different as well, so that the user can only select top level items in one view and then can only select child items in the other view.\nI'll try to give an example:\nLets say my TreeItem has three properties: a, b, c.\nI have two tree views: TreeView1, TreeView2. Each has two columns.\nTreeView1 displays data as follows: column1 -> a, column2 -> b\nTreeView2 displays data as follows: column1 -> a, column2 -> c\nI then need to create two different models, one for TreeView1 and one for TreeView2, and override the data and flags methods appropriately for each.\nSince they are now different models, even though they are both referring to the same TreeItem in the background, they are no longer staying in sync. I have to manually call the refresh on TreeView2 whenever I change data on TreeView1, and vice versa.\nConsider that column1, or property a, is editable and allows the user to set the name of the TreeItem. Desired behaviour would be for the edit that is done in TreeView1 to instantly be reflected in TreeView2.\nI feel like I am missing some important design pattern or something when approaching this. Can anyone out there see where I am going wrong and correct me? Or is this a correct interpretation?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":442,"Q_Id":29132741,"Users Score":2,"Answer":"One way to do it is to use viewmodels. Have one QAbstractItemModel adapter to your underlying data model. All interaction must pass through that model. When you need to further adapt the data to a view, simply use a proxy view model class that refers to the adapter above and reformats\/adapts the data for a view. All the view models will then be automagically synchronized. They can derive from QAbstractProxyModel, although that's not strictly necessary.\nThere is no other way of doing it if the underlying source of data doesn't provide change notification both for the contents and for the structure. If the underlying data source provides relevant notifications, it might as well be a QAbstractItemModel to begin with :)","Q_Score":2,"Tags":"python,qt,pyqt,pyside","A_Id":29132919,"CreationDate":"2015-03-18T21:10:00.000","Title":"How to keep multiple QAbstractItemModel classes in sync","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Okay, so I am brand new at this and I really need for this to be dumbed down for me. My python version is 2.7.9 and I downloaded pygame-1.9.1.win32-py2.7.msi and I am on a windows computer. I really need someone to explain why this is not working. I was reading on some of the other questions that you have to change the path of python and I have no idea how to do that. I am literally screwed because I have to turn something in for a major grade and I have literally been trying to figure this out for like about four weeks now.\nWhen I try to import pygame, I get this error message and I have absolutely no idea what I am doing wrong:\n\nTraceback (most recent call last):   File\n  \"C:\\Users\\Tiffany\\Documents\\NetBeansProjects\\NewPythonProject\\src\\newpythonproject.py\",\n  line 3, in \n      import pygame ImportError: No module named pygame","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3786,"Q_Id":29190350,"Users Score":0,"Answer":"There is only really only one way to do this:\n\nCreate a folder\nPut the Python Interpreter you are using in that folder\nPut the PyGame module you are using in that same folder\n\nAnd your problem is now solved. I hope this helps you!","Q_Score":0,"Tags":"python-2.7,pygame,importerror","A_Id":29221166,"CreationDate":"2015-03-22T02:39:00.000","Title":"ImportError: No module named pygame and how to change the path of pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a monitoring program for the control system at our plant. It is basically a GUI which lets the operator see the current status of the lock of the closed loop system and aware the operator in case the lock\/loop breaks.\nNow, the operation is heavily dependent on the responses of the GUI. My seniors told me that they prefer just the console prints instead of using TKinter based GUI as TKinter has lags while working in real time.\nCan anyone please comment on this aspect?\nCan this lag be checked and corrected?\nThanks in advance.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1676,"Q_Id":29190427,"Users Score":0,"Answer":"I would say that if your program is simply accessing data and not interacting with the data, then a GUI seems to be a bit of overkill. GUI's are guided user interfaces, as you know, and are made for guiding a user through an interface. If the interface is just a status, as you indicated, then I see nothing wrong with a console program.\nIf, however, your program also interacts with data in a way that would be difficult without a GUI, then the GUI is likely the right choice.\nHave you considered a GUI in another programming language? Python is known to be a bit slow, even in console. In my experience, C++ is faster in terms of viewing data. Best of luck!","Q_Score":1,"Tags":"python,user-interface,tkinter","A_Id":29191478,"CreationDate":"2015-03-22T02:53:00.000","Title":"Python TKinter for real time GUIs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Background\nI am working on a program that needs to find a list of open Metro apps. I originally tried using pure python with ctypes and using win32 api. Unfortunately, I couldn't get the names of Metro apps. So I moved on to IronPython thinking I could leverage a .net function or two to get what I want. No luck.\nWhere I am at\nI can easily get a list of running processes and their PID, but filtering the Metro apps from the non-metro apps is proving near impossible. Also, I need to get the HWND of that window so I can interact with it.\nWhat Won't Work\nEnumWindows doesn't seem to work. FindWindowEx seems promising, but I am not sure how to do this.\nThanks in advance.\nEDIT: I am now able to get what I want using IsImmersiveProcess, but the process list is doesn't include the Windows Apps.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":121,"Q_Id":29197996,"Users Score":0,"Answer":"I don't think MS  allows this functionality. As an alternative, you can have the user put their mouse over the window and press a keyboard shortcut (What I am doing). \nThat is the best one can do.","Q_Score":0,"Tags":"c#,python,windows-8,windows-store-apps,ironpython","A_Id":29978493,"CreationDate":"2015-03-22T18:11:00.000","Title":"IronPython-List Open Metro Apps only","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Up until now to move widgets I have been issuing another .place on it.  I wonder if that is creating another instance of the widget in memory or not?  \nIf it is creating another copy in memory, what is the correct way to move a widget when using place?  Do I need to keep destroying the widget and placing it perhaps over and over?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":13,"Q_Id":29200214,"Users Score":0,"Answer":"Now that I think about it, as long as I do a .place_forget() prior to any .place that should take care of any extra instances in memory.  Can anyone confirm?","Q_Score":0,"Tags":"python,widget","A_Id":29200555,"CreationDate":"2015-03-22T21:43:00.000","Title":"Python: When using place what is the correct way to move widgets?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a heads-up display that pops up it's frame, taking focus from the previous application and then gives focus back to that application when it's done.\nwxPython frames have Hide and Show methods that work but don't focus the application. Also, there's SetFocus which you'd think would do it but doesn't.\nUpdate\nI found a nasty hack that works. Rather than hide and show the frame, you save the app state and close the app instead of hiding. Then when you want to show again you spark a new one in a new multiprocessing.Process. Hardly ideal though. I hope someone has something better.\nClarification\nTo clarify, I'm trying to get the keyboard focus, not just to get the frame on top of the stack.\nThis issue might be specific to OS X.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":542,"Q_Id":29222699,"Users Score":2,"Answer":"You might be able to steal focus by calling Raise on the frame. There is the wx.STAY_ON_TOP style flag that could also be applied. Then you might be able to just use the frame's Show and Hide methods to make it work.\nDepending on what exactly you want to do, you might take a look at the ToasterBox widget. I can't recall if it actually steals focus, but it just pop up and go away on its own, which is handy in some cases.","Q_Score":1,"Tags":"python,wxpython,wxwidgets","A_Id":29233860,"CreationDate":"2015-03-24T00:03:00.000","Title":"How can a wxpython frame \"steal\" and \"return\" focus similar to the Dash app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've recently begun programming with QPython3 on my android phone, and I've found it slightly annoying that the console pops up whenever I run a script. I often have it sending the output through a Toast since I usually only need the information for a second. \nIs there a way I can make it, either within my script or in the settings of QPython3, that the console is default to the background while running a script? \nThank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":733,"Q_Id":29247204,"Users Score":0,"Answer":"Try to insert the \"#qpy:console\" into your script, does it work for you ?","Q_Score":0,"Tags":"qpython,qpython3","A_Id":29415173,"CreationDate":"2015-03-25T04:00:00.000","Title":"QPython 3 console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can I control the \"Wrap Text\" property of a cell using Python+xlwings?","AnswerCount":4,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2055,"Q_Id":29258237,"Users Score":2,"Answer":"For anybody like me who comes to this now and doesn't find these solutions are working, I found accessing the pywin32 API directly with work_sheet.range('A:A').api.WrapText = True worked in Python 3.7 and xlwings 0.15.8 in Windows 7 and Excel 2010.","Q_Score":2,"Tags":"python,excel,python-2.7,xlwings","A_Id":57833558,"CreationDate":"2015-03-25T14:17:00.000","Title":"Does xlwings support \"Wrap Text\" property?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a working C program and now I'm embedding a python script implementing a specific function.\nThe question is, the arguments passed into Python is a complicated(I mean nested) C structure defined in C. And I hope the solution would be able to do the two ways communication easily:\n1.Create structure in C, and pass it into Python. Let the Python do some modification.\n2.Create the structure in Python. And pass it back to C.\nI was trying \"SWIG\" to generate some wrappers for the structure, as well as some helper functions using SWIG for Python so that it could return me some nested part of the structure so that I could visit the structure through Python easily.\nWill this be a good solution or I may miss some very simple way of solving it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":134,"Q_Id":29269401,"Users Score":0,"Answer":"In my experience, SWIG should be able to handle arbitrarily nested structs the way you'd \"expect\". \u2013  brunobeltran0","Q_Score":0,"Tags":"python,c,structure,swig,mixed-programming","A_Id":32625890,"CreationDate":"2015-03-26T01:12:00.000","Title":"How do I pass C structure into Python when embedding a Python module in a C program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a program which use thread in Tkinter. It works fine when I run this program on linux, but when the same program run on Windows it doesn't work. \nProblem exist when loop (which is run under thread) is ended and call function which cause to appear Toplevel window\nAny suggestions??","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":391,"Q_Id":29295830,"Users Score":4,"Answer":"Generally speaking, you can't use threading with Tkinter. Or more accurately, you can only access tkinter widgets and functions from the thread that created them. If your thread is creating a window, that simply will not work on windows, and may work non-deterministically on other platforms.","Q_Score":0,"Tags":"python,multithreading,tkinter","A_Id":29298504,"CreationDate":"2015-03-27T08:00:00.000","Title":"Is there any difference in threading between Linux and Windows on python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Just like the title implies, is there any difference? I was using             pygame.display.flip and I saw on the Internet that instead of using flip they used pygame.display.update. Which one is faster?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":55985,"Q_Id":29314987,"Users Score":1,"Answer":"pygame.display.flip() updates the whole screen.\npygame.display.update() updates only specific section but with no arguments works similar to the pygame.display.flip().","Q_Score":42,"Tags":"python,pygame,python-2.x","A_Id":67557797,"CreationDate":"2015-03-28T08:03:00.000","Title":"Difference between pygame.display.update and pygame.display.flip","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Just like the title implies, is there any difference? I was using             pygame.display.flip and I saw on the Internet that instead of using flip they used pygame.display.update. Which one is faster?","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":55985,"Q_Id":29314987,"Users Score":9,"Answer":"Flip will always update the entire screen. Update also update the entire screen, if you don't give argument. But if you give surface(s) as arguments, it will update only these surfaces. So it can be faster, depending on how many surfaces you give it and their width and height.","Q_Score":42,"Tags":"python,pygame,python-2.x","A_Id":29316190,"CreationDate":"2015-03-28T08:03:00.000","Title":"Difference between pygame.display.update and pygame.display.flip","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I realize the short answer may be 'no,' but perhaps this is worth asking again.\nIf I am witting a Kivy app with a couple thousand of lines - then would it be possible to write some classes in another kv file?\nThis would make it so much easier to edit, correct errors, make changes... etc.\nJust to clarify - the .KV files would be a continuation of each other - not pointing to a parallel app.\nSome expert insight would be greatly appreciated - Thank you.","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":11529,"Q_Id":29332868,"Users Score":2,"Answer":"I believe you can create muliple .kv files and can include at one place (root file) by this way only you can distribute\/branch your code\nKivy documentation clearly says \"A kv file must contain only one root widget at most\"\nmeans only one kv main file. even if you run multiple instances of Mainapp class\nI'm newer to the Kivy, so please correct me if I'm wrong.\nThank you !","Q_Score":21,"Tags":"python,kivy","A_Id":61815101,"CreationDate":"2015-03-29T18:10:00.000","Title":"Is it possible to read from more than one .kv file in Kivy app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I saw that there are 2 ways for use the ui file with pyside. It's possible to convert or to load file. What is the best performance between this 2 solutions ?\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":29345617,"Users Score":0,"Answer":"Conversion processes the ui file once and creates a static module. Loading the ui file at runtime processes it every time the application is run. So obviously any difference in performance is going to be roughly equal to the overhead of processing the ui file.\nHaving said that, runtime performance is probably not a good reason for choosing between them. Most people prefer one over the other simply because it provides a better fit for their development process.","Q_Score":0,"Tags":"python,pyside,benchmarking","A_Id":29354758,"CreationDate":"2015-03-30T11:56:00.000","Title":"performance between converted and loaded file with pyside","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As I am more familiar with tkinter than Qt, is it possible to have a tkinter frame populate with a C++ application to enable the manipulation of visio files.  The end result would hopefully be to have a portable .exe that would connect to an access database for line item tracking, and the Visio \"canvas\" to manipulate visual layouts of work spaces.\nI am very new to programming, and learning as I go...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":96,"Q_Id":29351650,"Users Score":2,"Answer":"I don't think you can embed ActiveX controls like the one provided by Visio (it's probably what you refer to as \"visio canvas\") in tkinter. Even with Qt, this may be not that straightforward.\nThe second thing is, \"visio canvas\" won't work without Visio installed - not sure if that's okay with you. Means, your users first would have to install Visio (and provide a license) and then your .exe which uses Visio as \"canvas\".\nIf you want a sand-alone exe, I would recommend you to use whatever is available in your framework instead of Visio.","Q_Score":0,"Tags":"python,ms-access,visual-c++,tkinter,visio","A_Id":29352732,"CreationDate":"2015-03-30T16:40:00.000","Title":"C++ \"canvas\" inside of tkinter frame to manipulate MS visio files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"resized_image = Image.resize((100,200));\nImage is Python-Pillow Image class, and i've used the resize function to resize the original image,\nHow do i find the new file-size (in bytes) of the resized_image without having to save to disk and then reading it again","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1687,"Q_Id":29368155,"Users Score":0,"Answer":"You can't. PIL deals with image manipulations in memory. There's no way of knowing the size it will have on disk in a specific format.\nYou can save it to a temp file and read the size using os.stat('\/tmp\/tempfile.jpg').st_size","Q_Score":2,"Tags":"python,python-imaging-library,pillow","A_Id":29368336,"CreationDate":"2015-03-31T12:00:00.000","Title":"How to get image size in python-pillow after resize?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My application have a window which handle key press events. When user press a key I run some long tasks and during a task I update a label on the window. To update the label while task is still running I call the following code.\nwhile gtk.events_pending():\n    gtk.main_iteration(False)\nThis update the label but problem is that it process all the events including key presses. if user press a key while a tasks is running calling main_iteration start processing that task. I want that it should only update the label but any other events should not be processed . Those events should be processed when task is completed.\nOne way to do this is to remove the key press handler or with in that keypress handler check if task is running then ignore the key presses but in this way keypresses will be lost. I want that somehow it should only update the label but leave other events and those events should be handled after task is completed and application become idle.  Is there a way to do this?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":280,"Q_Id":29395356,"Users Score":1,"Answer":"You want the .queue_draw() and related GtkWidget methods. Note that these will mark your widget as needing redraw when you get back to the main loop; I don't think GTK+ has a method for drawing right now (but marking as dirty and letting the system redraw when it's ready is usually better for optimization reasons).","Q_Score":0,"Tags":"python,events,widget,gtk,redraw","A_Id":29396431,"CreationDate":"2015-04-01T15:52:00.000","Title":"How to redraw gtk widget in python without calling gtk.main_iteration?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My question is : is it possible to put ads on a tkinter program , something like google ads or something , because I made a program which a lot of people started using and I am not getting any benefits from it , is there a way ?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1029,"Q_Id":29446102,"Users Score":3,"Answer":"There is nothing built-in to tkinter, nor available as a third party library, that makes it possible to display an ad and receive revenue from it.","Q_Score":3,"Tags":"python,python-2.7,tkinter","A_Id":29446371,"CreationDate":"2015-04-04T11:55:00.000","Title":"Advertising on a tkinter program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running a simple client-server program written in python, on my android phone using QPython and QPython3. I need to pass some commandline parameters. How do I do that?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2584,"Q_Id":29456031,"Users Score":0,"Answer":"Just write a wrapper script which get the parameters and pass to the real script using some function like execfile, and put the script into \/sdcard\/com.hipipal.qpyplus\/scripts or \/sdcard\/com.hipipal.qpyplus\/scripts3 (for qpython3).\nThen you can see the script in scripts when clicking the start button.","Q_Score":2,"Tags":"qpython,qpython3","A_Id":29654733,"CreationDate":"2015-04-05T09:44:00.000","Title":"Passing commandline arguments to QPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I setup Spyder to highlight and auto-complete kivy files (.kv)?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":707,"Q_Id":29467603,"Users Score":1,"Answer":"(Spdyer dev here) There is no way at the moment for Spyder to highlight kivy files, sorry :-(","Q_Score":0,"Tags":"python,kivy,spyder","A_Id":29635815,"CreationDate":"2015-04-06T08:09:00.000","Title":"How do I setup Spyder to highlight and auto-complete kivy files (.kv)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"The question I have as the title says is on the idea of setting up a graph in pygame that graphs sub-pixel coordinates. \nSomething a friend and I spoke of was how I could try to make a function graphing program for fun in python, and I thought about how I could use it, but I found a few issues. \nThe first one was the use of range, due to it using integers and not floats, but arange from numpy fixed that problem, but that brings me to the second issue. \nThe idea for the graph I thought about so that it would be simple, not making massive thick lines or odd shaped one, is that it uses display.set_at to make a single pixel a color. And for simple graphs, this works perfectly. But when I went into more complicated graphs, I ran into two main errors: \n\nThe first error is that the graph shows pixels without any line between them, the idea of the line was the illusion of having all of the pixels near each other. But I found that with a range step of one in range, it leaves this gap. In theory, using arange with a step of .01, the gaps would vanish all together, but this brings to the second problem.\nThe display.set_at does not work with sub-pixel coordinates. Would anyone be able to suggest a way to make this work? It would be most appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":312,"Q_Id":29484408,"Users Score":0,"Answer":"Instead of setting each individual pixel, use pygame's line drawing function to draw a line from the current coordinate to the next instead of using sub-pixel coordinates (pygame.draw.line or even pygame.draw.lines).\nThis way, the \"gaps\" between two points are filled; no need for sub-pixel coordinates.\nYou just have to draw the lines in the right order; just ensure the coordinates are sorted.\n\nOther than that, you could also simple convert your sub-pixel coordinates by casting the x\/y values to integers.","Q_Score":0,"Tags":"python,numpy,pygame","A_Id":29488142,"CreationDate":"2015-04-07T05:29:00.000","Title":"Pygame, sub-pixel coordinates.","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I run python using Winpython. I would like to use the GUI libraries from wxpython in my Spyder IDE. I tried the wxpython installer but for some reason the packages are not copied to the WinPython\\python\\Lib\\site-packages folder. I also tried the build it \"Winpython Control Panel\" which is supposed to add new packages but dragging and dropping the installer file didn't really work.\nHow can I install wxpython so that I can use it from Winpython Spyder?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1863,"Q_Id":29509526,"Users Score":1,"Answer":"So I managed to find a solution to my problem. \nWinpython has the option to \"register\" the distribution, this will add associate file extensions, add icons, and importantly for my case, register WinPython as a standard Python distribution. When I registered my copy of Winpython, in the Advanced tab of the Winpython control panel , the wxPython installer was able to see Winpython in the Windows registry and copy all the files to the corresponding folders. \nNow if I run: import wx, it works","Q_Score":1,"Tags":"python,wxpython,spyder","A_Id":29619247,"CreationDate":"2015-04-08T08:25:00.000","Title":"Installing\/running wxpython on Winpython Spyder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I choose photo in Kivy ?\nI couldn't see a module to see and select a photo.\nfrom kivy.uix.filechooser import FileChooserListView\nshows files by names \nThank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":259,"Q_Id":29513493,"Users Score":0,"Answer":"There is no built in widget for displaying photos, the Kivy philosophy is instead to make it easy to build such a thing from component widgets, e.g. in this case layouts and Image widgets probably.\nThat said, we would be happy to include image browser implementations in the Kivy garden user repository.","Q_Score":0,"Tags":"python,kivy","A_Id":29522735,"CreationDate":"2015-04-08T11:36:00.000","Title":"Kivy Photo Chooser","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a program that streams my screen to another computer(like TeamViewer), I'm using sockets, PIL ImageGrab, Tkinter.\nEverything is fine but the screenshot I get from ImageGrab.grab() is without the mouse cursor, which is very important for my program purpose.\nDo you know how can I take screenshot with the mouse cursor?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":2661,"Q_Id":29524885,"Users Score":3,"Answer":"The cursor isn't on the same layer as the desktop or game your playing, so a screenshot won't capture it (try printscreen and paste into mspaint). A workaround is to get the position of the cursor and draw it on the image. you could use win32gui.GetCursorPos(point) for windows.","Q_Score":6,"Tags":"python,screenshot,python-imaging-library","A_Id":29624597,"CreationDate":"2015-04-08T20:37:00.000","Title":"Include mouse cursor in screenshot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a game for a presentation and I cannot seem to understand how to make a delay in Python.\nFor example, whenever I press the D key, my character not only moves but also changes pictures so it looks like it's running.\nI have the movement part down, I just need to slow down the changing of the sprite so that it doesn't look like he's running a million miles per hour. I have set the FPS.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":165,"Q_Id":29526895,"Users Score":0,"Answer":"The command turtle.down() will work, I guess","Q_Score":1,"Tags":"python,pygame","A_Id":29527035,"CreationDate":"2015-04-08T23:09:00.000","Title":"How Do you make a delay in python without stoping the whole program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to program an application that runs a HTTP server as well as a GUI using Tornado and PyQt4 respectively.  I am confused about how to use these two event loops in parallel. Can this be done with the multiprocessing module? Should the HTTP server be run in a QtThread? Or is a bash script the best way to go to run both of these processes at the same time?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":757,"Q_Id":29551003,"Users Score":0,"Answer":"You won't need a bash script. Probably simplest to write a PyQt application and have the application launch the web server. The server may be in a separate thread or process depending on your requirements, but I'd start by having a single thread as a first draft and splitting it out later.\nHaving the PyQt app as your main thread makes sense as your GUI is going to be responsible for user inputs (start\/stop server, etc) and program outputs (server status, etc) and therefore it makes sense to make this the controlling thread with references to other objects or threads.","Q_Score":0,"Tags":"python,bash,qt,pyqt,tornado","A_Id":29551539,"CreationDate":"2015-04-09T23:49:00.000","Title":"How can I combine PyQt4 and Tornado's event loops into one application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to build a GUI which will:\n\nLoad a file with parameters which describe certain type of problem.\nBased on the parameters of the file, show only certain tab in QTabwidget (of many predefined in Qt Designer .ui)\n\nI plan to make a QTabwidget with, say 10 tabs, but only one should be visible based on the parameters loaded. Enabling certain tab is not an option since it takes to many space and the disabled tabs are grey. I do not want to see disabled tabs.\nRemoving tab could be an option but the index is not related to a specific tab so I have to take care of the shift in the indices. And furthermore if user loads another file with different parameters, a good tab should be added and the current one removed.\nMy questions are:\n\nHow to do this effectively?\nIs it better to use any other type of widget?\nIn Qt designer, is it possible to define many widgets one over another and then just push the good one in front. If yes, how? And how to edit and change any of them?\nIf using RemoveTab, how to use pointers on tabs, rather than indices?\n\nI use PyQt4","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":7611,"Q_Id":29560307,"Users Score":0,"Answer":"I see that this thread is kinda old. But I hope this will still help.\nYou can use the remove() method to \"hide\" the tab. There's no way to really hide them in pyqt4. when you remove it, it's gone from the ui. But in the back end, the tab object with all your settings still exist. I'm sure you can find a way to improvise it back. Give it a try!","Q_Score":1,"Tags":"python,pyqt,qt-designer,qtabwidget","A_Id":44781276,"CreationDate":"2015-04-10T11:28:00.000","Title":"PyQT Qtabwidget add, remove, hide, show certain tab","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed (extracted) Kivy (Kivy-1.9.0-py3.4-win32-x86.exe) on my PC (Win7 32bit). Now whenever trying to run a file using kivy-3.4.bat getting an error message within a window...\n\npython.exe- Entry point not found\nThe procedure entry point inflateReset2 could not be located in the dynamic link library zlib1.dll.\n\nOnce click on the \"Ok\" button I see\n\n[Critical ] [app] unable to get a window, abort\n\non CMD.\nI think this is a problem related to my system and Python more than Kivy. Can anyone tell me what is the problem and how to solve it?\nThis is amazing!! Even in StackOverFlow no one could give me any solution!!","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":12725,"Q_Id":29566947,"Users Score":1,"Answer":"This happened to me because an old zlib1.dll was being loaded from somewhere in my PATH. I copied a new version to system32 and it solved the problem.","Q_Score":5,"Tags":"python-3.x,system,kivy","A_Id":35697811,"CreationDate":"2015-04-10T17:03:00.000","Title":"Python | Python.exe- Entry point not found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I installed (extracted) Kivy (Kivy-1.9.0-py3.4-win32-x86.exe) on my PC (Win7 32bit). Now whenever trying to run a file using kivy-3.4.bat getting an error message within a window...\n\npython.exe- Entry point not found\nThe procedure entry point inflateReset2 could not be located in the dynamic link library zlib1.dll.\n\nOnce click on the \"Ok\" button I see\n\n[Critical ] [app] unable to get a window, abort\n\non CMD.\nI think this is a problem related to my system and Python more than Kivy. Can anyone tell me what is the problem and how to solve it?\nThis is amazing!! Even in StackOverFlow no one could give me any solution!!","AnswerCount":4,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":12725,"Q_Id":29566947,"Users Score":4,"Answer":"Yes, I know this post is a bit old, but maybe someone else searches this.\nI got the same error. And really, I just tried to start the python script via MS Powershell instead of CMD. I just wanted to use the PS one time.\nAnd it worked, at least for me.\nSo, if you encounter this error, try to use the Powershell :)","Q_Score":5,"Tags":"python-3.x,system,kivy","A_Id":34912630,"CreationDate":"2015-04-10T17:03:00.000","Title":"Python | Python.exe- Entry point not found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I want to install pygame library on Ubunbu 14.10. I am using Python 2.7.x. At this time I found dependences problems with python-numpy dependence., because it uses a previous version of gcc that 14.10 uses that's why I am stuck with this, my question is: is there any way to install pygame on 14.10?\nbest","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":386,"Q_Id":29593223,"Users Score":1,"Answer":"If you open up the terminal\ntype in\nsudo apt-get install python-pygame\nIt should download and install the dependencies required for pygame.","Q_Score":0,"Tags":"python-2.7,pygame,ubuntu-14.10","A_Id":30444254,"CreationDate":"2015-04-12T18:46:00.000","Title":"install python pygame on ubuntu 14.10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"Is there any way to detect the color that the turtle is standing on in python?\nFor example if the the turtle is on a black colored space, he moves forward.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1770,"Q_Id":29649743,"Users Score":1,"Answer":"Quickly glancing over the turtle documentation, nope, there's no way to detect colors.\nYou should probably keep a record of which spaces you have drawn so far, adding to the collection whenever you draw a new space. Then, when you want to know the color of an old space, you only need to search through the collection.\nWhat collection you ought to use depends on what kind of spaces we're talking about here. If the spaces are nice tessellated squares, like a chessboard, you could probably get away with a dictionary whose keys are (row,col) coordinate tuples.","Q_Score":0,"Tags":"python,turtle-graphics","A_Id":29649944,"CreationDate":"2015-04-15T12:04:00.000","Title":"Turtle graphics color detection","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i'm trying to create chatbox on kivy python. one of the most difficult is to create class with super class Label, which can support select its text like a TextInput class. Can somebody help me?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":891,"Q_Id":29679264,"Users Score":3,"Answer":"Why not just use a TextInput field?  change the appearance parameters so it looks like a label and disable input to the field.","Q_Score":4,"Tags":"python,kivy","A_Id":29679556,"CreationDate":"2015-04-16T15:24:00.000","Title":"Label with selectable text","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to copy the console output to ask a question about a program that's not working. but it seems the normal way of holding down text doesn't highlight the text for selection like in the editor.\nIs there a way to copy the text from qpython console?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":471,"Q_Id":29706559,"Users Score":0,"Answer":"You can only press-and-hold the console and then select the \"Copy All\" option.\nAt least I am doing so.\nI think there is no way to copy specific text.","Q_Score":0,"Tags":"qpython","A_Id":30407110,"CreationDate":"2015-04-17T18:11:00.000","Title":"How do you copy text from qpython console?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python\\Tkinter Label formatting question.\nI have a simple main window with a Label that has its textvariable bound to a DoubleVar()\nI want to display the value in the DoubleVar() as a US dollar amount, \nas in \"$ 123.45\" \nHow can I have the Label display the value the way I want?\nI know I could change the textvariable to a StringVar() but then I have lost the precision of the DoubleVar(). I need it for other calculations in the app.\nI have also tried sub-classing the Label class but couldn't figure out what method to override when the textvariable value is accessed.\nHow do I tell a Label how I want a number formatted?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":3745,"Q_Id":29759754,"Users Score":1,"Answer":"You can't. At least, not automatically. You can use a separate label just for the \"$\", or manually format the string for the label.","Q_Score":0,"Tags":"python,tkinter,label","A_Id":29759880,"CreationDate":"2015-04-20T22:44:00.000","Title":"Python tkinker label formatting","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I m working on a python project currently, It is a application which don not interact with internet.GUI is being dine with wxpython. Is there code available in python which can simulate button click.","AnswerCount":1,"Available Count":1,"Score":0.761594156,"is_accepted":false,"ViewCount":1909,"Q_Id":29764235,"Users Score":5,"Answer":"I depends on what you really need it to do.  Do you just want cause the same code to be executed as would be done when the user clicks the button?  Or do you need to have a real system level mouse event occur on the native UI button as if there was a real user doing it?\nFor the former you just need to cause the event handler function to be called from wherever you need it to be done.  You can create a matching event object and use wx.PostEvent as suggested, or simply call the event handler method directly.  Or for a little bit better programming style, refactor and move the guts of the event handler to a separate function and call it from the event handler and also wherever else you need to simulate the effects of clicking the button.\nFor having real system level events being sent to the native widget there is the wx.UIActionSimulator class, which can be used to simulate the mouse or keyboard at a lower level than posting wx events, so the UI behaves exactly the same as if there was a real user doing it.  I would guess that 95% of the time that this is overkill for cases like what you describe, and also more complex than the above, but it's there if you really need it.","Q_Score":2,"Tags":"python-2.7,wxpython,buttonclick,simulate","A_Id":29778393,"CreationDate":"2015-04-21T06:11:00.000","Title":"simulating button click in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In pygame I can use pygame.mixer.music to load and play long audio files (by streaming), or pygame.mixer.Sound & pygame.mixer.Channel for shorter ones (that are loaded entirely into memory) - as I understand correctly.\nI'd like to use both of these methods. However I'd also like to know, when playback of given Channel or Music has just finished. There are methods for that: set_endevent() - on both music and channel. When I use pygame.locals.USEREVENT as a type of event, when channel's playback is finished i receive event with code == <channel_id>. When music's playback is finished, code is always 0. Thus I cannot tell the difference, whether it is music that stopped, or channel with id 0.\nIs there any way to tell them apart?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":196,"Q_Id":29805701,"Users Score":0,"Answer":"-.- I misunderstood the documentation. There is said:\n\nThe type argument will be the event id sent to the queue. This can be any valid event type, but a good choice would be a value between pygame.locals.USEREVENT and pygame.locals.NUMEVENTS. If no type argument is given then the Channel will stop sending endevents.\n\nAnd I understood I should choose either USEREVENT or NUMEVENTS. I was constantly looking for a way to use some new event types but I thought it is impossible. So I chose USEREVENT, hoping that no other pygame module uses it, and thinking it's better than NUMEVENTS.\nBut then I came up with idea, that maybe these types are just numbers and \"between\" means literally between. So after I checked it appeared that USEREVENT == 24 and NUMEVENTS == 32. So I can basically use any number from 25 to 32...\nSilly me. :)\nOnly one thing remain: let's take that I used 25 as type for Channel.set_endevent(). How to get my channel id now?\n\nEdit:\nOk, now I have a full image. It's even better - I think. If I understand correctly: pygame.USEREVENT (equal 24) is the first of many events up to pygame.NUMEVENT (equal 32). Any of them have an attribute code that can be used for whatever I want (and Channel uses it to put its id). So basically I can use pygame.USEREVENT + 0 for channels and pygame.USEREVENT + 1 for music.\nCorrect me please if I'm wrong.","Q_Score":0,"Tags":"python,events,audio,pygame","A_Id":29806090,"CreationDate":"2015-04-22T18:11:00.000","Title":"How to differentiate endevent of music and channel?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In PyQt4, I want to present a QPushButton that looks like the down-arrow button in QComboBox.  Feasible, and if so, how?\nI don't need help getting my new widget-combination acting like a QComboBox (see below). I only want the QPushButton display\/graphic to look like the down-arrow button in a QComboBox - and tips\/code on how to overlay that graphic (especially if said graphic comes via a file) onto my own QPushButton.\nMore details, context:\nI'm seeking to replace a QComboBox widget with a QLineEdit + QCalendarWidget, because QDateEdit isn't as customizable as I need (I think...).  The thought is to place a QPushButton immediately adjacent (on the right-side) of the QLineEdit to make it things look like regular QComboBox as much as possible. Then said button will .exec_() the QCalendarWidget (which is technically wrapped by a QDialog).\nLet me know if this doesn't make sense, and I can provide further or clarified context.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2863,"Q_Id":29806160,"Users Score":2,"Answer":"You can try a QToolButton with no text and the arrowType property set to Qt.DownArrow.  eg: myqtoolbutton.setArrowType(Qt.DownArrow).","Q_Score":0,"Tags":"python,pyqt,qcombobox,qpushbutton,qdate","A_Id":29907644,"CreationDate":"2015-04-22T18:36:00.000","Title":"PyQt: display QPushButton that looks like the down-arrow button in QComboBox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When PyScripter opens another window (eg. a pygame window or matplotlib graphs), I can't edit code until I close the other window. I can move around the code and delete bits, but can't type.\nThe problem didn't use to occur because the pygame window opened with another program (I think it was python.exe). I don't recall changing anything that would have made this happen; I have always just run a sctipt called Game.py from inside pyscripter which opens the pygame window using pygame.init().\nI have python 2.7.9 32bit, pyscripter 2.6.0 32bit (the problem also occured for pyscripter 2.5.3), windows 7 64bit.\nHow can I either get pygame to open in the python.exe, or change pyscripter so that I can edit scripts ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":233,"Q_Id":29848354,"Users Score":0,"Answer":"Woops I just needed to change run->python engine from internal to remote.","Q_Score":0,"Tags":"python,pygame,pyscripter","A_Id":29859267,"CreationDate":"2015-04-24T13:07:00.000","Title":"Pyscripter not editable when a sub window is open","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been programming some Kivy\/Python apps on my Motorola Moto G mobile phone.\nI've got a few handy little apps, that have been working OK for a few months.\nToday, I launched one of the apps - through the QPython interface, and it didn't work.\nSo, I tried another of my apps and that failed to launch for the same reason. In fact, all of them fail to launch for the same reason.\nThe error shown on screen ends with:\n\nFile \"\/QPython\/core\/build\/python-install\/lib\/python2.7\/UserDict.py\", line 23, in getitem\nKeyError: 'ANDROID_APP_PATH'\n\nI presume that something on the phone has taken an upgrade - and broken something.\nI assume that is the case because this problem affects all of the Kivy apps I was using.\nAnyone else encountered this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":543,"Q_Id":29851825,"Users Score":2,"Answer":"You need to have\n#qpy:kivy\npart in the first line.\nAt least that was what happened to me.\nI suppose that is because QPython is finding what type of app is it.","Q_Score":1,"Tags":"android,python,kivy,qpython","A_Id":30407066,"CreationDate":"2015-04-24T15:41:00.000","Title":"KeyError: 'ANDROID_APP_PATH'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am fairly new to Python and to GUI programming, and have been learning the Tkinter package to further my development.\nI have written a simple data logger that sends a command to a device via a serial or TCP connection, and then reads the response back, displaying it in a ScrolledText widget. In addition, I have a button that allows me to save the contents of the ScrolledText widget into a text file.\nI was testing my software by sending a looped command, with a 0.5 second delay between commands. The aim was to test the durability of the logger so it may later be deployed to automatically monitor and log the output of the devices it is connected to.\nAfter 30-40 minutes, I find that the program crashes on my Windows 7 system, and I suspect that it may be caused by a memory issue. The crash is a rather nondescript, \"pythonw.exe has stopped working\" message. When I monitor the process using Windows Task Manager, the memory used by pythonw.exe increases each time a response is read, and will eventually reach nearly 2Gb.\nIt may be that I need to rethink my logic and have the software log to the disk in 'real time', while the ScrolledText box overwrites the oldest data after x-number of lines... However, for my own education, I was wondering if there was a better way to manage the memory used by ScrolledText?\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":72,"Q_Id":29896688,"Users Score":0,"Answer":"In general, no, there are no memory limitations with writing to a scrolled text widget. Internally, the text is stored in an efficient b-tree (efficient, unless all the data is a single line, since the b-tree leaves are lines). There might be a limit of some sort, but it would likely be in the millions of lines or so.","Q_Score":0,"Tags":"memory,logging,textbox,tkinter,python-3.4","A_Id":29900168,"CreationDate":"2015-04-27T13:05:00.000","Title":"Are there memory limitations when outputting to a ScrolledText widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a pyQT4 application where the user is asked for a savefile (QFileDialog and all that...)\nOne annoyance is it does not remember the last directory so multiple call always defaults to the working directory of the application (or whatever I set the 3rd argument to)\nIf I set the option to not use the native file browser it remembers but \"it is not native to windows\" (note this doesn't bug me as I am a linux user, but others are not...) \nOne option I was considering was saving the last working directory and populating the 3rd argument with that for every call but this seems quite brutal, especially as it seems matplotlib appears to be remembering the last directory (so it is possible) \nAny ideas?\nfilename = QtGui.QFileDialog.getSaveFileName(self, \"Save Plot to CSV\", '', \"CSV Data (*.csv)\")","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":305,"Q_Id":29914909,"Users Score":0,"Answer":"The QFileDialog.saveState() and QFileDialog.restoreState() methods can save and restore the current directory of the dialog box.","Q_Score":1,"Tags":"windows,python-3.x,pyqt4","A_Id":29999330,"CreationDate":"2015-04-28T09:02:00.000","Title":"pyQT4 native file dialog remembering last directory","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to take existing python pyqtgraph and pyqt application and have it display on a web page to implement software as a service? I suspect that there has to be a supporting web framework like Django in between, but I am not sure how this is done.\nAny hints links examples welcome.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1640,"Q_Id":29928485,"Users Score":0,"Answer":"Here is what I have sort of put together by pulling several threads online:\n\nRuby On Rails seems to be more popular than python at this moment.\nIf you go python, Flask and Django are good templates.\nbokeh seems to be a good way of plotting to a browser. \nAFAIK, there is no way to take an existing PyQt or pyqtgraph application and have it run on the web.\nI am not sure how Twisted (Tornado, Node.js and Friends) fits in to the web SaaS, but I see it referred to occasionally since it is asynchronous event-driven.\nPeople often suggest using Rest, but that seems slow to me. Not sure why...","Q_Score":4,"Tags":"python,django,pyqt,saas,pyqtgraph","A_Id":29947088,"CreationDate":"2015-04-28T19:43:00.000","Title":"Displaying pyqtgraph and pyqt widgets on web","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Is there a way to take existing python pyqtgraph and pyqt application and have it display on a web page to implement software as a service? I suspect that there has to be a supporting web framework like Django in between, but I am not sure how this is done.\nAny hints links examples welcome.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1640,"Q_Id":29928485,"Users Score":0,"Answer":"If all you need are static plots, then it should be straightforward to draw and export to an SVG file, then display the SVG in a webpage (or export to image, as svg rendering is not reliable in all browsers). If you need interactivity, then you're going to need a different solution and probably pyqtgraph is not the tool for this job. VisPy does have some early browser support but this has only been demonstrated with ipython notebook.","Q_Score":4,"Tags":"python,django,pyqt,saas,pyqtgraph","A_Id":29987875,"CreationDate":"2015-04-28T19:43:00.000","Title":"Displaying pyqtgraph and pyqt widgets on web","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Is it possible to mount more than one image AND text on a Tkinter button?\nOr, is it possible to put a FRAME containing images + text on a button?\nI want a big button containing multiple widgets that, when taken together, fully describe the option the user will be able to choose.\nI appreciate any suggestions!!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":917,"Q_Id":29933581,"Users Score":2,"Answer":"Is it possible to mount more than one image AND text on a Tkinter button?\n\nStrictly speaking, no, it is not possible. \n\nOr, is it possible to put a FRAME containing images + text on a button?\n\nYes, though it probably won't work on OSX. It would probably take you less time to actually try it than to type in the question on stackoverflow. A little research goes a long way.\nYou can also simply not use a button. Just use a frame or canvas, and set up bindings on the container and\/or it's contents to react to a button click.","Q_Score":2,"Tags":"python,python-2.7,user-interface,button,tkinter","A_Id":29941782,"CreationDate":"2015-04-29T03:02:00.000","Title":"Python Tkinter: multiple images and text on a BIG button?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want the user to be able to select the items on a PyGTK ComboBox, while not being able to write in the combo. He\/She should be allowed just to select one of the items.\nSo I can't use set_active(False), for it will disable the combo.\nHow can I do this ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":667,"Q_Id":29969746,"Users Score":2,"Answer":"GTK+ 2 has a type GtkComboBoxEntry that always has the entry box you don't want (and handles some model-related things). Your Glade file uses a GtkComboBoxEntry. Change it to GtkComboBox and, assuming everything else is set up properly (your model is correct and you have a GtkCellRendererText), you should be good to go.\n(Thanks to gregier in irc.gimp.net\/#gtk+ for some information.)","Q_Score":0,"Tags":"python,gtk,pygtk","A_Id":29976673,"CreationDate":"2015-04-30T13:57:00.000","Title":"How do I disable edition of a PyGtk Combobox?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using wxPython ObjectListView and it is very easy to use. Now I need to render a wx.Color as a column but I haven't found a way in the documentation. Basically I have list of items each of them have the following attributes: name, surname and hair color. Hair color is a RGB color and I would like to show it as a column in my ObjectListView.\nIs there a way to do it ?\nMany thanks","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":360,"Q_Id":29990202,"Users Score":0,"Answer":"For the future: what I did was to show the color as a background of the row of the list.","Q_Score":0,"Tags":"python,wxpython,objectlistview-python","A_Id":30030742,"CreationDate":"2015-05-01T15:46:00.000","Title":"ObjectListView wxPython: how to show a wx.Color","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So, I'm working with pygame in python 2.7.9 and I'm trying to make some kind of zoom, to view details of a fractal.\nI can easily draw a Sierpinski triangle using polygons, my idea is to zoom a area of the triangle and see details of the depth without pixelation.\nSo far, I can zoom in but the surface gets pixelated\nIs there anyway to do this?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1289,"Q_Id":29994341,"Users Score":0,"Answer":"First make a canvas and triangle with a big size and Zoom out. So when you zoom in, it won't get pixelated.","Q_Score":0,"Tags":"python,pygame,zooming,pixel","A_Id":29994418,"CreationDate":"2015-05-01T20:09:00.000","Title":"Zoom in and Zoom Out Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a tuple of constants:\nWIN = 640, 360, \"Example\", False, 'tool' # x, y, title, resizable, style\nAnd now to use it I have to type in this:\napp = pyglet.window.Window(WIN[0], WIN[1], WIN[2], WIN[3], WIN[4])\nIs there a method to split tuple into separate elements like this:\napp = pyglet.window.Window(WIN.extract()) ?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":123,"Q_Id":30000275,"Users Score":0,"Answer":"app = pyglet.window.Window(*WIN)","Q_Score":0,"Tags":"python,python-3.x,tuples,extract","A_Id":30000302,"CreationDate":"2015-05-02T08:48:00.000","Title":"Python: method to extract tuple","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My question is simple, apart from the three themes pre-installed in Tkinter are there any other themes I can get ? Something like 3rd party themes ? If not, how can I change the button or other widgets looks (manually changing the form,etc..)?\nAlso I would like to know if it is possible to change the outside window look, like the look of the \n\n[ _ ] [ [] ] [X] \n\nbuttons of the window, if not is there a way to remove them so I can put my own buttons in the frame?\nAny code example or link is welcome.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":174,"Q_Id":30002869,"Users Score":2,"Answer":"You cannot change the window border, but you can remove it entirely and draw your own border. You'll also be responsible for adding the ability to move and resize the window. Search this site for \"overrideredirect\" for lots of questions and answers related to this feature.\nAs for third party themes: no, there aren't any.","Q_Score":1,"Tags":"python,python-2.7,tkinter","A_Id":30014871,"CreationDate":"2015-05-02T13:29:00.000","Title":"3rd party Tkinter themes and modifying outside window buttons","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have recently encountered an issue whenever I try and use pygame. The window that comes up hangs and just ends up crashing. I know this program works because I have run it many times before (this also occurs with anything else I try and run in pygame). Strangely, in the command prompt window it asks an input question from a completely unrelated program I was working on last night.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":190,"Q_Id":30089723,"Users Score":0,"Answer":"It could be, that you named your file pygame.py, so now, whenever you try to import pygame, it imports from THAT pygame.py file. Maybe delete\/rename the file and reinstall pygame would work, i had the same problem a year ago and it worked.","Q_Score":0,"Tags":"python,command-line,pygame","A_Id":31355786,"CreationDate":"2015-05-07T00:03:00.000","Title":"Pygame crashing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have recently encountered an issue whenever I try and use pygame. The window that comes up hangs and just ends up crashing. I know this program works because I have run it many times before (this also occurs with anything else I try and run in pygame). Strangely, in the command prompt window it asks an input question from a completely unrelated program I was working on last night.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":190,"Q_Id":30089723,"Users Score":0,"Answer":"Seems to be a setup problem. \npossible solutions:\n\nrename files (as Mooper suggested)\ncreate the smallest possible use for pygame (once without \/ once with windows popping up), in order to tell us where the error comes up \/ does not.\nlook at the code again; seems to me being an error with a neverending loop \/ overflowing stack  \/ a function not returning after being called.\nlast possible idea: reinstall pygame","Q_Score":0,"Tags":"python,command-line,pygame","A_Id":41851946,"CreationDate":"2015-05-07T00:03:00.000","Title":"Pygame crashing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been using Python for a bit now (5-6 months) and I would like to finally like to start programming in GUI. Is there a good tutorial for this? Also, I would really like to use something in the default Python language rather than something installed otherwise, unless Py2EXE has been updated to 3.x and it supports other modules (modules? add-ons? I'm trying to say 3rd party GUIs). Thanks!\nEDIT: Toolkit? Is that the right word? Also I have used Tkinter and it feels very limited. I could only get buttons to go on the top and it was just weird. Maybe I was doing it wrong. If you have a good tutorial for that, I would greatly appreciate it.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":65,"Q_Id":30111145,"Users Score":1,"Answer":"Tkinter is part of python, and it is quite powerful. You have Notebook, Listbox and such...\nThere are some limitations, and PyQt and PyGTK are more powerful.\nMy advice will be to start with Tkinter (typing what widget you want + tkinter in your search engine usually works) and see what you can do.\nI am not sure I understand your comment about buttons, but if you are talking about layout, the grid method of tkinter is very powerful.","Q_Score":0,"Tags":"user-interface,python-3.x","A_Id":30111555,"CreationDate":"2015-05-07T20:33:00.000","Title":"Integrated GUI for Python3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What I have is a large amount of C code and a bunch of swig wrappers to export all the functions into python. We like using python for testing, it's great, but my problem is there don't seem to be any editors out there that will share tags between python and C.\nWhat I want is to ctrl+click (or whatever shortcut) on a function in a *.py file and have it go to the function definition in a *.c file.\nGeany seems to do an alright job of this but it has some limitations (poor gdb support, etc). Eclipse, netbeans, Qt Creator are all good editors for C (creator being my fav) but they don't support cross-language tags. Eclipse in particular supports python quite well in PyDev but a tag in python is totally separate from a tag in C, and I can't seem to find a way to make them share. Vim\/emacs probably do due to the somewhat lower level ctags use but I don't like either of them.\nAny suggestions?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":290,"Q_Id":30112333,"Users Score":0,"Answer":"I do this using UltraEdit, but UltraEdit is not great if you do not like it :-) Its not really an IDE more like an Editor. However the way I do it can most likely be ported to e.g. Eclipse.\nI generate the Ctags file my self. and force UE to use the custom generated cTags file. This works like a charm.","Q_Score":5,"Tags":"python,c++,c,exuberant-ctags","A_Id":31437333,"CreationDate":"2015-05-07T21:54:00.000","Title":"Code editor that supports cross-language (c)tags between C and python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having some Python code that heavily relies on numpy\/scipy and scikit-learn. What would be the best way to get it running on an Android device? I have read about a few ways to get Python code running on Android, mostly Pygame and Kivy but I am not sure how this would interact with numpy and scikit-learn.\nOr would it be better to consider letting the android application send data to some server where Python is running?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2766,"Q_Id":30119149,"Users Score":1,"Answer":"Depends on what you need....\nPython on a server using Flask\/ Django would allow you to build an http UI or even an API interface for your Android (or any) device.\nQpython is a brilliant way to run python on an Android but probably won't cope with the whole of scipy so depends on what libraries have already been ported across by the Qpython team. It's a great tool though and worth a look anyway.\nIMHO learning a bit of flask for server side running would be easier and more flexible than using Kivy.","Q_Score":1,"Tags":"android,python,numpy,scikit-learn","A_Id":30120067,"CreationDate":"2015-05-08T08:23:00.000","Title":"Port Python Code to Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Tkinter to create a GUI in python.\nWhat I did was I insert a GIF image into the background and also created labels and buttons.\nHow do I make the labels and buttons background to be transparent as the background is covering my GIF image?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":7124,"Q_Id":30180138,"Users Score":2,"Answer":"Basically what @Paul Rooney indicated in his comment above.\nYou might be able to workaround this using canvas to create your own label. You can then use a canvas text object instead of a label. \nIf you create an empty canvas and add the text with the create_text(), and then place this text-canvas 'on top' of the 'main' canvas, it should simulate what you want. The reason for using two canvases is to prevent scrollability. \nI can not think of way to this for buttons though..\nPlease post your code if you need an example of this :)","Q_Score":0,"Tags":"python,tkinter","A_Id":30194049,"CreationDate":"2015-05-12T01:14:00.000","Title":"How to make labels background to be transparent in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a simple Python application for Linux and I'm using GTK to generate a UI for it. I've only begun exploring GTK but from what I can tell, the moment you call GTK.main() the program goes into that function wherever and only responds to user interactions with the UI. The thing is, I'm running an SDN controller (POX) alongside, and I want the events associated with instances of POX objects to also be able to run (which currently isn't happening since the program gets stuck in 'GTK.main()' forever).\nI've considered creating a new thread and calling GTK.main() from there, but then I'll have to worry about thread safety. Isn't there some way where the events for both the UI as well as the objects instantiated in the rest of the program fire alongside?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":69,"Q_Id":30280774,"Users Score":0,"Answer":"I was able to solve the problem by spawning separate threads for both GTK and the POX controller. With this done, everything's working fine simultaneously.","Q_Score":0,"Tags":"python,linux,multithreading,gtk,pox","A_Id":30397459,"CreationDate":"2015-05-16T21:06:00.000","Title":"Keep background events active when using GTK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got my own drawing loaded on to the screen and scaled it to the size I want, but the background of the program I used to make the drawing is still on the image. I noticed that when I move the image, the background doesn't move with the picture, but it actually looks like it's stretching out and it will cover wherever I move the picture to. I think this is because I used the .blit feature when getting my picture on screen, but I can't find a clear enough answer on how to get the picture on screen any other way. Can someone point me in the right direction, please?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":79,"Q_Id":30315466,"Users Score":0,"Answer":"Not sure if this is the problem, but the stretching might be caused by not redrawing the background. Blitting is like painting, you can't erase stuff. When you want to move something, you need to repaint all the places that have changed - also the background that is not visible after movement.\nThe quickest way to do this is to redraw the whole background.","Q_Score":0,"Tags":"python,pygame","A_Id":30315673,"CreationDate":"2015-05-19T01:47:00.000","Title":"Getting my drawing into pygame without .blit()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I register a callback for when a Kivy gui is loaded?\nIn my Kivy app, as soon as the GUI is loaded (aka the window pops up with the initial view), I need to kick off a function that loads expensive data and updates the UI. \nSo far i've been using the on_start method in App but this runs before the GUI is loaded. \nessentially, i want something like $( document ).ready() (from jquery) but for ivy","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":499,"Q_Id":30332159,"Users Score":0,"Answer":"You could Clock.schedule(some_function, 0) in your build method, I think that would run after everything is initialised but before the next frame.","Q_Score":2,"Tags":"python,kivy","A_Id":30334720,"CreationDate":"2015-05-19T17:21:00.000","Title":"kivy -- event for when guis is loaded","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to use any Python package within a Kivy program, and ultimately running it on an android device? for example - can I use the package \"xlrd\" or \"googlemaps\" on Kivy? If the answer is positive, How do I do it? normally I get an error message that says \"No module named X\". \nThank you.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":199,"Q_Id":30353541,"Users Score":1,"Answer":"Yes you can. Just download the package you want to use and place it in the same folder as your main.py. Then import whatever you wish to use from that package. The packages will also work when you deploy the app onto an Android device.","Q_Score":1,"Tags":"python,packages,kivy","A_Id":30354153,"CreationDate":"2015-05-20T15:04:00.000","Title":"Using various Python packages within a Kivy program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am building a turn-based strategy game using Libtcod and Python. The game map has variable terrain and each tile can be 1 of 5 types:\n\nPlains - Costs 1 to move over\nForest - Costs 2\nRiver - Costs 4\nHill - Costs 3\nMountain - Impassable\n\nEach type has its own movement cost, so that it costs less \"move points\" to move through plains than through a forest, for example. I want to display all the squares a unit can move to given its movement range\/starting move points. \nLibtcod has pathfinding functionality built for both A* and Dijtskra and it is trivial to display all the squares in a given range, without accounting for terrain. \nHowever, I cannot figure out how I can implement the terrain costs, without having to write my own pathfinding algorithm. Looking at the docs I know it has something to do with:\ndef path_func(xFrom,yFrom,xTo,yTo,userData) : ...\npath_new_using_function(width, height, path_func, user_data=0, diagonalCost=1.41)\ndijkstra_new_using_function(width, height, path_func, user_data=0,  diagonalCost=1.41)\nbut I cannot figure out what the custom function is supposed to do. According to the docs, it supposed to \n\n...return the walk cost from coordinates xFrom,yFrom to coordinates\n  xTo,yTo. The cost must be > 0.0f if the cell xTo,yTo is walkable. It\n  must be equal to 0.0f if it's not.\n\nbut, isn't that the point of the dijtskra algorithm to begin with? That is, the algorithm is supposed to take into account the variable costs of each tile and then build a path accordingly. \nThe map itself already has the terrain and move costs applied to it, I just need a way to bridge that data with the pathfinding.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":965,"Q_Id":30408098,"Users Score":0,"Answer":"As far as I understand, what you want to achieve is very well possible with tcod's built-in pathfinding function.\npath_new_using_function will call your path_func with adjacent cells, so you can simply have it return the values you listed above depending on the terrain below (xFrom, yFrom) and\/or (xTo, yTo).","Q_Score":2,"Tags":"python,algorithm,dijkstra,libtcod","A_Id":54982870,"CreationDate":"2015-05-23T01:50:00.000","Title":"Python Libtcod: How to do pathfinding with variable move cost terrain?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Making a very simple tic-tac-toe game in Python using a P2P architecture with sockets. Currently my GUI has button that says 'Create' that will open up and draw a new game board window, create a socket, bind, listen, and accept a connection. The 'Join' button will open and draw a new gameboard and connect to that 'server'. \nI'm trying to have it show a message saying 'Waiting for player...' when you create a game, a cancel button to stop and go back to the main menu, and have it disappear on it's own if a connection has been accepted.\nI tried using tkMessageBox but the script stops until the user clears the message so there's no way for me to listen\/accept until the user presses something. \nWhat other way is there for me to accomplish this?\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":339,"Q_Id":30430162,"Users Score":1,"Answer":"Sounds like a threading issue. \nI'm unfamiliar with TK graphics, but I'd imagine what you need to do is start the window showing the \"waiting for player\" message. That window then loops waiting for something to happen.\nWhen the message box displays you need to have the \"listening\" done on another thread, which signals back to the main message box when someone's connected using a semaphore or a queue. \nOn your main GUI thread you need to make the loop:\n\ncheck the queue or semaphore for values. If there's a value on there that you expect, close the box. This would need to be non-blocking so that the GUI thread can still check for input from the user.\ncheck for user input. That's probably done using callback functions though.","Q_Score":4,"Tags":"python,sockets,p2p","A_Id":30430588,"CreationDate":"2015-05-25T01:35:00.000","Title":"Python: Show message 'Waiting for player...' while socket listens for connection","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning python and i don't know that it will be helpful to me if i want to make android apps.I have read somewhere that python can make android app.But I want to ask you that is it a good option or we should always use andriod studio to make android apps because that is developed particularly for creating android apps.","AnswerCount":6,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":25019,"Q_Id":30465364,"Users Score":2,"Answer":"If the question is,can i run python programs on android then by all means yes.\nBut if the intent is to create a mobile app usibg python then please look at kivy which is yet to support python 3.\nBut outside the love of python ,its best to stick to android studio for native android apps.","Q_Score":9,"Tags":"android,python,android-developer-api","A_Id":30466179,"CreationDate":"2015-05-26T17:42:00.000","Title":"Can python build android apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning python and i don't know that it will be helpful to me if i want to make android apps.I have read somewhere that python can make android app.But I want to ask you that is it a good option or we should always use andriod studio to make android apps because that is developed particularly for creating android apps.","AnswerCount":6,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":25019,"Q_Id":30465364,"Users Score":0,"Answer":"Yes you can using\n1-  Kivy library\n2- install Ubuntu on a versatile machine\n3- run buildozer to transfer your main.py file into APK file","Q_Score":9,"Tags":"android,python,android-developer-api","A_Id":68053648,"CreationDate":"2015-05-26T17:42:00.000","Title":"Can python build android apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My setting: Python 2.7 with anaconda\nRecently I have installed OpenCV 3.0 and when I try to do simple image display or I want to run python samples that come with OpenCV, there is a error message:\n\nThis application failed to start because it could not find or load the Qt platform plugin \"xcb\".\n\nI have read many comments that I need to attach .so files to my project but I don't think it's the optimal solution since for most people it works out of a box. \nI have no clue what to do. I'm inexperienced. What comes to my mind is only to reinstall everything.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1947,"Q_Id":30483753,"Users Score":2,"Answer":"Okey, I have figured it out. \nDuring cmake I set flag -D WITH_QT=OFF since I read somewhere that it doesnt work for Qt5.x","Q_Score":1,"Tags":"python,opencv,anaconda,xcb","A_Id":30487195,"CreationDate":"2015-05-27T13:21:00.000","Title":"python app - xcb plugin fail","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program in which I use a tkinter button to exit the program with the exit() command. However, when I compile the program through cx_freeze, it doesn't work anymore. I also tried with sys.exit() but then the button doesn't work at all (with or without cx_freeze). Any hint would be appreciated, thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":628,"Q_Id":30490795,"Users Score":2,"Answer":"For tkinter applications, the preferred way to exit is name_of_application.destroy(). Using exit() can give unpredictable results.","Q_Score":3,"Tags":"python,python-3.x,tkinter,cx-freeze","A_Id":30491828,"CreationDate":"2015-05-27T18:50:00.000","Title":"exit() doesn't work with cx_freeze","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm experiencing something strange when using Image.resize(). I have two images, one is a cropped version of the other. I've been working out the aspect ratio so that I can resize both images by the same factor and then resizing them separately.\nNow for some reason, the larger of the two images is resized fine but the cropped version has some colour distortion. It almost appears like the image has been slightly saturated.\nHas anyone experienced this before or know why it might be happening?\nThanks for reading.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1342,"Q_Id":30540872,"Users Score":1,"Answer":"I haven't used Pillow, and I haven't seen your images or code, but let's say you have an image with a resolution of 400x200 and you want to resize it to 200x100, then each of the new pixels needs to have some color. Since the new image is smaller, the colors from the original will have to be mashed together to form the new colors. So, in this case where it gets smaller by a factor of two in each dimension, the color of each pixel will be the average of four pixels from the original. Similarly, if you resize to a larger image, depending on how that is done, the new pixels could be blocky (like when you zoom in to any pixel image) or smooth, which would mean that they are some interpolation of the pixels from the original image.","Q_Score":0,"Tags":"python,image,pillow","A_Id":30541163,"CreationDate":"2015-05-30T00:16:00.000","Title":"Using Python to resize images using Pillow, why are the colours changing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been working on my first wxpython app and this app has a search functionality. The app has to search for elements from database, list them and display details of one single element, when the element is clicked from the list.\nI found there is ListView or ObjectListView to be used for this. But what should be used so that on click of a single element in that list, I should display the panel which displays the dynamic data for that particular element?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":33,"Q_Id":30545494,"Users Score":0,"Answer":"I found out that wx has a EVT_LIST_ITEM_ACTIVATED event that is triggered when a list item is double clicked. I used this to capture the selected item and display the data accordingly.","Q_Score":0,"Tags":"python,wxpython","A_Id":30546887,"CreationDate":"2015-05-30T11:18:00.000","Title":"Display single element page on click of list element wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I got program that draws spaceship \n(Turtle Graphics) forward,backward etc. \nBy using a lot of orders and lines drawing spaceship takes 5 seconds using turtle.speed(0). \nAnd whenever you click the right\/left key it draws it again in other direction. \nIt major thing in my project. \nIs there a way to draw it faster?\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1123,"Q_Id":30554696,"Users Score":2,"Answer":"By default, turtle has a draw delay of 10 milliseconds. Every time it updates the canvas, it will pause 10 milliseconds as a simple way of controlling the animation speed. This delay is independent of the speed of the turtle itself. If you want to speed up the animation, you can set a shorter delay, e.g. with turtle.delay(3) or turtle.delay(0).\nNote that turtle graphics are more of an educational tool than a serious way to do graphics. If you don't have a specific reason to use turtle, consider switching to other graphics libraries.","Q_Score":3,"Tags":"python,python-2.7,turtle-graphics","A_Id":30554792,"CreationDate":"2015-05-31T06:53:00.000","Title":"Faster drawing in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I got program that draws spaceship \n(Turtle Graphics) forward,backward etc. \nBy using a lot of orders and lines drawing spaceship takes 5 seconds using turtle.speed(0). \nAnd whenever you click the right\/left key it draws it again in other direction. \nIt major thing in my project. \nIs there a way to draw it faster?\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1123,"Q_Id":30554696,"Users Score":1,"Answer":"you can use screen.tracer(n) where a bigger n value means a faster drawing speed but less details","Q_Score":3,"Tags":"python,python-2.7,turtle-graphics","A_Id":30555631,"CreationDate":"2015-05-31T06:53:00.000","Title":"Faster drawing in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on developing a PyQt4 application that will require a lot of widgets and I have run into an issue. When you say where to move the widget to (such as: btn.move(100, 100) it moves it properly, but if you resize the window, you can't see it). I'm not sure how to fix this. I don't want to restrict resizing of the window from the user, but I can't have widgets not showing up on screen.\nSo if the user resizes the program window to 600x600, how can I have widgets automatically change their location?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":30560147,"Users Score":0,"Answer":"Use a Qt layout (like a QVBoxLayout, QHBoxLayout, or a QGridLayout)","Q_Score":0,"Tags":"python,widget,pyqt,pyqt4","A_Id":30563200,"CreationDate":"2015-05-31T17:05:00.000","Title":"How to update PyQt4 widget locations based on window size?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am writing a Kivy UI for cmd line utility I have developed. Everything works fine, but some of the processes can take from a few seconds to a few minutes to process and I would like to provide some indication to the user that the process is running. Ideally, this would be in the form of a spinning wheel or loading bar or something, but even if I could update my display to show the user that a process is running, it would be better than what I have now.\nCurrently, the user presses a button in the main UI. This brings up a popup that verifies some key information with the user, and if they are happy with those options, they press a 'run' button. I have tried opening a new popup to tell them that the process is running, but because the display doesn't update until the process finishes, this doesn't work.\nI have a lot of coding experience, but mostly in the context of math and engineering, so I am very new to the designing of UIs and having to handle events and threads. A simple self-contained example would be greatly appreciated.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":12311,"Q_Id":30595908,"Users Score":1,"Answer":"I've dealt with similar problem and creating new thread didn't do the trick. I had to use Clock.schedule_once(new_func) function. It schedules function call to the next frame, so it is going to run almost immediately after callback ends.","Q_Score":9,"Tags":"python,user-interface,events,kivy","A_Id":56684592,"CreationDate":"2015-06-02T12:20:00.000","Title":"Building a simple progress bar or loading animation in Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wondering if there are any preloaded gestures on kivy, such as pinch, expand, etc. The examples have check, square, circle, and cross gestures. Is there a database for more?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":63,"Q_Id":30645470,"Users Score":0,"Answer":"I'm not sure that there is, not many people use the gestures. We have a gsoc project that will probably bring some improved tools for this to kivy core, though.","Q_Score":0,"Tags":"python,kivy,gesture","A_Id":30648659,"CreationDate":"2015-06-04T13:43:00.000","Title":"Preloaded gestures on Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm adding a simple toolbar to my PyQt application and trying to get the toolbar to start by default in the top position, but in the 2nd row beneath another toolbar.\nI have called:\nself.addToolBar(Qt.TopToolBarArea, navBar)\nThis combines the toolbar with my first toolbar which is much shorter into the same row.  Is there a way to force these toolbars to be in separate rows?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":714,"Q_Id":30687178,"Users Score":2,"Answer":"Finally found the solution after scouring the documentation and trying different options.  I think I was looking for something along the lines of \"toolBarRow\" so I missed it.\nThe solution is to insert a toolBarBreak.  The same way a separator can be added to a toolbar itself, a \"break\" simply breaks up one of the four areas provided for tool bars: either top, bottom, left, or right.  It is added with similar functions to the way separators are added to toolbars, with:\nQMainWindow.addToolBarBreak() which adds to the \"end\" of the toolbar area, which really means the most inward position.\nor\nQMainWindow.insertToolBarBreak(toolBarBefore) which adds right before the passed in toolbar reference.","Q_Score":1,"Tags":"python,pyqt","A_Id":30687563,"CreationDate":"2015-06-06T20:17:00.000","Title":"PyQt toolbar in 2nd row by default","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using the anaconda python distribution (python version 2.7) and I would like to be able to use wxpython either in a notebook or at least in an ipython console through the anaconda spyder app (their IDE). I am running into what is apparently a common problem which is due to the anaconda python environment not being recognized as a framework with GUI access. \nIn fact, I am able to launch a wxpython app when working directly in ipython when launched from the command line. However, when trying to get an app to run from either the spyder IDE ipython console or an ipython notebook I get this error:\nThis program needs access to the screen.\nPlease run with a Framework build of python, and only when you are\nlogged in on the main display of your Mac.\nIf anyone knows a workaround for this I would very much appreciate your advice.\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2244,"Q_Id":30743683,"Users Score":0,"Answer":"I believe simply using pythonw vs. python helped when I was using a MacBook.","Q_Score":0,"Tags":"python,wxpython,anaconda","A_Id":36034036,"CreationDate":"2015-06-09T22:08:00.000","Title":"How to use wxpython in an ipython notebook or console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using the anaconda python distribution (python version 2.7) and I would like to be able to use wxpython either in a notebook or at least in an ipython console through the anaconda spyder app (their IDE). I am running into what is apparently a common problem which is due to the anaconda python environment not being recognized as a framework with GUI access. \nIn fact, I am able to launch a wxpython app when working directly in ipython when launched from the command line. However, when trying to get an app to run from either the spyder IDE ipython console or an ipython notebook I get this error:\nThis program needs access to the screen.\nPlease run with a Framework build of python, and only when you are\nlogged in on the main display of your Mac.\nIf anyone knows a workaround for this I would very much appreciate your advice.\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2244,"Q_Id":30743683,"Users Score":0,"Answer":"In an ipython notebook before you run a cell invoking wxpython functions you have to insert the %gui magic:\n%gui wx","Q_Score":0,"Tags":"python,wxpython,anaconda","A_Id":30744213,"CreationDate":"2015-06-09T22:08:00.000","Title":"How to use wxpython in an ipython notebook or console","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know there are many posts about this problem (i've read them all).\nBut i still have a problem with my exe, still cannot be opened.\nI've tried to put the qwindows.dll (i tried with 3 different qwindows.dll) in the folder dist with my exe but doesn't change anyhting.\nI've tried with libEGL.dll, nothing.\nAny suggestions ? Is there a way to avoid having this problem ?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1637,"Q_Id":30757708,"Users Score":3,"Answer":"I've had this issue aswell, after a lot of digging I found the following solution:\nCopy the following file next to you main .exe:\nlibEGL.dll\nCopy the following file in a folder \"platforms\" next to you main .exe:\nqwindows.dll\nPutting the qwindows.dll in the subfolder is the important part I think, hope this helps","Q_Score":1,"Tags":"python,user-interface,py2exe,pyqt5","A_Id":31620544,"CreationDate":"2015-06-10T13:24:00.000","Title":"Qt platform plugin 'windows' - py2exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know there are many posts about this problem (i've read them all).\nBut i still have a problem with my exe, still cannot be opened.\nI've tried to put the qwindows.dll (i tried with 3 different qwindows.dll) in the folder dist with my exe but doesn't change anyhting.\nI've tried with libEGL.dll, nothing.\nAny suggestions ? Is there a way to avoid having this problem ?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1637,"Q_Id":30757708,"Users Score":0,"Answer":"For me it was enough to copy qwindows.dll to platforms folder, like @Inktvisje wrote.\nAnd don't repeat my mistake: don't download this dll from Internet! Copy it from your Python libs folder: YourPythonFolder\\Lib\\site-packages\\PyQt5\\plugins\\platforms.","Q_Score":1,"Tags":"python,user-interface,py2exe,pyqt5","A_Id":41159237,"CreationDate":"2015-06-10T13:24:00.000","Title":"Qt platform plugin 'windows' - py2exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python program using PySide. When run normally, it opens up a PySide GUI, but when run with some flags in the command line, it spits some things out in the console window.\nI'd like to retain this dual functionality, but it seems with py2exe you have to choose whether to have a console window or not when compiling, with no option for choosing during program execution.\nIs what I want to do possible with py2exe, or even with some other python \"compiler?\"","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":66,"Q_Id":30759749,"Users Score":1,"Answer":"This is not a py2exe limitation, but a Windows limitation. On Windows, applications are compiled either as Console Applications or GUI Applications. The difference is that Console Applications always open a console window, whilst GUI Applications never do.\nAs far as I can tell, it's not possible to have an application with dual functionality. As a workaround, I suggest that you simply compile two executables: one for console use and one for GUI use.","Q_Score":0,"Tags":"python,user-interface,console,pyside,py2exe","A_Id":30759966,"CreationDate":"2015-06-10T14:45:00.000","Title":"py2exe: Allow a console window to be either shown or hidden with a sys.argv","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm confused as to the difference between using a function in commands of tkinter items.  say I have  self.mb_BO.add_radiobutton(label= \"Red\",   variable=self.BO, value=2, command=self.red)\n\nwhat is the difference in how the add statement works from this:\nself.mb_BO.add_radiobutton(label= \"Red\",   variable=self.BO, value=2, command=self.red())\n\nwhere func red(self) changes the color to red.\nAnd self.mb_BO.add_radiobutton(label= \"Red\",   variable=self.BO, value=2, command=lambda:  self.red())\n\nEssentially I don't understand what these commands are doing and when to use the callback or function reference.  I've spent hours looking online for an easy to follow summary to no avail and I am still just as confused.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":881,"Q_Id":30769851,"Users Score":2,"Answer":"A good way to look at it is to imagine the button or binding asking you the question \"what command should I call when the button is clicked?\". If you give it something like self.red(), you aren't telling it what command to run, you're actually running the command. Instead, you have to give it the name (or more accurately, a reference) of a function. \nI recommend this rule of thumb: never use lambda. Like all good rules of thumb, it only applies for as long as you have to ask the question. Once you understand why you should avoid lambda, it's OK to use it whenever it makes sense.","Q_Score":1,"Tags":"python,lambda,tkinter,command","A_Id":30770368,"CreationDate":"2015-06-11T00:59:00.000","Title":"commands in tkinter when to use lambda and callbacks","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know the difference between static and dynamic linking in C or C++. But what does it mean in Python? Since it's just an interpreter, and only having one style of import mechanism of modules, how does this make sense? \nIf I freeze my Python application with cx_freeze by excluding a specific library, is it a kind of dynamic linking? Because, users have to download and install that library by themselves in order to run my application.\nActually my problem is, I'm using the PySide library (with LGPL v2.1) to develop a Python GUI application. The library says I should dynamically link to the library to obey their legal terms (same as Qt). In this case, how do I link to PySide dynamically?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2509,"Q_Id":30770219,"Users Score":1,"Answer":"In python there's no static linking. All the imports requires the correct dependencies to be installed on our target machine. The choice of the version of such libraries are in our decision.\nNow let's come to the binary builders for python. In this case, we'll have to determine the linking type based on the GNU definitions. If the user can replace the dependency as he likes, it's dynamic. If the dependency is attached together with the binary itself, it's static linking. In case of cx_freeze or pyinstaller, if we build this as one file, it's static linking. If we build this in normal mode where all the dependencies are collected as separate files, it's dynamic linking. Idea is, whether we can replace the dependency in target machine or not.","Q_Score":12,"Tags":"python,qt,pyside,cx-freeze","A_Id":43317798,"CreationDate":"2015-06-11T01:45:00.000","Title":"What does it mean for statically linking and dynamically linking in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using PyQt 4, Python 2.7, Windows 7 on a x64 machine.\nI have been developing a bit of code using a Python console with PyQt4 and passing strings from QLineEdit() widgets to OS commands with no issues using os.system(cmd)\nBut when I tried running from the command line in Windows I get the following error,\n\nTypeError: sequence item 0: expected string, QString found\n\nI got around this by converting the offending string via str(cmd) but it has left me curious about, why this should happen only when the code is called from the command line and not when called within a Python console?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":288,"Q_Id":30833264,"Users Score":-1,"Answer":"I think that this problem happens because the command line parameters are actually byte arrays and not strings, strings are encoded in Unicode, but byte arrays are not. Calling str(cmd) return the content of cmd as a string.","Q_Score":1,"Tags":"python,windows,command-line,pyqt4,qstring","A_Id":30833435,"CreationDate":"2015-06-14T18:54:00.000","Title":"PyQt Qstring not accepted when script run from WIndows command line, why?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyQt4 to enter credentials into a domain login page and pull data from several additional pages in the domain. Everything works exactly as expected when supplying login or search credentials from within the code. When I open up raw_input to allow the user to enter information, it causes hang-ups trying to download one of the web-pages. I can't provide information on the page itself because it is on a corporate network, but it doesn't make sense that simply using raw_input would cause problems with QWebpage loads. \nThe QNetworkManager throws 1 of the expected 3 or 4 .finished signals and the QWebpage frame never throws the .loadfinished signal so it just hangs.\n(I've tried to flushing stdin as well as seek(0) which gives me a bad file descriptor error). Has anyone run into such a problem before?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":285,"Q_Id":30926097,"Users Score":1,"Answer":"raw_input uses synchronous\/blocking IO without giving Qt a chance to continue processing events in the background. Qt isn't really prepared for it's processing to be halted in this way. In theory it should just resume when raw_input is finished. But maybe in the meantime a timeout occurred or something like that. You really should use signal\/event based input when using Qt. \nIf GUI interaction is ok you should try QInputDialog::getText because it looks like a blocking call from the outside but internally lets Qt to continue processing background jobs.","Q_Score":1,"Tags":"python,pyqt4,stdin,raw-input,qwebpage","A_Id":30926485,"CreationDate":"2015-06-18T21:27:00.000","Title":"Using raw_input causes problems with PyQt page loading","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Tkinter to design a UI for an application. I'm using grid geometry and while specifying button width (or any widget width), I realized that width should be specified in text units and not pixels. Since I want to make it platform independent and screen size independent Is there any method to get max text unit width ? So that I can do math on basis of that.\nFor example:\nI've 10 buttons in a row, which should be of equal width. If I hard code a width value specific to current screen value, it would not work on diff screen wise.\nThanks.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":10473,"Q_Id":30950925,"Users Score":8,"Answer":"If you want to make a GUI that is \"platform independent and screen size independent\", you definitely do not want to be measuring sizes yourself. Unless, by saying you want something platform independent, you're saying you want a button to be X pixels regardless of pixel density or screen resolution (which seems like a very bad idea). \nThe whole reason tkinter supports measuring in character units, along with options for widgets to stretch and shrink, is to support platform independence. When you start working at the pixel level, you will have many, many problems when you run the code on other platforms, or on other displays, or with other fonts.\nThat being said, the measure method of a font can tell you exactly how many pixels a given string will require in a given font. If you want to know how wide \"one character\" is, you can use the measure method on the string \"0\", which is what tkinter uses as a base when computing widths based on characters. \nIf you want buttons to be exactly the same size, using character widths will give you that, because it isn't the width of 10 actual characters in that widget, but ten average character widths. In that case, \"10 characters\" will be the same for every widget, no matter what the contents of that widget.","Q_Score":2,"Tags":"python,tkinter","A_Id":30954325,"CreationDate":"2015-06-20T06:13:00.000","Title":"Tkinter : Getting screen text unit width. (Not pixels)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to execute C++ code to acquire images to process in python.\nI need to use these commands from python:\n\nmake and\n.\/name_of_the_executable\n\nCould anybody please help know me how to do it?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":70,"Q_Id":30954589,"Users Score":2,"Answer":"Look For python.net which is cable of making a call to the interfaces written in .net supported languages.\nWhat all you need to do is\nSteps:\n\nDownload and put it two files Python.Runtime.dll and clr.pyd in your DLLs folder.\n\nFrom you >>>(triple greater than prompt )Python prompt Try\n>>>import clr\n\nif it doesn't gives any error you are good to go .\n\nNext You need to do is put Your C++ Dll inside Lib\/site-packages Folder .\n\n\n(This is not mandatory but good for beginners).\n\nNext to import clr try importing your Dll as a module import YourDllName\n\nIf step 5 doesn't gives you a error . Hola You are done That's All Folks :)","Q_Score":0,"Tags":"python,c++","A_Id":30954837,"CreationDate":"2015-06-20T13:36:00.000","Title":"Excuting cpp file from Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am currently trying to write a script to automate the ATTO disk benchmark GUI.  I can use the script to successfully locate images in the GUI, but I can not get any clicks generated by the script to register in the application.  I have modified the script to test if I could use the PyAutoGUI package to click things in other applications, and have been able to successfully click things in other applications.  Has anyone else had this issue with other applications using the PyAutoGUI package, and if so did you ever find any solution to the issue?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1086,"Q_Id":30991451,"Users Score":1,"Answer":"Please try to run your script with administrative privileges. If you are  using Powershell then run powershell as administrator","Q_Score":0,"Tags":"python,user-interface,automation","A_Id":34939080,"CreationDate":"2015-06-22T23:18:00.000","Title":"PyAutoGUI click() function will not register in certain applications","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am interested into programming with different languages besides Ti-Basic (like Java, C, and Python) on my Ti-84 plus calculator. Does my calculator support this, and if not, are there any calculators on the market that would be able to do this? Thanks in advance!\n(The idea is that when I don't have access to my computer at home, I could just pull out my pocket calculator and start programming and testing out some algorithms on the go that come in mind.) \nIt doesn't have to be a calculator, just something cheap and programmable and something I can carry around in my hand.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":3809,"Q_Id":30993221,"Users Score":1,"Answer":"You would need a compiler that will translate whatever language you're writing in (in the case of Java, an implementation of the JVM as well) to the assembly used by the calculator's CPU, it's probably not likely you will find an easy to use solution as calculators like the TI-84 are pretty archaic.","Q_Score":6,"Tags":"java,python,c,calculator,ti-basic","A_Id":30993515,"CreationDate":"2015-06-23T03:13:00.000","Title":"Multiple Language Programming on Ti-Calculator","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am interested into programming with different languages besides Ti-Basic (like Java, C, and Python) on my Ti-84 plus calculator. Does my calculator support this, and if not, are there any calculators on the market that would be able to do this? Thanks in advance!\n(The idea is that when I don't have access to my computer at home, I could just pull out my pocket calculator and start programming and testing out some algorithms on the go that come in mind.) \nIt doesn't have to be a calculator, just something cheap and programmable and something I can carry around in my hand.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":3809,"Q_Id":30993221,"Users Score":1,"Answer":"The TI-84 Plus CE Python allows you to code in Python but it is a barebones implementation. But it has been pretty useful for me.","Q_Score":6,"Tags":"java,python,c,calculator,ti-basic","A_Id":69366466,"CreationDate":"2015-06-23T03:13:00.000","Title":"Multiple Language Programming on Ti-Calculator","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am interested into programming with different languages besides Ti-Basic (like Java, C, and Python) on my Ti-84 plus calculator. Does my calculator support this, and if not, are there any calculators on the market that would be able to do this? Thanks in advance!\n(The idea is that when I don't have access to my computer at home, I could just pull out my pocket calculator and start programming and testing out some algorithms on the go that come in mind.) \nIt doesn't have to be a calculator, just something cheap and programmable and something I can carry around in my hand.","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":3809,"Q_Id":30993221,"Users Score":3,"Answer":"After a little research, I found some some hand-held \"pocket\" devices.\nThe Palm m500 has a JVM to program java on. There apparently was a website that had an SDK for C, but the website was removed. \nIn regards to calculators:\n\nTI-82, 83, 84, 85, 86, and related models all support TI-BASIC and z80 ASM.\nTI-92, Voyage 200, TI-89, and related models all support TI-BASIC, C, and 68000 ASM.\nTI-nspire supports TI-BASIC and Lua.\nHP 50g supports RPL (User and System), ARM ASM, Saturn ASM, and C.\nHP 49, 48G, or 48S, which support Saturn ASM and RPL.","Q_Score":6,"Tags":"java,python,c,calculator,ti-basic","A_Id":31085450,"CreationDate":"2015-06-23T03:13:00.000","Title":"Multiple Language Programming on Ti-Calculator","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to move the cursor in a Python matplotlib window by a (data) pixel at a time (I'm displaying a 2D image), using the keyboard arrow keys. I can trap the keyboard keypress events, but how do I reposition the cursor based on these events?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":533,"Q_Id":31003551,"Users Score":0,"Answer":"One solution is to make MatPlotLib react to key events immediately.\nAnother solution is print a 'Cursor' or marker line on the plot, and change its coordinates with the mouse events. Eg. draw a vertical line, and update its X coordinates with the left and right keys. You can then add a label with the X coordinate along the line, and other nice tricks.","Q_Score":1,"Tags":"python,matplotlib","A_Id":31004307,"CreationDate":"2015-06-23T13:02:00.000","Title":"move cursor in matplotlib window with keyboard stroke","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to get my game to look\/scale well across different devices. I am attempting to introduce the dp and sp metrics into my apps as much as possible, but in this case I am refactoring a game to use these metrics for layout and widget sizing. \nWhere before, my layouts were sized using size_hint in order to have everything get it's size relative to it's parent(the app itself is not given a size, nor is the window, but the root widget\/layout has size_hint=(1, 1)), I am now faced with replacing this system with dp values, and can't figure out what they should be. \nI am thinking, that if I just size the root widget, App itself, or Window with dp, then I could continue to use size_hinting, as this would have a trickle down effect and scale everything correctly from the top on down, so to speak. And for this, It seemed like getting the resolution or density of a devices screen would be a great help(so I could use it to size my root widget\/App\/Window, per device). Is that possible with Kivy? Will this work? Is there a better way? What would you do? Thanks","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":766,"Q_Id":31037748,"Users Score":2,"Answer":"Using size_hint alone already guarantees a degree of scale independence, as (as you note) all the sizes will be relative.\nKivy internally checks some resolution related values of the device, and this is basically the point of dp; something like dp(10) for instance should be the same actual size on any device, in terms of real size on the screen in e.g. centimetres. This won't actually be quite right, if nothing else I think devices don't report precisely right results, but unless this is very important it will already take care of making things mostly look the same anywhere.\nI'm not sure what you mean about setting the App size - in Android's window manager an App just fills the screen (at least in most cases).","Q_Score":1,"Tags":"android,python,scale,kivy,screen-density","A_Id":31038234,"CreationDate":"2015-06-24T21:51:00.000","Title":"Proper usage of metrics with Kivy(So GUI scales well across devices)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to python and want to learn this from the basic.\nI want to open two other application like notepad in a single window. I searched for any examples by using \"tkinter\". Any idea for implementing this using \"tkinter\". \nPS: two tabs one in left and one in right so that one tab will be having notepad and other will have a media player (let say) and i should be able to close the single parent window for closing this child windows.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":509,"Q_Id":31098786,"Users Score":0,"Answer":"I don't think you will be able to do this easily. Notepad is using its own toolkit which, most probably, is not compatible with the one you are using.\nIf you want to open eg. an editor, look for a widget in the toolkit of your choice which does what you want (or nearly). Eg. if you want an editor, use the GtkTextView in GTK, or, if you want something that can do code editing, look at GtkSourceView, etc. Same goes for media applications.\nThe 'include' applications as part of a project works only to a certain point. You can eg, include text-mode applications in a terminal window, but graphical apps are much harder.","Q_Score":0,"Tags":"python,window,parent","A_Id":31100428,"CreationDate":"2015-06-28T10:33:00.000","Title":"Opening other application in single window using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to python and want to learn this from the basic.\nI want to open two other application like notepad in a single window. I searched for any examples by using \"tkinter\". Any idea for implementing this using \"tkinter\". \nPS: two tabs one in left and one in right so that one tab will be having notepad and other will have a media player (let say) and i should be able to close the single parent window for closing this child windows.","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":509,"Q_Id":31098786,"Users Score":-1,"Answer":"For what you need, you will have to use libraries like tkinter or pyqt. As you want to learn it from the basic, I would suggest you to pick a GUI library and start learning it. Eventually you will know how to get the result that you desire.","Q_Score":0,"Tags":"python,window,parent","A_Id":31098854,"CreationDate":"2015-06-28T10:33:00.000","Title":"Opening other application in single window using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make a Drop Down Menu of colors. Red Green Blue Yellow. I want the words inside the option box to be colored with their respected name. So the when the user clicks the arrow to open the optionMenu, Option red will have red letters. blue will have blue letters and so forth.\nIs this Possible? \nThanks.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":439,"Q_Id":31105836,"Users Score":0,"Answer":"Try using the fg(or foreground) and bg(or background) options. If a is the menu, use:\na.entryconfig( optionindex , bg=\" color_name \" ) for the background, and\na.entryconfig( optionindex , bg= \" color_name \" ) for the foreground.","Q_Score":1,"Tags":"python,tkinter,optionmenu","A_Id":31127939,"CreationDate":"2015-06-28T23:24:00.000","Title":"How do you change the color of the words in a Python Tkinter OptionMenu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"In the program I'm writing, the user needs to be able to select a cell in the grid and edit its value. The program also shows what the value of the currently selected value is in hexadecimal (so (0,0) is 0x00, (1,3) is 0x19, etc.) I originally had this display be updated through a binding to the wx.grd.EVT_GRID_SELECT_CELL event. However, upon doing this, the GridCursor would no longer move, it would stay on (0,0). So, I added a SetGridCursor statement to the handler to have it move the cursor when the handler was called. However, this generated an infinite loop, as apparently SetGridCursor generates an EVT_GRID_SELECT_CELL command when called. \nMy question is, how do I have code that executes when a new cell is selected while still maintaining the old cell selection functionality?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":137,"Q_Id":31118668,"Users Score":0,"Answer":"Adding event.Skip() at the end of my custom handler passes the event to the default handler.","Q_Score":0,"Tags":"python,events,grid,wxpython,wxwidgets","A_Id":31124993,"CreationDate":"2015-06-29T14:44:00.000","Title":"In wxPython Grid, creating event handler for Cell Selection disables moving the GridCursor","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wondering if python is a good choice to develop a desktop application for a small business.\nIs it possible to build something using PyQT or even Swing + Jython ? How I can make a executable file at the end?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2859,"Q_Id":31123293,"Users Score":0,"Answer":"It depends on what you are looking to do.  I have done it and it worked but there are other questions that can factor in like who will maintain or update the code, and do they know Python.  You can look at cx_freeze for making a windows executable out of a python program as one of many options.","Q_Score":0,"Tags":"python,pyqt","A_Id":31123417,"CreationDate":"2015-06-29T18:50:00.000","Title":"Is python a good choice to build a desktop application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm wondering if python is a good choice to develop a desktop application for a small business.\nIs it possible to build something using PyQT or even Swing + Jython ? How I can make a executable file at the end?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2859,"Q_Id":31123293,"Users Score":8,"Answer":"I've found Python to be an excellent choice for developing a broad scala of applications including desktop applications. I've developed in C++ for many years, and for parts that are really time critical I sometimes use it still, but for most of my code Python helps me get results much faster. There are several ways to get an executable. Py2exe is one of them, Cython another option allowing easy combination with C++ if you need raw speed, interfacing with 3rd party libaries or low level control of devices. It also makes reverse engineering a bit harder, if that's a concern in your project.\nBy the way, when I started out with Python I was very concerned about performance and (being a quality manager at that time) almost blocked its introducion in our company for its lack of strickt typing. I was wrong about both. Since especially the rich set of built in datastructures as well as many of its standard modules are written in C++ and have been carefully optimized, it isn't so easy to beat on speed and memory efficiency as one might think. And the dynamic typing (only recently introduced in a language like C#) proved a very powerful means to write concise, readable, reliable and compact code.\nI don't have shares (since Python is open source anyhow) but from all the languages I've used in the past (Algol, Pascal, Modula II, Assembler, Basic, Fortran, Cobol, C, C++, C#, Java, JavaScript) it's the one I prefer rightnow to earn a living with.","Q_Score":0,"Tags":"python,pyqt","A_Id":31123686,"CreationDate":"2015-06-29T18:50:00.000","Title":"Is python a good choice to build a desktop application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a setup.py install script for my upcoming PyQt application. The PyQt modules are all spelled with camel case as opposed to the standard module name conventions, and I can't find what name to use in the setup script.\nWhat is the name of the PyQt4 module to be used in the install_requires field of setup()?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":432,"Q_Id":31167283,"Users Score":0,"Answer":"A search of the Python Package Index reveals it's actually python-qt. Annoying, but I suppose it works.\nEDIT: Actually, it's not. See the comments below.","Q_Score":1,"Tags":"python,dependencies,pyqt4,setuptools,setup.py","A_Id":31167583,"CreationDate":"2015-07-01T16:50:00.000","Title":"PyQt4 as dependency in setup script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to import the \"requests\" library into my Kivy application. How do I go about that? Simply giving import requests is not working out.\nEdit:\nI'm using Kivy on Mac OS X, 10.10.3.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1389,"Q_Id":31182671,"Users Score":1,"Answer":"If you're using windows with kivy's portable package, I think you can get a shell with kivy's env by running the kivy executable. Assuming so, I think you can run pip install requests in this shell to install it to kivy's environment.\nEdit: I see you've now noted you are using OS X, but something similar may be true. I don't know about this though.","Q_Score":2,"Tags":"python,kivy","A_Id":31183217,"CreationDate":"2015-07-02T10:57:00.000","Title":"Importing libraries in Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This question is distilled from the original application involving callback functions for Tkinter buttons.  This is one line that illustrates the behavior.\nlambdas = [lambda: i for i in range(3)]\nif you then try invoking the lambda functions generated:\nlambdas[0](), lambdas[1]() and lambdas[2]() all return 2.\nThe desired behavior was to have lambdas[0]() return 0, lambdas[1]() return 1, lambdas[2])() return 2.\nI see that the index variable is interpreted by reference.  The question is how to rephrase to have it treated by value.","AnswerCount":4,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":1153,"Q_Id":31186959,"Users Score":-2,"Answer":"Ahhh, further Googling found a solution (admittedly one I would not have stumbled upon myself). The desired behavior can be invoked by use of a default argument:\nlambdas = [lambda i=i: i for i in range(3)]","Q_Score":4,"Tags":"python,python-2.7,lambda,list-comprehension","A_Id":31187126,"CreationDate":"2015-07-02T14:13:00.000","Title":"How to generate a list of different lambda functions with list comprehension?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C# Application and I want to run python script by passing some arguments and i also want to return some values from python. should i make a .dll file of my python script ? or is there any other way.\nI can't use ironpython because i am unable to import my python project libraries in ironpython\nthanks","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":339,"Q_Id":31211941,"Users Score":1,"Answer":"Convert your Python script to executable using py2exe.exe, and call it from C# using Process.\nAnother way is to execute cmd command \"python program.py\" from your C# program. But, you've to make sure that environment variable for Python is set.","Q_Score":2,"Tags":"c#,python","A_Id":31212458,"CreationDate":"2015-07-03T17:37:00.000","Title":"Executing Python Script from C# (ironPython is not an option)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a design question. I'm doing an exercise in python (2.7) which is a simple game with a labyrinth. I need to read an write from a specific file every step of the game.\nCurrently I have 2 classes (Game and Labyrinth). The Labyrinth class is responsible for reading and writing the file.\nMy question is, is it ok to open the file in the init function of Labyrinth and close it at the end of the game within another function (which can be called from another class)? Or is it better to open and close the file every time?\nThe reason I don't save the file content into a string with readlines() is because I'm supposed to save to the file each step of the game.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":62,"Q_Id":31243476,"Users Score":1,"Answer":"You are at the design phase. \nSo, you have to weigh the chances of losing your data due to some error or crash against the importance of your data and the cost of \"protecting\" it.\nUsing with protects you from some errors. If you consider that python itself may crash (e.g.), then you still have some risk. Saving after each step is evidently safer. How useful it is depends on the volume of saved data (and there are techniques for reducing this as well), the impact of each save on performance, and the chances of such crashes.\nWithout any further info, and simply guessing, my answer to your specific question:\n\n... is it ok to open the file in the init function of Labyrinth and\n  close it at the end of the game...? Or is it better to open and close\n  the file every time?\n\nis that I would save after each step.","Q_Score":1,"Tags":"python,file,oop","A_Id":31244797,"CreationDate":"2015-07-06T10:27:00.000","Title":"Working with files in an object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to count the number of distinct colors in an image using img.getcolors(). However, this does not distinguish between transparent and black pixels - they both report as one pixel colored [0,0,0].\nHow can I distinguish between transparent and black pixels? Many of the images I need to process are largely black on a transparent background.\nFor test purposes, I'm using a PNG I created which is half transparent, half black. len(img.getcolors()) is 1.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":421,"Q_Id":31279936,"Users Score":0,"Answer":"Embarrassing answer:\nI was using convert('RGB') before calling getcolors(). Without the conversion, a 4-value tuple comes back with an alpha channel.","Q_Score":0,"Tags":"python,png,python-imaging-library,transparent","A_Id":31280044,"CreationDate":"2015-07-07T21:49:00.000","Title":"PIL Image.getcolors() cannot distinguish between black and transparent?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have code in python that integrates c++ code using swig.\nThe c++ class has a field with the long value 1393685280 which is converted to python.\nThe problem is that when calling the getter of this field from python I get the int value -2901282016 instead.\nHow can I fix it?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":103,"Q_Id":31314526,"Users Score":0,"Answer":"Well, sorry to give everyone the run-around on this one. \nWe found the solution and it's completely unrelated to SWIG. \nProblem emanated from the ODBC driver for the Vertica DB we were using which behaved unpredictably when using a long variable to bind the SQL result to. \nTomer and Inbal","Q_Score":0,"Tags":"python,type-conversion,swig","A_Id":31378499,"CreationDate":"2015-07-09T10:15:00.000","Title":"swig converts a positive long to negative int","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There is a command validatecommand in Entry widget. But there is not a simulated command in Text widget. \nHow to implement the function in Text widget in tkinter?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":39,"Q_Id":31364987,"Users Score":0,"Answer":"If you want to validate the data when the widget loses focus, you would simply bind a function to the <FocusOut> event.","Q_Score":0,"Tags":"python,python-2.7,user-interface,python-3.x,tkinter","A_Id":31366766,"CreationDate":"2015-07-12T06:16:00.000","Title":"How to validate the content of a Text widget while this Text widget loses focus?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any easy method for opening the text file if you are running your app from the same directory? I can't seem to find anything easy. \nI am asking because you can do that with most of the things in kivy (for image: \"name.png\", for .kv: load_kv(\"name.kv\") and so on) and I don't understand why it wouldn't be similar with finding a text document.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1130,"Q_Id":31368383,"Users Score":0,"Answer":"Just open('filename') - the path is relative, so if its in the same directory you don't have to do anything special.\nIf this appears not to work, perhaps it isn't your syntax that is the issue.","Q_Score":0,"Tags":"python,kivy","A_Id":31368591,"CreationDate":"2015-07-12T13:41:00.000","Title":"Open (read, write) a file in same directory as main app - python\/kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the scope of root if I have a custom widget embedded in another custom widget? Is there a rule of thumb to avoid confusion?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":199,"Q_Id":31387311,"Users Score":0,"Answer":"root is global to every widget rule and refers to the top most widget which in most cases is the instance of the class...","Q_Score":1,"Tags":"python,kivy","A_Id":31411920,"CreationDate":"2015-07-13T15:22:00.000","Title":"Scope of root in kivy language","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How I can use the Kivy framework in Qpython3 (Python 3.2 for android) app?\nI know that Qpython (Python 2.7 for android) app support this framework.\npip_console don't install kivy. I have an error, when I try to install it. Please help me.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":6003,"Q_Id":31387660,"Users Score":0,"Answer":"Edit: Kivy now supports python3 on Android, though qpython would still have to include this (or a similar build process) to have kivy work in qpython3.\nYou can't right now, as kivy does not have a python3-supporting backend on android.\nWe're working towards adding one, at which point I quess qpython may look at adding support in qpython3.","Q_Score":0,"Tags":"kivy,qpython,qpython3","A_Id":31388789,"CreationDate":"2015-07-13T15:39:00.000","Title":"Kivy on Qpython3 (Android)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a ToolBarToolBase object without adding it visibly to the toolbar. I've tried instantiating ToolBarToolBase, but I'm using wxPython version 2.8.12.1 (I can't upgrade, I'm doing this for work) so I don't think it's fully implemented. Is there any way to do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":31393074,"Users Score":0,"Answer":"No. That widget is part of the toolbar. Just use a BitmapButton or a PlateButton. They both support images and would be more flexible to use anyway.","Q_Score":0,"Tags":"python,user-interface,wxpython,toolbar,wxwidgets","A_Id":31393184,"CreationDate":"2015-07-13T20:42:00.000","Title":"wxPython Create a LabelTool without adding it to a Toolbar","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to trigger a function when the mouse stop moving?\nFor example, I have a scale, and I want to trigger a function when I still holding a button and stop dragging. I used 'ButtonRelease-1' but I had to release a mouse button to be able to trigger a function, it's not what I want.\nHope you guys can help me.\nThank you in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":753,"Q_Id":31399631,"Users Score":0,"Answer":"No, you can't bind to \"mouse stopped moving\". However, you can bind to <B1-Motion>, and with each callback set a timer to run in the future. If the mouse hasn't moved within that time the function will be called. Within that function you could use event_generate to generate a custom <<MouseStopped>> event. If the mouse moves before the timer expires, reset the timer. \nYou get the exactly the same effect as if you bound to the mouse not moving.","Q_Score":0,"Tags":"python,events,binding,tkinter,mouse","A_Id":31418783,"CreationDate":"2015-07-14T06:50:00.000","Title":"Binding mouse events on 'stop' motion in tkinter python3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a wx Popupmenu appear when I left-click on a toolbar LabelTool. I already have a binding to have a handler run when I left click an item in the menu, but I want another popup menu to appear when I right click an item in the original popup menu. I've already tried binding it to wx.EVT_RIGHT_DOWN but it doesn't do it. Whenever I try right clicking on a menu object, it seems it still calls the wx.EVT_MENU, which calls the same handler as a left-click would. How would I implement this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":67,"Q_Id":31464191,"Users Score":0,"Answer":"As far as I can tell, that is not supported. Besides, no user is going to expect that they need to right click on a context menu anyway. You should rethink your design so it's more intuitive. Perhaps by using a sub-menu instead of a secondary popup menu","Q_Score":0,"Tags":"python,wxpython,right-click,wxwidgets,popupmenu","A_Id":31477578,"CreationDate":"2015-07-16T20:44:00.000","Title":"Have a popupmenu appear on a popupmenu on right-click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have desktop application in wxpython. User will get notification whenever there is new release available. I would like to create new beta update channel for specific customers. I was thinking of adding check box in the AboutBox. If check box is checked, then user will get update from beta location. There is no way to add check box or other controls in AboutBox. Is there any to achieve this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":31468947,"Users Score":0,"Answer":"Not really. But you can create your own about box by rolling your own dialog with wx.Dialog. Then you can put any widgets that you want to in your custom about box.","Q_Score":0,"Tags":"wxpython","A_Id":31476854,"CreationDate":"2015-07-17T05:31:00.000","Title":"How to add check box control in AboutBox wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have just started learning OpenCV using Python and the first tutorial starts with capturing video using either in built laptop webcam or external webcam. And as it would happen, I have neither. So I thought if it would be possible to use Camera of my Android Smartphone and then capture that video using IP for further processing.\nMy Smartphone: Moto E\nOS: Windows 7\nLanguage: Python\nAndroid Application : IP Webcam\nI have searched the net extensively but am unable to find any working solution, so can anyone please guide me on how to capture the video from my smartphone using IP Webcam.\nSorry for posting no code as I am just trending into this field so am completely clueless.\nThanks.","AnswerCount":7,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29328,"Q_Id":31478137,"Users Score":0,"Answer":"download Droidcam. It can be used by wifi and after that in\ncv2.VideoCapture(n) where n can be 1 or 2 for me its 2 you can use mobile cam in python open_cv2","Q_Score":15,"Tags":"python,opencv,video","A_Id":71733031,"CreationDate":"2015-07-17T14:25:00.000","Title":"Capturing Video from Android Smartphone using OpenCV Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Right now I'm working on a program using wxPython, and I want to make a GUI in which under certain conditions, the widgets become inactive and the user can't interact with them. I'm pretty sure I have seen this in programs before, but I can't come up with a specific example. Is there a way to do this in wxPython? I have no idea what the technical name for this is, so even giving me that would be helpful.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":85,"Q_Id":31480224,"Users Score":1,"Answer":"When you say \"the objects\", what do you mean? If you mean a wx Frame, then you can call Frame.Freeze() to disable the frame, and Frame.Thaw() to unfreeze it. If you want to create a new dialog that must be interacted with and make all background windows unuseable, you can call Dialog.ShowModal(). Finally, many widgets have a Widget.Enable() function, to which you can pass True or False depending on if you want to enable it or not.","Q_Score":0,"Tags":"user-interface,wxpython","A_Id":31480387,"CreationDate":"2015-07-17T16:14:00.000","Title":"wxPython inactive state?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need a user input for my pygame program, but I need it on my GUI(pygame.display.set_mode etc.), not just like: var = input(\"input something\").  Does anybody have suggestions how to do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":113,"Q_Id":31485636,"Users Score":0,"Answer":"There are some answers already here. Anyway, use PGU (Pygame GUI Utilities), it's available on pygame's site. It turns pygame into GUI toolkit. There is an explanation on how to combine it and your game.  Otherwise, program it yourself using key events. It's not hard but time consuming and boring.","Q_Score":0,"Tags":"python,pygame","A_Id":31485743,"CreationDate":"2015-07-17T22:30:00.000","Title":"Pygame, user input on a GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having an instance of QTablewidget with some columns a few rows and some data in it.\nNow I am searching for a way to make the columns fill the full width of the tablewidget. Also, I want all the columns to have the same width. \nIs there a way to achieve this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2439,"Q_Id":31493324,"Users Score":4,"Answer":"This code worked fine for me:\nself.tablewidget_preview.horizontalHeader().setStretchLastSection(True)     self.tablewidget_preview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)","Q_Score":0,"Tags":"python-3.x,pyqt,qtablewidget","A_Id":31641703,"CreationDate":"2015-07-18T16:39:00.000","Title":"Make columns fill the full width of QTableWidget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use Python 2.x and Pygame to code games. Pygame has a built-in rect (Rectangle) class that only supports ints instead of floats. So I have made my own rect class (MyRect) which supports floats. Now my question is as follows:\nA 2D platformer char moves its position (x, y -> both floats). Now when I blit the char onto the screen, is the position rounded to an int (int(round(x))) or just converted into an int (int(x))? I know this might sound a bit stupid, but I've got an issue with this and I'd like to know how this is usually handled.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":68,"Q_Id":31520331,"Users Score":1,"Answer":"You should assume that when blitting a pygame.Surface, the position gets converted to an int via int()","Q_Score":3,"Tags":"python,animation,pygame,2d,sprite","A_Id":31527282,"CreationDate":"2015-07-20T15:21:00.000","Title":"Movement in 2D Games (round position when blitting?)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I downloaded some python library package (for example uncompile2) from GitHub. How I can install it into Qpython from the directory in my android device with pip-console? Or at least to try install...","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":9530,"Q_Id":31526259,"Users Score":0,"Answer":"You could copy the modules you want installed into the site-packages folder\nusing a file manager open up the folder: \n\/sdcard\/com.hipipal.qpyplus\/lib\/python2.7\/site-packages\/\n\nthat is where you can put the modules, i have not tried it with the pip console.","Q_Score":3,"Tags":"python,python-2.7,qpython,qpython3","A_Id":32291741,"CreationDate":"2015-07-20T20:59:00.000","Title":"How to install library with pip-console?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wanted to insert an icon in my GUI. I have already tried inserting one but I need help and want to make it transparent. Can I make the icon transparent in any way? Any help would be appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1083,"Q_Id":31568442,"Users Score":0,"Answer":"If you are using tkinter, you can use Python 3: tkinter.iconbitmap(yourIconFilePath) Python 2: Tkinter.iconbitmap(yourIconFilePath)\nNOTE: Icon files have the *.ico extension","Q_Score":1,"Tags":"python,tkinter","A_Id":31597337,"CreationDate":"2015-07-22T16:07:00.000","Title":"Make the logo transparent in Python tkinter 3.4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are two games (A and B), on the left and right screen sides. The game A responds to mouse clicks, the game B \u2014 to left\/right keydowns.\nThere is also a server which handles games behaviour:\n\nstart(A), start(B)\npause(A), pause(B)\nunpause(A)\nuser clicks on window A, window A gets focus\npause(A), unpause(B)\nuser tries to press left\/right keys, it obviously doesn't focus window B and I can't read keydown events from the game B\n\nI run games as two separate subprocesses (using subprocess.Popen I start a.py and b.py).\nWhere a.py and b.py are simple pygame games that listen my server events inside their game loop.\nIs it possible to share event loop between two different pygame windowed apps?\nOr may be it's better to change focus in some OS-specific way?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":198,"Q_Id":31612336,"Users Score":0,"Answer":"Okay, I have got a solution which works like a charm.\nSince we have a server for handling some game events,\nwe decided to grab a focus inside one game and share all keyboard events\nto other games through the server using web sockets.","Q_Score":0,"Tags":"python,pygame,event-loop","A_Id":32638692,"CreationDate":"2015-07-24T13:51:00.000","Title":"How to switch focus between multiple pygame apps?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to change the font size globally in a Python3\/Tkinter program.  I've managed to do it in the buttons and labels in the main window, but I also have a messagebox in the program that only displays the default font size.","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":1191,"Q_Id":31622397,"Users Score":-1,"Answer":"Im not certain but I believe you can use ttk to change global font size","Q_Score":0,"Tags":"python-3.x,fonts,tkinter","A_Id":31623769,"CreationDate":"2015-07-25T02:52:00.000","Title":"Changing all font sizes in Tkinter\/Python3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to importing pygoogle by import pygoogle in my main.py but when i make an app via buildozer , in logcat i am finding that no module named pygoogle  I have installed pygoogle in my kali linux os and then i went to usr\/local\/lib\/python2.7 and copied pygoogle folder to my home folder where my main.py is.....then i tried again but still same error and then i went distribute.sh -m 'kivy pygoogle everything went good but still was facing same error and then i went to buildozer and in requirments added pygoogle but in aviable module pygoogle is not showing by buildozer .... not with pygoogle only ..with all lbrary i am facing same problem ... any solution some know ???I am not linux expert","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":31636560,"Users Score":0,"Answer":"Since it's a pure python module, and it's on pypi, you can just add it to requirements in buildozer, it doesn't need a specific recipe.","Q_Score":0,"Tags":"android,python,linux,kivy","A_Id":31639040,"CreationDate":"2015-07-26T11:43:00.000","Title":"Facing issues while importing third party (pygoogle) library in main.py for making android apk via buildozer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using wxPython to write an app.  I have a menu that pops up.  I would like to know how to keep it on the screen after the user clicks an item on the menu.  I only want it to go away after the click off it or if I tell it to in the programming.  Does anyone know how to do this?\nI am using RHEL 6 and wxPython 3.01.1","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":55,"Q_Id":31661138,"Users Score":0,"Answer":"I don't think the regular wx.PopupMenu will work that way. However if you look at the wxPython demo, you will see a neat widget called wx.PopupWindow that claims it can be used as a menu and it appears to work the way you want. The wx.PopupTransientWindow might also work.","Q_Score":1,"Tags":"python,wxpython","A_Id":31680789,"CreationDate":"2015-07-27T18:58:00.000","Title":"Keep menu up after clicking in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to Python and Tkinter and I am needing to move a button. \nI have been using button1.pack() to place the button. \nI am not able to move the button from its original position at the bottom of the screen.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":12820,"Q_Id":31699447,"Users Score":1,"Answer":"button1.grid(row = 0, column = 0, padx = 0, pady = 0)\nBut this cannot be used together with pack(), you need to stick to either one.\nAnd this only orders objects relatively, so if you have only one object and you set the row and column to 40 and 50, respectively, the object will still be on the top left corner.","Q_Score":2,"Tags":"python,python-2.7,button,tkinter","A_Id":31700809,"CreationDate":"2015-07-29T11:40:00.000","Title":"How to move a Tkinter button?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I add a vertical gauge which counts from 0 to 100. It works perfectly however it moves from bottom to top. Is there a way to change rotation of it? There is no any setting for that in gauge class.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":40,"Q_Id":31699938,"Users Score":0,"Answer":"Have you considered using a vertical slider as a work around?","Q_Score":0,"Tags":"wxpython,gauge","A_Id":31782512,"CreationDate":"2015-07-29T12:05:00.000","Title":"Change rotation of vertical gauge in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've probably been completely oblivious to the answer but I want to turn a Tkinter program into an exe file and all the programs I've found that do so either don't work for Python 3.4 or I can't install properly and I don't know why. Can I have some help please?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":171,"Q_Id":31716514,"Users Score":0,"Answer":"Turns out I was being a derp after all and just downloaded the wrong version of the program I was trying to use which was cx_freeze.","Q_Score":0,"Tags":"tkinter,exe,python-3.4","A_Id":31782009,"CreationDate":"2015-07-30T06:25:00.000","Title":"Tkinter program into exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make four buttons in a panel receive focus at once. Is this possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":32,"Q_Id":31726919,"Users Score":1,"Answer":"No, it is not possible. wxPython does not support setting focus to multiple widgets at once.","Q_Score":1,"Tags":"widget,wxpython,focus","A_Id":31727286,"CreationDate":"2015-07-30T14:43:00.000","Title":"Can multiple widgets receive focus at once in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm designed a small tool with MFC and python. \nIn this program, I use C++ to cooperate with python API. \nI need: \n\nC++ function A calls Py_Initialize(), and then call python function B with Python API. \nIn the python script Python function B starts a new python thread E, which will create a new file and make some output to this file. \nThen C++ function F calls Py_Finalize(). End. \n\nBut things works unexpectedly. \nB can be called, but E will not start. After calling F, Py_Finalize() is called, then E will start and create the new file. \nI'm wondering what's wrong with this? It seems python is blocked by C++. Does this related with python GIL? If so, what should I do?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":93,"Q_Id":31737012,"Users Score":0,"Answer":"I solved the problem and would like to paste it here if someone else needs. \n\nAfter A calls Py_Initialize(), PyEval_InitThreads() is also needed. \nAfter A calls Python function B, GIL needs to be released by PyEval_ReleaseThread(PyThreadState_Get()). Then thread E can startup. \nAfter E is over, PyGILState_Ensure() should be called in C++ to get back the lock.","Q_Score":0,"Tags":"python,c++,mfc,gil","A_Id":31738521,"CreationDate":"2015-07-31T02:07:00.000","Title":"Create a new Thread in a python script, which is embeded in MFC","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I appreciate this is a VERY novice question but I just want to check in regard to Tkinter Photoimage class, is it only GIF\/PGM\/PPM images that it can read from files and nothing else unless I download the Python Image Library.\nIf thats the case I now know exactly where I went wrong in the code I'm writing. IE: wrong file format","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2941,"Q_Id":31762577,"Users Score":0,"Answer":"That sounds right.  There may be another format or two that native Tkinter supports, but it's very limited.  There's a more up-to-date version of PIL named Pillow that you might want to look into.  It doesn't seem like PIL is being actively maintained, last I looked.  If you want to work with JPEG for example, you need PIL (or Pillow).","Q_Score":0,"Tags":"python,tkinter","A_Id":31762715,"CreationDate":"2015-08-01T13:50:00.000","Title":"Python Tkinter PhotoImage file formats supported?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When changing the foreground colour of an IntCtrl it acted as if it was not set on every subsequent update, as the colour of the text reverted back to black.\nIs there a way to avoid this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":17,"Q_Id":31764392,"Users Score":0,"Answer":"It took a while to find the answer, so if you have a similar issue the answer lies in default_color and oob_color.\nDefine it similar to this:\nself.Client_rate = ic.IntCtrl(self.panel3,-1,value=0,size=(25,22),default_color=self.txt_colour,oob_color=\"red\") \nThen if you need to change the foreground colour alter like this:\nself.Client_rate.SetColors(default_color=self.txt_colour, oob_color=\"red\") \nI trust this helps someone. Note: requires the spelling \"color\"!","Q_Score":1,"Tags":"wxpython","A_Id":31764393,"CreationDate":"2015-08-01T17:36:00.000","Title":"How to prevent IntCtrl() ignoring SetForegroundColour","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Qt Designer to build a UI. In Qt Designer, in the Signal\/Slot editor I set up the following:\nSender: radioButton,\nSignal: toggled(bool),\nReceiver: checkbox,\nSlot: setChecked(bool)\nWhen I run my .py file, as expected, when I select radioButton with the mouse in the user interface, checkbox is checked.\nHowever. if I add a button that calls a function, which includes the following code:\nprint(checkBox.isChecked())\nThe boolean value I get in return is 'False', even though the checkbox is visibly checked.\nDoes anyone know why?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":404,"Q_Id":31779148,"Users Score":0,"Answer":"the problem is that the \ncheckBox.isChecked()\nmethod was in the wrong place. It was checked whenever the program was run (where the checkbox was empty) but not afterwards. As it turns out, the signal is generated via mouse after the program is run.\nSo I added the method to the function that checks the state of the checkbox after a button is clicked.\nPlease be merciful in grading this post thread :). New to stackoverflow.","Q_Score":0,"Tags":"python,qt,pyqt4","A_Id":31779357,"CreationDate":"2015-08-03T03:49:00.000","Title":"PyQt4 isChecked() method","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been writing a Kivy graphical program on Raspberry Pi, with the KivyPie OS (Linux pre-configured for Kivy development).\nFor some reason, it's running extremely slow if started with sudo.\nNormally, running \"python main.py\", the program runs at about 30 cycles per second.\nHowever, if I do \"sudo python main.py\", it runs as slowly as 1 cycle per 5-10 seconds.\nI need to use sudo to access Raspberry's GPIO. (unless I try some other way to do it, that I see people discuss).\nI'm interested, though, what could be the cause of such a massive performance drop with sudo? And is it possible to work around that?\nPS: Running the same program on my PC (Linux) with and without sudo doesn't seem to cause such problem. Only on Raspberry.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2524,"Q_Id":31786122,"Users Score":0,"Answer":"Well, I would call this problem solved, even if a few questions remain.\nHere are the key points:\n\nThe slowdown is caused by Kivy being unable to load the proper video driver under \"sudo\", and using software rendering instead.\nI haven't figured out why the driver isn't loading with sudo or how to fix it. However...\nAfter compiling the program with Pyinstaller, everything works fine. The executable can be started with sudo, GPIO is working, Kivy loads the appropriate driver, everything works fast, as it should.\n\nTo sum it up, the reason of the initial problem has been found, no fix for launching the program directly with Python was yet found, but the problem was removed by compiling the program with Pyinstaller. (still, not a convenient way for debugging.)","Q_Score":6,"Tags":"python,raspberry-pi,kivy,sudo","A_Id":31861791,"CreationDate":"2015-08-03T11:31:00.000","Title":"Raspberry Pi Python (Kivy) extremely slow with sudo","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having some trouble with my Kivy apps when run from the QPython launcher.\nIf I run the standard pong example, I don't see any output.\nThis used to work.\nSo, I suspect that QPython, or Kivy has taken an 'upgrade' which has broken something.\nIn the past I would be able to swipe down to see the log output icon.\nBut, now that's no longer there.\nWell done QPython, Kivy !!!!\nSo, what's changed?\nAnd, how am I supposed to check program log output to see why it no longer runs?\nRegards\nNick","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":429,"Q_Id":31852534,"Users Score":0,"Answer":"I don't know about qpython's log stuff, but you can see the kivy log output by viewing the logcat stream, e.g. from an attached computer (with developer mode enabled) using adb logcat.\nThis has always been possible and is the standard way to view the log output with kivy (and with android in general). It sounds like your direct problem relates to a change in qpython.","Q_Score":1,"Tags":"android,kivy,qpython","A_Id":31858806,"CreationDate":"2015-08-06T09:52:00.000","Title":"Kivy QPython app on Android Moto G phone - no log output","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a program using Python\/Tkinter and it involves a main screen with a bunch of buttons. Each button will launch another Python script in the same folder.\nI'm trying to create a function that will quit the script and open another. How can this be done?\nPeople have recommended os.system on other similar threads, however everything I've tried has failed to work.\nAny ideas\/help would be greatly appreciated,\nJarrod","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":428,"Q_Id":31867145,"Users Score":0,"Answer":"I'd consider using subprocess library in python.\nimport subprocess\np=subprocess.Popen([\"python\", \"my_script_1.py\"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\noutput=p.communicate()[0]\nHope this helps.","Q_Score":0,"Tags":"python,tkinter,launch,os.system","A_Id":31867275,"CreationDate":"2015-08-06T22:59:00.000","Title":"Function to Launch Another Python Script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a 10 x 10 GridLayout with 100 Image widgets, and on_touch_down, I want the picture that was touched to change to a different picture. Since the touch signal will bubble through GridLayout and all its 100 Image children, I want to do a check in on_touch_down to see if the touch coordinates are within the area occupied by the Image that was touched. How can I find the vertices of the Image, or is there an alternative to my approach? Calculating each Image's four vertices as they are added would be rather difficult since I am stretching these Images.\nMany thanks in advance. :)","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":74,"Q_Id":31887058,"Users Score":0,"Answer":"self.pos and self.size would have sufficed. How silly of me.","Q_Score":0,"Tags":"python,python-2.7,user-interface,kivy","A_Id":31888122,"CreationDate":"2015-08-07T21:42:00.000","Title":"How Can I Find the Area\/Vertices Occupied By a Widget in Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was looking for a faster way to blit multiple objects in pygame than the traditional blitting method, in which you have an array or list, and you use a for loop to go and insert each image at its position. \nMaybe there is a way of blitting the whole array at once, without having to go value by value throughout the whole array?\nThanks for the ideas and help!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":662,"Q_Id":31926126,"Users Score":1,"Answer":"use pygame.sprite.Group or multithread the blit method. In pygame 1.9.2alpha, it releases the python gil and allows multi-cpu rendering.\nAlso look up for pygame dirty rendering. Depending on what you want to draw, this can give you significant speed increase.","Q_Score":0,"Tags":"python,arrays,pygame,blit","A_Id":31948684,"CreationDate":"2015-08-10T17:58:00.000","Title":"Using arrays to blit multiple objects in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like build the kivy application which will work on 64bit Windows (and if possible 32bit also).\n\nIs it possible that one app will work on both platforms?\nCan I use 32bit system to build 64bit app?\n\nThis is probably simple questions, but I've never write code for these systems.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":302,"Q_Id":31973865,"Users Score":1,"Answer":"A lot of windows software is still shipped as 32bit-only, because for some reason compat with obsolete 32bit-windows still matters.  Alternatively, 32 and 64bit builds are available.\nIf you write your source code properly (without any assumptions about being able to store a possibly-64bit type in an int), you can make 32 and 64bit builds from the same source.  I think this is really unlikely to be a problem for python!\nBuilding 64bit software on a 32bit platform is no problem.  You'll only run into trouble if you have a complicated build system that builds some tools (which are part of what gets shipped, so you build them for the target instead of host), but also want to run those tools during the build.","Q_Score":0,"Tags":"python,windows,x86,x86-64,kivy","A_Id":31977726,"CreationDate":"2015-08-12T19:32:00.000","Title":"Kivy - build 64bit application on 32bit Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a newbie with PySide. I have a QGridlayout with QLabel's and I want to add\/remove\/update QLabel. \n\nIs it possible to create QList of QLabel with PySide similar to Qt in C++? After I populate the QGridlayout with QLabel and I want to dynamically increase\/decrease the number of items in QGridlayout.\nIs QListWidget\/QListWidgetItem only way to create list in PySide? Can it be used with QLabel\/QPixmap?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":432,"Q_Id":31996847,"Users Score":0,"Answer":"Sure. The python code will look just like C++ would look, sans syntax adaptations.\nNo. You can use a QStandardItemModel, or a custom model. In addition, there's no point to creating QLabel delegates for model data, since all standard views handle images and pixmaps available from Qt::DecorationRole. If all you want is a list of images, even a custom model would be trivial.","Q_Score":0,"Tags":"python,qt,pyqt,pyside","A_Id":31998434,"CreationDate":"2015-08-13T19:28:00.000","Title":"List of QLabel in PySide\/Qt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"\"pygame ImportError: No module named pygame\"\nI get this on my Android Moto G phone when running a simple QPython script.\nI should point out that this script used to work - so I suspect that QPython, Android, pygame, or something has taken an auto upgrade which has gone bad.\nI tried to install pygame in the pip console, but it told me that pygame was already installed.\nSo, what's gone wrong !!! ????\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":986,"Q_Id":32010208,"Users Score":1,"Answer":"The shell is telling you it cannot find the module named \"pygame\"\nThe module \"pygame\" is either not installed or you have typed the name incorrectly.\nTry reinstalling the pygame module","Q_Score":0,"Tags":"android,pygame,kivy,qpython","A_Id":32010262,"CreationDate":"2015-08-14T12:32:00.000","Title":"What does this mean?: \"pygame ImportError: No module named pygame\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When using TextInput in Kivy, everything that is entered is kept as a string, even when the input is restricted to characters that represent floats or ints using input_filter. How can TextInput.text be converted into an actual float or int type so that I can do calculations with it?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3422,"Q_Id":32028928,"Users Score":0,"Answer":"Why couldn't you just grab the TextInput.text and convert it using float or int? ie text = TextInput.text for an int.. conversion = int(text)","Q_Score":0,"Tags":"python,kivy","A_Id":32028953,"CreationDate":"2015-08-15T20:13:00.000","Title":"Kivy: How to convert user input into int or float","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running Windows 8.1 64bit but have Python 2.7.10 32bit. Now I'm trying to install PyQt using Windows installer. What version should I download?\n\nPyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe    Windows 64 bit installer\nPyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe    Windows 32 bit installer\n\nI have 64bit windows but 32bit Python and I want to make a 32bit executables.\nI think that I should install 32bit, is it true?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1155,"Q_Id":32139820,"Users Score":1,"Answer":"Yes I would guess you're right since python will link to PyQt they should be based on the same architecture !","Q_Score":1,"Tags":"python,windows,pyqt,32bit-64bit","A_Id":32139874,"CreationDate":"2015-08-21T12:02:00.000","Title":"What version of PyQt should I install (32 vs 64)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to capture a screenshot of a wxpython GUI program when the program menu on the menu bar drops down?. I attempted to do this by pressing the print screen key on my keyboard but it didn't work. \nNevertheless, the print screen function key works fine when the menu on the menubar does NOT drop down.\nI noticed I can take screenshots of other GUI programs on my system when their menu options are seen .\nIf this is possible, what codes can I place in my program to facilitate a successful screenshot when any menu is showing?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":320,"Q_Id":32148604,"Users Score":2,"Answer":"I just tried \"Shift-prt scr\" on my Windows 8.1 to capture a screen with a menu shown (used the wxPython demo) and it worked for me.\nYou can also use a screen capture utility, e.g. I often use IrfanView, to do this, with it I set a timer to capture things which go away when the window looses focus.","Q_Score":1,"Tags":"python,wxpython","A_Id":32154356,"CreationDate":"2015-08-21T20:14:00.000","Title":"How to take a screenshot of a Wxpython GUI program when menu drops down on menubar","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know that you can set undo=True for a Text widget, and then press CTRL + Z and CTRL + Y for undo and redo. \nBut I was wondering if there was a function I could bind to a button or something like that.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":115,"Q_Id":32150994,"Users Score":1,"Answer":"The text widget has both an edit_undo() and edit_redo() method, which is what the built-in bindings use. You can call these methods from a button or menu item if you wish.","Q_Score":0,"Tags":"python,text,tkinter,undo-redo","A_Id":32151274,"CreationDate":"2015-08-22T00:13:00.000","Title":"Calling a function when undoing or redoing in a Text widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got PyQt4 and pyqt4-dev-tools installed on my raspberry pi but I'm getting \n\nImportError: No module named PyQt4 on my Raspberry Pi\n\nwith the following includes when I run python3\n\nfrom PyQt4 import QtGui\nfrom PyQt4 import QtCore\n\nI've got another Pi that PyQT4 is found so I'm not sure what I've done wrong on this one.  Can anyone tell me what I can do to get Python to find the PyQt4 modules?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":8273,"Q_Id":32173695,"Users Score":0,"Answer":"Most likely you installed PyQt4 and pyqt4-dev-tools for Python 2.x, but not for Python 3.x.\nCheck if PyQt4 is in your site-packages directory for Python 3.x. For me this is under \/usr\/lib\/python3.4\/site-packages\/PyQt4.\nIf it's not there, you need to grab the correct Python 3 version of the packages. What distro are you using?","Q_Score":0,"Tags":"python,python-3.x,import,pyqt4","A_Id":32173862,"CreationDate":"2015-08-24T02:27:00.000","Title":"ImportError: No module named PyQt4 on my Raspberry Pi","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a C-function which returns a struct data type with several items in it (size_t, char*, int, unsigned and other structs). When I call this function there is no output in python. After some googling I think the problem is that I didn't declare the data type in my interface file. But this turns out to be not that easy. What is the right approach: typemaps or just a simple typedef?\nCan someone help me?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":667,"Q_Id":32178005,"Users Score":2,"Answer":"You need to %include the header first. You need the headers for the nested structs too, in dependency order!\nAfter you've done that, Swig should automatically wrap the struct so that a call to your function will return a proxy object with the appropriate members.\nA typemap is for when you want to change Swig's default behaviors.","Q_Score":0,"Tags":"python,c,struct,swig,return-type","A_Id":32178123,"CreationDate":"2015-08-24T08:47:00.000","Title":"Return Struct data type from C-function in Python via SWIG","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to have an event for hovering\/clicking on a drawn line on the Canvas widget (not the widget itself)?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":59,"Q_Id":32186447,"Users Score":1,"Answer":"You can put a tag on the line and then bind Enter or Button-1 to the tag with the tag_bind method of the canvas widget.","Q_Score":1,"Tags":"python,tkinter,tkinter-canvas","A_Id":32186808,"CreationDate":"2015-08-24T15:46:00.000","Title":"Run event on hovering on drawn line on canvas in python's tkinter gui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've tried everything to get this to work and nothing worked. I tried installing all of the binary directories for Kivy but it didn't work. Is there a very simple way to allow Sublime Text to understand Kivy language.\nI am using Windows 10 with Python 2.7.10.","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":2803,"Q_Id":32195042,"Users Score":6,"Answer":"For enabling highlighting of Kivy language in Sublime Text make following steps:  \n\nPress Ctrl + Shift + P\nWrite IP (install package)\nChose \"Install Package\"\nWrite KV \nFound KIVY install pack.\nPress it. \nIn right bottom part of window Sublime Text you will seen \"Plain Text\". Press this and in this Syntax Bar choose Kivy Syntax. \n\nMaybe it's not what you looking for, but when I looking solutions for my problem  I found this topic and here was solution without method explanation.","Q_Score":2,"Tags":"python,text,sublimetext2,kivy","A_Id":60463882,"CreationDate":"2015-08-25T03:22:00.000","Title":"How do you add the Kivy directories so Sublime Text can compile using Kivy language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing an app using wxpython for use specifically with a Microsoft surface, which requires text input. Is there a way to automatically bring up the onscreen keyboard when an input box is selected?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":397,"Q_Id":32228920,"Users Score":0,"Answer":"You can create an onscreen keyboard with wxPython for your applications. If you want keyboard to appear when you click your app's wx.TextCtrl, you just need to bind wx.EVT_LEFT_DOWN and\/or wx.EVT_LEFT_UP events to it. However, if you want keyboard to appear when any app's input is clicked then it is really hard to achieve, instead you can assign a function key to popup.","Q_Score":0,"Tags":"windows,input,wxpython,tablet,on-screen-keyboard","A_Id":32413608,"CreationDate":"2015-08-26T14:05:00.000","Title":"Opening onscreen keyboard wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I think my question is already asked, but I didn't find any topic about that.\nWhen I try somme script with kivy, I have sometimes errors (such as undeclared variable, bad indentation...), but Qpython don't display them.\nI lunch kivy with:\n\"#qpy:kivy\"\nand consequently, there is no console. A log is however present, but it's empty.\nIs there a way to remedy this ?\nShould I add a line to display error ?\nThanks\nSimon\nPS: The \"print\" command is also useful, but not working (no console). I think it's the same problem.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":143,"Q_Id":32247747,"Users Score":0,"Answer":"The newest 1.2.0 version had fixed this blank log issue.","Q_Score":0,"Tags":"kivy,qpython","A_Id":32610342,"CreationDate":"2015-08-27T11:07:00.000","Title":"How to display error occurred in script?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"That is, without doing focus_set on some other widget?\nThe original post ended with the sentence above, but it did not meet quality standards. These standards demand that the problem is described completely, including what one has tried. They insist on proper grammar too.\nWell, it is not really a problem, just a question. I tried to find a widget method, say, focus_unset, that would do the trick. I didn't. My grammar is proper. Maybe the robotic police is confused with terms like focus_set?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":193,"Q_Id":32255872,"Users Score":0,"Answer":"No. Some widget must have focus. You can set focus to the root window if you don't have any other widgets that naturally accept keyboard input.","Q_Score":0,"Tags":"python,tkinter","A_Id":32257282,"CreationDate":"2015-08-27T17:29:00.000","Title":"Is there a way to make s tkinter widget lose focus?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I was looking around at different things to do on Python, like code for flashing text or a timer, but when I copied them into my window, there were constant syntax errors. Now, maybe you're not meant to copy them straight in, but one error I got was 'no module named wx'. I learned that I could get that module by installing wxPython. Problem is, I've tried all 4 options and none of them have worked for me. Which one do I download and how do I set it up using Windows?\nThanks","AnswerCount":10,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":91741,"Q_Id":32284938,"Users Score":7,"Answer":"3 steps to install wx-widgets and pygame in python IDLE\n\nInstall python 3xxx in your system opting (Add 3xxx to your path).\nopen python CLI to see whether python is working or not.\nthen open command prompt (CMD).\n\n\ntype PIP to see whether pip is installed or not.\n\nenter command : pip install wheel\nenter command : pip install pygame \nTo install wxpython \nenter command : pip install -U wxPython\n\nThats all !!","Q_Score":20,"Tags":"python,windows,download,wxpython","A_Id":48046623,"CreationDate":"2015-08-29T10:15:00.000","Title":"How to properly install wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I was looking around at different things to do on Python, like code for flashing text or a timer, but when I copied them into my window, there were constant syntax errors. Now, maybe you're not meant to copy them straight in, but one error I got was 'no module named wx'. I learned that I could get that module by installing wxPython. Problem is, I've tried all 4 options and none of them have worked for me. Which one do I download and how do I set it up using Windows?\nThanks","AnswerCount":10,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":91741,"Q_Id":32284938,"Users Score":0,"Answer":"Check the version of wxpython and the version of python you have in your machine.\nFor python 2.7 use wxPython3.0-win32-3.0.2.0-py27 package","Q_Score":20,"Tags":"python,windows,download,wxpython","A_Id":54313732,"CreationDate":"2015-08-29T10:15:00.000","Title":"How to properly install wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a WPF application.It has a iron python script editor using AvalonEdit. We were able to validate and run the iron python scripts using this application.\nBut we need to integrate an iron python debugger in to this application.\nCan anyone suggest better solution for this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":256,"Q_Id":32353881,"Users Score":0,"Answer":"You could take a look at pdb and dbd. This are some very useful modules. You could go through the code and integrate it in your application.","Q_Score":3,"Tags":"wpf,ironpython,avalonedit","A_Id":33526046,"CreationDate":"2015-09-02T12:59:00.000","Title":"Iron python debugger for my application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a .py and .kv file for my game, now I must package it. I, however, do not own a mac. I have a linux and a windows computer, I prefer linux. Is it possible for me to make an Iphone app without using a Mac?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":1543,"Q_Id":32445682,"Users Score":3,"Answer":"I think it's technically possible (though against apple's TOS) to use a virtual machine, though there are many problems you can encounter in setting this up.\nIt may also be possible to use some online provider, but I don't think I've seen an example of this with kivy in particular.\nThere's no way to do it natively on linux, due to apple's toolchain requirements.","Q_Score":5,"Tags":"python,ios,linux,kivy","A_Id":32484689,"CreationDate":"2015-09-07T20:32:00.000","Title":"How can I package a Kivy IOS app while on linux?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using a ttk treeview  like a table full of testdata and I'd like to highlight now the values which are out of range.\nTherefore I'd like to color single values (or the background color of this value) in a item and not the whole item (row).\nIs this possible? \nI've found one example where this problem is solved with a treeview per column, but this is not possible, because I don't want to color the whole column, but just one value...\nr","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1417,"Q_Id":32495332,"Users Score":1,"Answer":"The Treeview widget doesn't allow you to change the color of individual values.  You can change the color of an entire row, but not just a single value within a row.","Q_Score":2,"Tags":"python,treeview,ttk","A_Id":32788603,"CreationDate":"2015-09-10T07:07:00.000","Title":"python ttk treeview: Different background or font color for values in item","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking to take a .exe file I've built using cx_Freeze, move it to my desktop, and have the ability to execute it while allowing it to reference the necessary directory. When I copy and paste the application, it tries to find its necessary files on the desktop rather than in the original directory.\nCurrently, all my files (including the .exe file) for this program are in the directory C:\\Users\\my_name\\PycharmProjects\\PROGRAM_DIRECTORY\\build\\exe.win32-3.4. I would like to take the file PROGRAM.exe, move it to my desktop (for more accessible execution) while still permitting it to reference all of the necessary files in the C:\\...\\exe.win32-3.4 directory. Is this possible?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":146,"Q_Id":32526329,"Users Score":0,"Answer":"Copying the .exe file from the directory and pasting it to the desktop will create a shortcut that has a default reference directory of its new location (the desktop), and this cannot be changed. A way around this is:\n-Right click on the desktop\n-Select \"New > Shortcut\"\n-Browse for the .exe file or copy the directory into the field and add \\PROGRAM.exe after it\n-Name the shortcut\nThis shortcut will direct the execution to the parent file which remains in its necessary directory (C:\\...\\exe.win32-3.4) rather than trying to reference the desktop as the directory.","Q_Score":0,"Tags":"python,windows,tkinter,exe,cx-freeze","A_Id":32526330,"CreationDate":"2015-09-11T14:51:00.000","Title":"Python\/ Tkinter\/ cx_Freeze: Creating standalone .exe application outside directory","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have just started using django imagekit. I have a list view page where the images are of dimensions 270 x 203 (30 KB approx.) and same images have a size of 570 x 427 (90 KB approx.) in the details view page.\nI wanted to know;\n\nShould have create 2 different images for each image with different size and dimensions.\nif the answer to the 1st query is yes. How to do it on Django Imagekit.\n\nPS: I am planning to use django Imagekit on the form level.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":95,"Q_Id":32531308,"Users Score":0,"Answer":"Based on the answer provided by kicker86. I plan to retain single image.","Q_Score":1,"Tags":"python,django,django-class-based-views,django-imagekit","A_Id":32639949,"CreationDate":"2015-09-11T20:03:00.000","Title":"django imagekit - list view and details view image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm using Fedora 21. Installed the python3-tkinter package using yum install python3-tkinter. The package gets stored in the \/usr\/lib64\/python3.4 directory. Is there a way to use pip to install tkinter?\nHave a virtualenv setup with python3. When I try to run my program within that virtualenv I get:\n\nImportError: No module named 'tkinter'. \n\nDoes it make sense to copy the package directories from \/usr\/lib64\/python3.4 to the site_packages folder associated with the virtualenv?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1536,"Q_Id":32540787,"Users Score":0,"Answer":"I was using python 3.3.2 interpreter. Turns out the default packages installed when running the command     yum install python3-tkinter are set to work with python 3.4.1 interpreter. Configuring my virtualenv to use the python 3.4.1 interpreter proved to be the solution as the python interpreter was then able to find the required libraries in it's path.","Q_Score":0,"Tags":"python-3.x,tkinter,virtualenv,yum,fedora-21","A_Id":32723786,"CreationDate":"2015-09-12T15:55:00.000","Title":"Installation of tkinter on python3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have Python 3.4.3 installed on an older laptop (Pentium 4) with Windows XP.\nIt seems that half the time when the Python shell is open, the CPU usage goes up to 12-13%.\nIt is the Python shell itself, not any Python script it may have launched, and not the IDLE text editor.\nI have yet to figure out the pattern when it goes up and when it does not. CPU usage actually goes to zero when I begin to debug a tkinter based script.\nThe shell window is opened by clicking on IDLE shortcut, if it makes any difference.\nI have resorted to closing the shell until I need it, while I am working in IDLE editor.\nAny idea why this happens and can this be remedied?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2211,"Q_Id":32551405,"Users Score":0,"Answer":"IDLE normally runs in two processes: one to run the graphical user interface, one to run your code.  The processes currently communicate through a socket.  Each process polls the socket for input 20 times a second.  The user process also calls tk update in case the use is using tkinter but is not running mainloop.\nI have a 6-core Pentium with gigabytes of memory and SSD main drive running 64-bit Win10.  I currently have 5 IDLE shells running and 5 corresponding user processes: installed 2.7, 3.4, 3.5, 3.6, and development build of 3.6.  Task Manager mostly shows each at 0%. One occasionally bumps up to .7%.  This would be a much higher % on a single core machine.  This seems to happen more often  with the 3.4 IDLE.\nI can only speculate that some combination of less memory, slower memory, less CPU cache space, much slower swap to disk, old single-core laptop chip with fewer instructions, and older OS with fewer system calls results in the difference.\nDoes your laptop have its maximum memory?\nHow often when using IDLE is the 12% an actual problem?  (I guess that partly depend on time on battery versus power cord.)","Q_Score":1,"Tags":"python,shell,python-idle","A_Id":38809051,"CreationDate":"2015-09-13T15:40:00.000","Title":"Python Shell High CPU Usage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible with gspread or other Python-based access to Google Spreadsheets to insert an image into a spreadsheet?\nAlso, is it possible to make rich text cells (e.g., bold, italic, different fontsize, colors, etc.)?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1698,"Q_Id":32570491,"Users Score":5,"Answer":"The question is a bit old, but today I had to check this for myself, so this may be useful for people that arrive here.\nInsert an image: I'm not sure if inserting images as objects (as in the Google Sheets UI) is possible, but one way of doing it is setting the content of the cell to =IMAGE(\"<url of image>\"). I believe the image here needs to be a public link, so a direct link to a protected Google Drive resource wouldn't work (even if the user has permission to access it).\nFormatting cells: Now there is package gspread-formatting to do this, but it could be also done calling the v4 of spreadsheets API.","Q_Score":9,"Tags":"python,google-sheets,gspread","A_Id":56837998,"CreationDate":"2015-09-14T17:28:00.000","Title":"Does the Google Spreadsheet Python API or gspread allow images or rich text?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use %include wchar.i in C# and it seems to work correctly for all wchar_t values and arrays mapping to C#'s string. Swig's library for Python also contains the typemaps for wchar_t in wchar.i file.\nJava's library doesn't have wchar.i. What's the reason for that? And also how I can achieve type mapping from wchar_t types in C++ to String in Java?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":426,"Q_Id":32572114,"Users Score":0,"Answer":"As you are using c++, than you can try with std::wstring as it has typemaps for all: C#, Python and Java. It is in std_wstring.i","Q_Score":2,"Tags":"java,c#,python,c++,swig","A_Id":32615679,"CreationDate":"2015-09-14T19:07:00.000","Title":"SWIG: wchar_t support for Java","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"During IPython 3 times, I could make my custom IPython.html.widgets.DOMWidget span the full width of the notebook by setting it's width trait (corresponding to the CSS width of the widget div) to 100 %. In Jupyter 4, that does not work anymore, the widget gets squashed to the left edge of the notebook. Web inspector tells me that the parent div.widget-subarea essentially has zero width up to padding. Is that a new feature or a bug? What is the exact widget API to achieve a full-width widget? I guess I'm bound for trouble if my widget's JS just sets the width of the parent wrapper to 100 % as well...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":686,"Q_Id":32585703,"Users Score":0,"Answer":"Apparently, that was due to a bug in the version of Jupyter I was using. The style for .widget-subarea in widget.css has gained a flex: 2 1 0%; property since, which was missing before, despite display: flex;.","Q_Score":0,"Tags":"widget,ipython-notebook,jupyter","A_Id":33165242,"CreationDate":"2015-09-15T12:08:00.000","Title":"IPython\/Jupyter notebook widget span full width","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using pygame with a joystick controller. The joystick controller is not calibrated correctly, though. The right horizontal controller continually outputs bad values and does not zero correctly upon return to center position. Is this fully a hardware issue, or is there a method of calibration\/continual calibration using pygame or another library?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":378,"Q_Id":32595475,"Users Score":0,"Answer":"I had to calibrate my joystick by using software provided when I bought the joystick. I couldn't find a way to do so with pygame.\nAre the outputs actually incorrect though? My outputs are never zero'd, but my program functions properly when using them.","Q_Score":0,"Tags":"python-2.7,pygame,user-input,joystick","A_Id":32722976,"CreationDate":"2015-09-15T20:56:00.000","Title":"Python pygame calibrate joystick controller","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to capture text from a Text Input box and fire off a function after the text is inputted. Only problem is the event is fired everytime a character is entered. I would like the event fired after all characters have been entered in the text input box. How could i delay the firing until all characters have been entered?\nI tried to override the on_text method but did not solve my problem as it is this method that is being called 20 times. I also tried putting in a sleep in the on_text but it just buffered the responses and still fired 20 times.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":133,"Q_Id":32639137,"Users Score":1,"Answer":"Do exactly what you're already doing, but have the function you're calling check if whatever condition you're after is met. For instance, if you want to call it after 5 characters have been entered, check the length of the string.\nThis seems an awkward way of working though, are you sure you want to check after every character rather than, say, wait for the user to press enter?","Q_Score":0,"Tags":"python-2.7,kivy","A_Id":32649566,"CreationDate":"2015-09-17T20:10:00.000","Title":"How do I delay an event in Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a tkinter-based gui that has a sidepanel with comboboxes.  They are all contained within a frame for easy packing.\nThing is if I put a \"long_test_level_for_instance\" the width of the combobox grows to accommodate that(whether such a string is selected or not)\nWhat I would like is a fixed width combobox\/frame. Is this doable?  it was a pain todo it in GTK but I found a way, it is automatic in qt and I am wondering now for tk\n--edit-- \nself.framePLOTSEL.pack_propagate(False)  in conjunction with width=... \nThis however clips the content of the combobox when it is expanded (its expected to be clipped when collapsed)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":61,"Q_Id":32683912,"Users Score":0,"Answer":"The combobox widget has a width attribute which you can use to control the width of the combobox. However, the dropdown menu will always be the same width as the control, so you won't be able to see all of the characters in long items.","Q_Score":0,"Tags":"python,python-3.x,tkinter,ttk","A_Id":32696645,"CreationDate":"2015-09-20T20:22:00.000","Title":"TK combo boxes & restricting their size","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"After a ttk.Button has been created, the name of the callback function can be obtained in various ways.  But is there a way to obtain the callback function itself?\nThe use case is that I want to use the button's callback function in the callback function to be assigned to another widget.\nCurrently I'm assigning the button's callback function to an additional attribute of the Button object after creating it.  That's redundant, though, and I'd like to get the callback function directly from the Button object itself, if possible.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":34,"Q_Id":32719789,"Users Score":2,"Answer":"No, there is no supported way to get the command via introspection. Your solution of adding it as an attribute is a perfectly reasonable thing to do. If you're bothered by the fact it takes two lines of code instead of one, you can subclass the button to hide that detail.","Q_Score":1,"Tags":"python,tkinter","A_Id":32720291,"CreationDate":"2015-09-22T14:36:00.000","Title":"How can the command function be obtained from a Tkinter button?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just made an apk app using kivy. In the code, I defined the positions of all widgets according to scale of the screen. However, when I rotate the screen, say, from portrait to landscape, the absolute coordinates still stay the same, and it doesn't fit in very well.\nIs there a method to identify whether portrait or landscape is being displayed? I need this in order to re-define the positions of my widget when user rotates the phone.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":888,"Q_Id":32751538,"Users Score":0,"Answer":"It would be much better to just not use absolute coordinates, but rather to use kivy's layout classes to achieve relative positioning (you can also specify the relative positioning manually but that's harder and more verbose, and you're just reinventing the layouts if you do it).\nIn any case, the direct answer to your question is that there may be an android api function you can call to get the orientation if you really want, or in reality you presumably care specifically about the window size which is exposed by kivy.core.window.Window.size","Q_Score":0,"Tags":"android,python,rotation,kivy,buildozer","A_Id":32758159,"CreationDate":"2015-09-24T00:29:00.000","Title":"How to identify whether the screen is in Portrait or Landscape in Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm just wondering (as im starting to make a game with pygame) is there a way to 1) Run a program that only opens a GUI and not the shell\nand \n2) Run the program without having to edit with idle (I'd like to do this so the game will look more professional.\nI would like to just have a desktop shortcut or something that when clicked, runs only the GUI and doesnt show my code or show the shell.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":87,"Q_Id":32771481,"Users Score":1,"Answer":"If you're on windows, a quick thing could be to make a one-line batch script.\nstart pythonw.exe <filename>\nThe start keyword causes the shell to not wait for the program to finish. \npythonw vs python prevents the python terminal from appearing. \nIf you're on linux\/mac, you could do the same with shell scripts.","Q_Score":0,"Tags":"python,pygame,python-idle","A_Id":32771570,"CreationDate":"2015-09-24T21:48:00.000","Title":"How to make the text shell not appear when running a program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I don't really want to move the whole world in my game but I do want the screen to follow my character. \nSo for example, normally pygame would render at the position of 0,0 and the window height width would allow you to expand that viewing area. But I want to move the starting position so that I can view something at coordinates 1000x1000 even if my screen is only 500x500 big.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":24,"Q_Id":32802726,"Users Score":0,"Answer":"Is it possible to make camera tracking without moving the whole world?\n\nNo.\nBy relativity, moving the player within the world is the same as moving the world around the player.  Since your camera is fixed on the player, by definition you will see the world moving when the player moves within it.  Therefore, you must draw your world in a different place.\nIt is more explicit in 3D graphics; we represent the scene's motion as one matrix, and the camera's as another.  The renderer uses their product.  It doesn't care which contributed to the motion.","Q_Score":0,"Tags":"python-3.x,pygame","A_Id":32802814,"CreationDate":"2015-09-26T22:39:00.000","Title":"Is it possible to make camera tracking without moving the whole world?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a command in Tkinter that allows the program to pop up a window that lets the user pick a printer from the list of drivers that they have installed? \nSorry that I can't provide any details, but I haven't found anything about this topic on the web.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":62,"Q_Id":32811951,"Users Score":0,"Answer":"No, there is not. You'll  have to create your own popup window for that specific problem.","Q_Score":0,"Tags":"python,printing,tkinter","A_Id":32812217,"CreationDate":"2015-09-27T19:26:00.000","Title":"Tkinter Print function[filedialog]","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a Python GUI (wxPython) which wraps around a fortran \"back-end,\" using f2py. Sometimes, the fortran process(es) may be quite long running, and we would like to put a progress bar in the GUI to update the progress through the Fortran routine.  Is there any way to get the status\/progress of the Fortran routine, without involving file I\/O?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":185,"Q_Id":32873308,"Users Score":0,"Answer":"At high  risk of being down voted, if you know roughly how long each task is going to take, the simplest option is base the progress on how much time has elapsed since the task started, measured against the expected duration of the task.\nTo keep it relevant you could always store the run duration for the task each time and use that, or an average, as your base time-line.\nSometimes, we can over over complicate things ;)","Q_Score":1,"Tags":"python,fortran,wxpython,f2py","A_Id":32882987,"CreationDate":"2015-09-30T18:34:00.000","Title":"Updating long-running Fortran subroutine in Python GUI using f2py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Tkinter to create a window in python and a canvas to display graphics in the window. This is working fine so far.\nBut I have a two dimensional list containing colours that I would like to directly place on the canvas.\nExample\nI have a class defined (named CRGB) that has three variables: r, g and b. These are the red, green and blue values of a colour, and are integers between 0 and 255.\nI also have a two-dimensional list, which contains CRGB objects with the colour data.\nI then have a Canvas (defined in a variable called screenCanvas) which is the same size as the 2D list.\nHow would I transfer the pixels from the 2D list to the canvas?\nNotes: I would like the code to work on Mac AND Windows, and not use any external libraries (libraries not included in Python by default.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2388,"Q_Id":32922630,"Users Score":2,"Answer":"The canvas has no way to draw an individual pixel, except to draw a line that is exactly one pixel long and one pixel wide.\nIf you only need to place pixels, and don't need the other features of the canvas widget, you can use a PhotoImage object. An instance of PhotoImage has methods for setting individual pixels.","Q_Score":1,"Tags":"python,list,canvas,tkinter","A_Id":32924414,"CreationDate":"2015-10-03T12:35:00.000","Title":"Drawing individual pixels to a canvas in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I had a pretty general question. \nI'm used to programming my main code inside def main(): \nBut when I made a GUI using TKinter and put it inside my main code none of my variables worked! After putting my GUI on indent 0 code the GUI finally worked, but any functions I activated using my GUI didn't have my variables! Does anyone know what to do? \nAlso, if my GUI takes input values and stores them in a variable and activates a function, will that function need to have this variable passed into it? Or does it already know?\nProgramming on Jetbrains Pycharm in Python 3.4.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":32939832,"Users Score":0,"Answer":"The simple fact is, GUI code is no different than any other python code. It can go wherever you want. The exact same rules apply for widgets as they do for integers and strings and anything else in a python program. Local variables are only visible locally, global variables are visible everywhere within a module, and instance variables are accessible to anything inside an object, or anything that has a reference to an object.","Q_Score":0,"Tags":"function,user-interface,python-3.x,tkinter,parameter-passing","A_Id":32940178,"CreationDate":"2015-10-05T00:37:00.000","Title":"Where do GUI's go in a general application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to get a clear window in Pygame?\nI know that I can have a borderless window, but is it possible to get rid of everything inside of the window to make it clear? I want to make some stuff that works on top of my desktop, but it needs a shape that isn't rectangle. I do know that it would still be a rectangle, I just don't want it to look like one.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":85,"Q_Id":32950512,"Users Score":0,"Answer":"I do not believe this is possible within regular Pygame. A Google search turned up \"Window Manager Extensions\", though, which explicitly supports non-rectangular windows.","Q_Score":0,"Tags":"python,window,pygame","A_Id":32959873,"CreationDate":"2015-10-05T14:02:00.000","Title":"How Do I Make A Clear Window in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Last week I was given a requirement for an already crowded display\/input screen written in wxPython (data stored in MySQL database) to show the first 24 characters of two free format comment fields but to allow up to 255 characters to be displayed\/input. For instance on entry the screen might show \u201cRight hip and knee X-ra\u201d whilst the full entry continues \u201cys requested 24th September in both laying and standing positions with knee shown straighten and bent through 75 degrees\u201d. Whilst I can create a wxtextCtrl that holds more characters than displayed (scrolls) I cannot work out how to display\/enter the contents as a multiline box when selected. I have gone through our wxPython book and searched online with no joy.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":109,"Q_Id":32965937,"Users Score":1,"Answer":"The simplest way to do it I see would be to store only the abbreviated contents in wxTextCtrl itself normally and only replace it with the full contents when the user is about to start editing it (i.e. when you get wxEVT_SET_FOCUS) and then replace it with the abbreviated version again later (i.e. when you get wxEVT_KILL_FOCUS).","Q_Score":0,"Tags":"wxpython,wxwidgets","A_Id":32968457,"CreationDate":"2015-10-06T09:07:00.000","Title":"wxtextCtrl To Allow Input\/Display Of More Text Than Default Display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Last week I was given a requirement for an already crowded display\/input screen written in wxPython (data stored in MySQL database) to show the first 24 characters of two free format comment fields but to allow up to 255 characters to be displayed\/input. For instance on entry the screen might show \u201cRight hip and knee X-ra\u201d whilst the full entry continues \u201cys requested 24th September in both laying and standing positions with knee shown straighten and bent through 75 degrees\u201d. Whilst I can create a wxtextCtrl that holds more characters than displayed (scrolls) I cannot work out how to display\/enter the contents as a multiline box when selected. I have gone through our wxPython book and searched online with no joy.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":109,"Q_Id":32965937,"Users Score":0,"Answer":"Have you considered using my.TextCtrl.SetToolTipString() and setting it to the same value as the textctrl contents. In this manner only the first 24 characters show in the textctrl but if you hover over it the entire string will be displayed as a tooltip.","Q_Score":0,"Tags":"wxpython,wxwidgets","A_Id":33018442,"CreationDate":"2015-10-06T09:07:00.000","Title":"wxtextCtrl To Allow Input\/Display Of More Text Than Default Display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Do you know an easy way to make an \"history\" on a QLineEdit in PySide\/PyQt?\nExample: Whenever Enter is pressed, the typed text will be stored, and pressing the \"up\" or \"down\" arrows allows you to navigate through the history.\nThank you very much","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1457,"Q_Id":32972145,"Users Score":6,"Answer":"Blah....\nI just figured that the QComboBox does exactly what I want to do when the \"setEditable\" is on...\nIt has a completer, and an history of whatever was typed in the textfield!","Q_Score":5,"Tags":"python,pyqt,pyside,maya,qlineedit","A_Id":32972495,"CreationDate":"2015-10-06T14:09:00.000","Title":"PyQt QLineEdit with history","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an image of a map.  I would like to make the left and right (East and west) edges of the map connect so that you can scroll forever to the right or left and keep scrolling over the same picture.  I've looked around and can't find anything on the topic (likely because I don't know what to call it).  I would also like to have the picture in a frame that I can grab and drag to move the picture around.  I was trying to do this in Tkinter, but I have a feeling there are probably easier ways to do this.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":180,"Q_Id":33000288,"Users Score":0,"Answer":"(actually, you are asking 2 different, not very precise questions)\n\nscroll forever: Independent from python a common approach is to\nmirror the images at the edges so you can implement a virtually\nendless world from 1 or some images (tiles of the map).\nGUI framework\/API: From my experience Qt (so in your case maybe PyQt) is\nwell documented and designed to quite easily realize OS independent\nGUI.","Q_Score":0,"Tags":"python,tkinter,python-imaging-library,tkinter-canvas","A_Id":33000636,"CreationDate":"2015-10-07T18:57:00.000","Title":"Connecting edges of picture in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I change the defaulttheme-0.png of my Python Kivy installation, my App appears different when launching it as .py on Ubuntu. But if I now \"convert\" it to an .apk and run it on my mobile (Android 5.1.2) it appears as before, without the theme being changed.\nWhat do I have to do, to tell kivy\/buildozer to integrate the theme into the .apk?\nWhat I tried:\n- Normally running \"sudo buildozer android debug\"\n- Deleting all files created by \"sudo buildozer init\" and calling that one again\n- And of course I searched Google, but as I didn't found anything, I hope you can help me, because my App would be almost done after fixing that problem...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":358,"Q_Id":33002726,"Users Score":2,"Answer":"Instead of changing the theme in a local kivy installation, place the image in a folder named data\/images in your app's directory (i.e. .\/data\/images\/defaulttheme-0.png from your app script).\nEdit: it is also necessary to copy the atlas file to this location, as noted by Tshirtman.","Q_Score":0,"Tags":"android,python,apk,kivy,buildozer","A_Id":33002817,"CreationDate":"2015-10-07T21:29:00.000","Title":"Python Kivy: Changing defaulttheme-0.png won't change final .apk design","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a working program written in Java (a 3d game) and some scripts in Python written with theano to process images. \nI am trying to capture the frames of the game as it is running and run these scripts on the frames.\nMy current implementation grabs the binary data from each pixel in the frame, saves the frame as a png image and calls the python script (using ProcessBuilder) which opens the image and does its thing.\nWriting an image to file and then opening it in python is pretty inefficient, so I would like to be able to pass the binary data from Java to Python directly.\nIf I am not mistaken, processBuilder only takes arguments as strings, so does anyone know how I can pass this binary data directly to my python script? Any ideas?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":250,"Q_Id":33029293,"Users Score":0,"Answer":"If there is no limit to the length of the string argument for launching the python script, you could simply encode the binary data from the image into a string, and pass that. The only problem you might encounter with this approach would be null characters and and negative numbers.","Q_Score":0,"Tags":"java,python,subprocess,jython,processbuilder","A_Id":38824000,"CreationDate":"2015-10-09T03:13:00.000","Title":"Passing binary data from java to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm currently working on a simple GUI written using the Tkinter library for Python that makes use of two different frames. With a button I can switch between the two frames making only one of the two visible at a time.\nThere's one specific button that I would require to use in both frames. Is it possible to place it in different frames?\nOf course I have several back-door solutions to my problem, like creating a button that makes use of the same variables and commands, but what I would like to know is if it is possible to use exactly the same button.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":154,"Q_Id":33038821,"Users Score":1,"Answer":"You can place a button in whatever frame you want (with the exception you can't move a widget between toplevel windows). However, the button can't appear in two frames at the same time. \nIt's certainly possible to move the button when you switch frames, though I would either move the button to a common toolbar, or just have two buttons that call the same functions. Moving the button around adds complexity without giving much extra value in return.","Q_Score":0,"Tags":"python,tkinter,widget","A_Id":33040441,"CreationDate":"2015-10-09T12:53:00.000","Title":"Using the same button in different Tkinter frames","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to set a window's size, and then be able to resize it while the program is running. I've been able to make the window large, but I can't resize it smaller than the original set size. For a different project, I would also like to know how to make it so the window is not resizable at all.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":41,"Q_Id":33057049,"Users Score":3,"Answer":"For the first question: Gtk.Window.resize(width, height) should work. If you use set_size_request(width, height), you cannot resize your window smaller than these values.\nFor the second question: Gtk.Window.set_resizable(False)","Q_Score":1,"Tags":"python,resize,pygtk","A_Id":33057480,"CreationDate":"2015-10-10T17:42:00.000","Title":"PYGTK Resizing permissions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm interesting in making games in my future, and I've heard that my favourite game's engine is made with c++, but its embedded with python. I have little experience with programming, but I greatly understand how object orientation works.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":159,"Q_Id":33088102,"Users Score":2,"Answer":"Why would someone need\/want to embed a scripting language into a programming language?\n\nThe main reason obviously is to allow to provide extensions to the game engine without need to recompile the entire game executable program, but have the extensions loaded and interpreted at run time.\nMany game engines provide such feature for extensibility.\n\n... but I greatly understand how object orientation works.\n\nObject orientation comes in with the interfaces declared, how to interact with the particular scripts.\nSo python is itself an object oriented language which supports OOP principles quite well.\nFor instance integration of non OOP scripting languages, like e.g. lua scripts (also oftenly used for extensions), makes that harder, but not impossible after all.","Q_Score":2,"Tags":"python,c++,scripting,embedded-language","A_Id":33088189,"CreationDate":"2015-10-12T18:44:00.000","Title":"What is the purpose of embedding a scripting language into a programming language in a game engine?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What do I have to do so that the function that I bind with the <KeyPress> event only triggers once, even when I hold the key?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":836,"Q_Id":33088597,"Users Score":0,"Answer":"There may be nothing you can do. It could very well be that the keyboard itself is sending multiple events (ie: it's a hardware problem that can't be solved with software).\nThese events are probably coming very close together -- maybe every 100ms or so. You can use that knowledge to affect how you process events. For example, you can only do something special on a key release if it was at least 200ms after the last press.","Q_Score":0,"Tags":"python,events,triggers,tkinter,keypress","A_Id":33089284,"CreationDate":"2015-10-12T19:16:00.000","Title":"Python: Tkinter Keypress Event Trigger once: Hold vs. Pressed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a ship that shoots lasers. It draws a line from itself to (mouseX, mouseY). How can I have the ship accelerate in the exact opposite direction as if being pushed backwards?\nI have been working through some trig and ratios but am not making much progress. Acceleration is constant so how far the mouse is doesn't matter, just the direction. \nI've been primarily working on trying to create a vector that only works with integers in the range (-4,4), as I cannot have the ship move across the screen at a Float speed, and the (-4,4) range would at least give me... 16 different directions for the ship to move, though I'd like that not to be a limitation.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":185,"Q_Id":33172753,"Users Score":0,"Answer":"The vector of acceleration will be in the direction from the mouse cursor to the ship, away from the mouse position - so if the line from mouse to ship is at angle theta to horizontal (where anticlockwise theta is +ve, clockwise is -ve), so will the force F acting on the ship to accelerate it. If ship has mass M then using f=ma, acceleration A will be F\/M. Acceleration in x axis will be A * cos(theta), in y A * sin(theta) - then use v=u+at after every time interval for your simulation. You will have to use floating point maths for this calculation.","Q_Score":0,"Tags":"python,vector,pygame,trigonometry","A_Id":33172964,"CreationDate":"2015-10-16T14:19:00.000","Title":"How to have an object run directly away from mouse at a constant speed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating an application with Tkinter that contains a grid of widgets. Is there anyway to mimic the behavior of bootstrap such that all the elements appear on the window after it is collapsed?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1698,"Q_Id":33280111,"Users Score":0,"Answer":"There are three ways to insert elements in a tkinter window.\nFirst you could use only yourelement.pack() to put the element, and every element you put after, it will be downside the first align at the center.\nYou could use yourelement.pack() and yourelement.place(x=xx,y=xx,width=xx,height=xx) to place the element where you want according to your x and y values.\nAnd last of all but not less important, you could use yourelement.grid(row=xx,column=xx) to place the element in the window on a grid you have previously defined.\nThis last way to place the element is redimensionable, but a little bit difficult to assemble all the things in the window, but it's a thing of try and fail.","Q_Score":2,"Tags":"python,tkinter","A_Id":44626762,"CreationDate":"2015-10-22T11:38:00.000","Title":"Bootstrap Behavior in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made a GUI for my application. All scripts are in Python (2.7) and the GUI is created with Tkinter. I work on Linux, but I needed this app to be executable on Windows. So I've used py2exe, to create an executable. After a while it is working almost perfectly, but I have the following problem:\nSomewhere in the application, I need to call external programs, namely ImageMagick and LaTeX. I use the commands convert, pdflatex, simply by importing os module and running os.system(build), where build = 'convert page.pdf page.gif'etc. When those commands are called from the *.exe application the console pops up (meaning a console window opens up for a split of a second and closes again). Is there a way, to prevent this behaviour? \nIt does not interrupt the application, but it is ugly and not a desired behaviour.\n[Note] I chose not to add any samples, since there are lots of files and other content, which, I think, is not related to the problem. I could however try to post minimal (not)working example. But maybe it is not needed.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":893,"Q_Id":33352574,"Users Score":0,"Answer":"import subprocess\nsubprocess.Popen(\"application.exe\", shell = True)","Q_Score":0,"Tags":"python,windows,tkinter,console,py2exe","A_Id":33352759,"CreationDate":"2015-10-26T18:01:00.000","Title":"How to stop console from poping up when command is called from python GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can not find which is the main event for the checkbox in the kv file.\nI tried on_checkbox_active but raise an error.\nI tried on_active but does nothing (and do not raise any error)\non_release, on_press but obviously give me an error.\nthis is my basic test code line: on_active: print(\"hello\")\nWhat is the event that run when click on a checkbox?\nthank you guys","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":730,"Q_Id":33399351,"Users Score":0,"Answer":"The event raised when the state of the checkbox is changed is on_active. If you have a problem with it, post a simple runnable example demonstrating the issue.","Q_Score":0,"Tags":"python,user-interface,checkbox,event-handling,kivy","A_Id":33402193,"CreationDate":"2015-10-28T18:55:00.000","Title":"Why Kivy checkbox active event not work?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use \"tkinter\", \"opencv\" (cv2) and \"numpy\" in windows(8 - 64 bit and x64) with python2.7 - the same as I have running perfectly well in Linux (Elementary and DistroAstro) on other machines. I've downloaded the up to date Visual Studio and C++ compiler and installed these, as well as the latest version of PIP following error messages with the first attempts with PIP and numpy\n\nfirst I tried winpython, which already has numpy present but this comes without tkinter, although openCV would install. I don't want to use qt.\nso I tried vanilla Python, which installs to Python27. Numpy won't install with PIP or EasyInstall (unless it takes over an hour -same for SciPy), and the -.exe installation route for Numpy bombs becausee its looking for Python2.7 (not Python27). openCV won't install with PIP (\"no suitable version\")\nextensive searches haven't turned up an answer as to how to get a windows Python 2.7.x environment with all three of numpy, tkinter and cv2 working.\n\nAny help would be appreciated!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":170,"Q_Id":33418678,"Users Score":0,"Answer":"Finally did it with .whl files. Download them, copy to C:\\python27\\Scripts and then open \"cmd\" and navigate to that folder with \"cd\\\" etc. Once there run:\npip install numpy-1.10.1+mkl-cp27-none-win_amd64.whl\nfor example.\nIn IDLE I then get:\nimport numpy\nnumpy.version\n'1.10.1'","Q_Score":0,"Tags":"python,windows,opencv,numpy,tkinter","A_Id":33434056,"CreationDate":"2015-10-29T15:41:00.000","Title":"tkinter opencv and numpy in windows with python2.7","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use \"tkinter\", \"opencv\" (cv2) and \"numpy\" in windows(8 - 64 bit and x64) with python2.7 - the same as I have running perfectly well in Linux (Elementary and DistroAstro) on other machines. I've downloaded the up to date Visual Studio and C++ compiler and installed these, as well as the latest version of PIP following error messages with the first attempts with PIP and numpy\n\nfirst I tried winpython, which already has numpy present but this comes without tkinter, although openCV would install. I don't want to use qt.\nso I tried vanilla Python, which installs to Python27. Numpy won't install with PIP or EasyInstall (unless it takes over an hour -same for SciPy), and the -.exe installation route for Numpy bombs becausee its looking for Python2.7 (not Python27). openCV won't install with PIP (\"no suitable version\")\nextensive searches haven't turned up an answer as to how to get a windows Python 2.7.x environment with all three of numpy, tkinter and cv2 working.\n\nAny help would be appreciated!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":170,"Q_Id":33418678,"Users Score":0,"Answer":"small remark: WinPython has tkinter, as it's included by Python Interpreter itself","Q_Score":0,"Tags":"python,windows,opencv,numpy,tkinter","A_Id":33441221,"CreationDate":"2015-10-29T15:41:00.000","Title":"tkinter opencv and numpy in windows with python2.7","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"ok, I've got into programming with python and thus far was having a fair amount of success. I've typed up a program that uses pyautogui to automates atask I need to do on a monthly basis. \nI took Screenshots of where I needed the mouse to click and when all was done I had a working program that searched the screen for the button to clicked, controlled the mouse that location, and printed out the report I needed. So, all I needed to do was plug it into the task scheduler and it would do the work for me! \nSeveral days afterwards, I decided to go ahead and schedule it. I ran the program again, and it crashed! Long Story short, the screen shots didn't match. I took a screen shot again, and zoomed both images 800% in Paint, and check the pixel next to the \"I\" in The two different images and sure enough the rgb values are different. \nI tried several other places to, and while they looked the same... The rgb values are different by maybe one or two points! I'm curious as to why is this happening!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1631,"Q_Id":33426380,"Users Score":0,"Answer":"Use confidence, default value is 0.999. Reason is pyscreeze is actually used by pyautogui which has the confidence value which most likely represents a percentage from 0% - 100% for a similarity match. Looking through the code with my amateur eyes reveals that OpenCV and NumPy are required for confidence to work otherwise a different function would be used that doesn't have the confidence value.\nfor example:\nby doing pyautogui.locateCenterOnScreen('foo.png', confidence=0.5) will set your confidence to 0.5, which means 50%.","Q_Score":1,"Tags":"python,pyautogui","A_Id":38478105,"CreationDate":"2015-10-29T23:25:00.000","Title":"Pyautogui - Problems with Changing Screenshots","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know that tkinter has issues working with virtual envs due to the binaries not being copied and that there are workarounds if I'm just using virtual envs, but what about the autogenerated virtual envs generated by tox? Is there any way to use something like tkinter with tox?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":88,"Q_Id":33442707,"Users Score":1,"Answer":"Not yet but hopefully soon someone will address this problem and create a compatible virtual env.","Q_Score":0,"Tags":"python,windows,tkinter,virtualenv,tox","A_Id":33454458,"CreationDate":"2015-10-30T18:31:00.000","Title":"Can tkinter work with tox (on windows)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to run a sample Theano code that uses GPU on windows.\nMy python (with python-dev and Theano and all required libraries) was installed from Anaconda.\nThis is the error I run into:\nCannot open include file: 'Python.h': No such file or directory\nMy Python.h is actually in c:\/\/Anaconda\/include\/\nI'm guessing that I should add that directory to some environmental variable, but I don't know which.","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":20029,"Q_Id":33473848,"Users Score":14,"Answer":"If you are using Visual Studio in Windows, right-click on your project in the Solution Explorer and navigate as follows: Properties -> C\/C++ -> General -> Additional Include Directories -> Add C:\/Anaconda\/include\/ (or wherever your Anaconda install is located)","Q_Score":13,"Tags":"python,windows,theano","A_Id":46394599,"CreationDate":"2015-11-02T08:54:00.000","Title":"Windows missing Python.h","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have an large frame of a wide array of elements. Within this frame, there are basically two different sides to the frame. Consider a widget x on the left side, which is placed by .grid(row=4, column=0). Padding is added to this object x, so it is actually x.grid(row=4, column=0, pady=10) Well, the opposite object, object y, is placed on the same row by y.grid(row=4, column=4), or something along those lines. I have this setup, but the pady on x is adding padding to y as well. I want there to be padding on one widget in the row-- not the entire row. Therefore, my paraphrased question is, how does one add padding to only one widget in a row, without adding padding to every object in that respective row?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":767,"Q_Id":33506328,"Users Score":0,"Answer":"The very definition of a row is that is the same height all the way across. That's what makes it a row. The same can be said for columns.\nTherefore, the tallest item in a row (height plus padding) is what controls the overall height of the row. The only control you have over smaller widgets is which sides of their too-large cell they stick to. \nFor example, if you want all widgets to be aligned along their tops, use sticky=\"n\", which causes the top of the widgets to \"stick\" to the top (north) side of the space they have been allocated. If you want them aligned along their bottoms, use sticky=\"s\". Providing neither \"n\" or \"s\" means they will be aligned along their midpoints.","Q_Score":0,"Tags":"python,tkinter,widget","A_Id":33507438,"CreationDate":"2015-11-03T18:19:00.000","Title":"How to add padding to a widget, but not the entire row's widgets, in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So i think this is possible but I'm not sure...\nIm creating a login system for my program, the main screen is a tinter GUI root window, when this is created it is then .withdraw() and the top level login window is opened (this is stored in another module in a class). When the username and password are correct in the login top level window i want to .deiconify() the root window from within a method of the login window class. Is this possible and if so how....\nSorry i haven't got the code with me so can't upload any right now\nThank You!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3137,"Q_Id":33511004,"Users Score":3,"Answer":"Sure it's possible.  Just call root.deiconify().  You can either pass root as a parameter to the login window, or make it a global variable.","Q_Score":1,"Tags":"python,user-interface,tkinter","A_Id":33511107,"CreationDate":"2015-11-03T23:23:00.000","Title":"Tkinter GUI - deiconify() top level window from a top level window class in another module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Being new to QPython, didn't find any reference\nabout developing on a Mac or Pc, eventually \ndeploying the code on the Android device.\nIn contrast to developing the code itself on the Android device\nwhich seems very awkward specially for larger projects.\nI wish to write the code using a \"normal\" IDE such as IntelliJ\nusing my Mac or Windows, eventually deploy it on an Android device, \nand execute with QPython.\nSo the following questions come to mind:\n\nBest practice to transfer source code to an Android device with QPython installed (not using the QR Code which is limited to few KB's of code)\nIs it possible to develop QPython code on Mac\/Windows namely using the SL4A (androidhelper) or is it strictly available on the Android device itself\n\nI have more questions but would be better to have the basic best practices.\nPs. to give a context in relation to question #1 we need to rapidly deploy QPython code on many devices quickly, so copying the .py files manually is out of the question, and the QR code feature is very limited, so perhaps create a script that imports a script? (via git or HTTP)","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":2614,"Q_Id":33511359,"Users Score":2,"Answer":"You can develop qpython project as other python projects with your pc or MC, and upload the project into your mobile's \/sdcard\/com.hipipal.qpyplus\/projects\/ then run it in qpython.\nThe qpython project should contain the main.py which is used for the project first launch script.\nBesides adb (android develop tool), you can use the qpython's FTP service ( You could find it in setting page ) or other FTP app to upload the project into your mobile.\nGOOD NEWS: In the newest qpython(1.2.2), it contains a qedit4web.py which allow you develop from browser and edit and run code from your mobile.","Q_Score":3,"Tags":"android,python,sl4a,qpython","A_Id":34069082,"CreationDate":"2015-11-03T23:53:00.000","Title":"QPython development environment using mac or windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like plot circles or ellipses in Pyqtgraph gl.GLViewWidget(). However I did not find a function to do that.\nAnyone know the way to do that?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":2153,"Q_Id":33525279,"Users Score":1,"Answer":"As a regular user of pyqtgraph I do not believe that it has functions for generating circles or ellipses. I believe that you would have to define the circle and ellipse functions yourself and generate the points of the circle or ellipse from those.","Q_Score":0,"Tags":"python,plot,geometry,ellipse,pyqtgraph","A_Id":34653828,"CreationDate":"2015-11-04T15:11:00.000","Title":"Pyqtgraph: How do I plot an ellipse or a circle","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have to create a game in Python for University and it should run on Windows.\nNow I have found kivy and I am asking myself, if kivy is even better than pygame or is it just for touch displays and I better use pygame?\nWe don't have touch displays btw! \nThe questions are, is kivy easier to program, easier to learn or more efficiently?\nP.S.: I'm aware of the fact, that pygame is part of kivy!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4160,"Q_Id":33562616,"Users Score":3,"Answer":"I personally find kivy better than pygame. The latter one is kind of outdated and doesn't get much support today while kivy is still growing and gaining new possibilities. It's also not true that kivy is only for touch displays. It's completely multiplatform so you can create a kivy app for almost any operating system without needing to change anything in your code! Although you might get a little bit better performance with pygame, kivy is much more intuitive framework and if you don't aim to create a Crysis I'd go with kivy. Cheers!\nP.S. You couldn't make anything like Crysis even with pygame :D If you want to create a 3D game in Python you better use kivent, a 3D engine written in C with Python API dedicated for kivy.","Q_Score":2,"Tags":"python,touch,kivy","A_Id":33562894,"CreationDate":"2015-11-06T08:39:00.000","Title":"When I write a game for Windows, should I use kivy or pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created a Pyside QT GUI app (Python 2.7) and part of the spec is to launch it automatically when the system starts.  Normal init.d stuff doesn't seem to work since it's a GUI app.\nSo far I've tried x11 init.d and xdg xyz.desktop solutions and they don't seem to work.\nHow would you solve this?\nHow are Pyside apps auto started on system boot?\n(Debian Wheezy)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":121,"Q_Id":33599791,"Users Score":0,"Answer":"Ok after hours and hours of fooling around I figured it out.  I actually used the built-in startup manager in GNOME.  I tried this before but it didn't work.  So this time I created an entry to start gnome-calculator.. the built in calculator.\nThen I edited the entry in ~\/.config\/autostart\/gnome-calculator.desktop using gedit (gedit ~\/.config\/autostart\/gnome-calculator.desktop).  I changed Exec=gnome-calculator to Exec=python \/home\/me\/myapp.py\nand it works.\nYes it is a lame solution and it doesn't identify what the problem was but it's a start.  Thanks for the help.","Q_Score":0,"Tags":"python,qt,debian","A_Id":33642196,"CreationDate":"2015-11-08T22:30:00.000","Title":"How can I auto start a python\/pyside GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a p2p chat program in Python 3 using Tkinter. I can paste Korean text into the Entry widget and send to the other user and it works.\nHowever, I can't 'type' Korean into the widget directly.\nWhy is this happening? \nI am using Mac OS X Yosemite.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":669,"Q_Id":33603442,"Users Score":0,"Answer":"As mentioned by @mohit-bhasi, upgrading my python version to 3.8 which has tkinter 8.6 in it solved the problem. I can now type Korean directly into the widgets.\nOnly caveat is that I need to press right arrow once when I finished typing to have the last letter appear. Otherwise, the last letter is not recognized.","Q_Score":4,"Tags":"python,unicode,tkinter,tkinter-entry","A_Id":61833731,"CreationDate":"2015-11-09T06:16:00.000","Title":"Python Tkinter Entry. I can't type Korean in to the Entry field","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to write a program to change the DPI setting on my logitech G502 mouse (My goal being to use the program with AutoHotkey to help automate a task where I switch my DPI allot and to learn a bit about USB). I'm fairly fluent in C++ , C# and python. But I'm not at all knowledgeable on USB or drivers.\nSo far I have: used the program USBlyser to identify a Control transfer sent to my mouse when using Logitech's software, which byte of the data corresponds to my DPI setting, and the product ID and Vendor ID of my mouse.\nAfter looking around on the net I decided PyUSB would be a good option for communicating to my mouse. After installing libUsb for use with PyUSB I realised that this then replaces my current mouse driver and makes it unusable.\nAm I just going about this all wrong? In my head all I want to do is send to my mouse the data \"10 FF 0E CA 01 00 00\", should I instead be somehow communicating with my existing logitech driver to do this? Or can I set-up libUsb without interfering with existing drivers?\nAny help will be appreciated, cheers Bradley.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":800,"Q_Id":33638747,"Users Score":1,"Answer":"libusb doesn't interfere with anything. In PyUSB you choose to communicate directly with the device. To do this any other app holding this USB port have to be stopped.\nWindows driver in your mouse case.\nI think it may be possible for you to push the DPI activation code while driver is still using mouse, but how, I have no idea now.\nOr you may detach mouse temporarily , pass the code, and then release mouse back to Windows, hoping that DPI config wouldn't be reseted.\nIf that doesn't pass, you may always completely emulate mouse driver. It is very easy.\nThere are code samples for PyUSB on internet on how to interpret mouse data. So you do it and you pass the recognized command to OS either directly through Windows API or using PyMouse library.\nIn this case you do not need driver, because your program is one, and it sends to mouse whatever you want.\nYou have a lot of options how to do what you want.\nFor instance, if this is only for your local use, and there is interface already doing what you want, automate that interface using pywinauto to perform a macro to activate\/disable higher DPI.\nThere are more possibilities.\nYou can replace Windows driver with your own version, which will support what you wish, thus making your own layer in mouse stack. But this is extreme.\nI think you should start in order I wrote:\n\nSee whether you can use PyUSB to send bytes needed without detaching mouse from OS\nIf not, see whether detaching mouse, changing DPI, and returning mouse back to OS using PyUSB keeps the set DPI.\n\n3.1 If not, make your own artificial driver using PyUSB and PyMouse\nor\n3.2 Use pywinauto to automate the existing interface to change DPI for you.","Q_Score":1,"Tags":"python,usb,driver,libusb,pyusb","A_Id":33641552,"CreationDate":"2015-11-10T20:15:00.000","Title":"Communicating to USB devices in windows 7 and still use pre-existing drivers?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If so, how would this be done? If not, is there a conventional way to achieve the same effect?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":463,"Q_Id":33646840,"Users Score":0,"Answer":"Thank you, PM 2Ring. \nFor posterity, the answer is that you can bind multiple callbacks to a signal in GTK3. They will be called in the order they were bound in.","Q_Score":0,"Tags":"python,callback,gtk3","A_Id":33658899,"CreationDate":"2015-11-11T08:39:00.000","Title":"Is it possible to set multiple callback functions for a given event with GTK (Python)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a window with a treeview and an entry widget. I would like to be able to write in the entry widget while still being able to use the up\/down arrows to navigate the treeview. There are a few ways I've tried doing this:\n\nSend all keyboard events to both widgets (I have tried using custom bind_tags, unsuccessfully)\nUse the entry <Up> and <Down> bindings to navigate the treeview (I have not found a straightforward way to move up and down a tree with multiple parents and children, such as a file directory)\nUse the root <Key> binding to selectively send raw keycodes to the entry widget so things like backspace and left\/right arrow work as expected (I haven't come across a method to send keycodes\/events directly to the entry widget)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":112,"Q_Id":33646953,"Users Score":1,"Answer":"Your #2 is the right approach. You will have to write methods that calculate how to move up and down the tree. You can get the currently selected item, then use the .next() method to get the next child of the same parent. If that returns an empty string you can get the parent (by calling .parent()) and call .next() on it. You can recursively keep doing that until you hit the end of the tree (the parent is the root node, and .next() returns the empty string).","Q_Score":0,"Tags":"python,user-interface,tkinter,widget,treeview","A_Id":33649692,"CreationDate":"2015-11-11T08:46:00.000","Title":"Split keyboard entry between two Tkinter widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I am attempting to make a little audio player using Pygame. I wanted to add a little audio visualizer similar to in Windows Media Player. I was thinking of starting with an audio wave that scrolls across the screen. But I'm not sure where to start. \nRight now I'm just using pygame.mixer to start, stop, and pause the music. I think I would have to use pygame.sndarray and get some samples but I don't know what to do from there. What can I do to turn those samples into a visual audio wave?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":753,"Q_Id":33701621,"Users Score":1,"Answer":"Check out the pygame.draw methods.\nYou can probably take the audio values and map them to one of the draw options - like draw.arc or draw.line. You will have to map the signal output to values that remain within the X and Y max and min of the viewport.\nProcessing can do the same thing, but is a bit easier to implement if you are interested in learning the scripting language. It has methods specifically for doing the mapping for you and you can do some pretty extreme visuals without a lot of code.","Q_Score":2,"Tags":"python,audio,pygame","A_Id":33701749,"CreationDate":"2015-11-13T20:56:00.000","Title":"Audio visualization","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been playing with basic Python and be familiar with Turtle module in Python. Then, I download Kivy, and write some basic application with that.\nmy problem is that I couldn't use Turtle module in Kivy. I search a lot, but I couldn't find any example or tutorial on it.\nis it possible to use turtle module in Kivy application?\nis there any example to use turtle in their Kivy application?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":984,"Q_Id":33763674,"Users Score":3,"Answer":"The default turtle gui uses tkinter (a different graphics toolkit), it can't draw in a kivy app. You can certainly use the turtle module with Kivy, it should be very easy to draw the turtle's path, but you'd need to write some code to actually do this - turning the turtle position stuff into kivy graphics instructions.","Q_Score":2,"Tags":"android,python,kivy,turtle-graphics","A_Id":33767341,"CreationDate":"2015-11-17T17:47:00.000","Title":"Turtle and Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have downloaded the package 'Kivy-1.9.0-py3.4-win32-x64' from their website. I extracted it and gives me a folder with gstreamer, kivy34, MinGW, etc. As I have searched to some tutorials I clicked the kivy-3.4.bat file to set the paths. Now I'm lost, what to do next? \nI wanted to do Kivy applications through Python IDLE. Help!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2161,"Q_Id":33782926,"Users Score":0,"Answer":"Make sure you have PIP installed (it gives the option to install when you download python). Then, open a command shell (CMD on Windows; enter the search bar and type in 'cmd') and type pip install kivy.\nSome would recommend setting up a virtualenv and stuff but as a quick answer this should work.","Q_Score":0,"Tags":"python,kivy","A_Id":43096978,"CreationDate":"2015-11-18T14:40:00.000","Title":"How to install Kivy on Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been trying to install the pygame module and get the error \n\nImportError: No module named 'pygame'.\n\nI currently have Python version 3.3.4 and installed pygame cp33 32-Bit. \nIt is currently a whl file and I have tried following tutorials etc in order to import it but I'm having no luck.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":346,"Q_Id":33786307,"Users Score":0,"Answer":"You can easy install and check which version fits you by downloading PyCharm IDE. When you download it, go to:\n\nFile\nSettings\nProject <project's name>\nPython Interpreter\n\nThen press the plus icon on your right (install), and type pygame. When you find the module, check the box Specify version and select the version you want.\nIf this version does not want, you can easily select and check the other versions.","Q_Score":1,"Tags":"python,pygame","A_Id":63551510,"CreationDate":"2015-11-18T17:17:00.000","Title":"Installing Pygame Module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to have dynamic text alignment with kivy listview? \nI have a list of responses from a web lookup.\nI would like to have the text alignment (left or center) of each list item depending on the quality of the response item.\nI can't find a way to access 'halign' for each list item.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":383,"Q_Id":33789249,"Users Score":0,"Answer":"You can use your own item class, I think this is an option on the ListAdapter (maybe named cls). In doing so, you can add whatever logic you like to how the item is displayed.","Q_Score":0,"Tags":"python,widget,kivy","A_Id":33792073,"CreationDate":"2015-11-18T20:00:00.000","Title":"Kivy listview text alignment","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a screen written in wxPython, and Python, that has five groups of CheckBoxes. Three of the groups can have between none and all the CheckBoxes selected. However with two of the groups only none or one can be selected. RadioButtons have been considered and disregarded as you cannot select none and their appearance is different making the look and feel of the page inconsistent. Obviously I could write numerous OnCheckBox events that would all be very similar. Is there an easier and more elegant way of achieving this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":915,"Q_Id":33829421,"Users Score":0,"Answer":"Have you considered cycling through them on EVT_CHECKBOX.\nEach box can be tested with IsChecked(), if the test is True then you can use SetValue(False) on the others or whatever suits your requirements.\nAlso, there is nothing to stop you creating a radiobutton with the value None.","Q_Score":0,"Tags":"python,checkbox,wxpython","A_Id":33853583,"CreationDate":"2015-11-20T14:43:00.000","Title":"Need To Select Only One Checkbox In Group","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"After researching a little I found some libraries like pygame, tkinter, etc. I was able to install pygame easily but am not able to find any help on how to install tkinter for v3.2.\nI know many of these type of q's heve been answered but most of them show only errors when importing Python or it is for Linux\/mac.\nI have a Windows based os.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":189,"Q_Id":33968542,"Users Score":0,"Answer":"Tkinter is already installed with Python so you just need to import tkinter. Don't import Tkinter as you might see in some tutorials because Python 3+ has a different version.","Q_Score":0,"Tags":"python,tkinter","A_Id":33969234,"CreationDate":"2015-11-28T06:43:00.000","Title":"Tkinter install in Python version 3.2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So far I am using Tkinter to make textfields in Python. \nMy question is how do I make it so there are placeholders, preferably in the style of mathematica or something similar so that when a user starts a new line, a right and left place holder appear on that line and the user can only enter text in these placeholders? Eventually I would like to be able to make it so all the right placeholders are aligned as well, but that may be too complicated. I can't seem to find a way to do this in Tkinter. Is there possibly a better package for this?\nI'm not sure how to generate and format \"text placeholders\"\nEdit: I think this question is coming down to: how do I dynamically add text placeholders within already existing text fields based on certain key commands?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":62,"Q_Id":33974018,"Users Score":0,"Answer":"tkinter doesn't have anything built-in to support this. Tkinter likely has all of the fundamental building blocks in order to build it yourself, but it will require a lot of work on your part.","Q_Score":0,"Tags":"python,tkinter,textfield","A_Id":34096603,"CreationDate":"2015-11-28T17:06:00.000","Title":"Adding dotted text placeholders within a textfield in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I trying to make an application with a pop-up menu - when I type SPACE-R_ALT on my keyboard, globally across the OS (Windows in my case). When that happens, I want to pop-up a window (I know how to do that), and it is crucial that I can happen to be using Chrome or Word, then tap Space-Right Alt, then be able to open up this little menu.\nTkinter event bindings have two problems:\n\nFirst, when I use an event binding for <Key> and then, in the\nfunction, use evt.keysym, I can see that the program can't register\nboth at the same time. I could use a timer and then see if it works,\nbut I would prefer one line that fixes it all.\nSecond, I find that tkinter event bindings only work when the binded widget's window (or window itself) is FOCUSED. I will hide my root and TopLevel at all times, and so is not focused.\n\nI would appreciate any help on this. If your suggestion uses another module, I don't really care, as long as it works on Windows 10 (not Mac OS X, not Linux, but Windows). I'm also using Python 3, but any version (aka 2) would also be okay, as I could either try to port YOUR suggestion to Py3, or port MY code to Py2. Thanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":65,"Q_Id":33980603,"Users Score":0,"Answer":"I figured it out with Furas's help - with Pyhook I can wait for events globally, and then tie in the event with tkinter events.","Q_Score":0,"Tags":"python,tkinter","A_Id":33993563,"CreationDate":"2015-11-29T07:52:00.000","Title":"Check for tkinter events globally (across OS)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't seem to get Tkinter to load up in the pip search menu. This is what I have done so far: view>python enviorments>updated\/installed setuptools>pip search menu> input\"Tkinter\" with no luck.Please help, Thanks guys!","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":11918,"Q_Id":34014148,"Users Score":3,"Answer":"Tkinter should be installed by default, so there's no need to install it.\nIf you don't have it, open Programs and Features, find Python and select Change, then make sure that the Tcl\/Tk option is selected.","Q_Score":2,"Tags":"python-3.x,tkinter,visual-studio-2015","A_Id":34078641,"CreationDate":"2015-12-01T06:41:00.000","Title":"How to install Tkinter to visual studio 2015","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I own a raspberry pi 2 and i start learning Python. I would like to do something very basic : the window of my Python program on top of omxplayer window like a notification system.\nI have been able to make an \"always on top\" window with TKinter but when i launch omxplayer my window is no more on top. \nI would apreciate some help !\nThanks","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":985,"Q_Id":34031727,"Users Score":0,"Answer":"My solution is to used Hello_font from the hello_pi examples on the raspberry pi.","Q_Score":0,"Tags":"python,omxplayer","A_Id":34075563,"CreationDate":"2015-12-01T22:51:00.000","Title":"Python + TKinter + OMXPlayer window on top","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The title says it all, really.   I am writing functions that deal with pygame.Surface objects from multiple sources. Among other operations, these functions will ensure that the Surface objects they return have been convert()ed at least once (or, according to user preference, convert_alpha()ed), as is required to optimize them for blitting in the current display mode. But I don't want to run the the convert() or convert_alpha() methods needlessly since they create copies of the surface and therefore take up time and memory.  How do I tell whether I need to do it? I have looked at the output of S.get_flags() before and after S = S.convert_alpha() but it doesn't seem to change.  The scalar value of S.get_alpha() does change (from 255 to 0) but I'm not convinced that's meaningful or reliable (and it doesn't solve the problem of knowing whether you have to .convert() in the case where alpha blending is not desired).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":86,"Q_Id":34033149,"Users Score":1,"Answer":"I do not believe the existing API provides a way to do this.  I think the intended use is to convert all your surfaces (why wouldn't you?) so you never have to worry about it.\nPerhaps it is possible to subclass pygame.Surface and override the convert methods to set a flag in the way you wish.","Q_Score":1,"Tags":"python,pygame,pygame-surface","A_Id":34033205,"CreationDate":"2015-12-02T01:02:00.000","Title":"how can you tell whether convert()\/convert_alpha() has already been run on a pygame.Surface?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a making a blackjack game with cards using turtle and each time I play a hand turtle just prints over the last game instead of clearing the window. Is there a method that closes the window when it is called or is there another why of doing this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":46320,"Q_Id":34033701,"Users Score":18,"Answer":"I want to clarify what various turtle functions do as there are misunderstandings in this discussion, including in the currently accepted answer, as the method names themselves can be confusing:\n\nturtle.mainloop() aka turtle.Screen().mainloop()  Turns control over to tkinter's event loop.  Usually, a lack of turtle.Screen().mainloop() (or turtle.Screen().exitonclick(), etc.) will cause the window to close just because the program will end, closing everything.  This, or one of its variants, should be the last statement in a turtle graphics program unless the script is run from within Python IDLE -n.\nturtle.done() (Does not close window nor reset anything.)  A synonym for turtle.mainloop()\nturtle.clear()  Deletes everything this turtle has drawn (not just the last thing).  Otherwise doesn't affect the state of the turtle.\nturtle.reset()  Does a turtle.clear() and then resets this turtle's state (i.e. direction, position, etc.)\nturtle.clearscreen() aka turtle.Screen().clear()  Deletes all drawing and all turtles, reseting the window to it's original state.\nturtle.resetscreen() aka turtle.Screen().reset()  Resets all turtles on the screen to their initial state.\nturtle.bye() aka turtle.Screen().bye()  Closes the turtle graphics window.  I don't see a way to use any turtle graphics commands after this is invoked.\nturtle.exitonclick() aka turtle.Screen().exitonclick()  After binding the screen click event to do a turtle.Screen().bye() invokes turtle.Screen().mainloop() \n\nIt's not clear that you can close and reopen the graphics window from within turtle without dropping down to the tkinter level that underpins turtle (and Zelle's graphics.py)\nFor purposes of starting a new hand in your blackjack game, I'd guess turtle.reset() or turtle.resetscreen() are your best bet.","Q_Score":7,"Tags":"python,turtle-graphics","A_Id":42260054,"CreationDate":"2015-12-02T02:07:00.000","Title":"Python: How to reset the turtle graphics window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to build the android app from kivy application. I used the Buildozer image as given on the kivy.org downloads page, but that Virtual Machine never runs on the virtualbox. Is there any other way to do this. I have seen some SO questions regarding this but they seem to be very old and hasn't been of much help till now.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":145,"Q_Id":34035329,"Users Score":0,"Answer":"You need to provide information about what goes wrong when you try to run the VM - nobody can help if we know only that something doesn't work.\nAlternatively, you can make a new VM with any linux distro (a recent Ubuntu is a good choice) and install all the dependencies. Kivy's VM is nothing special except that it has them preinstalled.","Q_Score":1,"Tags":"android,python,apk,kivy","A_Id":34042147,"CreationDate":"2015-12-02T05:08:00.000","Title":"Building Android apk from kivy application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing Android app.\nThe problem is that it should execute some calculations and library for this is written in Python.\nWhat is the best way to invoke Python from Android\/Java?\nI heard about Kivy and even managed to run application, but python code returns latex formulae, that can't be rendered within Kivy app.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":231,"Q_Id":34069428,"Users Score":0,"Answer":"You can probably render LaTeX in Kivy fairly easily using a png exporter (such as presumably exists for web export tools, and modes like emacs' preview mode).\nIf you need to run python as part of a java app, probably a practical way to do it is to use kivy's python-for-android tools with your own java frontend, invoking the python interpreter via JNI. This would require some thinking and experimentation but should be possible. There are also other projects for building python for android, which might be able to do the same things.","Q_Score":0,"Tags":"android,python,kivy","A_Id":34069875,"CreationDate":"2015-12-03T15:11:00.000","Title":"Run Python Code from Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have code which runs immediately when I run using python. The code has tkinter module and bunch of if statements. I created a standalone executable and it takes about 8 minutes to give the output for the GUI. I was wondering why it takes so much time to run ?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":275,"Q_Id":34099639,"Users Score":0,"Answer":"If you do a bunch of work before calling mainloop, you won't see anything appear until you call mainloop or update. The only way a window will appear is in response to an event that asks for the window to be displayed, and tkinter can't process events if mainloop isn't running.","Q_Score":0,"Tags":"python,tkinter,pyinstaller","A_Id":34137551,"CreationDate":"2015-12-05T00:16:00.000","Title":"pyinstaller executable takes more than 8 minutes print out?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on an assignment for school, and didn't realize that I needed to install the pygame\/livewires package to use the program I am writing, because I have been using a school laptop while in class and haven't used my personal laptop. It is a really simple program, but I still can't run it because the pygame setup I downloaded isn't working. When I type \"import pygame\" into the shell it works, but when I try something like \"from livewires import games\" it says that the module livewires cannot be found. I am using Python3.1.1 but I also have Python3.4.3 installed. PLEASE HELP and thank you in advance.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3136,"Q_Id":34123018,"Users Score":0,"Answer":"For python3 this works for me:\n\nFirst you need to install pip module (it will help to install livewires in last step)\n\nsudo apt install python3-pip\n\nInstall pygame module which is required for livewires\n\nsudo apt install python3-pygame\n\nAnd at last install needed module\n\npip3 install livewires\n\nBut most likely livewires will not work well, as it isn't working for me. So you can use updated version - superwires. Installation is almost the same:\n\npip3 install superwires\nAnd just use superwires instead of livewires in your instructions.\nNote, that this didn't work for me:\nsudo apt install python3-livewires\nwith error: E: Unable to locate package python3-livewires","Q_Score":1,"Tags":"python,installation,pygame,livewires","A_Id":66070964,"CreationDate":"2015-12-06T21:30:00.000","Title":"Installing livewires for python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use LinuxMint 17.3 Cinnamon in VirtualBox, 1920*1080 resolution is used in this machine, the Hi-DPI option is turned on. The host machine is Windows 10, with 3840*2160 resolution.\nDespite turning on Hi-DPI option in LinuxMint, some applications become to look good for comfortable work, in terms of scaling, but python-tk GUI (python2) hasn't been changed - font size is tiny, changing of Font options in Cinnamon doesn't change fonts in tk. Is there any way to scale correctly already written tk GUI applications?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":15979,"Q_Id":34132203,"Users Score":-1,"Answer":"you can use the Clmage module to increase the resolution of your GUI render","Q_Score":9,"Tags":"python,python-2.7,tkinter,tk","A_Id":68737194,"CreationDate":"2015-12-07T11:14:00.000","Title":"Scaling of Tkinter GUI in 4k (3840*2160) resolution?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently using the turtle.goto cords from a text file. I have the triangle drawn and everything but I don't know how to fill the triangle.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":812,"Q_Id":34160995,"Users Score":2,"Answer":"You are ending fill after every new coordinate. You need to call t.begin_fill() before your for loop and call t.end_fill() after the last coordinate, otherwise you are just filling in your single line with each iteration.","Q_Score":2,"Tags":"python,colors,turtle-graphics","A_Id":34161243,"CreationDate":"2015-12-08T16:26:00.000","Title":"Python Turtle fill the triangle with color?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use QListView (in PyQt5) to display strings.\nI want to have the background color of each item in that list changing between two colors to make it easier to read.\nI tried Qt.DecorationRole but this only create an \"icon\" on the left side of each item.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":963,"Q_Id":34188594,"Users Score":1,"Answer":"self. listWidget.setAlternatingRowColors(True) this will give you Alternate color for each row.","Q_Score":0,"Tags":"python,c++,qt,pyqt,qlistview","A_Id":34188907,"CreationDate":"2015-12-09T20:43:00.000","Title":"QListView with row background in two different colors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python script and a C++ program running at the same time, both accessing the GPIO pins (not the same ones, though) in this order:\n\nC++\nPython\nC++\n\nThe access of the C++ program worked (I used wireless transmitters and received the message). After that the Python access (light up an LED) worked as well. But when I tried to send another message using the wireless transmitters with C++, nothing happened, I don't receive messages anymore.\nIs there a way to find out, whether the GPIO pins are blocked or something?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":250,"Q_Id":34200159,"Users Score":0,"Answer":"If you clean up the GPIO Headers in both scripts, it should be possible, otherwise it wont work.\nYou can clean up in python by using GPIO.cleanup(), then it sould work, cause it is clean again to your c++ Code.","Q_Score":0,"Tags":"python,c++,raspberry-pi,gpio","A_Id":40125816,"CreationDate":"2015-12-10T10:58:00.000","Title":"Is it possible to access GPIO pins from a Python script and a C++ program at the same time?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Trying to install python-poppler-qt4 on Windows (8.1) but i've been having issues building\/installing it \n(error fatal error C1083: Cannot open include file: 'QMetaType' : No such file or directory. #include QMetaType)\nBefore this error I had a missing poppler-qt4.dll issue. After locating and installing the dll I get the error above\nIt's pretty annoying how I cant install this package like any other .. suggestions? Really need to use poppler for PDF rendering.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":627,"Q_Id":34213429,"Users Score":0,"Answer":"In C:\\poppler-0.24.5\\include\\src replace it C:\\poppler-0.24.5\\include\\qt4\\src","Q_Score":1,"Tags":"python,qt,pyqt4,poppler","A_Id":34292822,"CreationDate":"2015-12-10T23:09:00.000","Title":"Python Poppler install issues","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Kind all, I'm really new to python and I'm facing a task which I can't completely grasp.\nI've created an interface with Tkinter which should accomplish a couple of apparently easy feats.\nBy clicking a \"Start\" button two threads\/processes will be started (each calling multiple subfunctions) which mainly read data from a serial port (one port per process, of course) and write them to file. \nThe I\/O actions are looped within a while loop with a very high counter to allow them to go onward almost indefinitely.\nThe \"Stop\" button should stop the acquisition and essentially it should:\n\nKill the read\/write Thread\nClose the file\nClose the serial port\n\nUnfortunately I still do not understand how to accomplish point 1, i.e.: how to create killable threads without killing the whole GUI. Is there any way of doing this?\nThank you all!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1596,"Q_Id":34284335,"Users Score":0,"Answer":"First you can use subprocess.Popen() to spawn child processes, then later you can use Popen.terminate() to terminate them.\nNote that you could also do everything in a single Python thread, without subprocesses, if you want to.  It's perfectly possible to \"multiplex\" reading from multiple ports in a single event loop.","Q_Score":4,"Tags":"python,multithreading,kill-process","A_Id":34284612,"CreationDate":"2015-12-15T08:34:00.000","Title":"How to integrate killable processes\/thread in Python GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are multiple questions about \"how to\" call C C++ code from Python. But I would like to understand what exactly happens when this is done and what are the performance concerns. What is the theory underneath? Some questions I hope to get answered by understanding the principle are:\nWhen considering data (especially large data) being processed (e.g. 2GB) which needs to be passed from python to C \/ C++ and then back. How are the data transferred from python to C when function is called? How is the result transferred back after function ends? Is everything done in memory or are UNIX\/TCP sockets or files used to transfer the data? Is there some translation and copying done (e.g. to convert data types), do I need 2GB memory for holding data in python and additional +-2GB memory to have a C version of the data that is passed to C function? Do the C code and Python code run in different processes?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":397,"Q_Id":34284421,"Users Score":2,"Answer":"You can call between C, C++, Python, and a bunch of other languages without spawning a separate process or copying much of anything.\nIn Python basically everything is reference-counted, so if you want to use a Python object in C++ you can simply use the same reference count to manage its lifetime (e.g. to avoid copying it even if Python decides it doesn't need the object anymore).  If you want the reverse, you may need to use a C++ std::shared_ptr or similar to hold your objects in C++, so that Python can also reference them.\nIn some cases things are even simpler than this, such as if you have a pure function in C or C++ which takes some values from Python and returns a result with no side effects and no storing of the inputs.  In such a case, you certainly do not need to copy anything, because you can read the Python values directly and the Python interpreter will not be running while your C or C++ code is running (because they are all in a single thread).\nThere is an extensive Python (and NumPy, by the way) C API for this, plus the excellent Boost.Python for C++ integration including smart pointers.","Q_Score":2,"Tags":"python,c++,c,language-binding","A_Id":34284538,"CreationDate":"2015-12-15T08:39:00.000","Title":"How does calling C or C++ from python work?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have an interface made with Kivy, which has an image in part of it. I want to fade one edge of this image. What's the easiest way of achieving this?","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":243,"Q_Id":34324386,"Users Score":-1,"Answer":"You can just create another image with faded edge and load it.","Q_Score":0,"Tags":"python,kivy","A_Id":34325646,"CreationDate":"2015-12-16T23:56:00.000","Title":"How to add a gradient to an image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to set up a complete build environment with SCons and I came across this problem:\nMy project can be compiled with two different compilers (c or cpp compilers) and the resulting object files linked with the same linker.\nBecause of this, I need to know how to split the compilation part from the linking part.\nAlso, there are cases when I only need the .o files so I want to avoid linking. \nIs this possible using the same environment ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":657,"Q_Id":34333808,"Users Score":0,"Answer":"Create two Environments, one with each compiler, use where necessary.\nThen use whichever Environment you need for linking object from either Environment.","Q_Score":0,"Tags":"python,build,scons","A_Id":34335139,"CreationDate":"2015-12-17T11:45:00.000","Title":"How to compile with two different compilers using SCons?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to run a Tkinter GUI on Python 3.x and When I use the .get command to get the number off a scale, this error pops up\nException in Tkinter callback\nTraceback (most recent call last):\n  File \"C:\\Python34\\lib\\tkinter\\__init__.py\", line 1482, in __call__\n    return self.func(*args)\n  File \"C:\\Users\\Danny\\Downloads\\Space RPG. Alpha 0.2 (2) (1).py\", line 39, in close\n    print (w1.get(), w2.get())\n  File \"C:\\Python34\\lib\\tkinter\\__init__.py\", line 2840, in get\n    value = self.tk.call(self._w, 'get')\n_tkinter.TclError: invalid command name \".52674064\"\nWhat is happening?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":642,"Q_Id":34344624,"Users Score":1,"Answer":"That usually means that you're trying to call a method on a widget that has been destroyed. The string .52674064 is the internal name of a specific widget. \nThis can easily happen if you call a function via a binding or via after, if the widget is destroyed before the binding or after call has been triggered.","Q_Score":0,"Tags":"user-interface,python-3.x,tkinter","A_Id":34344977,"CreationDate":"2015-12-17T21:32:00.000","Title":"tkinter.TclError: invalid command name \".52674064","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QTableView on top of a QSqlTableModel. My database is sqlite.\nI know QSqlTableModel lazily loads the data from the database (it actually loads 256 rows at a time), so when the users scrolls the view to the bottom, the model loads the 256 next rows.\nI would like to know:\n\nWhat is the signal emitted when the users reaches the bottom of the view ?\nWhat is the model's method called to load the 256 next rows ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":304,"Q_Id":34357818,"Users Score":0,"Answer":"The view asks the model for data by calling data function for all table cells that are visible. The model then queries the database if needed. How this happens in detail depends on the underlying database. The QSqlQueryModel documentation says that: \"if the database doesn't return the number of selected rows in a query, the model will fetch rows incrementally. See fetchMore() for more information\". Apparently this is the case for sqlite. \nThe query happens in the fetchMore method of the model, I don't think there are any signals involved. You should be able to use the canFetchMore method to test if all records have been retrieved (not sure if this is want you want, perhaps you can tell us what you are ultimately trying to achieve.)\nEdit after discussion:\nYou can inherit from the model and override the data method. I don't know where it's called in the view, probably in many places. You could try to look in the Qt source. If you need to do this from the view: when I look in the documentation of QAbstractScrollArea (which is an ancestor of QTableView) it seems that you can connect to a scroll bar's QAbstractSlider.actionTriggered signal to detect if the scroll bar is at the maximum.","Q_Score":0,"Tags":"python,qt,pyqt","A_Id":34370666,"CreationDate":"2015-12-18T14:27:00.000","Title":"What model's slot is called when Qtableview scrolled","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to 3d world. I would like to open 3ds files with python and visualize the objects.\nI could not find any easy and straight forward way to play with 3ds max files.\nCan you let me know how can I achieve this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":717,"Q_Id":34400788,"Users Score":0,"Answer":"According to my understanding, there are some advanced graphics libraries out there for advanced usage, however Blender, (an application developed in python) supports python scripting. There are even a simple drag and drop game engine for simpler tasks.","Q_Score":1,"Tags":"python,file,3d,3dsmax","A_Id":34401590,"CreationDate":"2015-12-21T16:59:00.000","Title":"how to open 3ds files with python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Running brew install pyqt --with-python3, I get Error: Failed to determine the layout of your Qt installation. Adding --verbose to the brew script, the problem is that ld can't find -lgcc_s.10.5.\n(This is on Mac OS X 10.10.5 Yosemite)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":900,"Q_Id":34502194,"Users Score":0,"Answer":"Answering to help other people who encounter this: The solution was to first upgrade XCode to XCode 7.2 and open it once to accept the license and have it install additional components. Then, a brew update and a brew install pyqt --with-python3 finally worked.","Q_Score":0,"Tags":"python-3.x,pyqt,homebrew","A_Id":34502219,"CreationDate":"2015-12-28T23:17:00.000","Title":"`Error: Failed to determine the layout of your Qt installation` when installing pyqt for python3 on Mavericks","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have data in an excel spreadsheet (*.xlsx) that consists of 1,213 rows of sensitive information (so, I'm sorry I can't share the data) and 35 columns. Every entry is a string (I don't know if that is screwing it up or not). The first row is the column names and I've never had a problem importing it with the column names embedded before (it's just easier to click that they're embedded so I don't have to name every column by hand). I put the path to the data in the quick start wizard and hit the next button and it doesn't do anything. I hit it again and it turns the mouse into the loader as if it's loading. I've waited for it for 15 minutes before, but every time I click on QlikView the program just crashes.\nI have a deadline I have to meet here and I can't afford to not finish this project. It's extremely important that I get it working.\nJust as a NB, I used Python to merge two Excel spreadsheets together so I don't know if that may be what's causing the problem either. I can open the file perfectly fine in Excel though.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":626,"Q_Id":34532708,"Users Score":0,"Answer":"I have had QlikView crash when importing an Excel spreadsheet that was exported with the SQuirreL SQL client (from a Firebird database). Opening the spreadsheet in Excel, and saving it again solved the problem.\nI know that this is no longer relevant to your problem, but hopefully it can help someone with a similarly appearing issue.","Q_Score":0,"Tags":"python,excel,qlikview","A_Id":34534891,"CreationDate":"2015-12-30T15:52:00.000","Title":"Why does QlikView keep crashing when I try to load my data?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to programmatically install an Android .apk in Python?\nCould you please show me how? I'm new to Python.\nThanks in advance.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2635,"Q_Id":34538988,"Users Score":1,"Answer":"As @Swing mentioned in his comment, subprocess.call(\"adb install path-to-file.apk \") solves the issue.","Q_Score":3,"Tags":"android,python,apk,android-install-apk","A_Id":62234030,"CreationDate":"2015-12-30T23:43:00.000","Title":"How to install an Android .APK using Python code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If this question could be worded better\/needs to be split into many questions, please alert me\nI need to package Python scripts in order to ship them as single-executables (ideally), or single-executables with supporting files (non-ideally).\nI have seen py2app and py2exe.  They do not fit my requirements, as I am looking for a single method to do this, and in the future may need to have the packaged scripts interact with the executable that they are being run from.\nWhat is the best way to go about this?  The scripts which I would be embedding may even require multiple files, which complicates matters I'm sure.\nIf I wanted to use an interpreter other than CPython (ie: PyPy or Stackless) in the future, would the process be different (other than API calls in the C++ executable)?\nDoes Python have to be installed on the computers which would be running the package, or does embedding Python mean that it is fully embedded? I saw on the Python Wiki something about Py_SetPythonHome(), which would indicate to me that it needs Python (or at least its libraries) to be installed.  Am I correct?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1476,"Q_Id":34583134,"Users Score":0,"Answer":"Are you sure that you need to embed the Python files? \nI ask because you mention you want to package the Python files as single executables. Couldn't you install Python on the target machine and since Python scripts are executables on their own, you would only need something to kick them off. A master python script could kick off all the rest of the scripts.\nOtherwise you should look in C++ what can run a Python script. Then have the master python script run all the other scripts.","Q_Score":1,"Tags":"python,c++,python-embedding","A_Id":34583312,"CreationDate":"2016-01-04T00:10:00.000","Title":"Embedding Python into C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to set a dictionary as an event object, but SetEventItem is expecting an object of type wxObject. What's the best way to go around this? \nBasically, I have a settings dialog. If the \"Apply All\" button is pressed, an event is generated which will propagate up to some parent window, which can then set the settings to all the appropriate children. I have these settings stored in a dictionary. Is there a better way to do this? This seemed the simplest to me.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":90,"Q_Id":34621426,"Users Score":0,"Answer":"SetEventObject is used to set the originating GUI element not to pass data to the event listeners ... \nyou could certainly add a GetValue method to your GUI element that returned your dictionary... and then use GetEventObject().GetValue() to get your dictionary\nalternatively the wx.lib.pubsub module is designed to pass data to event subscribers and I would recommend using this, for this particular use case ...","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":34621808,"CreationDate":"2016-01-05T21:20:00.000","Title":"wxPython - Set dictionary as event object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a class derived from wx.Panel that creates an image in a large border area (e.g. a little over 30 pixels across on the left edge).  I want to be able to derive subclasses from it for the panels in part of my application, but I can't figure out how to adjust the position the children in the derived panels - they think the added border area is part of the client window and quite happily position themselves under it (and are subsequently erased by the base class' EVT_PAINT handler).\nI've tried tracking a client area and overriding the various GetClient... methods in my base class, but it doesn't seem to change anything about the child behavior.  I suppose I could manually reposition the child windows in the subclasses, but that's a lot of repeated code and it seems like it shouldn't be necessary.\nSearching for answers on the Internet has not been a successful enterprise.  I also tried looking through the wx code for an answer, but I haven't had any luck there either.\nWhat's the best way to define the client area in the window so that children automatically position themselves away from the edge of the parent?  Is there a way to tell new objects that their parent's client area doesn't start at (0,0) (it seems like overriding GetClientAreaOrigin should do this, but doesn't seem to work)?  Should I be moving them manually in the context of Layout() or a wx.EVT_SIZE handler?  What's the elegant and\/or appropriate solution?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":119,"Q_Id":34625218,"Users Score":0,"Answer":"I abandoned this approach as unwieldy after some effort, but I did have some limited success, and I wanted to point out some of the things I learned in case someone else is considering it.\n\nLook at PyPanel - it is designed to be overridden fairly extensively and responded well to most of what I was doing.\nThe best approach I found in my original effort was to create a panel instance as a child of the control to work as a content manager.  I overloaded AddChild and SetSizer in the control to redirect them to the child panel; I also implemented a protected flag that I could set in the control to prevent that redirection (otherwise I'd be trying to add the content panel to itself instead of the control when I created it).\nI still encountered some weirdness with certain controls (SpinCtrl in particular wanted to position itself in very strange ways, often partially outside the content panel, despite all my efforts to prevent it).  I also had some trouble with getting the sizers to behave well as regards the best\/minimum size for the controls.\n\nI think the best piece of advice I could give is to consider looking at other ways to do this; in my case, I was able to create a control that could be included in a panel that facilitates the desired behavior of the parent; the hooks in the parent's routines were much easier to manage than the Frankensteinian mess of a derived class that I had created in my original effort.","Q_Score":0,"Tags":"wxpython","A_Id":34937077,"CreationDate":"2016-01-06T03:37:00.000","Title":"How to reposition children in wx.Panel derived class with a large border?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making an app with Kivy and Python,is there a native way to create a field with a spinbox to select the number like in HTML for the tag input (type = \"number\") ?? I see there are checkboxes for Kivy but not this spinbox number; should I use a normal text input provided by Kivy and get the number from that?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":547,"Q_Id":34629190,"Users Score":1,"Answer":"You can use a Spinner widget._","Q_Score":0,"Tags":"python,html,kivy,qspinbox","A_Id":34631685,"CreationDate":"2016-01-06T09:04:00.000","Title":"Kivy native spinbox number widget for insert number","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a number of wxPython textCtrls that are used for data input. Use is made of various Validators to make sure the data is of the correct type. I now need to validate that the data is within range, e.g. where two textCtrls are used for feet and inches that the inches are less than 12, before the user can move to the next field. I did try wx.lib.intctrl.IntValidator() but seemed to have an issue because I am using Python 2.7 and wxPython 2.8. This must be a problem for others but a Google has not found anything.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":165,"Q_Id":34634735,"Users Score":0,"Answer":"Bind the textctrl to wx.EVT_KILL_FOCUS and then check the contents of the textctrl. If there is invalid input, issue your error message and then self.my_textCtrl.SetFocus() which will put you back in the textctrl for input again.","Q_Score":0,"Tags":"python-2.7,validation,wxpython","A_Id":34651896,"CreationDate":"2016-01-06T13:49:00.000","Title":"Validating wx.textCtrl Field For Sensible Values","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm learning to use Tkinter and in the tutorials it tells me to import W from Tkinter, but W is just a str (\"w\").\nMy question is why use Tkinter.W not \"w\".  Is it because Tkinter will sometimes have the var equal something else dependent upon system?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":535,"Q_Id":34699869,"Users Score":1,"Answer":"This is done mostly for user convinience.\nConsider the Image class from PIL\/Pillow. It has a method to create a thumbnail out of an image, in the process resizing it. The method takes two arguments, the new size in a tuple and a resampling method. This can be antialias, bilinear, cubic, etc. These are internally represented with integer values, like 0, 1, etc. If you don't know which value represents which resampling method, it's cumbersome to look it and may also lead to more errors. But access it from the constant Image.BILINEAR and boom, you're done.\nIn your case, importing W just for the string \"w\" seems to be needlessly polluting the namespace and typing tkinter.W is longer than \"w\". This might be so. However, remember, constants in a program are defined in one place so if you ever have to change them, it will be easy to so. You never know, the module may be internally use the constant W, even if you see no point in it.\nThis also leads to the reason you pointed out. A constant may have a different value depending on the system or version. By using the internally consistent constant and not a static, hardcoded value, you make your life easier when you reuse that code on a diferent system or version.","Q_Score":1,"Tags":"python,tkinter,python-2.x","A_Id":34700366,"CreationDate":"2016-01-09T22:53:00.000","Title":"Python Tkinter: Why use Tkinter.W not str \"w\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm learning to use Tkinter and in the tutorials it tells me to import W from Tkinter, but W is just a str (\"w\").\nMy question is why use Tkinter.W not \"w\".  Is it because Tkinter will sometimes have the var equal something else dependent upon system?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":535,"Q_Id":34699869,"Users Score":2,"Answer":"I always use the string value. I see absolutely no benefit in using the constants. The chance of them changing is virtually zero. These constants have remained unchanged since Tkinter was created. \ntkinter takes backwards compatibility pretty seriously, so even if they are changed, the string values will undoubtedly continue to work for a year or two. \nMy recommendation is to never use the constants.","Q_Score":1,"Tags":"python,tkinter,python-2.x","A_Id":34703004,"CreationDate":"2016-01-09T22:53:00.000","Title":"Python Tkinter: Why use Tkinter.W not str \"w\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to develop an app to track people's Whatsapp last seen and other stuff, and found out that there are APIs out there to deal with it, but the thing is they are writen in python and are normally run in Linux I think\nI have Java and Android knowledge but not python, and wonder if there's a way to develop the most of the app in Java and get the info I want via calls using these python APIs, but without having to install a python interpreter or similar on the device, so the final user just has to download and run the Android app as he would do with any other \nI want to know if it would be very hard for someone inexperienced as me (this is the 2nd and final year of my developing grade), for it's what I have in mind for the final project, thx in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":34710059,"Users Score":0,"Answer":"Instead of running it as one app, what about running the python script as separate from the original script? I believe it would bee possible, as android is in fact a UNIX based OS. Any readers could give their input on this idea an if it would work.","Q_Score":0,"Tags":"java,android,python","A_Id":34710122,"CreationDate":"2016-01-10T19:50:00.000","Title":"how to write an Android app in Java which needs to use a Python library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm writing an experimental GUI framework. The GUI is constructed by combining components (similar to widgets). There are a few \"native\" classes of components. The framework user specializes by providing certain methods that define configuration, bindings, etc. This can be done by extending a native class and overriding its methods, which is fine, but many of the derived classes will be instantiated just once. Alternatively, I could provide a factory function that would take a native class and the specializing methods (functions, really). This function would instantiate the native class and replace the appropriate methods. Any reason to prefer one approach over the other?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1540,"Q_Id":34710277,"Users Score":0,"Answer":"What most GUI toolkits (wxpython,kivy,pyQT) in python are doing is the inheritance approach.\nI guess both approach should work but using inheritance will be more familiar to your potential users\nWhat you may also want to look at is a template language (suck as kv lang or html)\nto layout the UI since it is a modern approach","Q_Score":4,"Tags":"python,inheritance,monkeypatching","A_Id":34710599,"CreationDate":"2016-01-10T20:10:00.000","Title":"Monkey patching vs inheritance and overriding in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hey i'm new here so if I've done something wrong i apologize. I have been searching for hours though and i figured i would just open a new question.\nI want to have a python program that will open another window so it can display different information on that window whilst still displaying it's own information.\nFor ex: I have \"hello.py\" and it opens up another python window \"goodbye.py\"\ni dont want what ever is in \"goodbye.py\" to show up on \"hello.py\" i want it to stay in its own window.\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":17,"Q_Id":34793777,"Users Score":0,"Answer":"Assuming your question is to open 2 programs at the same time, couldn't you just open 2 tabs and open the 2 programs side by side like that? Ex. on mac, double click open new window and open a new tab.","Q_Score":0,"Tags":"python-3.x","A_Id":34801497,"CreationDate":"2016-01-14T15:47:00.000","Title":"Python 3 opening more than one .py program instead of just calling it in the same window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a program using the pygame module on Python 3 and it works fine within python, but when I try to compile is using py2exe it won't run. (I just get the programName.exe has stopped working error upon trying to run it).\nI managed to narrow down this problem to the pygame.font module as when I comment all the lines that use that module everything works fine. I tried to forcefully include the module using the -i flag in py2exe, but it doesn't appear to change anything...\nWhat am I doing terribly wrong?\nEdit: I managed to get the reason of the program not working - it crashes as it can not find build\\executable.exe\\pygame\\freesansbold.ttf . What I don't understand is why the hell is the pygame folder supposed to be located in a folder with the name of my executable? (Of course, I can not create a folder with the same name as an existing file in the directory). If anyone has a clue to how to fix it, please help!!","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":319,"Q_Id":34800524,"Users Score":1,"Answer":"I had the same problem using cx_Freeze, so hopefully this will work for you as well. Open up your pygame package folder. It should be C:\\Python34\\Lib\\site-packages\\pygame. There should be a True Type Font File titled freesansbold.ttf. Copy that file then open the folder containing your exe program. There should be a zipped file called library. Open it up and go to the pygame folder inside the zipped file. Should look something like this \\build\\exe.win32-3.4\\library.zip\\pygame. And just paste the freesansbold.ttf file in that folder and it should work perfectly.","Q_Score":0,"Tags":"python,python-3.x,compilation,pygame,py2exe","A_Id":34801623,"CreationDate":"2016-01-14T21:55:00.000","Title":"Py2Exe won't successfully compile the pygame.font module on Python 3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a program using the pygame module on Python 3 and it works fine within python, but when I try to compile is using py2exe it won't run. (I just get the programName.exe has stopped working error upon trying to run it).\nI managed to narrow down this problem to the pygame.font module as when I comment all the lines that use that module everything works fine. I tried to forcefully include the module using the -i flag in py2exe, but it doesn't appear to change anything...\nWhat am I doing terribly wrong?\nEdit: I managed to get the reason of the program not working - it crashes as it can not find build\\executable.exe\\pygame\\freesansbold.ttf . What I don't understand is why the hell is the pygame folder supposed to be located in a folder with the name of my executable? (Of course, I can not create a folder with the same name as an existing file in the directory). If anyone has a clue to how to fix it, please help!!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":319,"Q_Id":34800524,"Users Score":0,"Answer":"I managed to find a way! By including -l library.zip argument in the build_exe command and then following the instructions given by DeliriousSyntax in the answer above I managed to get it to work!","Q_Score":0,"Tags":"python,python-3.x,compilation,pygame,py2exe","A_Id":34867493,"CreationDate":"2016-01-14T21:55:00.000","Title":"Py2Exe won't successfully compile the pygame.font module on Python 3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyQtGraph to plot mesh surfaces. I would like to see the 3D world with perspective turned off. \nIs this possible in pyQtGraph? I have searched through the documentation and the google groups and can't find any reference to this. I think it is possible in principle with openGL so is there a way to bring this out and control perspective on\/off in pyQtGraph?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1275,"Q_Id":34801254,"Users Score":0,"Answer":"A cursory inspection of the docs renders no help ... however if you decrease the field of view (FOV) while also increasing the distance you will approximate an orthographic projection to arbitrary precision as you vary those two parameters","Q_Score":2,"Tags":"python-3.x,opengl,pyqtgraph","A_Id":34801690,"CreationDate":"2016-01-14T22:49:00.000","Title":"PyQtGraph - Turn off perspective in 3d view","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyQtGraph to plot mesh surfaces. I would like to see the 3D world with perspective turned off. \nIs this possible in pyQtGraph? I have searched through the documentation and the google groups and can't find any reference to this. I think it is possible in principle with openGL so is there a way to bring this out and control perspective on\/off in pyQtGraph?","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1275,"Q_Id":34801254,"Users Score":0,"Answer":"I would recommend trying out the newer vispy; it is much more flexible with regards to the types of cameras and mouse interactions supported. In particular, orthographic projection happens to be the default for the 'arcball' camera type, and probably the others too; it's set by setting camera.fov to be 0.\nAs a bonus, ergonomics with ipython are also much improved, i.e. your ipython shell stays responsive at the same time the scene is active, and you can kill the scene without killing your ipython instance, and launch another.","Q_Score":2,"Tags":"python-3.x,opengl,pyqtgraph","A_Id":37876896,"CreationDate":"2016-01-14T22:49:00.000","Title":"PyQtGraph - Turn off perspective in 3d view","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In a PyQt application is it possible to kill only the GUI (Qt) part?\nAny Python commands running should be unaffected, only the graphics should disappear.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":237,"Q_Id":34803369,"Users Score":2,"Answer":"how about QtGui.QWidget.setVisible(visible)  \n\nPySide.QtGui.QWidget. setVisible ( visible )\n     Parameters:  visible \u2013 PySide.QtCore.bool\n     This property holds whether the widget is visible.\nCalling setVisible(true) or PySide.QtGui.QWidget.show() sets the widget to visible status if all its parent widgets up to the window are visible. If an ancestor is not visible, the widget won\u2019t become visible until all its ancestors are shown. If its size or position has changed, Qt guarantees that a widget gets move and resize events just before it is shown. If the widget has not been resized yet, Qt will adjust the widget\u2019s size to a useful default using PySide.QtGui.QWidget.adjustSize() .\nCalling setVisible(false) or PySide.QtGui.QWidget.hide() hides a widget explicitly. An explicitly hidden widget will never become visible, even if all its ancestors become visible, unless you show it.\nA widget receives show and hide events when its visibility status changes. Between a hide and a show event, there is no need to waste CPU cycles preparing or displaying information to the user. A video application, for example, might simply stop generating new frames.\nA widget that happens to be obscured by other windows on the screen is considered to be visible. The same applies to iconified windows and windows that exist on another virtual desktop (on platforms that support this concept). A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again.\nYou almost never have to reimplement the PySide.QtGui.QWidget.setVisible() function. If you need to change some settings before a widget is shown, use PySide.QtGui.QWidget.showEvent() instead. If you need to do some delayed initialization use the Polish event delivered to the PySide.QtGui.QWidget.event() function.","Q_Score":0,"Tags":"python,qt,pyqt","A_Id":34803713,"CreationDate":"2016-01-15T02:20:00.000","Title":"Kill only Qt in PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've installed Kivy some time ago, and since then I've tried many ways to run Kivy, but till today I'm not successful.\nI am able to \"import kivy\" in python but while importing app module by \"from kivy.app import app\"\nIt shows error 'no module named app', while there is a folder in Kivy named \"app\".\nThe location of this folder is \"D:\\utils\\Kivy\\Kivy-1.9.0-py2.7-win32-x64\\kivy27\\kivy\"\nHere's my environment path which I have setup for Kivy:\n\n\n\nKIVY_DATA_DIR : D:\\utils\\Kivy\\Kivy-1.9.0-py2.7-win32-x64\\kivy27\\kivy\\data\n      KIVY_EXTS_DIR : D:\\utils\\Kivy\\Kivy-1.9.0-py2.7-win32-x64\\kivy27\\kivy\\tools\\extensions\n      KIVY_HOME : D:.kivy; D:\\utils\\Kivy\\Kivy-1.9.0-py2.7-win32-x64\\kivy27\\kivy\n      KIVY_MODULES_DIR : D:\\utils\\Kivy\\Kivy-1.9.0-py2.7-win32-x64\\kivy27\\kivy; D:\\utils\\Kivy\\Kivy-1.9.0-py2.7-win32-x64\\kivy27\\kivy\\modules\n\n\n\nCan anyone please help me....","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":983,"Q_Id":34813877,"Users Score":0,"Answer":"Why are you trying to use a old version of kivy? Use the latest version 1.9.1. follow the documentation\n\nEnsure you have the latest pip and wheel:\npython -m pip install --upgrade pip wheel setup tools\n. Install the dependencies (skip gstreamer (~90MB) if not needed, see Kivy\u2019s dependencies):\npython -m pip install docutils pygments pypiwin32 kivy.deps.sdl2\n  kivy.deps.glew \\ kivy.deps.gstreamer --extra-index-url\n  https:\/\/kivy.org\/downloads\/packages\/simple\/\nInstall kivy:\npython -m pip install kivy\nThat\u2019s it. You should now be able to import\n  kivy in python.","Q_Score":0,"Tags":"python,kivy","A_Id":35005349,"CreationDate":"2016-01-15T14:58:00.000","Title":"I'm getting error while importing app from kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an .so file which I pulled from an Android APK (Not my app, so I don't have access to the source, just the library)\nI want to use this shared object on my 32 bit Ubuntu machine, and call some functions from it (Preferably with Python) . Is it possible to convert an Android .so to a Linux .so?\nOr is there any simple solution to accessing the functions in the .so without resorting to a hefty virtual machine or something?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1289,"Q_Id":34883612,"Users Score":1,"Answer":"Most likely not. It's very probably the Android you pull it from is running on the ARM architecture, and therefore the .so library was compiled for that architecture. \nUnless your desktop machine is also on the ARM architecture (it's most likely x86 and it would have to be specific such as ARMv7) the .so binary will be incompatible on your desktop.\nDepending on what the .so library actually is, you may be able to grab the source code and compile it for your x86 machine.\nDisclaimer: Even if you obtain a library compiled for the same architecture as your desktop (from x86 phone), there is no guarantee it will work. It may rely on other libraries provided only by Android, and this may be the start of a very deep rabbit hole.","Q_Score":3,"Tags":"android,python,linux,shared-libraries","A_Id":34883727,"CreationDate":"2016-01-19T17:47:00.000","Title":"How to use Android shared library in Ubuntu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"If I set a pygame window to resizable and then click and drag on the border of the window the window will get larger but nothing blit onto the surface will get larger with it. (Which is understandable) How would I make it so that when I resize a window all blit objects resize with it and fill the window properly?\nFor example: Say I have a window of 200 x 200 and I blit a button at window_width\/2 and window_height\/2. The button would be in the center of the window at 100 x 100. Now if I resize the window to 300 x 300 the button stays at 100 x 100 instead of 150 x 150. \nI tried messing around with pygame.Surface.get_width ect, but had no luck.\nBasically I'm trying to resize a program's window and have all blit images stay proportionate.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":12690,"Q_Id":34910086,"Users Score":0,"Answer":"Recently with pygame2.0 You can use the SCALED flag","Q_Score":7,"Tags":"python,pygame,resizable,surface,blit","A_Id":58898639,"CreationDate":"2016-01-20T20:41:00.000","Title":"Pygame. How do I resize a surface and keep all objects within proportionate to the new window size?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently creating a Snake game on Python using the TKinter library.\nSo right now, I've implemented the movements, the food system, and the score system. I still need some help on how I can make the snake grow when it eats the food.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1681,"Q_Id":34914142,"Users Score":0,"Answer":"I do not see the associated code that actually displays the current position of the snake on the screen and remove it after movement, but this is where you can change the size if you make the length of the snake variable and have it drawn and removed in an iterate fashion. When food is eaten, you can simply increase the size of the snake length variable and pause the erasing of the snake movement as it proceeds along its vector until the desired growth has occurred, at which time removal can proceed at the new length rate. Please clarify the part of the code that actually renders the snakes position.","Q_Score":1,"Tags":"python,tkinter","A_Id":34914501,"CreationDate":"2016-01-21T02:03:00.000","Title":"Need help for a Python Snake game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have wrote python(2.7) GUI desktop application using TKinter library and it is working fine. Now i want to convert it into web application. I have looked into pyjaco and pyjamas but not getting it done.\nHow can i convert it into Web App ? \nThanks in advance..","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":9730,"Q_Id":34921411,"Users Score":5,"Answer":"You will have to rewrite your app. There is simply no way to convert a tkinter application to run on the web. You could potentially use pyjs to convert some of the business logic, but the entire GUI will have to be rewritten.","Q_Score":6,"Tags":"python-2.7,web-applications,tkinter","A_Id":34924538,"CreationDate":"2016-01-21T10:39:00.000","Title":"How to Convert python Tkinter desktop App to Web App","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a problem with using sys.exit() to stop a Tkinter program?\nI know normally people use root.destroy() why is that?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2199,"Q_Id":34935100,"Users Score":0,"Answer":"I use both. root.destroy() is used to destroy all windows (parent, child) within the root tkinter instance, but it doesn't end the python program. \nsys.exit() stops all active applications used by python. \nIn short, if your python code runs a tkinter GUI exclusively and it's functionality ends after the window is closed then use both root.destroy() followed by sys.exit() to effectively end the session.","Q_Score":2,"Tags":"python,python-2.7,tkinter,tk","A_Id":34935285,"CreationDate":"2016-01-21T21:57:00.000","Title":"Can I use sys.exit() to stop a Tkinter program","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I run my Tkinter application, a command line\/terminal opens. How can I run my application without it invoking a command line\/terminal session?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1518,"Q_Id":34937925,"Users Score":2,"Answer":"Save your file with \".pyw\" extension instead of \".py\".","Q_Score":1,"Tags":"python,tkinter,terminal,window","A_Id":34939110,"CreationDate":"2016-01-22T02:21:00.000","Title":"How to run a Tkinter program without opening a terminal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am rendering a virtual object on a video feed, and I want to try zooming in on it. Right now, I:\n\nrotate and translate the camera by where it actually is with respect to the object,\nmake a 2D texture of the latest frame filling up the entire screen, and\ndraw the object at the origin after multiplying the vertices by a rotation matrix.\n\nThe position is a 3D-vector, and the orientations of the object and camera are quaternions.\nHow can I zoom in on the object while simultaneously magnifying the texture?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":206,"Q_Id":34990774,"Users Score":0,"Answer":"If you are using perspective matrix adjust you field of view. Smaller fov bigger the object","Q_Score":1,"Tags":"python,opengl,pyopengl","A_Id":34991608,"CreationDate":"2016-01-25T10:51:00.000","Title":"Zooming onto an object and background in OpenGL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've spent some time looking online and so far haven't found anything that answers this without using PIL, which i can't get to work is there another way to do this simply?","AnswerCount":3,"Available Count":1,"Score":-0.1325487884,"is_accepted":false,"ViewCount":33691,"Q_Id":35024118,"Users Score":-2,"Answer":"Luke, this is too late , however may help others. Your image has to be in the same sub directory with .py script. You can also type  '.\/imageFileName.png'","Q_Score":6,"Tags":"python,image,python-3.x,tkinter","A_Id":54412011,"CreationDate":"2016-01-26T21:16:00.000","Title":"How to load an image into a python 3.4 tkinter window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wanted to write python code in my local computer and transfer it to Android device to execute the codes in mobile or Tablet.\nIs it possible to transfer? If yes, in which location do I need to transfer.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":330,"Q_Id":35032917,"Users Score":1,"Answer":"In QPython in Programs I see \/storages\/emulated\/0\/com.hipipal\/qpyplus\/scripts\/","Q_Score":0,"Tags":"android,python,qpython","A_Id":35033063,"CreationDate":"2016-01-27T09:05:00.000","Title":"Qpython in Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are many questions dealing with pyglet and pygame, but what I want to know is difference in theses two, in simple terms.\nNot in technical terms, not experimental features and all that.\nThey are both libraries, both API, both for creation of games and multimedia apps, right?\nJust in plain English, for someone like me, relative begginer, who has finished course about Python in Codecademy and read Head first Python book.","AnswerCount":3,"Available Count":2,"Score":-0.1325487884,"is_accepted":false,"ViewCount":3694,"Q_Id":35044298,"Users Score":-2,"Answer":"I've tried pyglet and pygame and rate pygame as the best .","Q_Score":2,"Tags":"python,api,pygame,pyglet","A_Id":56559014,"CreationDate":"2016-01-27T17:36:00.000","Title":"Difference between pyglet and pygame, in simple words?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are many questions dealing with pyglet and pygame, but what I want to know is difference in theses two, in simple terms.\nNot in technical terms, not experimental features and all that.\nThey are both libraries, both API, both for creation of games and multimedia apps, right?\nJust in plain English, for someone like me, relative begginer, who has finished course about Python in Codecademy and read Head first Python book.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":3694,"Q_Id":35044298,"Users Score":1,"Answer":"PyGame is low-level library. You have to do all on your own - starting at mainloop and all functions called by mainloop. You can do it in different ways. \n(And you can learn something about mainloops in Pyglet, Tkinter, PyQt, wxPython and other GUIs, not only in Python)\nPyglet is framework - it has already mainloop and you can't change it and you can't see how it works. You override functions which mainloop calls. You have to keep its rules.","Q_Score":2,"Tags":"python,api,pygame,pyglet","A_Id":35044912,"CreationDate":"2016-01-27T17:36:00.000","Title":"Difference between pyglet and pygame, in simple words?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wonder if it is possible to change the weight of one word on a tkinter button? So the result would look something like this:\n[ yes, I agree ]\nI've tried using tags but neither tk.Button nor tk.Button['text'] seem to allow it.\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":33,"Q_Id":35064212,"Users Score":1,"Answer":"No, it's not possible. If you want a button with rich text you'll have to create your own. Or, create an image that has the look you want, and use the image with a standard button. \nYou can create your own using a text widget that is one character tall and a few characters wide. Then, you can place bindings on the button to handle clicks, and to change the relief to simulate a button. Unfortunately, it won't have the look of the platform-specific buttons.","Q_Score":1,"Tags":"python,python-3.x,tkinter","A_Id":35066487,"CreationDate":"2016-01-28T14:31:00.000","Title":"Modifying a Part of Text on tk.Button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running Qpython (andoid) 1.2.3 (the latest as of 2016-01-31) and I can get scripts to run. I've been able to create a shortcut on my homescreen for a simple test script that put the current date in yyyy-mm-dd format into the clipboard, and speaks the content. I have #qpy: console directing the script to execure in the console. When I click the shortcut, the clipboard is happily updated, and read out to me. But... the console window stays open, telling me to hit enter to close the window.\nI have tried:\n\nadding \"exit\"\nadding \"exit(0)\"\nadding \n\nimport sys\n\nsys.exit()\nI have tried printing ctrl-d\n\nI still get the console staying open until I manually hit enter.\nI tried reheadering my script to run as kivy instead of console, and I could get it to exit, but it takes several seconds to load up kivy, and it's silly to load a huge amount of gui capability, when I neither need nor want them.\nHow can I close the console automatically?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1803,"Q_Id":35113618,"Users Score":0,"Answer":"edit the file end.sh. Remove or comment the \"read\" command.","Q_Score":4,"Tags":"android,console,qpython","A_Id":52803215,"CreationDate":"2016-01-31T12:03:00.000","Title":"How do I exit Qpython (android) console automatically afer script completes?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In tkinter I am creating a Toplevel widget to prompt the user with \"Are you sure you want to exit?\" every time they try to exit my application. While this is happening, I want the Toplevel widget to have full focus of my application and the user to be unable to click anything on the root window, if possible.\nWhile trying to figure out to do this, I discovered grabs and the ability to set the focus of the application. What is the difference between these two things?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1583,"Q_Id":35140140,"Users Score":1,"Answer":"Focus means that your window will receive all keyboard events until some other window gets the focus.  A grab tells the window manager that your window should have the focus until you explicitly tell it that it is allowed to take it away (ungrab).","Q_Score":2,"Tags":"python,macos,python-3.x,tkinter","A_Id":35140293,"CreationDate":"2016-02-01T20:55:00.000","Title":"Tkinter: What's the difference between grab and focus?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Quick question everyone. I apologize for how simple it is but why is it that when I add something to a frame like a checkbutton or label the formatting of the frame goes away and it's size snaps to whatever it is I put inside it? \nThank you,\nMark","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":35143105,"Users Score":1,"Answer":"That's simply how it's designed to work. It's a very powerful feature. You worry about what widgets you want in a frame and thinter can take care of doing all the math to make sure everything fits.","Q_Score":0,"Tags":"python,tkinter","A_Id":35143172,"CreationDate":"2016-02-02T00:40:00.000","Title":"TKInter Frame formatting not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to verify the style of an element i.e. the color of the text shown in a textview. Whether it is black or blue ex. textColor or textSize. This information is not listed in the uiautomatorviewer. \nI can get the text using elem.get_attribute(\"text\") as the text value is seen in the Node Detail.  Is there a way to check for the style attributes?( I can do this fairly easy with straight selenium.)","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1771,"Q_Id":35164413,"Users Score":1,"Answer":"Update. As it turns out that cannot be done with appium webdriver.\nFor those of you who are wondering this is the answer I rec'd from the appium support group:\nThis cannot be done by appium as underlying UIAutomator framework does not allow us to do so.\nIn app's native context this cannot be done\nIn app's webview's context this will be same as below because webview is nothing but a chromeless browser session inside and app\n print searchBtn.value_of_css_property(\"background-color\").\nSummary \nfor element inside NATIVE CONTEXT ==>> NO\nfor element inside WEBVIEW CONTEXT ==>> YES\nHope this helps.","Q_Score":1,"Tags":"android,python,appium,python-appium","A_Id":35277434,"CreationDate":"2016-02-02T21:48:00.000","Title":"Appium Android UI testing - how to verify the style attribute of an element?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm new to GUI-programming and using now tkinter for python. \nIn the past my \"non-GUI\" programs always consisted out of a few classes but if I look to the examples with a GUI it appears that only one class is used. All functions are included in this one class. Is this the normal way or is it possible to write a gui class which \"calls\" functions from other classes?\nAs I look at it now it seems the concept of object oriented programming dissapears by implementing the GUI in an OOP manner","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":110,"Q_Id":35165461,"Users Score":3,"Answer":"It is definitely possible to use multiple classes in GUI apps.\nFor example you can have one class which defines and layouts GUI elements (like buttons, text fields, scrollbars etc.) and the second class would subclass it adding some functionality on top of it.","Q_Score":1,"Tags":"python,oop,user-interface,tkinter","A_Id":35166083,"CreationDate":"2016-02-02T23:01:00.000","Title":"Only one Class possible for GUI programming","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm really sorry if this question sounds really simple but I couldn't figure out the solution yet...\nI'm using wxPython in order to create a GUI. I've used wx.Notebook, and created some tabs, all default configuration are located in the last tab.\nMy question is, how can I get these default values from the last tab and use it?!? I tried \"pub\" (wx.lib.pubsub), but I only get these default values after an event (e.g. button click). Also there is\/are any magic to get these values after user modification without a button click?\nThanks all,\nRegards,","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":35188282,"Users Score":0,"Answer":"When you create the UI, you can keep the default config in a variable. A dictionary would probably work. Then when you create the tabs, you can pass them a dictionary. Alternatively, you could just save the defaults to a config file and then use Python to read it and load it into the UI. Python can parse csv, json, xml and whatnot right out of the box after all.","Q_Score":0,"Tags":"python,user-interface,wxpython","A_Id":35229531,"CreationDate":"2016-02-03T21:40:00.000","Title":"Default values from wxPython notebook","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently working on a Battleship game project (for learning purposes) that uses tkinter for the UI and, because I want this program to be able to run on two computers for multiplayer, twisted for data transfer. This is my first time using twisted however I have used tkinter many times.\nI know both twisted and tkinter run in loops so it is normally not possible to have these running in the same thread. So I found out there's two ways to get around this: tksupport and running twisted's reactor in a separate thread.\nHowever, I tried to import tksupport from twisted.internet but it said that it didn't exist. I checked my twisted folder in my site-packages to be sure and it is indeed not there, but even the twisted docs claim it is. I assuming that this is because I am running python 3.5 and tksupport hasn't been ported over yet, but If this is not the case, please let me know.\nAlso, as for the solution with threading, I discovered there's some controversy over putting twisted's reactor in it's own thread. Is it ok to put the reactor in its own thread, and, if so, what precautions should I take?\nThanks.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":698,"Q_Id":35229352,"Users Score":0,"Answer":"I currently have twisted 17.9.0 and python 3.6.\nIn reference to the answer above,\ntksupport for python 3 is now available with twisted, so no need to create your own tksupport module.","Q_Score":1,"Tags":"python,python-3.x,tkinter,twisted","A_Id":49701788,"CreationDate":"2016-02-05T16:48:00.000","Title":"Threading with Twisted with Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have downloaded the 3.5 version of python on my windows 7 home premium computer with version 6.1 software. I wish to use a C main program with python library extensions. I have aded the path to the include folder and the library folder to the dev studio c-compiler. I am testing with the supplied test program that prints out the time but I get a compile error. While it can find Python.h, it can't find python35_d.lib. I can't either. Is it missing from the download or is this another name for a one of the libraries in the download? Thanks","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":4011,"Q_Id":35250175,"Users Score":12,"Answer":"Maybe a little too late, but I found a work around for the missing 'python3x_d.lib' : When installing the python with pythoninstaller.exe, choose the advanced setup options in the first command window of the installation wizard, there choose the option \"download debug binaries\", then the file python3x_d.lib is automatically installed. \nI faced this error when trying to build opencv with python bindings","Q_Score":4,"Tags":"c,python-3.x","A_Id":36926551,"CreationDate":"2016-02-07T05:43:00.000","Title":"I cannot find python35_d.lib","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm making a python app that triggers an action when the print screen key is pressed. I'm using pyhook library. However, every time I press a character written with the language of my country (\u00e3\u00ed\u00e9 and others) is doubling the characters . For example : ~~a ''e ''i , causing problems in the normal user written use. Is there any way to fix ?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":208,"Q_Id":35259943,"Users Score":-1,"Answer":"try to add this line:\n# -* - coding: utf-8 -* -","Q_Score":0,"Tags":"python,utf-8,pyhook","A_Id":35260023,"CreationDate":"2016-02-07T22:29:00.000","Title":"Pyhook UTF-8 issue","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a simple chat program in python that uses tkinter and mysql db. It connects to db first, gets the messages and shows them to user. But when another user send a message to the user, the user can not see the new messages. So, I made a refresh button. But, everybody knows, people don't want to use a chat program that you always should press a button to see messages. The question is, how can I make a instant message app without clicking any buttons?\n\nIt doesn't require to use tkinter for gui. It can be run with other gui libs.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":294,"Q_Id":35294239,"Users Score":0,"Answer":"in order to periodically refresh the user messages, just make an infinite while loop and set it to update every 5 seconds or so. this way every 5 seconds you check to see if database has new messages. alternatively you can make the while loop update if the database has been updated at any point but this is more complex.","Q_Score":0,"Tags":"python,mysql,tkinter","A_Id":35295077,"CreationDate":"2016-02-09T14:12:00.000","Title":"Python3 - Tkinter - Instant messaging","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We're building off of the Tower app, which was built with dronekit-android, and flying the 3dr solo with it.  We're thinking about adding some sort of collision detection with it.\nIs it feasible to run some python script on the drone, basically reading some IR or ultrasound sensor via the accessory bay, and basically yell at the Android tablet when it detects something?  That way, the tablet will tell the drone to fly backwards or something.\nOtherwise, would we use the dronekit-python libs to do that?  How would use a tablet \/ computer to have a Tower-like functionality with that?\nThanks a bunch.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":208,"Q_Id":35308103,"Users Score":0,"Answer":"I don't really know what you are asking for but:\nif the distance between the centers of two circles < the sum of their radii then they have collided.","Q_Score":1,"Tags":"dronekit-python,dronekit-android","A_Id":54972589,"CreationDate":"2016-02-10T06:12:00.000","Title":"Implementing collision detection python script on dronekit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to run the Invensense motion_driver_6.12. I compiled the code with IAR and the STM32 works ok - all the test I've done with the board are ok: UART, I2C.. etc. But when I run the python client demo program \"eMPL-client-py\" the program shows only one empty black window and nothing occurs. I tried to run first the program and then switch on the board and vice-versa.\nThanks","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":733,"Q_Id":35313998,"Users Score":-1,"Answer":"which type of Invensense chip you are using?\n\nI think you need to check if you use the right COM Port in windows.\nCheck if you could get data from your MPUxxxx Board through I2C\nCheck log_stm32.c if this function work well fputc(out[i]);","Q_Score":0,"Tags":"python,stm32,discovery","A_Id":38325794,"CreationDate":"2016-02-10T11:30:00.000","Title":"Invensense Motion Driver 6.12 STM32 demo python don't work","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have a Python PyQt program which has a QWidget on the main window.\nI added 2 different views into the same QWidget.\nWhen the user clicks Button1, I show view1 and hide view2.\nWhen the user clicks Button2, I show view2 and hide view1.\nEach view has its own KeyPressEvent for using arrow keys to page through records in the view.\nI don't want to page through records in both views simultaneously, I just need to page the records of the active view.\nHow can I disable\/enable the appropriate KeyPressEvent when the corresponding view is active.  Or is the a better approach? \nApologies for no code, but it is difficult to simplify my working example.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":80,"Q_Id":35324749,"Users Score":0,"Answer":"If you setFocus on an object in the corresponding view that was just made visible, then only that view's keyPressEvent will be triggered.  No need to disable or enable keypress events.  The focus does this automatically.\nThe solution above is the answer to the question.  However, I may change from using QAction buttons to trigger changing the views, to using a tabwidget to change the views instead.","Q_Score":0,"Tags":"python,view,pyqt4","A_Id":35326282,"CreationDate":"2016-02-10T20:00:00.000","Title":"PyQt: Independent KeyPressEvent between 2 different views on a form","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Ok, so our world map for a Risk-style conquest game we are making is made of a matrix of mouse-interactive \"country\" objects containing their own values like name, owner, and unit counts.\nRight now the entire map is sized to fit within the game screen; we are considering making the map scrollable. A possibly I found was that we generate the map on its own surface that's bigger than the game screen, then blit a portion of the map surface onto a subsurface of the game screen and let player input offset what portion of the map is being drawn at a given time.\nI know this type of scrolling works- that's not what this question is about- the question is would using this kind of scrolling prevent us from letting the player properly interact with the countries on the map using the mouse?\nWe already tried a form of scrolling where we just offset the indexes of the map matrix to move the countries positions that way, but this gave the server problems handling attack orders as the same two countries could be at different coordinates for different players. The scrolling method I described would allow the map itself to remain stationary for all players, but how would we determine the mouse's position relative to the world map as opposed to its position on the game screen?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":192,"Q_Id":35330326,"Users Score":1,"Answer":"You have to translate the mouse position on the screen to the world coordinates. When you scroll your map, you generate an offset, and you have to use that for translation.\nSay if the map is not scrolled ((0, 0) of the map is at (0, 0) of the screen), and a player clicks on (12, 12), you know she clicked on (12, 12) of the world.\nWhen this player scrolled the map to the right (let's say 100px), then you blit the map surface at (-100, 0) of the screen. Now if the player clicks on (12, 12), you can calculate that (12, 12) of the screen is actually (112, 12) on the map (screenX - scrollX, screenY - scrollY).\nSo if you want to determinate which country a player clicked on, always use the translated coordinates (not the screen coordinates), and the issue you describe disappears.","Q_Score":1,"Tags":"python-3.x,scroll,pygame,interactive","A_Id":35336224,"CreationDate":"2016-02-11T03:35:00.000","Title":"pygame- Making mouse-interactive elements on a \"scrolling\" surface","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have designed my whole pygame to work for 1920x1080 resolution.\nHowever, I have to adapt it for smaller resoltion.\nThere is a lot of hardcoded value in the code.\nIs there a simple way to change the resolution, like resizing the final image at the end of each loop, just before drawing it ?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1469,"Q_Id":35333875,"Users Score":1,"Answer":"i usually create a base resolution and then whenever the screen is resized, i scale all the assets and surfaces by ratios. \nThis works well if you have assets that are of large resolution and you have scaled then down but would pixelate for smaller images.\nyou can also create multiple assets file for each resolution and when ever your resolution goes above one of the available asset resolution you can change the image. you can think in in context of css media query to better understand.","Q_Score":1,"Tags":"python,pygame,resolution","A_Id":35334029,"CreationDate":"2016-02-11T08:09:00.000","Title":"Pygame, change resolution of my whole game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a widget that shows a thread visually for Tkinter?\nreason why. I want to open a Vpython window inside a Tkinter window.\nI know there is a possibility to open a Vpython thread on the side while Tkinter is active, but can i show it inside Tkinter? (Like in some sort of Frame)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":96,"Q_Id":35349113,"Users Score":0,"Answer":"No, there is no widget to do that.","Q_Score":0,"Tags":"python,multithreading,tkinter,vpython","A_Id":35349400,"CreationDate":"2016-02-11T20:10:00.000","Title":"can Python Tkinter widget show a thread?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to open push notification tray for iOS on hardware device using Appium and Python.\nRegards","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":322,"Q_Id":35358825,"Users Score":0,"Answer":"No, there no way to open push notification tray for iOS on hardware device using Appium and Python, or any iOS public API.","Q_Score":0,"Tags":"python,ios,iphone,selenium-webdriver,appium","A_Id":35365816,"CreationDate":"2016-02-12T09:20:00.000","Title":"Open push notification tray on iOS hardware device using Appium","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm building a small project for my android phone using kivy. I am trying to get the android back key to do a make Toast saying 'press back again to exit', and then exit when the back key is pressed twice. I checked online and saw a tutorial on how to do this. I had to useimport android \nbut the problem is that it just doesn't work on my phone. Not on kivy launcher when i tested it. I even compiled to an android apk using buildozer, but it still doesn't work. Please im still very new to kivy and android api. Help me get this right. Or if there is another way to do this i also appreciate it. Please include an example in your response.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":614,"Q_Id":35376747,"Users Score":2,"Answer":"Hello  guys I finally found the problem. The import android actually works.\nThe problem was that I used it wrongly . I was trying to do a makeToast  like dis 'android.makeToast'. Evidently dat was wrong. Found out there was another way to do it with pyjnius. \nThanks so ooo much for your assistance","Q_Score":1,"Tags":"android,python,kivy,buildozer","A_Id":35383918,"CreationDate":"2016-02-13T06:11:00.000","Title":"kivy import android doesnt work","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a model using QSqlTableModel, then created a tablview using QTableView and set the model on it.\nI want to update the model and view automatically whenever the database is updated by another program. How can I do that?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":255,"Q_Id":35383018,"Users Score":1,"Answer":"There's no signal emitted for that currently. You could use a timer to query the last update timestamp and refresh the model data at designated intervals.","Q_Score":0,"Tags":"python,pyqt,auto-update,qtableview,qsqltablemodel","A_Id":35392361,"CreationDate":"2016-02-13T17:31:00.000","Title":"Automatically updating QSqlTableModel and QTableView","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to deploy a Python3 app that uses tkinter on OpenShift.  I added the following to setup.py: install_requires=[\"Tcl==8.6.4\"].  When I ran git push I received the following error:\n\nCould not find suitable distribution for Requirement.parse('Tcl==8.6.4').\n\nCan anyone provide the correct syntax, distribution package name and version?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":105,"Q_Id":35395843,"Users Score":0,"Answer":"Bryan has answered the question.  Tkinter will not work with WSGI.  A web framework such as Django must be used.","Q_Score":0,"Tags":"python,openshift","A_Id":35442172,"CreationDate":"2016-02-14T19:01:00.000","Title":"Using Tkinter with Openshift","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm working on an application using Python (3.4) and PyQt. The goal of the program is to manage and analyze large amount of data - up to ~50 binary files, which might be of total size up to 2-3 GB. When I tried to load a couple files into the program, it stops responding during loading and then takes ~1.5GB RAM just to keep running. My question is quite general - what are the possible methods in python\/PyQt for handling such data sets?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":367,"Q_Id":35514886,"Users Score":1,"Answer":"You might consider the HDF5 format, which can access using h5py, pytables, or other python packages.  Depending on the dataformat, HDF5 could enable you to access the data on the HD in an efficient manner, which in practice means that you can save memory.  The downside is that it requires some effort on your side as a programmer.","Q_Score":1,"Tags":"python,pyqt,pyqt4,python-3.4,large-data","A_Id":35515404,"CreationDate":"2016-02-19T20:57:00.000","Title":"Python - managing large data","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a multithreaded cython application and would like to pass an extension type between threads that holds a pointer to a thread safe Circular buffer that also makes various calculations.  \nIs there any way to make a c++ container handle a Extension type?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":143,"Q_Id":35538946,"Users Score":1,"Answer":"I guess you can just cast to void *, pass it into your container, then convert back to your extension type. It's up to you to ensure you still have a reference to it in order to not let the pointer being invalid.","Q_Score":0,"Tags":"python,cython","A_Id":35573200,"CreationDate":"2016-02-21T16:53:00.000","Title":"Gil-less container for cython extension type","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am programming a game with multiple script files and I am wondering, on the files that I have used pygame.init(), do I have to call pygame.quit() at the end of the file?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":62,"Q_Id":35544448,"Users Score":3,"Answer":"You should only call pygame.init() and pygame.quit() on 1 and same file. this the main file where your game loop runs. \nYou will need other scripts for different things but all those you can just import in this main file where game loop runs. \nIf you find this confusing checkout some pygame projects on github that will help you understand the structure. Also studing a little object orientation will help you a lot for making games.","Q_Score":0,"Tags":"python,pygame","A_Id":35544509,"CreationDate":"2016-02-22T01:32:00.000","Title":"Python & Pygame - Does pygame.quit() have to be written at the end of every .py file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using xlwings on a Mac and would like to set the foreground color of text in a cell from Python. I see that range.color will change background color which I could use but it has an additional problem that the cell borders are overwritten by the new BG color.\nIs there any way to change foreground text color from Python and\/or prevent the cell borders being overwritten by a new BG color?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5576,"Q_Id":35584309,"Users Score":0,"Answer":"This solution is working fine for me.\nfrom xlwings.utils import rgb_to_int\nimport xlwings as xw\nsht.range('A1').api.Font.Color = rgb_to_int((192, 192, 192))","Q_Score":3,"Tags":"python,text,colors,xlwings","A_Id":70505321,"CreationDate":"2016-02-23T17:32:00.000","Title":"xlwings: set foreground text color from Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create an app for Windows but I've to developed it on Mac OS X.\nI've created a desktop app with Python using PyQt5. The steps that I followed are:\nStep 1. Create a desktop app (On Mac OS X):\n\nInstall Qt.\nInstall Sip.\nInstall PyQt5.\n\u00a1Develop!\n\nStep 2. Package the Python app with PyInstaller(On Windows 8):\n\nInstall Python.\nInstall Pip-Win.\nInstall PyWin32.\nInstall PyInstaller.\nCreate the executable.\n\nThe problem is that, when I execute the app on Windows, it shows a window with the following message:\nFatal error: app returned -1.\nAnybody knows what is wrong? Maybe I need to do the Step 1 on Windows too?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":520,"Q_Id":35598908,"Users Score":1,"Answer":"PyInstaller brings together every dependancy of your python script. But you need to install all dependancies before running pyinstaller.\nSo, before running it on windows, you must install qt5, sip and pyqt5.","Q_Score":1,"Tags":"python,windows,macos,qt,pyqt5","A_Id":35684613,"CreationDate":"2016-02-24T10:02:00.000","Title":"Desktop app created with PyInstaller doesn't run","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am unable to find a pygame download for Python 3.5 and the ones I have downloaded don't seem to work when I import to the shell. Help?\nThis is the message I receive on the shell:\n\n\n\nimport pygame\n      Traceback (most recent call last):\n        File \"\", line 1, in \n          import pygame\n      ImportError: No module named 'pygame'","AnswerCount":6,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27913,"Q_Id":35609592,"Users Score":0,"Answer":"Even when you have windows 64 bit you need to get the win32.whl file , then follow the standard instructions","Q_Score":6,"Tags":"python,python-3.x,pygame","A_Id":39562265,"CreationDate":"2016-02-24T17:59:00.000","Title":"How do I download Pygame for Python 3.5.1?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently trying to create a canvas which will have other objects on it and I want to use a scroll-bar for when the objects on the canvas take too much space so that the size of the window will stay the same. \nThe problem is that although I set an initial size for the canvas it changes to fit all of the objects on it. Can I make the canvas to keep a specific size so that I can use the scroll-bar instead?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1958,"Q_Id":35669264,"Users Score":0,"Answer":"myscrollbar = Scrollbar(myframe,orient=\"vertical\",command=canvas.yview)\ncanvas.configure(yscrollcommand=myscrollbar.set)","Q_Score":0,"Tags":"python,canvas,tkinter","A_Id":35670592,"CreationDate":"2016-02-27T11:42:00.000","Title":"tkinter fixed canvas size","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So recently I made a script, and I also finished gui and managed to merge those two together. Now i wish when I start the exe file that cmd doesn't appear but instead only GUI? Any idea on how to manage this? So far my searching didn't yield any satisfying results. Some more info is: Python 3.5, using pyinstaller to convert to exe, Tkinter Gui, pycharm 5.0.1. Thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":89,"Q_Id":35685734,"Users Score":0,"Answer":"Since your question mentions .exe executables, I'wll assume you work in the Windows environment.  Try using a .pywextension instead of a .py extension for the python program.","Q_Score":0,"Tags":"python,user-interface,python-3.x","A_Id":35685792,"CreationDate":"2016-02-28T17:23:00.000","Title":"How do I stop cmd from appearing when i run exe file (python 3, gui)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem statement- to develop an application for processing DICOM images for diagnostic applications from scratch. It includes:\n\nImage processing- model based segmentation and registration (C++)\nVisualization- 2D and 3D image visualization (C++)\nGraphical User Interface (Python)\n\nIs it feasible to develop this using C++ (for large chunk of image data) and Python for the GUI?\nWhat are the pros and cons of using openCV? \nWhich libraries would be suitable for this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":803,"Q_Id":35715313,"Users Score":0,"Answer":"I would say go with VTK, ITK and Qt. Python brings nothing to the table in terms of GUI compared against Qt. VTK\/ITK can read DICOM for you and probably also do segmentation and registration as needed.","Q_Score":1,"Tags":"python,c++,opencv,visualization,dicom","A_Id":35716718,"CreationDate":"2016-03-01T05:27:00.000","Title":"DICOM image processing, visualization and GUI- C++ and Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Pyinstaller (after spending a long time with py2exe) to convert my REAL.py file to .exe. I used Anaconda to make .py file which is running perfectly on my computer. But when I make  .exe file, it shows no error and an application is created in dist\\REAL folder. But when I run the .exe file, the console opens and closes instantly.\nIt should ideally show a GUI window and take inputs and use them to make plots. It does so when I run REAL.py file. I am using Tkinter, Matplotlib, numpy, scipy which comes with Anaconda.\nEDIT: I tried to run simple code to check the compatibility with matplotlib:\nimport matplotlib.pyplot as plt\nplt.plot([1,2,3,4])\nplt.ylabel('some numbers')\nplt.show()\nThe same issue persists with this. Opens console window and then closes but no plot is given out.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2158,"Q_Id":35737188,"Users Score":0,"Answer":"Try using the --hidden-import=matplotlib when calling pyinstaller. For example, in the command prompt you would type:\nPyinstaller --hidden-import=matplotlib your_filename_here.py\nand you could try giving it a shot with tkinter in there as well.\nPyinstaller --hidden-import=matplotlib --hidden-import=tkinter your_filename_here.py","Q_Score":1,"Tags":"python-2.7,anaconda,pyinstaller","A_Id":47044598,"CreationDate":"2016-03-02T02:13:00.000","Title":"Pyinstaller with Tkinter Matplotlib numpy scipy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have tried following the steps on the website but they're not working for me. At least I must be doing something for them not to work.\nFirstly, before the steps, the site tells me to open the command line and type python --version. So I typed on the windows search bar 'command line'. Python (command line) came up and I went ahead and typed python --version and I got the error\n\npython is not defined\n\nalong with other stuff. So I decided to try the command prompt, the second option to come up when I typed 'command line' in on my windows search. It returned saying that it was not recognized as an internal or external file.\nI attempted step 1, just to try my luck, on both the Python command line and the command prompt and nothing really happened. I'm not really sure what to do now.","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":12655,"Q_Id":35779145,"Users Score":1,"Answer":"i have encountered a simillar setback while trying to install kivy on python.\nin python version 3, py is used instead of python for launching python in the command prompt i.e\npy (to launch python3) \npy -m pip install kivy (to install kivy) \nN.b: before installing kivy it is recommended to install cython and other python dependencies using py -m pip install cython","Q_Score":0,"Tags":"python,kivy","A_Id":41786561,"CreationDate":"2016-03-03T17:37:00.000","Title":"How to install kivy on Windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm fairly far along developing a Kivy app. Its targeted for android, but will also work (simultaneously with a different skin) on desktops and hopefully iOs eventually.\nThe basic dependencies I'm heavily using are:-\n\ntwisted - using this as an IPC, my app has a server\/client\nrelationship   between the data manipulation and the UI\nWhoosh - for text search\nxmltodict - for easy XML manipulation\n\nI'm having REALLY long app startup times on android, on a relatively recent phone, which doesn't bode well. From my rough timings (based on time.time() and subtracting from my App's init time):-\n\nMy app gets control from kivy startup at about 1 second in\nMy initialization of custom classes etc. is done at the 2.4 second mark\nAt the 14.4 second mark, I finally complete the bulk of my data loading\nAt the 17 second mark, I start sending the data out to the client UI using twisted\nAt the 22 second mark, the UI receives the data\n\nThere's multiple points I want to address there. For example the roughly 5 second gap for data send can be easily broken into pieces and updated in the UI piecemeal, so I'm keeping that for later, but I need to ask about the long 12 second gap for data loading. This data loading involves creating about a 1000 instances of a custom class, with the following steps (cumulative time over 1000 instances):-\n\nReading data from 1000 text XML files (0.734 seconds)\nParsing the XML in the read data (9.198 seconds)\nFilling the object's variables based on the parsed XML (0.585 seconds)\nDirectory tree traversal (use this to locate a certain base folder, 0.0824 seconds)\nmtime measurement for the xml files (0.12 seconds)\n\nThe measured timings surprised me, because the equivalent timings for running the same code on my laptop are 0.041, 0.9, 0.062, 0.009, and 0.016). Everything's about 10 times slower.\nWhat, if anything, can I do about this? The phone being used for testing has 3GB of RAM and a Snapdragon 801 processor, so I'm quite worried about using this app on slower\/older models. My initial thoughts were that the slow-down was due to sd cards being inherently slower than my laptop's hard disk drive, but the fact that xml parsing (non IO related) took so long seems to indicate processing problems.\nSuggestions\/criticisms welcome.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1330,"Q_Id":35788298,"Users Score":1,"Answer":"The immediate possibility is that you're just seeing the android processor be slower than the desktop one. I'm not sure what the benchmark comparisons are nowadays, but I've seen this be a problem in the past. That said, I'd have guessed the same as you that the difference shouldn't be that big.\nI don't know if it would make a difference, but one general thing to try might be to compile for armeabi-v7a (rather than the default armeabi). This enables hardware floating point calculation, amongst other things. I don't know if it makes a difference in generic apps, but it certainly could. You can target this using the python-for-android master branch with --arch=armeabi-v7a, or the android_new target in the buildozer master branch (the rest of buildozer operation is the same, and it automatically uses v7a).\nAnother question would be, do you have access to a more efficient xml parser? If you can find one in e.g. cython rather than python (I don't know what you're using right now), this could make a difference. I see the other alternative of using a more efficient data structure has already been raised in a comment.\nSorry that neither of these suggestions are very specific. If you ask on the kivy support channels you may find someone who's found and resolved similar issues.","Q_Score":1,"Tags":"android,python,optimization,kivy","A_Id":35795097,"CreationDate":"2016-03-04T04:58:00.000","Title":"Python on android (kivy) - speed bottlenecks for certain operations?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Recently ,  I wanted to install OpenCV (in Win10 64 bit ) using Cmake 3.5.0-rc3 and Visual studio 2015 . I have python 3.5 as root and 2.7 as python2 . The issue is while configuring it recognizes python 3.5 as main interpreter but i want  it to be 2.7.Is there a possible way to make cmake recognize 2.7 as my main python while maintaining python 3,5 in my PC . I can probably do it by deleting python 3.5 but i dont want that . Help is very much appreciated.Thanking you ,\nP.S. If there is a simpler way to install OpenCV along with extramodules in WIndows ,please do tell me  thanks in advance","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":102,"Q_Id":35805904,"Users Score":1,"Answer":"You should look for Python related variables in the CMake GUI. There may be some variables you could set to force paths to the python2.7 interpreter, libs and include dirs.","Q_Score":0,"Tags":"python,visual-studio,opencv,cmake,cmake-gui","A_Id":35806266,"CreationDate":"2016-03-04T20:58:00.000","Title":"Managing OpenCV python Cmake Studio Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"New to Theano when I tried to use the package I keep getting the following error: \nImportError: ('The following error happened while compiling the node', Dot22(, ), '\\n', 'dlopen(\/Userdir\/.theano\/compiledir_Darwin-14.3.0-x86_64-i386-64bit-i386-2.7.11-64\/tmpEBdQ_0\/eb163660e6e45b373cd7909e14efd44a.so, 2): Library not loaded: libmkl_intel_lp64.dylib\\n  Referenced from: \/Userdir\/.theano\/compiledir_Darwin-14.3.0-x86_64-i386-64bit-i386-2.7.11-64\/tmpEBdQ_0\/eb163660e6e45b373cd7909e14efd44a.so\\n  Reason: image not found', '[Dot22(, )]')\nCan someone tell me how to fix this issue?  Thanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":35811941,"Users Score":0,"Answer":"get rid of theano and reinstall. If that doesn't work, reinstall all of python","Q_Score":0,"Tags":"python-2.7,anaconda,theano","A_Id":42725755,"CreationDate":"2016-03-05T08:34:00.000","Title":"Running Theano on Python 2.7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using kivy to create an android app. However some important pieces of code are based on the python os module. Now since the os is supposed to be system-dependant, i was wondering if it would work on a mobile device running android. If it doesn't work is there some other way to achieve the same results?\nAlso, the app needs to save and retrieve data based on the user's actions. Currently, i am reading and writing to plain .txt files to achieve that, but will it work on an android device? Is there a more flexible alternative?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2556,"Q_Id":35816195,"Users Score":4,"Answer":"Yes, It'll work. os works on windows, linux and mac and android is well.. linux. If python runs on it, os will too.\nFor simple storing you can use os.path.dirname(os.path.abspath(__file__)) and it'll store data in your data\/<app>\/ or data\/data\/<app>\/ on android, so common user will not access it. Of course if your app is built that way. It's nice to make yourself a folder for such files, because it can become messy when you use too much files.\nIf it's built the way it will use sdcard, it'll place data to your sdcard\/<app>\/ if I remember correctly.","Q_Score":2,"Tags":"android,python,kivy","A_Id":35817419,"CreationDate":"2016-03-05T15:51:00.000","Title":"Will python os module work on android?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm in the process of making a simple game in pygame. Its looking to be a platformer RPG. But that is neither final or relevant per this question. So far i have very little functionality in the game. Its just a skeleton at this point if that. My question is kind of two fold: \n\nWhats the best (in terms of performance and flexibility) way to add gravity to classes in pygame?\nWhat are the best practices for adding gravity in general? For example, do you just simply do a \"if keyPressed == k_W then subtract 2pixels per tick from player-y for 20 ticks\" or something with velocity in the up or negative-y direction?\n\nI've seen other posts on adding gravity to games after the fact, where adding it really wasn't thought about during initial development. I want to add it in as early as possible so instead of adding gravity to other things, i can add other things to gravity. I'm going to continue to read up on this, so if you prefer to point me in the direction of some online resources, I'd much appreciate that as well!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":238,"Q_Id":35820336,"Users Score":0,"Answer":"Quick dislaimer: I do not know multiple ways to incorporate gravity, so I can not say which is \"best\". But, if you're fighting the performance battle in Python, you've probably fighting the wrong battle.\nFor gravity, you can use a vector system. Say a character jumps off the ground and has initial velocity of [5, -15] (negative y because positive y is down!), you can move your character's rect by this velocity every frame to simulate movement. To throw gravity into this, you need to add 9.8 to your y velocity component value every second. So 1 second in, the velocity will be about [5, -5]. This will have your character slow to a stop, and begin moving down.\nFor key pressed movement, I recommend using booleans. An example, upon pressing k_U , a variable that says you are moving up becomes True. Then, if this variable is True, you move him, say, [0, -5]. Upon keyup, set variable to false. Do this for north\/east\/south\/west, and then you have a movement system in 4 directions, that moves you while you hold the key down.","Q_Score":3,"Tags":"python,pygame,gravity","A_Id":35822375,"CreationDate":"2016-03-05T21:49:00.000","Title":"Pygame - Gravity Methods","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I get a gtk-WARNING when trying:\ncv2.imshow(\"WindowName\", image)\nI'm using this to watch a live stream one frame at a time. Are there any alternative libraries I could use? I tried several other options like PIL and Tkinter as well as wand, but could get none of them to work for various different reason.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1687,"Q_Id":35901246,"Users Score":2,"Answer":"You need to use a windowing system to display images using imshow.\n(That can be enabled in settings running sudo raspi-config)\nIf you absolutely, positively need to display images without using a windowing system, consider providing an html\/web interface. Two options that come to mind when serving a web interface are:\n\nCreating an HTTP video stream (serve the output image as if it's an IP camera, kind of)\nStream the output matrix as a jpg blob via websockets","Q_Score":2,"Tags":"python,linux,opencv,terminal,raspberry-pi","A_Id":35901608,"CreationDate":"2016-03-09T19:48:00.000","Title":"Show image using OpenCV in Python on a Raspberry Pi terminal","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a .cpp and .h source file pair which is a manager (I guess a wrapper also) for a c++ library I have made. I want to let people use this manager to work with my library in python. I have heard about several different ways to wrap this library into python like cython and boost.python but Im having trouble with understanding the process.\nIf I want to make this manager usable in python, do I need to wrap it in a different way for each version of python? (2.7 vs 3.4) Do I also need to wrap it in a different way for each operating system for each version? So 2.7\/3.4 for Windows vs 2.7\/3.4 for Linux?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":85,"Q_Id":35901908,"Users Score":1,"Answer":"Concerning your confusion about the process, just follow any tutorial for any of the wrapper libs you found or where suggested in the comments.\n\nIf I want to make this manager usable in python, do I need to wrap it in a different way for each version of python? (2.7 vs 3.4)\n\nYes. You might be able to load binary modules compiled for Python 3.4 into Python 3.5, but it's unlikely to work across major versions.\n\nDo I also need to wrap it in a different way for each operating system for each version?\n\nYes. Just as you need to compile your C++ code for different operating systems (and possibly versions) and CPU architectures, Python modules are not different. However, the \"wrap it in a different way\" just means \"compile for the target environment\".","Q_Score":0,"Tags":"python,c++,wrapper","A_Id":35902761,"CreationDate":"2016-03-09T20:28:00.000","Title":"Confusion wrapping c++ library to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I begun to develope with Python and Kivy and I really like it :-) For daily business I'm a Java developer and also a an eclipse child. So i decided to setup eclipse (Mars) with Python, means install PyDev-Plugin and create the settings (done in one button-click).\nBut I have a problem, my eclipse do not want to recognize the kv-files as python files.\nSo my question has anyone experience with this set up?\nDo anyone knows a good set up tutorial?\nThanks for your help","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":451,"Q_Id":35903034,"Users Score":2,"Answer":"*.kv files aren't Python files.  I don't think trying to treat them as such is really what you want to do.  If you must, you can choose to treat *.kv files as python files by going to Preferences > General > Editors > File Associations and adding an entry for *.kv with the Python Editor as an associated editor.\nMy own personal preference, however, is to use YEdit YAML editor for *.kv files.  It won't recognize Python syntax in expressions, but it works well enough for me.  If you're willing to use an external editor, you can get Kv-lang syntax highlighting in Vim.  If you're willing to learn to use Vim.  Which you should, because Vim is awesome.\nFinally, if you're willing to pay, the developer of PyDev also develops a closed source fork of Eclipse called Liclipse, which, if I recall correctly, has syntax highlighting, outlining, and autocomplete in kv files.","Q_Score":1,"Tags":"python,ubuntu-14.04,kivy,pydev","A_Id":35906874,"CreationDate":"2016-03-09T21:31:00.000","Title":"Kivy development in eclipse PyDev on Ubuntu 14.04 SetUp","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have python 2.7 under windows x64, I have been trying to make a simple GUI using PyQt4, like this:\nfrom PyQt4 import *\nfrom ui_mainwindow import Ui_MainWindow\nclass MainWindow(QtGui.QMainWindow, Ui_MainWindow):\nwhen I run the program I have this error:  \" No module named ui_mainWindow\"\n-I have pyqt4 installed\n- I have tried to replace um_mainwindow with ui_simple and clientGUI but the same error resulted.\nWhat am I doing wrong and how to fix this?\nthank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":831,"Q_Id":35914596,"Users Score":0,"Answer":"As far as I know, ui_mainWindow is a python file generated by some Qt Tool, that transforms .ui file from QtDesigner to Python class.\nI have no real experience with PyQT, but I know both C++\/Qt and python. In C++\/Qt QtCreator does the job of transforming .ui file to C++ class, but probably in python You need to do this Yourself.","Q_Score":0,"Tags":"python,python-2.7,pyqt4","A_Id":35914964,"CreationDate":"2016-03-10T11:02:00.000","Title":"python 2.7 under windows: cannot import ui_mainwindow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with Openslide's python bindings. I am using Tif images, which are supported by Openslide. It seems I am able to use the methods read_region and get_thumbnail with a smaller, binary masked Tif of about 100 mb's.\nHowever, with a larger, RGBa Tif of about 1.5 Gb, I get the following error: \n\nopenslide.lowlevel.OpenSlideError: Wrong JPEG library version: library\n  is 90, caller expects 80\n\nI have libjpeg8d installed, and everything seems fine with a smaller Tif. Any suggestions on how fix this issue?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":574,"Q_Id":35924270,"Users Score":1,"Answer":"I would guess your smaller TIFF is not JPEG-compressed, but your larger one is. \nWhen libtiff starts the jpeg decoder, it checks that the version number in the libjpeg library binary matches the version number in the libjpeg headers that it was compiled against, and if they do not match, it prints the warning you are seeing. \nThe error means that you have installed a new jpeg library, but not recompiled libtiff or perhaps openslide. \nYou don't say what platform you are using, but on linux these issues should all be handled for you by your package manager, as long as you stick to the supported versions. If you've built any parts of the system yourself, you'll need to recheck how each part was configured and installed, and how your environment has been set up.","Q_Score":0,"Tags":"python,error-handling,libjpeg,openslide","A_Id":35983246,"CreationDate":"2016-03-10T18:19:00.000","Title":"Openslide libjpeg error: Wrong JPEG library version","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I run python in my Android Terminal and want to run a .py file with:\npython \/sdcard\/myScript.py\nThe problem is that python is called in my Android enviroment indirect with a shell in my \/system\/bin\/ path (to get it direct accessable via Terminal emulator). \nMy exact question, how the title tells how to pass parameter through multiple Shell scripts to Python?\nMy direct called file \"python\" in \/System\/bin\/ contains only a redirection like:\nsh data\/data\/com.hipipal.qpyplus\/files\/bin\/qpython-android5.sh\nand so on to call python binary.\nEdit:\nI simply add the $1 parameter after every shell, Python is called through like:\nsh data\/data\/com.hipipal.qpyplus\/files\/bin\/qpython-android5.sh $1\nso is possible to call \npython \/sdcard\/myScript.py arg1\nand in myScript.py as usual fetch with sys.argv\nthanks","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":373,"Q_Id":35928155,"Users Score":0,"Answer":"I don't have experience in Android programming, so I can only give a general recommendation:\nOf course the naive solution would be to explicitly pass the arguments from script to script, but I guess you can't or don't want to modify the scripts in between, otherwise you would not have asked.\nAnother approach, which I sometimes use, is to define an environment variable in the outermost scripts, stuff all my parameters into it, and parse it from Python. \nFinally, you could write a \"configuration file\" from the outermost script, and read it from your Python program. If you create this file in Python syntax, you even spare yourself from parsing the code.","Q_Score":0,"Tags":"android,python,shell,qpython","A_Id":35935344,"CreationDate":"2016-03-10T21:58:00.000","Title":"Pass parameter through shell to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I run python in my Android Terminal and want to run a .py file with:\npython \/sdcard\/myScript.py\nThe problem is that python is called in my Android enviroment indirect with a shell in my \/system\/bin\/ path (to get it direct accessable via Terminal emulator). \nMy exact question, how the title tells how to pass parameter through multiple Shell scripts to Python?\nMy direct called file \"python\" in \/System\/bin\/ contains only a redirection like:\nsh data\/data\/com.hipipal.qpyplus\/files\/bin\/qpython-android5.sh\nand so on to call python binary.\nEdit:\nI simply add the $1 parameter after every shell, Python is called through like:\nsh data\/data\/com.hipipal.qpyplus\/files\/bin\/qpython-android5.sh $1\nso is possible to call \npython \/sdcard\/myScript.py arg1\nand in myScript.py as usual fetch with sys.argv\nthanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":373,"Q_Id":35928155,"Users Score":0,"Answer":"I have similar problem. Runing my script from Python console \n\/storage\/emulator\/0\/Download\/.last_tmp.py -s && exit \n I am getting \"Permission denied\". No matter if i am calling last_tmp or edited script itself. \nIs there perhaps any way to pass the params in editor?","Q_Score":0,"Tags":"android,python,shell,qpython","A_Id":36178959,"CreationDate":"2016-03-10T21:58:00.000","Title":"Pass parameter through shell to python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Total beginner here, so please be gentle. I have a example.cpp file which has one main function which accepts some input parameters and returns an integer value.\nHow would I run this .cpp file from within Python such that I can specify the input parameters from within Python and access the output of the .cpp so that it is stored in Python?\nThanks\nI've modified the main function to accept command line input. What do you mean by \"returns its result as its exit code\", kindall?\nAlso, want to add that I'd want to return a vector created from the .cpp so that the variable is in Python","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":684,"Q_Id":35929840,"Users Score":0,"Answer":"You can't run a .cpp file, as you need to compile a binary from your .cpp file before you can execute it. first, try to compile it using your terminal, after that you might port it to python, and automate it in a Python script (I guess, that's why you want to do it in Python).","Q_Score":0,"Tags":"python,c++","A_Id":35929867,"CreationDate":"2016-03-11T00:08:00.000","Title":"Python\/C++: Running .cpp in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently writing a wxPython GUI with Twisted Python integrated to be able to send basic text over LAN to a RaspberryPi.  I am at a point where I want some help figuring out the design path that would be best for this project when it comes to the way I should implement my networking.\nTo briefly give more context to the project I have been tasked to create a GUI that connects to a RaspberryPi which controls a research grade CCD, (basically an Astronomy use only camera) a very expensive piece of equipment.  I will be sending commands, given by the user over, the local network to a TwistedPython server that uses a \"parser\" to send the commands to the CCD drivers.\nOn to figuring out the network design philosophy.  I am at the point where the major components of my GUI are implemented and just start needing to talk over the network.  As for the network coding, I have successfully implemented in a few buttons the code needed to send text over the network (e.g. when I hit the camera expose button it sends the file name and time of exposure).  It is at this point where I need to decide on whether I should be using threading or not.  I have some experience in threading through C programming with openMP, MPI, and Pthreads, but I can't wrap my head around what \"kind\" of threading I should be using.  \nSome research has lead me to see that there is the Python built in threading and then threading with TwistedPython.  I fail to see the big differences in the two when it comes to how they work.  Overall, I think I  want it so I can just simply open up a separate thread for Twisted and then send a line of text off and then close it when I am done.  However, I am not sure which way of threading I should implement this.  There is also the possibility that I don't even need to implement threading if I am only sending small bits of data over the area network.\nThere is one part in my GUI that I know will need threading and that would be a progress bar that updates via a clock.  The GUI should still be usable while this is going on, because in Astronomy you can have exposures lasting over ten minutes.\nAnyway can some of you folks help me pose the right questions for my needs?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":89,"Q_Id":35931803,"Users Score":0,"Answer":"It looks like this is an really \"old\" question without any answer. I hope you have figured it out by now, if not I have a solution you might be interested. I have done something similarly, except I was using an Arduino with an EthernetShield. \nI use socket to communicate through LAN and python built-in thread (threading.Thread) to do whatever task it needs to be done. \nNow the question is that are you having your GUI inside your Twisted framework? If so, then you should simply rely on the Twisted framework to make your code more maintainable. If not, since your GUI is already built, you can use the method I mentioned above to communicate to the server. If my understanding is wrong, you should clear with me on the architecture\/relationship of the GUI, Twisted, and server.","Q_Score":3,"Tags":"python,multithreading,wxpython,twisted","A_Id":48219389,"CreationDate":"2016-03-11T03:44:00.000","Title":"Python GUI implementation direction","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So, I'm creating a client manager software for a local club.\nI'm using Python 3.5.1 and Tkinter.\nUsed a Notebook to nest my Frames.\nOn my first frame I made the form to add new clients (labels and textboxes) and an \"add\" button at the end.\nProblem is that it executes the function associated with the button insted of onclick, and the button actually does nothing on click.\nBeen searching everywhere and it seems a rare problem.\nHelp?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":451,"Q_Id":35966578,"Users Score":-1,"Answer":"I would try using lambda: before the command.\nFor instance, replace readFile(file) with lambda: readFile(file).\nThis will ensure an anonymous (\"lambda\") function with no parameters is passed, which upon execution will run the intended code. Otherwise, the function is executed once when the behavior is set, then the returned value is simply re-evaluated every time rather than the appropriate function being called.","Q_Score":0,"Tags":"python","A_Id":35966622,"CreationDate":"2016-03-13T04:43:00.000","Title":"Python 3.5.1, Tkinter: Functions execute on start instead of button click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a program in Python which draws parts of the Mandelbrot set using pygame. However, when I leave it running to generate for a long time and then save the file I get this error: \n\npygame.error: SavePNG: could not open for writing \n\nI'm not sure why this would happen and saving works fine usually. Perhaps when the computer goes to sleep something stops working? But more importantly does anyone know how to fix this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1146,"Q_Id":35968464,"Users Score":0,"Answer":"Are you on windows or on mac? If you're on windows look if you wrote the location like this\n\"\\folder\\thing.png\", that's an error because you put the starting \"\\\". Remove that and try again.","Q_Score":1,"Tags":"python,image,crash,save,pygame","A_Id":51588818,"CreationDate":"2016-03-13T09:08:00.000","Title":"pygame.error: SavePNG: could not open for writing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a program with using sqlite3 and pyqt modules. The program can be used by different persons simultaneously. Actually I searched but I did not know and understand the concept of server. How can i connect this program with a server. Or just the computers that have connections with the server is enough to run the program simultaneously?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":59,"Q_Id":35986526,"Users Score":2,"Answer":"Do u want to connect to sqlite database server? SQLite Is Serverless. It stores your data in a file.\nU should use maria db for db server. Or u can store your sqlite database file in a network shared drive or cloud or...","Q_Score":0,"Tags":"python,sqlite,server","A_Id":35986703,"CreationDate":"2016-03-14T11:38:00.000","Title":"How to connect my app with the database server","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to cut a transparent rectangle in the background of a wxFrame to see the desktop or other windows behind that rect?\nCustom shape is not an option since I want to capture mouse events there too.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":107,"Q_Id":35991038,"Users Score":1,"Answer":"No, the only possibilities here are using a custom shape or SetTransparent() but the latter can only set the transparency uniformly.\nSetTransparent() could probably be extended to be more flexible, but so far nobody has done it.","Q_Score":0,"Tags":"wxpython,wxwidgets","A_Id":35992362,"CreationDate":"2016-03-14T15:03:00.000","Title":"Transparent hole in wxFrame background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hi have been scavenging the web for answers on how to do this but there was no direct answer. Does anyone know how I can find the version number of tkinter?","AnswerCount":6,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":40994,"Q_Id":35999344,"Users Score":4,"Answer":"Run Tkinter.TclVersion or Tkinter.TkVersion and if both are not working, try Tkinter.__version__","Q_Score":27,"Tags":"python-3.x,tkinter","A_Id":35999383,"CreationDate":"2016-03-14T22:30:00.000","Title":"How to determine what version of python3 tkinter is installed on my linux machine?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Hi have been scavenging the web for answers on how to do this but there was no direct answer. Does anyone know how I can find the version number of tkinter?","AnswerCount":6,"Available Count":2,"Score":0.1651404129,"is_accepted":false,"ViewCount":40994,"Q_Id":35999344,"Users Score":5,"Answer":"Type this command on the Terminal and run it.\n\npython -m tkinter\n\nA small window will appear with the heading tk and two buttons: Click Me! and QUIT. There will be a text that goes like This is Tcl\/Tk version ___. The version number will be displayed in the place of the underscores.","Q_Score":27,"Tags":"python-3.x,tkinter","A_Id":63566647,"CreationDate":"2016-03-14T22:30:00.000","Title":"How to determine what version of python3 tkinter is installed on my linux machine?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am trying to set up Cocos2d-x for Android in Windows using python, but my ROOT values give me an error. \nMy path to my ndk folder is: C:\\Users\\user\\AppData\\Local\\Android\\ndk\\android-ndk-r11\nWhen I try to run setup.py is asks \"Please enter the path of NDK_ROOT: \". I enter in my path to the ndk but it then says: \"Error: \"ndk folder path here\" is not a valid path of NDK_ROOT. Ignoring it. \nI have also tried manually entering it in my environmental variables, but it still does not work. What is my error here?\nMy adk folder contains the following:\n\nbuild (folder) \nplatforms (folder)\nprebuilt (folder)\npython-packages(folder)\nsources (folder)\ntoolchains (folder)\nCHANGELOG.md (md file)\nndk-build (Windows command script)\nsource.properties (properties    file)\n\nEdit:\nI have now gotten the NDK to accept on the build folder in my previous location, but there is still an issue with the NDK when I try to create a project.","AnswerCount":5,"Available Count":5,"Score":1.2,"is_accepted":true,"ViewCount":3355,"Q_Id":36001080,"Users Score":2,"Answer":"There are some changes made on the new NDK r11 release and some tools were moved to different folders, I guess cocos2d-x scripts need to be updated to support the latest NDK release.\nYou can wait for a new cocos2d-x release or use the previous NDK (r10e) version.","Q_Score":0,"Tags":"android,python,android-ndk,cocos2d-x","A_Id":36012463,"CreationDate":"2016-03-15T01:25:00.000","Title":"NDK_ROOT path for ndk r11 in Cocos2d-x","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to set up Cocos2d-x for Android in Windows using python, but my ROOT values give me an error. \nMy path to my ndk folder is: C:\\Users\\user\\AppData\\Local\\Android\\ndk\\android-ndk-r11\nWhen I try to run setup.py is asks \"Please enter the path of NDK_ROOT: \". I enter in my path to the ndk but it then says: \"Error: \"ndk folder path here\" is not a valid path of NDK_ROOT. Ignoring it. \nI have also tried manually entering it in my environmental variables, but it still does not work. What is my error here?\nMy adk folder contains the following:\n\nbuild (folder) \nplatforms (folder)\nprebuilt (folder)\npython-packages(folder)\nsources (folder)\ntoolchains (folder)\nCHANGELOG.md (md file)\nndk-build (Windows command script)\nsource.properties (properties    file)\n\nEdit:\nI have now gotten the NDK to accept on the build folder in my previous location, but there is still an issue with the NDK when I try to create a project.","AnswerCount":5,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":3355,"Q_Id":36001080,"Users Score":0,"Answer":"Try adding a \"\\\" at the end. I know it sounds silly, but I had the same problem when setting up on my MacOs.\nBeyond that, see if you'll encounter other problems like.... wrong toolchain version when compiling","Q_Score":0,"Tags":"android,python,android-ndk,cocos2d-x","A_Id":36040698,"CreationDate":"2016-03-15T01:25:00.000","Title":"NDK_ROOT path for ndk r11 in Cocos2d-x","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to set up Cocos2d-x for Android in Windows using python, but my ROOT values give me an error. \nMy path to my ndk folder is: C:\\Users\\user\\AppData\\Local\\Android\\ndk\\android-ndk-r11\nWhen I try to run setup.py is asks \"Please enter the path of NDK_ROOT: \". I enter in my path to the ndk but it then says: \"Error: \"ndk folder path here\" is not a valid path of NDK_ROOT. Ignoring it. \nI have also tried manually entering it in my environmental variables, but it still does not work. What is my error here?\nMy adk folder contains the following:\n\nbuild (folder) \nplatforms (folder)\nprebuilt (folder)\npython-packages(folder)\nsources (folder)\ntoolchains (folder)\nCHANGELOG.md (md file)\nndk-build (Windows command script)\nsource.properties (properties    file)\n\nEdit:\nI have now gotten the NDK to accept on the build folder in my previous location, but there is still an issue with the NDK when I try to create a project.","AnswerCount":5,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":3355,"Q_Id":36001080,"Users Score":0,"Answer":"I know android studio should set you ndk path in local.properties,there is the setting:\n\nndk.dir=C:\\android-ndk-r10e \n  sdk.dir=C:\\Studio_SDK","Q_Score":0,"Tags":"android,python,android-ndk,cocos2d-x","A_Id":36001423,"CreationDate":"2016-03-15T01:25:00.000","Title":"NDK_ROOT path for ndk r11 in Cocos2d-x","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to set up Cocos2d-x for Android in Windows using python, but my ROOT values give me an error. \nMy path to my ndk folder is: C:\\Users\\user\\AppData\\Local\\Android\\ndk\\android-ndk-r11\nWhen I try to run setup.py is asks \"Please enter the path of NDK_ROOT: \". I enter in my path to the ndk but it then says: \"Error: \"ndk folder path here\" is not a valid path of NDK_ROOT. Ignoring it. \nI have also tried manually entering it in my environmental variables, but it still does not work. What is my error here?\nMy adk folder contains the following:\n\nbuild (folder) \nplatforms (folder)\nprebuilt (folder)\npython-packages(folder)\nsources (folder)\ntoolchains (folder)\nCHANGELOG.md (md file)\nndk-build (Windows command script)\nsource.properties (properties    file)\n\nEdit:\nI have now gotten the NDK to accept on the build folder in my previous location, but there is still an issue with the NDK when I try to create a project.","AnswerCount":5,"Available Count":5,"Score":0.0399786803,"is_accepted":false,"ViewCount":3355,"Q_Id":36001080,"Users Score":1,"Answer":"if you want to set relative path that work on all other fellow system without changing again and again then set ndk root path in such a way.\nNDK_ROOT=\"$APP_ROOT\/..\/your ndk name\"\nyour ndk is placed one directory behind the proj.android file.","Q_Score":0,"Tags":"android,python,android-ndk,cocos2d-x","A_Id":38472553,"CreationDate":"2016-03-15T01:25:00.000","Title":"NDK_ROOT path for ndk r11 in Cocos2d-x","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to set up Cocos2d-x for Android in Windows using python, but my ROOT values give me an error. \nMy path to my ndk folder is: C:\\Users\\user\\AppData\\Local\\Android\\ndk\\android-ndk-r11\nWhen I try to run setup.py is asks \"Please enter the path of NDK_ROOT: \". I enter in my path to the ndk but it then says: \"Error: \"ndk folder path here\" is not a valid path of NDK_ROOT. Ignoring it. \nI have also tried manually entering it in my environmental variables, but it still does not work. What is my error here?\nMy adk folder contains the following:\n\nbuild (folder) \nplatforms (folder)\nprebuilt (folder)\npython-packages(folder)\nsources (folder)\ntoolchains (folder)\nCHANGELOG.md (md file)\nndk-build (Windows command script)\nsource.properties (properties    file)\n\nEdit:\nI have now gotten the NDK to accept on the build folder in my previous location, but there is still an issue with the NDK when I try to create a project.","AnswerCount":5,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":3355,"Q_Id":36001080,"Users Score":0,"Answer":"I have figured out that at the time of this post, the NDK11 has just been released and the current version of Cocos2dx does not support it. I had to find a download link elsewhere to download an older version.","Q_Score":0,"Tags":"android,python,android-ndk,cocos2d-x","A_Id":36167731,"CreationDate":"2016-03-15T01:25:00.000","Title":"NDK_ROOT path for ndk r11 in Cocos2d-x","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a GUI on Python 2.7.11 that consists of a main page along with page 1 and page 2 that are linked through buttons on main page. Converted main page to a python exe file using PyInstaller and there were no errors in the conversion. main page.exe appeared in the dist folder but on clicking it, a DOS screen flashed and the main page did not open nor persist on the screen. \nBeing a beginner, I am not sure about how to proceed further. Please help.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":265,"Q_Id":36007373,"Users Score":1,"Answer":"There were multiple issues associated with converting the Python Script that links modules through button clicks. Keeping in mind these factors, it would be best to convert it to exe using Cx_Freeze. It is more user-friendly and was highly effective for the GUI when compared to PyInstaller and Py2Exe.","Q_Score":1,"Tags":"python-2.7,tkinter,exe","A_Id":36943399,"CreationDate":"2016-03-15T09:34:00.000","Title":"Tkinter exe file - DOS screen flashes but GUI does not persist","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a GUI on Python 2.7.11 that consists of a main page along with page 1 and page 2 that are linked through buttons on main page. Converted main page to a python exe file using PyInstaller and there were no errors in the conversion. main page.exe appeared in the dist folder but on clicking it, a DOS screen flashed and the main page did not open nor persist on the screen. \nBeing a beginner, I am not sure about how to proceed further. Please help.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":265,"Q_Id":36007373,"Users Score":1,"Answer":"If you've got a line like root.mainloop() at the end (with root standing for your main Tk window) to make sure the event loop runs, then you'll need to debug your code. Try running a small segment of the code at a time to see if all goes well, and see where it is that all doesn't go well; then examine the offending part closely to find the error, maybe running some lines of code in the interpreter from the command line to see what (if any) error messages you get.\nOn the other hand, if you don't have a line like root.mainloop() at the end, that could produce the error you saw. Being a Python beginner myself, and having learned to program in Tcl where the Tk event loop runs automatically, I've seen that error a few times myself. :o(","Q_Score":1,"Tags":"python-2.7,tkinter,exe","A_Id":36009578,"CreationDate":"2016-03-15T09:34:00.000","Title":"Tkinter exe file - DOS screen flashes but GUI does not persist","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I try to use the turtle module with the python 2.7.11 shell, the turtle graphics window that does not respond. Can I use the python 2.7.11 shell with the turtle module?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":138,"Q_Id":36073457,"Users Score":0,"Answer":"With the 2.7.11 python shell it won't let use use the features of the turtle module. Sorry","Q_Score":0,"Tags":"python-2.7,turtle-graphics","A_Id":36073624,"CreationDate":"2016-03-17T23:24:00.000","Title":"Can I use python 2.7 shell with the turtle module?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two questions regarding tkinter that I cant seem to find the answer too. \n1) I currently have 2 radio buttons. I have programmed them in such a way that when one of them is clicked another definition is called and that creates a regular button on the screen. Now my problem is, if the user toggles between the both radio buttons, each time a new button will be created (instead of just having 1 the first time he toggles the options). Is there any way I can stop the extra buttons from being created if one already exsists?\n2) Is there a widget that can easily be used to create check box lists?\nEDIT: Sorry, I meant check box list not radio button list.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":26,"Q_Id":36085002,"Users Score":2,"Answer":"1> Define you button outside the eventHandler of the radiobutton. \ninside the event handler only grid\/pack it,whenever the radiobutton is pressed. In this way the button will not be defined multiple times.\nN.B. Use fix row & column with the grid if you need.","Q_Score":0,"Tags":"python,python-3.x,tkinter","A_Id":36085149,"CreationDate":"2016-03-18T12:57:00.000","Title":"Doubts about checking if button is already displayed and making a list of radio buttons","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Simple question, have parsed numerous search results, haven't found a simple answer.  I set a very urgent button to red if something is not found so users click it first.  Once clicked, I want to set the background back to normal like button.config(bg='').  I tried 'grey' but it's not the right color.\nWhat do I set it to?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":15651,"Q_Id":36093839,"Users Score":1,"Answer":"The default background color of tkinter is #f0f0f0. Hope this helps ;)","Q_Score":14,"Tags":"python,tkinter","A_Id":68903355,"CreationDate":"2016-03-18T20:40:00.000","Title":"How to reset background color of a python tkinter button?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Simple question, have parsed numerous search results, haven't found a simple answer.  I set a very urgent button to red if something is not found so users click it first.  Once clicked, I want to set the background back to normal like button.config(bg='').  I tried 'grey' but it's not the right color.\nWhat do I set it to?","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":15651,"Q_Id":36093839,"Users Score":7,"Answer":"The default colour for buttons is SystemButtonFace. I am not sure how many versions of Windows this spans back to, but it is the default system colour for buttons.\nYou can find the default colours by using @Bryan Oakley's answer above, and then print() it to the console.","Q_Score":14,"Tags":"python,tkinter","A_Id":44747033,"CreationDate":"2016-03-18T20:40:00.000","Title":"How to reset background color of a python tkinter button?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been learning how to make GUIs with Tkinter and a question has occurred to me. As I'm testing the program, I often end up building the code while an instance of it already exists in the background. Are these two independent of each other in terms of performing their functions? I've always read that when I create the instance of the Tk() and then run its mainloop(), that is what takes care of everything. Can I have two or more loops running if each pertains to a different Tk() instance?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":291,"Q_Id":36141010,"Users Score":1,"Answer":"Each instance of Tk is separate from any other instance of Tk. It gets its own copy of an underlying tcl interpreter. Two instance of Tk in the same process means you have two active tcl interpreters. \nAs a general rule you should only ever have exactly one instance of Tk, but I suppose if you fully understand how they work, it should be possible to have two or more. \nI think this falls into the category of things you shouldn't do until you understand why you shouldn't do them. And once you understand, you won't want to do it.","Q_Score":1,"Tags":"python,python-2.7,tkinter","A_Id":36141286,"CreationDate":"2016-03-21T20:32:00.000","Title":"Is each instance of Tk() class running independent of each other?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have python 2.7.6, the newest kivy and buildozer installed. \nNow I want to use firebase for python, downloaded by: sudo pip install python-firebase.\nI can add this to the requirements in the buildozer.spec file as python-firebase. This all works fine and in the folder .buildozer\/applibs\/ I got: \nfirebase,\npython_firebase-1.2.dist-info,\nrequests,\nrequests-2.9.1.dist-info.\nSo I expect that I could import firebase in my application, but that doesn't work. when I add: from firebase import firebase the app on android can not even run (I see the kivy app logo, but then the app shuts down).\nCan anyone explain me why and what the next steps are? \nedit 1: \nI\/python  (14201):    File \"\/home\/notwaka\/Desktop\/App\/.buildozer\/android\/app\/_applibs\/firebase\/__init__.py\", line 3, in <module>\nI\/python  (14201):    File \"\/home\/notwaka\/Desktop\/App\/.buildozer\/android\/app\/_applibs\/firebase\/async.py\", line 1, in <module>\nI\/python  (14201):    File \"\/home\/notwaka\/Desktop\/App\/.buildozer\/android\/platform\/python-for-android\/build\/python-install\/lib\/python2.7\/multiprocessing\/__init__.py\", line 84, in <module>\nI\/python  (14201):  ImportError: No module named _multiprocessing\nI\/python  (14201): Python for android ended.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1125,"Q_Id":36158037,"Users Score":2,"Answer":"The multiprocessing module is not supported in Android due to incompatibilities with bionic (Android's libc). I would suggest trying to use the Firebase Android SDK via pyjnius, or just make web requests using Kivy's UrlRequest or via Twisted - it's just a REST API, after all.","Q_Score":0,"Tags":"android,python-2.7,firebase,kivy,buildozer","A_Id":36160691,"CreationDate":"2016-03-22T15:06:00.000","Title":"Implement python-firebase in android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Pygame module is installed but not working.\nImportError: No module named 'pygame.locals'; 'pygame' is not a package\nit worked when I import it in idle without creating a file but not working when .py file is executed through interpreter","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":74,"Q_Id":36214865,"Users Score":1,"Answer":"Make sure that you're not using pygame.py as a script filename. It will prevent the import of pygame module you want.\nRename the file not to conflict. Also make sure there's no remaning pygame.pyc file.","Q_Score":0,"Tags":"python,pygame","A_Id":36214891,"CreationDate":"2016-03-25T06:03:00.000","Title":"pygame module is not working in python 3.4.2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use a phone number field in my form. What I need is when this field is tapped on Android phone, not general keyboard, but digital only appears.\nI learned that this can be achieved by using <input type=\"tel\" or <input type=\"number\".\nHow do I use the tel or number input types in WTForms?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":5419,"Q_Id":36240900,"Users Score":1,"Answer":"Ok. I found it.\nIntegerField(widget = widgets.Input(input_type=\"tel\"))","Q_Score":6,"Tags":"python,flask,wtforms,flask-wtforms","A_Id":36382378,"CreationDate":"2016-03-26T21:06:00.000","Title":"How do I use \"tel\", \"number\", or other input types in WTForms?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am trying to use a Qlabel as a message center for relaying messages to users of the application. Some messages might be longer than allowed for the Qlabel and I want it to just scroll horizontally until the end of the text. How can I do this in a Qlabel? I cannot seem to find anything in designer and don't want to work out some sort of truncation method in code that just takes off pieces from the front of the string, that seems silly.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2078,"Q_Id":36297429,"Users Score":0,"Answer":"There's nothing in Qt that does that by default.  You will indeed need to create an animation that changes the text.\nYou can use QFontMetrics (label.fontMetrics()) to determine if the label text is larger than then QLabel (to know if you need to scroll it or not).  You need a way to repaint the QLabel every half second or so to animate the scrolling.  The easiest way is probably a QTimer.  The easiest method would probably be to subclass QLabel and have it check if it needs to scroll itself and reset the text every half second or so to simulate the scrolling.\nIf you wanted scrolling to be even smoother (at a sub-character level), you'd have to override the paint method and paint the text yourself translating and clipping it as necessary.","Q_Score":1,"Tags":"python-2.7,pyqt,pyqt4,qwidget,qlabel","A_Id":36314912,"CreationDate":"2016-03-30T00:16:00.000","Title":"Smooth scrolling text in Qlabel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I am learning to use python 3 and now the \"pyautogui\" module. When I try to use \"pyautogui.click(x, y)\". I get this error \"[WinError 5] Access is denied\". It still clicks the coordinates, but why I get this error. I have tried to run this from normal and administer CMD. I am using windows 10. If you can help me please help!\nThanks for advice!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1059,"Q_Id":36307621,"Users Score":0,"Answer":"I had the same problem using Windows 8.1. I solved making a bat file calling the python script and running the bat file as administrator. \nTo run the bat file as administrator I made a right click on bat file and run as administrator.","Q_Score":1,"Tags":"python,python-3.x,pyautogui","A_Id":38230687,"CreationDate":"2016-03-30T11:35:00.000","Title":"Pyautogui.click(x, y) error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I am learning to use python 3 and now the \"pyautogui\" module. When I try to use \"pyautogui.click(x, y)\". I get this error \"[WinError 5] Access is denied\". It still clicks the coordinates, but why I get this error. I have tried to run this from normal and administer CMD. I am using windows 10. If you can help me please help!\nThanks for advice!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1059,"Q_Id":36307621,"Users Score":0,"Answer":"The root cause is when you have a mouse options app installed (at least in my case).\nI know it from this story: I had a python script that used click (twice). It worked well, but in the meantime, I installed a mouse settings app on my comp. After that I run my script, but got this access denied error. (However, the first click worked, only the second one gave that error). Then I uninstalled this mouse software (almost unusable anyway), and voila, the clicking was again all right.\nHope this helps you as well.","Q_Score":1,"Tags":"python,python-3.x,pyautogui","A_Id":39370746,"CreationDate":"2016-03-30T11:35:00.000","Title":"Pyautogui.click(x, y) error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hi i noticed that whenever you have the focus property of a textinput widget set to True,\nthe hint_text is not displayed when the textinput is actually in focus.\nPlease is there a way to combine them both, i.e the hint_text gets displayed even when the text input is in focus?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":443,"Q_Id":36314303,"Users Score":4,"Answer":"This is an issue with Kivy 1.9.1, where the hint text disappears as soon as the TextInput is focused. It has been fixed in the development branch, and now only disappears when there is content in the field.","Q_Score":4,"Tags":"python,kivy","A_Id":36314717,"CreationDate":"2016-03-30T16:14:00.000","Title":"Kivy TextInput how to combine hint_text and focus","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"wrote a small application which is composed of a QT GUI module which in turn initiate an object that inherits from ShowBase class.\nProblem is, if I close the Panda App, the ShowBase class calls finalizeExit() which in turn shuts the whole process by calling exit.\nIf I avoid calling the finalize method by overriding userExit(), the resources for the App are not being deleted and the task manager keeps on working.\nIs there a way to close the Panda App without calling exit?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":928,"Q_Id":36339195,"Users Score":1,"Answer":"At least in recent development builds of Panda, you should be able to call base.destroy() to shut down ShowBase and unload (most) resources.  You would still need to override finalizeExit() to not quit the application when the main window is closed.","Q_Score":1,"Tags":"python,python-2.7,panda3d","A_Id":43324179,"CreationDate":"2016-03-31T16:44:00.000","Title":"Closing a Panda3d app without shutting down the whole Process","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using a pygtk application and I have added a Treeview inside a ScrolledWindow. Now I want to freeze the first column (fix the column position), so that when scrolling the Treeview horizontally the column position is fixed and still visible (as it's done in excel for the row column).\nSo how I can freeze the Treeview column in pygtk?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":544,"Q_Id":36427596,"Users Score":0,"Answer":"The closest I've been able to get is a bit of a kludge.  I use Perl, not Python, so I'll just describe my technique.\nConnect to the treeview's scroll-event signal and watch for direction=left\/right (or smooth with get_scroll_deltas() returning non-zero for the X axis).  Be sure to return FALSE for vertical scrolling so that remains unaffected.  Then show\/hide the columns after the fixed one(s) and return TRUE.\nFor example: when scrolling right, hide column 2, then 3, etc.  When scrolling left, show the highest number column that's hidden.\nThere are a couple drawbacks:\n\nIt's not as smooth as what you're looking for (columns can't be partially hidden).\nDoesn't work with the scrollbar, only when tilting the mouse wheel.  Not all mice have tiltable wheels.","Q_Score":2,"Tags":"python,gtk,pygtk,gtktreeview","A_Id":36670919,"CreationDate":"2016-04-05T13:20:00.000","Title":"Freeze the first column in Treeview pygtk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running El Capitan, when I type python --version the terminal prints Python 2.7.10, I have successfully downloaded pygame for Python 2.7.10 but I want to develop in python 3.5.1, I know I can do this by entering python3 in the terminal, but how do I properly set up pygame for this version of python?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":44,"Q_Id":36456584,"Users Score":1,"Answer":"Use python3.5 -mpip install pygame.","Q_Score":0,"Tags":"python,pygame","A_Id":36456629,"CreationDate":"2016-04-06T16:10:00.000","Title":"How to download pygame for non default version of python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to \"rip\" Qt stylesheet from Python app? \n.styleSheet() returns an empty string.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":171,"Q_Id":36475003,"Users Score":1,"Answer":"You're assuming two things:\n\nThe app has implemented its styling using stylesheets, and\nThe app uses an application-wide stylesheet.\n\nEither of these assumptions is wrong in your case. You might need to extract stylesheets from individual widgets. Or the application might be using a custom QStyle and not stylesheets.","Q_Score":2,"Tags":"python,qt,pyside","A_Id":36476989,"CreationDate":"2016-04-07T11:35:00.000","Title":"Get Qt stylesheet from Python app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a app with Python 3.4 and Tkinter.\nMy app runs several (3-5) threads, and each thread does below.\n\nendless loop of recvfrom() to get message from socket(UDP)\nendless loop which displays the message and write it to a file\n\nI use my app on windows embedded OS which is based on XP,\nand I watch memory usage with TaskManager, \nbecause I want to run my app for a long (maybe more than month) without shutdown.\nThen, a problem is\nMem Usage(physical) gradually increase, but sometimes drastically decrease.\n So overall it looks okay.\nBut Virtual Memory Size(VMSize) is increasing with long-term view.\n For example, when I started app, VMSize was 26MB.\n and next day, it become 29MB,\n and next day, it become 32MB.\n It sometimes increase a little, sometimes decrease a little(e.g. 20KB).\n but overall it's on upward trend.\n This is not so large volume but \"increasing\" makes me uneasy.\nI expected GarbageCollection could help so I inserted gc.collect() on my code, \nso that it will be invoked every 3 hours.\nBut nothing changed, and print(gc.collect()) showed always 0 (except right after start-up of app itself).\nIs this memory-leak?\nI read definition of del() and reference cycle can lead to memory leak in Python,\nbut I never define del() by myself.\nThank you in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":232,"Q_Id":36478336,"Users Score":0,"Answer":"I discovered the cause by myself, so I write it here and close the question.\nThe cause of memory leak was I was calling tkinter functions from multiple threads.\ntkinter is not thread safe so I was violating its rule.\nI modified my program so that only main thread use tkinter function then\nmemory leak has gone.\nThank you.","Q_Score":0,"Tags":"python,sockets,memory-leaks,tkinter","A_Id":38483492,"CreationDate":"2016-04-07T13:54:00.000","Title":"Windows Task Manager: Python app memory usage increase","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to insert text to a textinput without overwriting the previous text? Textinput().text = \"something\" deletes the previous text.I also want to add it everytime in a new line.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":799,"Q_Id":36529242,"Users Score":3,"Answer":"It has nothing to do with kivy, these are basics of python language. Instead of overwriting the varliable with = sign, use += to append.","Q_Score":0,"Tags":"python,kivy","A_Id":36529332,"CreationDate":"2016-04-10T11:41:00.000","Title":"Insert text to TextInput() in Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Pygal (with Python \/ Flask) relatively successfully in regards to loading data, formatting colors, min\/max, etc., but can't figure out how to format a number in Pygal using dollar signs and commas.  \nI'm getting 265763.557372895 and instead want $265,763.\nThis goes for both the pop-up boxes when hovering over a data point, as well as the y-axes.  \nI've looked through pygal.org's documentation to no avail.  Does anyone know how to properly format those numbers?\nUPDATE:\nI'm not quite ready to mark this question \"answered\" as I still can't get the separating commas.  However, I did find the following native formatting option in pygal.  This eliminates trailing decimals (without using Python's int()) and adds a dollar sign:\ngraph.value_formatter = lambda y: \"$%.0f\" % y\nChange the 0f to 2f if you prefer two decimals, etc.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":784,"Q_Id":36552029,"Users Score":3,"Answer":"graph.value_formatter = lambda y: \"{:,}\".format(y) will get you the commas.\ngraph.value_formatter = lambda y: \"${:,}\".format(y) will get you the commas and the dollar sign.\nNote that this formatting seems to be valid for Python 2.7 but would not work on 2.6.","Q_Score":2,"Tags":"python,flask,formatting,pygal","A_Id":36914709,"CreationDate":"2016-04-11T14:48:00.000","Title":"Properly formatting numbers in pygal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python code. I need to execute the python script from my c# program. After searching a bit about this, I came to know that there is mainly two ways of executing a python script from c#.\nOne by using 'Process' command and\nthe other by using Iron Python. \nMy question might seem dumb, is there any other way through which I can execute a python script? To be more specific, can I create a class , lets say 'Python' in c#  and a member function 'execute_script' which doesn't use any api like iron python or doesn't create a process for executing the script, so that if call 'execute_scipt(mypythonprogram.py)' , my script gets executed. Sorry if this seems dumb. If this is possible, please do help me. Thanks in advance.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":74,"Q_Id":36563002,"Users Score":0,"Answer":"Can you create a C# class that calls a Python script without using Iron Python and without using any external API? No. That is not possible. You have a few other choices:\n\nIntegrate the Python runtime into your program. \n\nSmead already described one way to do this. It will work, and it does avoid creating another process, but it will be a lot of work to get it running, and it is still technically using an API. I do not recommend this for a single Python script where you don't need to pass data back and forth, but it's good to know that option exists if your other options don't pan out. \n\nUse the Process module. \n\nThis is probably what I would do. Process has security concerns when a malicious user can cause you to execute bogus shell commands, or if the malicious user can replace the contents of the Python script. It is quite safe when you can lock down those two things. \nThe speed is unlikely to be a concern. It will literally only take a few minutes to set up a C# program with a process call, so if your mentor is concerned about speed, just write it and measure the speed to see if it's actually a problem. \n\nConsider rewriting the script in C#\n\nC# is a very expressive language with a very strong standard library, so assuming your script is not thousands of lines long, and does not use any obscure Python libraries, this might actually not be much work. If you really must not use Process, this would be the next solution I would consider.","Q_Score":0,"Tags":"c#,python","A_Id":36647773,"CreationDate":"2016-04-12T03:15:00.000","Title":"Creating a class that executes python in c#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if it is possible to save a canvas that had several textures painted on it as an image file.\nI know I can save regular Image's (kivy.core.image) or Texture's (kivy.graphics.texture) as an image file with the save() function, so if I am able to convert the canvas to an Image or a Texture it should be easy, but so far I wasn't able to do this.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2200,"Q_Id":36600993,"Users Score":9,"Answer":"Widgets have an export_to_png method. Call this from the Widget whose canvas you have drawn on.","Q_Score":3,"Tags":"python,python-3.x,kivy","A_Id":36601394,"CreationDate":"2016-04-13T14:09:00.000","Title":"How to save a kivy canvas object as an image file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to add a simple password check to a Python\/wxPython\/MySQL application to confirm that the user wants to carry out a particular action. So far I have a DialogBox with a textCtrl for password input and Buttons for Submit or Cancel. At the moment the password appears in the textCtrl. I would prefer this to appear as asterisks whilst the user input is captured but cannot figure out how to do this. How could I implement this?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":493,"Q_Id":36643784,"Users Score":2,"Answer":"Set the style on the text ctrl as\nTE_PASSWORD: The text will be echoed as asterisks.","Q_Score":0,"Tags":"python-2.7,wxpython","A_Id":36649037,"CreationDate":"2016-04-15T09:49:00.000","Title":"Creating Simple Password Check In wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm searching for a way to get the path of the directory of the file that I have chosen by QFileDialog.getOpenFileName().\nI know that you can access it by os.path.dirname(os.path.realpath(filename), but I'm searching for a better way because I need to work in this directory.\nI don't really understand why you can access the file by open(filename, 'r') though your current working directory (when typing print(os.getcwd()) is not the directory of the file.\nMaybe there is a way by accessing something like the current working directory of the Qt.Application, but I had no success..\nAlso I have functions where you need arg1 = directory and arg2 = filename1 (in the directory) as arguments. Funnily enough they suddenly seem to work with just(!) arg1 = 'C:' as directory and arg2 = filename2 when filename2 is the file I've accessed by QFileDialog.getOpenFileName().\nI'm happy about any explanation!","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":5334,"Q_Id":36645478,"Users Score":3,"Answer":"It turns out that the filename which is accessed by QFileDialog.getOpenFileName() is actually not only the filename but the whole path..","Q_Score":2,"Tags":"python,directory,pyqt,qfiledialog,getopenfilename","A_Id":36650012,"CreationDate":"2016-04-15T11:06:00.000","Title":"pyqt QFileDialog.getOpenFileName() get path of the directory of the file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would you be able to create multiple screens using Pygame and events performed by the user? \nFor example, if I had a menu screen with 2 buttons ('Start' and 'Exit') and the user clicked on 'Start', a new screen would appear in the same window with whatever is next in the game. From that screen, a user could click on another button and move on to another screen\/ return to the menu, etc.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3094,"Q_Id":36667149,"Users Score":4,"Answer":"Make classes for each one, where each class is a subclass of pygame.Surface, of the same size as the display.  Then you could have 3 variable TITLESCREEN, PLAYING, HIGHSCORES and change them on key press.  Then you would be able to blit the correct screen to the display.","Q_Score":1,"Tags":"python,pygame","A_Id":36670152,"CreationDate":"2016-04-16T17:08:00.000","Title":"Making multiple 'game screens' using Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How would you be able to create multiple screens using Pygame and events performed by the user? \nFor example, if I had a menu screen with 2 buttons ('Start' and 'Exit') and the user clicked on 'Start', a new screen would appear in the same window with whatever is next in the game. From that screen, a user could click on another button and move on to another screen\/ return to the menu, etc.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3094,"Q_Id":36667149,"Users Score":0,"Answer":"What I did for this was have a literal main loop that checks to see what \"Screen\" the player wants to go to. Like if they press the exit button, it returns where to go next. The main loop then runs a the new script for the new screen.","Q_Score":1,"Tags":"python,pygame","A_Id":62853674,"CreationDate":"2016-04-16T17:08:00.000","Title":"Making multiple 'game screens' using Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to using emacs as python ide. \nI am using Emacs 24.5.1 with its default python mode.\nI am writing a game with pygame and pyganim modules, but i am not able to run the code and test it because sometimes when i hit C-c C-c for eval buffer at the down window (i think it calls mini buffer?) i see only Sent: import pygame... (if i have imported pygame for example) and nothing more happens. How can i evaluate the whole code and why is this happening?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":459,"Q_Id":36668587,"Users Score":1,"Answer":"You need to start the interpreter first with C-c C-p (run-python). Then you can C-c C-c (python-shell-send-buffer) to send the entire buffer to the python process or even C-c C-r (python-sheel-send-region) to only send the selected region to the python process. See more keybindings for your current buffer with C-h m (describe-mode).","Q_Score":0,"Tags":"python-2.7,ubuntu,emacs","A_Id":36672978,"CreationDate":"2016-04-16T19:17:00.000","Title":"Emacs+python C-c C-c not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to try Qpython on a Samsung Galaxy Tab 4 running Android 4.4.2. Which would be better, in terms of stability, functionality, supported libraries, etc., Qpython or Qpython3? Or can they be installed side-by-side?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2861,"Q_Id":36680852,"Users Score":1,"Answer":"You can install and run both the apps.It is better to install both because qpython uses python2.7 where as qpython3 uses python3.x.The syntax are different for both the versions so obviously the libraries.\n    There is a pip console in qpython to install libraries where as in qpython3 it is not there.","Q_Score":0,"Tags":"android,galaxy-tab,qpython,qpython3","A_Id":39323926,"CreationDate":"2016-04-17T18:58:00.000","Title":"Qpython or Qpython3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I thought it meant everything in the module. But in tkinter I would have to specifically import things like messagebox, colorchooser and filedialog despite having a \"from tkinter import *\" command. So exactly what does \"import *\" mean?","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":11100,"Q_Id":36695687,"Users Score":-1,"Answer":"It just means that you import all(methods, variables,...) in a way so you don't need to prefix them when using them.","Q_Score":1,"Tags":"python,python-3.x","A_Id":36695749,"CreationDate":"2016-04-18T13:40:00.000","Title":"What exactly does \" from module import * \" mean?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed theano but when I try to use it I got this error:\n\nWARNING (theano.configdefaults): g++ not detected! Theano will be unable to execute \n   optimized C-implementations (for both CPU and GPU) and will default to Python \n   implementations. Performance will be severely degraded.\n\nI installed g++, and put the correct path in the environment variables, so it is like theano does not detect it.\nDoes anyone know how to solve the problem or which may be the cause?","AnswerCount":6,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":31119,"Q_Id":36722975,"Users Score":3,"Answer":"This is the error that I experienced in my mac running jupyter notebook with a python 3.5 kernal hope this helps someone, i am sure rggir is well sorted at this stage :) \nError\nUsing Theano backend.\nWARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.\nCause\nupdate of XCode (g++ compiler) without accepting terms and conditions, this was pointed out above thanks Emiel\nResolution:\n\ntype g++ --version in the mac terminal\n\"Agreeing to the Xcode\/iOS license requires admin privileges, please re-run as root via sudo.\" is output as an error\nlaunch Xcode and accept terms and conditions\nreturn g++ --version in the terminal\nSomething similar to the following will be returned to show that Xcode has been fully installed and g++ is now available to keras\n\n\nConfigured with: --prefix=\/Applications\/Xcode.app\/Contents\/Developer\/usr --with-gxx-include-dir=\/usr\/include\/c++\/4.2.1\nApple LLVM version 8.0.0 (clang-800.0.42.1)\nTarget: x86_64-apple-darwin15.6.0\nThread model: posix\nInstalledDir: \/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\n\nRestart you machine\u2026 I am sure there are some more complicated steps that someone smarter than me can add here to make this faster\nRun the model.fit function of the keras application which should run faster now \u2026 win!","Q_Score":18,"Tags":"python,g++,theano","A_Id":40705647,"CreationDate":"2016-04-19T15:31:00.000","Title":"theano g++ not detected","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed theano but when I try to use it I got this error:\n\nWARNING (theano.configdefaults): g++ not detected! Theano will be unable to execute \n   optimized C-implementations (for both CPU and GPU) and will default to Python \n   implementations. Performance will be severely degraded.\n\nI installed g++, and put the correct path in the environment variables, so it is like theano does not detect it.\nDoes anyone know how to solve the problem or which may be the cause?","AnswerCount":6,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":31119,"Q_Id":36722975,"Users Score":7,"Answer":"I had this occur on OS X after I updated XCode (through the App Store). Everything worked before the update, but after the update I had to start XCode and accept the license agreement. Then everything worked again.","Q_Score":18,"Tags":"python,g++,theano","A_Id":39568992,"CreationDate":"2016-04-19T15:31:00.000","Title":"theano g++ not detected","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed theano but when I try to use it I got this error:\n\nWARNING (theano.configdefaults): g++ not detected! Theano will be unable to execute \n   optimized C-implementations (for both CPU and GPU) and will default to Python \n   implementations. Performance will be severely degraded.\n\nI installed g++, and put the correct path in the environment variables, so it is like theano does not detect it.\nDoes anyone know how to solve the problem or which may be the cause?","AnswerCount":6,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":31119,"Q_Id":36722975,"Users Score":6,"Answer":"On Windows, you need to install mingw to support g++. Usually, it is advisable to use Anaconda distribution to install Python. Theano works with Python3.4 or older versions. You can use conda install command to install mingw.","Q_Score":18,"Tags":"python,g++,theano","A_Id":37846308,"CreationDate":"2016-04-19T15:31:00.000","Title":"theano g++ not detected","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just started a new job.  Existing code is wxpython GUI that is partially implemented.  The jist is that there are 2 independent GUIs: one is a \"status monitor with test abort button\" and the other is a test executive, running tests that might take a few minutes.  \nAt any time, the status monitor GUI abort button should be able to be pressed to stop the long running test script process running in the executive GUI.\nThe long script process is started in a new thread and is working from the test executive GUI, but no matter what I do, the status monitor GUI is frozen.\nIve done similar things in pyside and it didnt seem to be as much of a bear as with wxpython.\nI don think this is a thread problem.  seems like its a wxpython problem.\nIs it possible to have 2 independent wxpython GUIs started from the same script? I seem to have read somewhere that im required to have only one main loop.\nAny hints\/examples of 2 parallel independent GUIs would be great!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":144,"Q_Id":36757558,"Users Score":0,"Answer":"Yes and no.\nAs far as I know, it is not possible to run 2 GUIs just seperated by threads.\nWe had a quite similar problem. And as we are using Windows mainly, we needed to work around the Python GIL, to enable the GUI to stop the subprocess which executes the tests.\nIn order to do so, we moved to multiprocessing library and we are using a Processpool which executes the tests (we are running multiple items at the same time - you can use just a process for your purpose). In a new process you will also be able to execute a second GUI, which is completely independent (We are doing this as well). When using another process, it gets a PID, which can be used with os.kill. The main GUI will stay stable throughout this.\nTo communicate with the new process we use Pyro4, but you could also use a approach with Queues to get the communication done. You cannot directly access data from another process if you are using Windows like with the threading approach.\nHope this helps.\nRegards,\nMichael","Q_Score":0,"Tags":"multithreading,user-interface,parallel-processing,wxpython","A_Id":36760661,"CreationDate":"2016-04-21T00:29:00.000","Title":"2 \"parallel\" wxpython GUIs possible?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a msi for my PyGame game with cx_Freeze :\n(I already created an execute file)\nSo, i used python setup.py bdist_msi, but I got this message : \nFile \"C:\\Python34\\lib\\msilib\\__init__.py\", line 213, in commit\n    FCICreate(filename, self.files)\nValueError: FCI error 1\nAn idea ?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1671,"Q_Id":36802811,"Users Score":0,"Answer":"I had that problem, the build was created and worked ok, but an ValueError: FCI error 1 take place in the msi creation. In my case, it was due to data files containing a point in your name (example AB_12345.1.fasta). I replaced the point by the underscore symbol (example AB_12345_1.fasta) and everything worked properly. I hope it helps you on something.","Q_Score":3,"Tags":"python,pygame,cx-freeze","A_Id":38202398,"CreationDate":"2016-04-22T20:29:00.000","Title":"Building msi with cx_Freeze : ValueError: FCI error 1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a msi for my PyGame game with cx_Freeze :\n(I already created an execute file)\nSo, i used python setup.py bdist_msi, but I got this message : \nFile \"C:\\Python34\\lib\\msilib\\__init__.py\", line 213, in commit\n    FCICreate(filename, self.files)\nValueError: FCI error 1\nAn idea ?","AnswerCount":4,"Available Count":3,"Score":-0.049958375,"is_accepted":false,"ViewCount":1671,"Q_Id":36802811,"Users Score":-1,"Answer":"I had the same problem. I solved my problem by deleting the build directory. \nThen run python setup.py bdist_msi.\nThat works for me.\nI wish it will help you.","Q_Score":3,"Tags":"python,pygame,cx-freeze","A_Id":47951324,"CreationDate":"2016-04-22T20:29:00.000","Title":"Building msi with cx_Freeze : ValueError: FCI error 1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a msi for my PyGame game with cx_Freeze :\n(I already created an execute file)\nSo, i used python setup.py bdist_msi, but I got this message : \nFile \"C:\\Python34\\lib\\msilib\\__init__.py\", line 213, in commit\n    FCICreate(filename, self.files)\nValueError: FCI error 1\nAn idea ?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1671,"Q_Id":36802811,"Users Score":0,"Answer":"I had the same problem. I used non-ascii characters at the path contains. I solved that by changing the path contains into ascii characters.","Q_Score":3,"Tags":"python,pygame,cx-freeze","A_Id":49082133,"CreationDate":"2016-04-22T20:29:00.000","Title":"Building msi with cx_Freeze : ValueError: FCI error 1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a simple program in Python 3.5 that contains turtle graphics\nand I have a problem: after the turtle work is finished the user has to close the window manually.\nIs there any way to program the window to close after the turtle work is done?","AnswerCount":3,"Available Count":2,"Score":-0.1325487884,"is_accepted":false,"ViewCount":42886,"Q_Id":36826570,"Users Score":-2,"Answer":"Try exitonclick() or done() at the end of the file to close the window .","Q_Score":16,"Tags":"python,python-3.x,turtle-graphics","A_Id":36827757,"CreationDate":"2016-04-24T17:30:00.000","Title":"How to close the Python turtle window after it does its code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a simple program in Python 3.5 that contains turtle graphics\nand I have a problem: after the turtle work is finished the user has to close the window manually.\nIs there any way to program the window to close after the turtle work is done?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":42886,"Q_Id":36826570,"Users Score":18,"Answer":"turtle.bye(), aka turtle.Screen().bye(), closes a turtle graphics window.\nUsually, a lack of turtle.mainloop(), or one of its variants, will cause the window to close because the program will exit, closing everything. turtle.mainloop() should be the last statement executed in a turtle graphics program unless the script is run from within Python IDLE -n which disables turtle.mainloop() and variants.\nturtle.Screen().mainloop() and turtle.done() are variants of turtle.mainloop().\nturtle.exitonclick() aka turtle.Screen().exitonclick() binds the screen click event to do a turtle.bye() and then invokes turtle.mainloop()","Q_Score":16,"Tags":"python,python-3.x,turtle-graphics","A_Id":42283059,"CreationDate":"2016-04-24T17:30:00.000","Title":"How to close the Python turtle window after it does its code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have designed a gui with PYQT4. It has two buttons. One of start button. It starts a start.py file. And another button execute stop.py file that stop start.py pid.\nThis start.py and stop.py files are on a remote location. I am connecting there with ssh and paramiko. \nWhen I click to start button, gui is freezing and never answering. I can only get rid of the situation by closing the program . I know the problem. Because  there is a while loop in start.py and it never ends. \nWhen i click to start button its wait for the while loop.\nI want to run start.py and i dont want to wait for the loop. It must be run in background or etc.. \nWhat can i do ? I tried to trigger it with another .py file. I used subprocess method. But no success. Still have same problem.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":236,"Q_Id":36828383,"Users Score":0,"Answer":"I found the solution. I covered that function in thread. And now its working properly without freeze or lag.","Q_Score":0,"Tags":"python,debugging,pyqt4","A_Id":36916323,"CreationDate":"2016-04-24T20:11:00.000","Title":"Qt freezing cause of the loop?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I developed a GUI app in Python 3. I want to be able to launch it by clicking on the script itself or in a custom-made launching script. I have changed permissions and it's now opening with \"Python Launcher\" on double-click. But everytime I run my app, I get a lot of windows:\n\nMy Python application (that's the only one I need to be on screen) \nThe Python launcher preferences (I could live with this one, but\nwould prefer it to be hidden)\nA Terminal window with the default shell (don't need this one) \nAnother Terminal window showing the output of the app (like print, errors... I don't want this window)\n\nWhat is the easiest way to get only the GUI on screen, without any Terminal windows?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3492,"Q_Id":36864537,"Users Score":0,"Answer":"By changing the file extension to .pyw (Python Windowed), any terminal\/shell\/cmd would be hidden by default (I even don't know about the preferences window).\nHope this helps!","Q_Score":3,"Tags":"python,macos,python-3.x,tkinter","A_Id":36864625,"CreationDate":"2016-04-26T12:08:00.000","Title":"How to run a Python 3 tkinter app without opening any Terminal windows in Mac OS X?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a program that will display images on a Tkinter canvas, but I need to use images in a different folder than the program is in so I can't use what I usually do:\nimg = PhotoImage(file=some_img)\nI have an os path like C:\\Users\\SomeUser\\Documents\\some_img. I need to access some_img to make it a PhotoImage while it is in a different folder. How would I go about doing that?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":252,"Q_Id":36898571,"Users Score":1,"Answer":"If you have the full path then that should work fine as it is.","Q_Score":0,"Tags":"python-2.7,tkinter,tkinter-canvas","A_Id":36898667,"CreationDate":"2016-04-27T18:56:00.000","Title":"Using an os path in Tkinter PhotoImage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to create a label for a string in TKinter. The string can be very long, and greater than the length of the label. Therefore, I wanted to implement a label which can scroll sideways, to show the entirety of the string. \nHow would you do this in TKinter?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":379,"Q_Id":36959902,"Users Score":3,"Answer":"You cannot scroll a label. I suggest using an entry widget. You can set the state to disabled to prevent users from using it like an entry widget, and you can change the borders to make it look like a label.","Q_Score":1,"Tags":"python,user-interface,tkinter","A_Id":36961427,"CreationDate":"2016-04-30T20:28:00.000","Title":"Scrollable label for TKinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I guess this might be a trivial question, nonetheless I couldn't find the answer anywhere.\nI am currently building a small rpg style game and I am starting to have quite a few sprite groups.\nI was wondering if there was a way to ask Pygame to refer to all existing groups ?\nI would need this function to be able to move sprites which are deleted from my game to a deleted_sprite_group that I have.\nAt the moment I am adding all the groups to a list and iterating through that list but this requires some maintenance.\nNote: I am not that lazy as to mind using a list but I try and optimize and clean up my code every so often. ;)\nThank you for your help !","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":36968992,"Users Score":0,"Answer":"Try making one group for all sprites in your game, and filling it while filling the separate groups","Q_Score":0,"Tags":"python-2.7,loops,pygame,sprite","A_Id":37002212,"CreationDate":"2016-05-01T16:26:00.000","Title":"Is there a way to iterate through all existing groups automatically?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I guess this might be a trivial question, nonetheless I couldn't find the answer anywhere.\nI am currently building a small rpg style game and I am starting to have quite a few sprite groups.\nI was wondering if there was a way to ask Pygame to refer to all existing groups ?\nI would need this function to be able to move sprites which are deleted from my game to a deleted_sprite_group that I have.\nAt the moment I am adding all the groups to a list and iterating through that list but this requires some maintenance.\nNote: I am not that lazy as to mind using a list but I try and optimize and clean up my code every so often. ;)\nThank you for your help !","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":36,"Q_Id":36968992,"Users Score":0,"Answer":"From @Ni. \nSprite.kill() removes a sprite from all its groups","Q_Score":0,"Tags":"python-2.7,loops,pygame,sprite","A_Id":37038660,"CreationDate":"2016-05-01T16:26:00.000","Title":"Is there a way to iterate through all existing groups automatically?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"so i'm going to be as in depth as possible, here's my problem:\nI'm using the turtle.addshape() command to add images onto the turtle. In order to do this I have to do turtle.addshape(C:\\Users\\Username Here\\Desktop\\Game\\Images\\an image.gif)\nThe problem is with this, is that if I were to distribute my file, it would search for C:\\Users\\Username Here\\Desktop\\Game\nI want it to find the image, WHEREVER the file is and WHOEVER is using it, for example:\nC:\\Users\\ the computers user here \\ where ever the file is located here \\Game\\Images\\an image.gif\nIf You Can Help Me Please Do, It's Been Driving Me CRAZY - Thanks :D","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":179,"Q_Id":36971884,"Users Score":0,"Answer":"For this to happen you need to use a relative path from your Game directory (assuming this is the working directory for your game).\nEg. \"Game\\Images\\an image.gif\"","Q_Score":0,"Tags":"python,file","A_Id":36971947,"CreationDate":"2016-05-01T21:00:00.000","Title":"Python - File Directory Issue","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know how to use ctypes to call a function from a C++ .dll in Python by creating a \"wrapper\" function that casts the Python input types to C. I think of this as essentially recreating the function signatures in Python, where the function body contains the type cast to C and a corresponding .dll function call.\nI currently have a set of C++ .dll files. Each library contains many functions, some of which are overloaded. I am tasked with writing a Python interface for each of these .dll files. My current way forward is to \"use the hammer I have\" and go through each function, lovingly crafting a corresponding Python wrapper for each... this will involve my looking at the API documentation for each of the functions within the .dlls and coding them up one by one. My instinct tells me, though, that there may be a much more efficient way to go about this.\nMy question is: Is there a programmatic way of interfacing with a Windows C++ .dll that does not require crafting corresponding wrappers for each of the functions? Thanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1193,"Q_Id":37002150,"Users Score":2,"Answer":"I would recommend using Cython to do your wrapping. Cython allows you to use C\/C++ code directly with very little changes (in addition to some boilerplate). For wrapping large libraries, it's often straightforward to get something up and running very quickly with minimal extra wrapping work (such as in Ctypes). It's also been my experience that Cython scales better... although it takes more front end work to stand Cython up rather than Ctypes, it is in my opinion more maintainable and lends itself well to the programmatic generation of wrapping code to which you allude.","Q_Score":2,"Tags":"python-3.x,dll,ctypes","A_Id":38547145,"CreationDate":"2016-05-03T10:51:00.000","Title":"How to programmatically wrap a C++ dll with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to do make a virtual keyboard using tkinter. Is there any method that allow tkinter window focus out? For example in java we can have setFocusableWindowState(false) \nThank you very much for your help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":440,"Q_Id":37026046,"Users Score":0,"Answer":"I believe you can accomplish what you want with tkinter, but it's not about not getting focus. I don't think, that other GUI tools will make it any easier.\nIt's part of operation system, or more precisely window manager to give focus to some window, when it is clicked. So, in case of virtual keyboard:\n\nUser has focus in text editor (for example). \nUser presses a button on your virtual keyboard.\nOS\/Window manager gives focus to your keyboard window and sends mouse click event to the GUI library (tkinter).\nHere you need to identify where was the focus before your window got it, i.e. get the text editor window handler somehow.\nSend the button press event to that window and return focus.\nRepeat.\n\nYou'll use tkinter to draw the keyboard window and handle mouse clicks\/touches on virtual keyboard keys. But you'll need to work with OS\/Window manager to identify other windows by handlers and send keypress events to them. May be you will be able to prevent focus switch by working with OS\/Window manager, but it's not tkinter or other GUI library functionality.","Q_Score":0,"Tags":"python,tkinter","A_Id":37028844,"CreationDate":"2016-05-04T11:07:00.000","Title":"How to set tkinter window focus out?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Currently in my work placement, I have to creat a GUI thanks to Tkinter.\nIn this GUI I have to embed a console, this console has to be interactive that is to say stdout & stderr will display in this console and user can type up a commande.\nWith my first research, I think xterm can be useful, but I didn't find how we can redirect stdout & stderr to it\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1028,"Q_Id":37026175,"Users Score":0,"Answer":"You should start with an analysis of what you expect:\n\ninput from user: what do you want, how you want to process it? (is this really shell input?)\nfeed back: what do you want to display, how is it produced? (direct shell output?)\n\nxterm is just a graphic interface around a shell. That means that is captures keyboard input coming to its window, submit it to is shell, and in turn display its shell stdout and stderr to the window, with respect to formatting code (not for from vt220 terminal + ANSI color codes). It is uncommon to use xterm in a GUI.\nThe shell can be any command line program that processes standard input and uses standard output and standard error streams. It is commonly \/bin\/sh or bin\/bash but could be any program.\nIf you really want to do that, you could start xterm in a subprocess, with a special shell that passes all input lines to your main program for example through a Unix domain socket, and in turn echoes back what your main program sends to it.\nMore commonly, GUIs use an text widget to get input from the user and another or the same widget to display feedback. Until you have analyzed things at that level and designed a global architecture please do not think too much about subprocess module syntax.","Q_Score":0,"Tags":"python,tkinter,console,stdout,xterm","A_Id":37031498,"CreationDate":"2016-05-04T11:13:00.000","Title":"Python, Tkinter, embed an interactive console and redirect stdout","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a GridView inside of a ScrollView. I am trying to create and display approximately ~12,000 items in the GridView (which clearly will not display appropriately on screen), but the number of items could feasible be ~40,000. Currently ~18 seconds are spent constructing all of the items (Labels), and any resizing of the window results in another significant delay.\nHow can I speed up the construction and rendering of the items? I don't know how to do paging or delayed, on-demand loading on a ScrollView.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":525,"Q_Id":37064168,"Users Score":0,"Answer":"How can you imagine a user scrolling through 40000 labels? You should rethink your app design.\nConsider adding a text input, and based on the given string, fetch filtered data from the database you have.","Q_Score":0,"Tags":"python,kivy","A_Id":37085902,"CreationDate":"2016-05-06T04:19:00.000","Title":"Kivy ScrollView (with Gridview) Suffering Performance Issues","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found ways to hide something after pressing a button, but what I would like to do is having an invisible button that can still be pushed. A secret button of some sort, using Tkinter. It doesn't need to do anything yet","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1995,"Q_Id":37111267,"Users Score":0,"Answer":"You don't need an invisible button to register a secret click Simply bind <1> to the root window and it will register whenever you click on anything (unless you click on some other widget that is listening for that event). You can then check the coordinates of the click to see where the use clicked.","Q_Score":1,"Tags":"python,tkinter","A_Id":37117837,"CreationDate":"2016-05-09T08:44:00.000","Title":"Is there a way to make an invisible button in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I searched on the web and couldn't find anything. How can I install PyQt5 for Python 3.4 version?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":10671,"Q_Id":37150509,"Users Score":0,"Answer":"I am using pyCharm and it allows me to install PyQt5 from the settings menu, just go to the \"Project Interpreter\" and install it.","Q_Score":4,"Tags":"python,python-3.4,pyqt5","A_Id":37150609,"CreationDate":"2016-05-10T23:23:00.000","Title":"How to install PyQt5 for Python 3.4 version?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"In my build I am required to copy header files in a flat structure while source code files are copied in a hierachical structure. \nBy default when specifying duplicate = 1 (my build is a variant dir build) in SCons all header files and .c\/.cpp files are duplicated in a hierarchical structure.\nIs there a way to deactivate duplication of header files ?\nWhat I tried until now:\nTo provide an empty list to CPPPATH. \nTo remove source scanners from my builders.\nI want to install them by myself in a separate folder. I don't want to turn off duplication since I need that for .c\/.cpp files.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":82,"Q_Id":37271162,"Users Score":1,"Answer":"You can't turn off the duplicate method for only a subset of files (based on their extension for example).\nInstalling a subset of source and target files to a specific directory is usually handled by calling the Install() method. Independent of whether you plan to use duplicate=0 or duplicate=1 for your actual builds, I'd suggest to not interfere with what happens in the variant dirs...and just letting SCons do its thing.","Q_Score":0,"Tags":"python,scons","A_Id":37272718,"CreationDate":"2016-05-17T08:41:00.000","Title":"How to deactivate header files duplication in SCons?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a program that I would like to use as a normal program as well as continue to code it on the side. To do this I first tried creating a shortcut of the .py file in my PyCharms project folder and sent it to desktop. When I double-clicked the shortcut the command prompt would open for a second and then shut. It's a PyQt4 program so I'm not sure if this has any bearing. The program has been coded in Python 3.4. I've noticed that when I open the command prompt and type 'python' it shows Python 3.5 for some reason so I'm not sure if this has any bearing on the situation. \nIf you've ever programmed in C# I'd like to be able to build a solution and then rebuild the solution when I've updated the code so that I can access the program as a normal program as well as continue to improve the code of it. \nThanks for any help.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":883,"Q_Id":37297917,"Users Score":0,"Answer":"Managed it thanks to the link above. Uninstalled Python 3.5 and set my PATH variable to C:\\Python34. Downloaded pyinstaller and installed it using PIP. Then navigated to Python34\/Scripts and dragged myFile.py (the one to be made an .exe) into it. Ran pyinstaller.exe --windowed myFile.py to create the exe which then went to my dist folder. Created a shortcut and it worked perfectly.","Q_Score":0,"Tags":"python,pyqt","A_Id":37298956,"CreationDate":"2016-05-18T11:13:00.000","Title":"How can I run my Python program like a normal program from the desktop?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a program that I would like to use as a normal program as well as continue to code it on the side. To do this I first tried creating a shortcut of the .py file in my PyCharms project folder and sent it to desktop. When I double-clicked the shortcut the command prompt would open for a second and then shut. It's a PyQt4 program so I'm not sure if this has any bearing. The program has been coded in Python 3.4. I've noticed that when I open the command prompt and type 'python' it shows Python 3.5 for some reason so I'm not sure if this has any bearing on the situation. \nIf you've ever programmed in C# I'd like to be able to build a solution and then rebuild the solution when I've updated the code so that I can access the program as a normal program as well as continue to improve the code of it. \nThanks for any help.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":883,"Q_Id":37297917,"Users Score":0,"Answer":"Go to your environmental variables (Right click on Computer > Properties > Advanced system settings > Environment Variables...). Find Path in System variables, select it, and click edit. Remove the Python 3.5 path and replace it with your python 3.4 or virtual environment folder that has python.exe in it. \nMake a shortcut on your desktop that points to the .py file that you are editing.\nIf you have all of the dependencies right then double clicking the .py file's shortcut should run your program.\nOther wise you can pip install cx_freeze and use cx_freeze like setuptools. Create a setup.py file and build the executable.\nIf you want to install this executable I suggest using Inno Setup. It is pretty straight forward on how to use and has an easy wizard that helps you build a basic installer.","Q_Score":0,"Tags":"python,pyqt","A_Id":37299236,"CreationDate":"2016-05-18T11:13:00.000","Title":"How can I run my Python program like a normal program from the desktop?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on an GUI based application, that is developed using python and go. I am using python(+Kivy) to implement UI and Go to implement middleware \/ core on windows OS.\nmy problem statement is : \n1) I want to run the exe of the core on launching the application and it should remain in the background till my application is closed.\n2) When an event is triggered from the application, a command is sent to the core, which it turns execute the command on the remote device and returns with the result of command execution.\nI want to know, how I control the lifetime of the exe and how I can establish a communication between the UI and Core.\nAny ideas!!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":105,"Q_Id":37319345,"Users Score":1,"Answer":"There are many ways you can tackle this but what I would recommend is having one of the parts (GUI\/Core) as the main application that does all of the initializations and starts the other part. I would recommend using the core for this. \nHere's a sample architecture you can use, though the architecture you choose is highly dependent on the application and your goals.\nCore runs first, performing initialization actions including starting the GUI, sets up the communication between the GUI (using pipes, sockets, etc), then waits for commands from the GUI. If the GUI signals to close, the core can perform whatever clean up necessary and then exits. With this scenario, the lifetime of the exe is controlled by the GUI.(GUI sends a signal to the core when the user hits the exit button to let the core know it should exit)\nIf the core starts the GUI, then it can set up the STDIN\/STDOUT pipes for it and listen for commands on the STDOUT, while sending results on the STDIN. You can also take the server approach, having the core listen on a socket, and the GUI sends requests to it and wait for a response. With the server approach, you can have some sort of concurrency unlike the serial pipes, but I think it might be slower than the pipes (the difference might be negligible but its hard to say without knowing what exactly you're doing).","Q_Score":2,"Tags":"python,user-interface,go,communication,core","A_Id":37328359,"CreationDate":"2016-05-19T09:37:00.000","Title":"Communication between UI and Core on windows machine","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a QComboBox and say I type the word \"info\" in the box, followed by \"INFO\".\nWhy doesn't it remember both as 2 distinct words and instead convert \"INFO\" to \"info\"?\nHow can I go about solving this issue so that both words would end up in the list. Also the back-end is in python.\nNote: I would prefer a solution without setDuplicatesEnabled.\nI read the documentation and searched the web but with no luck and I cannot figure this one out. Most answers on SO were outdated(5+ years )","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":37336002,"Users Score":0,"Answer":"The easiest way - to use setAutoCompletion(false) on your QComboBox.","Q_Score":0,"Tags":"python,qt,qcombobox","A_Id":37339381,"CreationDate":"2016-05-20T00:08:00.000","Title":"QComboBox: same words with different cases are seen as duplicates","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have just installed kivy in python 2.7.11. After installing it, whenever i try to open IDLE, it is giving subprocess startup error.\nActually i installed kivy on my windows 7 PC through command prompt. After installation, I copied programs of kivy from my android tab to run them on my pc. When I tried to open them, IDLE doesn't respond for some time and after some time it gives startup error. Since then IDLE is not starting .\nBut it is quite strange that, on running python builtin module, there is no error.\nI had reinstalled python but still there is no change.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":566,"Q_Id":37346844,"Users Score":0,"Answer":"reason for subprocess startup error can be a new python file that you have created recently with the same name as same existing libraries or module name\n\ne.g. 're.py','os.py' etc\n\nbeacuse re,os are the predefined libraries\njust go and find the file and rename it\nhope so it will be resolved","Q_Score":0,"Tags":"python-2.7,kivy,startup,python-idle","A_Id":48363806,"CreationDate":"2016-05-20T12:32:00.000","Title":"Python IDLE giving startup error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Ok so I am very bad at sprites and I just don't get how to use sprites with blitted images. So I was wondering, if I make the image and just make a rectangle around that object that follows that image around, would that be a good replacement for sprites, the rectangle would be the one that's colliding for instances... Or should I try learning sprites. If I should is there any tutorial that could help me with using blitted images to make sprite characters that use python 3.4? \nThank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":25,"Q_Id":37381061,"Users Score":0,"Answer":"In my experience, most uses for sprites can work with rectangular collision boxes. Only if you had an instance where a ball needed to be collided with then you would have to use an actual sprite. In the long run, I would recommend learning sprites, but if you need help with sprites, the pygame documentation has loads of information!","Q_Score":2,"Tags":"python-3.x,pygame","A_Id":37381094,"CreationDate":"2016-05-23T00:28:00.000","Title":"Replacing sprites idea","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"OptionMenu is working perfectly in my application to select one option among several possible. However, I need to allow the user to select more than one option. Is it possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":230,"Q_Id":37394199,"Users Score":2,"Answer":"It's not designed for that. If you want that sort of behavior you can create your own widget. An optionmenu is just a menubtton and a menu, and a tiny bit of code.","Q_Score":2,"Tags":"python-3.x,tkinter,optionmenu","A_Id":37395425,"CreationDate":"2016-05-23T14:51:00.000","Title":"How to allow more than one selection in tkinter OptionMenu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I searched the web and SO but did not find an aswer.\nUsing Python, I would like to know how (if possible) can I stop the screen from updating its changes to the user.\nIn other words, I would like to buid a function in Python that, when called, would freeze the whole screen, preventing the user from viewing its changes. And, when called again, would set back the screen to normal. Something like the Application.ScreenUpdating Property of Excel VBA, but applied directly to the whole screen.\nSomething like:\nFreezeScreen(On)\nFreenScreen(Off)\nIs it possible?\nThanks for the help!!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1178,"Q_Id":37419778,"Users Score":1,"Answer":"If by \"the screen\" you're talking about the terminal then I highly recommend checking out the curses library. It comes with the standard version of Python. It gives control of many different aspects of the terminal window including the functionality you described.","Q_Score":0,"Tags":"python,screen,freeze,display","A_Id":37421436,"CreationDate":"2016-05-24T17:03:00.000","Title":"Using Python, how to stop the screen from updating its content?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm still relatively new to Python and Kivy (much more so for Kivy). I'm running Python 3.5 and Kivy 1.9.1 on OS X. I installed Kivy using pip install, and I was never really able to get Kivy to work using the download and putting in my Applications folder like the instructions were asking. Everything seems to work fine, and I've made a few apps; however, I seem to encounter a problem whenever I try to resize the window. The window goes white while I'm resizing it, and then it turns blank\/black afterwards. The terminal just says that it reloaded the graphics and the amount of time it took. I was hoping that after I made my apps using Pyinstaller that this would go away, but the problem still persists. Has anyone else encountered this problem? I haven't been able to test this on another computer yet to see if the problem persists. Any help would be appreciated. Thanks!(:","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":556,"Q_Id":37476505,"Users Score":3,"Answer":"The problem was caused because Kivy was using Pygame. I had to brew install the SDL2 dependencies and reinstall Kivy. This fixed the problem.","Q_Score":1,"Tags":"python,kivy","A_Id":37493470,"CreationDate":"2016-05-27T06:41:00.000","Title":"Kivy window goes blank after being resized","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am starting to learn Tkinter and have been creating new windows with new instances of Tk every time. I just read that that wasn't a good practice. If so, why? And how could this be done better? I have seen others create windows with Toplevel and Frame instances. What are the benefits\/drawbacks of using these instead?\nIn case this makes a difference: The application that I am writing code for starts off with a login window and then proceeds to a second window is the entered password is correct.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1757,"Q_Id":37502942,"Users Score":3,"Answer":"Every tkinter program needs exactly one instance of Tk. Tkinter is a wrapper around an embedded tcl interpreter. Each instance of Tk gets its own copy of the interpreter, so two Tk instances have two different namespaces. \nIf you need multiple windows, create one instance of Tk and then additional windows should be instances of Toplevel. \nWhile you can create, destroy, and recreate a root window, there's really no point. Instead, create the root window for the login screen, and then just delete the login screen widgets and replace them with your second window.\nThis becomes trivial if you make each of your \"windows\" a separate class that inherits from tk.Frame. Because tkinter will destroy all child widgets when a frame is destroyed, it's easy to switch from one \"window\" to another. Create an instance of LoginFrame and pack it in the root window. When they've input a correct password, destroy that instance, create an instance of MainWindow and pack that.","Q_Score":0,"Tags":"python,python-2.7,user-interface,tkinter","A_Id":37503535,"CreationDate":"2016-05-28T19:17:00.000","Title":"Tkinter Creating Multiple Windows - Use new Tk instance or Toplevel or Frame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made a GUI application using wxpython and some other packages (matplotlib, pandas, numpy). I tried to compile this into a standalone executable. However, when I run the 'my_script.exe'  I get the following error in my command prompt: \n\nIntel MKL FATAL ERROR: Cannot load mkl_avx2.dll or mkl_def.dll.\n\nThe versions I am using are: \n\nAnaconda 2.0.0 (Python 2.7) 64 bit \nSetuptools 19.2 (downgraded from 20.3 because of import error)\n\nThanks in advance for helping me!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2841,"Q_Id":37511165,"Users Score":2,"Answer":"Search for mkl_avx2.dll & mkl_def.dll files and paste them in your .exe\n folder.","Q_Score":1,"Tags":"python,executable,anaconda,pyinstaller","A_Id":37513422,"CreationDate":"2016-05-29T14:37:00.000","Title":"Pyinstaller Intel MKL fatal error when running .exe file Python 2.7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python function that takes no parameters. In my code, I call this function twice. Once as a command behind a Tkinter Button and once as a function to an event that I bind to a window. For the command, I call the function as func and that works fine. For the event, it will only work if I call it as func() and change the definition of the function to be: func(self).\nWhy? How can I make both these calls compatible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":116,"Q_Id":37514795,"Users Score":-1,"Answer":"This is because when you bind a function to a button you are not calling the function, only binding it so that tkinter knows what to do when the button is pressed. You only need to use func() when you are calling the function as you are doing in the the event.","Q_Score":1,"Tags":"python,tkinter","A_Id":37514847,"CreationDate":"2016-05-29T20:44:00.000","Title":"What is the difference between \"func\" and \"func()\" in TkInter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to set my QGroupBox's title with HTML expressions in python program, \ne.g. :\n ABC. (subscript)\nDoes anybody have an idea how to do this?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":372,"Q_Id":37527124,"Users Score":1,"Answer":"QGroupBox's title property does not support HTML. The only customization you can do through the title string (besides the text itself) is the addition of an ampersand (&) for keyboard accelerators.\nIn short, unlike QLabel, you can't use HTML with QGroupBox.","Q_Score":1,"Tags":"python,html,qt,groupbox","A_Id":37535825,"CreationDate":"2016-05-30T13:38:00.000","Title":"How can I set QGroupBox's title with HTML expressions? (Python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"to elaborate, I'm currently creating a maze layout using wall sprites. however, I want the maze to be invisible when I am actually playing the game, while still able to be able to have collision detection. Is this possible in any way? Thanks.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":318,"Q_Id":37535998,"Users Score":1,"Answer":"Are you using images to show your walls? Because if you are, you can use a program called paint.net to create a transparent sprite. Just create a file with the desired dimensions and use the eraser tool to make the whole thing transparent (click on the little squiggly arrow up at the top to make it easier). Save it as a png in your pygame folder and you have a transparent square.","Q_Score":0,"Tags":"python,python-2.7,pygame","A_Id":42210427,"CreationDate":"2016-05-31T02:38:00.000","Title":"How to make an invisible sprite in pygame? (python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know how to make message boxes, and I know how to create textboxes. However, I don't know how to make a message box WITH a textbox in it. I've looked through the tkinter documentation and it seems message boxes are kind of limited.\nIs there a way to make a message box that contains a text entry field, or would I have to create a new pop up window from scratch?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":392,"Q_Id":37556808,"Users Score":0,"Answer":"simpledialog.askstring() was exactly what I needed.","Q_Score":1,"Tags":"user-interface,python-3.x,tkinter,textbox,messagebox","A_Id":37559356,"CreationDate":"2016-05-31T22:40:00.000","Title":"Python: Create a message box with a text entry field using tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know \"adb push\" command could be used to push files to android device. But in Python how do i push single file for example file.txt(size of about 50 KB) into android sdcard with different names(for ex. file1.txt, file2.txt etc) until the device storage is full. Any idea much appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":227,"Q_Id":37559502,"Users Score":0,"Answer":"I found an alternative solution to this problem. In a python while loop push a single file into SD Card and use \"adb mv\" to rename the file in the SD Card after pushing the file, continue this until the device memory is full.","Q_Score":1,"Tags":"python","A_Id":37658540,"CreationDate":"2016-06-01T04:34:00.000","Title":"Python push single file into android device with different names until the device runs out of memory","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make a grid on a QGraphicsView and QGraphicsScene with custom QGraphicsWidgets, but I am not sure how the best way to do this would be. I'm working with PyQt4, but this is a general Qt question.\nMy current implementation contains the following. One QGraphicsScene (with view) and one QGraphicsWidget that contains the QGraphicsGridLayout onto which I insert my custom widgets.\nThe problem I'm having is that each of these custom widgets has different sizes, and they overlap and I'm not sure as to how I would go about changing the sizes for each widget separately. Also, the grid needs to be \"responsive\" i.e. if the widget is some width, then there should be 3 columns, but if the widget is smaller, only 2 columns should be displayed.\nI've read this may be solvable by implementing the size hints, but I haven't really found any good documentation on that topic.\nSo my questions are:\n\nIs there a better way to make the hierarchy of widgets, my current one seems excessive (Scene > Widget > Layout > Widgets)\nWhat's the best way to make different sized widgets the same size (so they would all appear the same size in the grid and not overlap)?\nMy main QGraphicsWidget (on which the grid is displayed) doesn't take up the whole width of the view, what is the best way to achieve this?\nHow would I go about making my QGraphicsGrid \"responsive\"?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":464,"Q_Id":37592580,"Users Score":1,"Answer":"Is there a better way to make the hierarchy of widgets, my current one seems excessive (Scene > Widget > Layout > Widgets)\n\n\nWhen I use the QGraphics.... classes, I generally will subclass QGraphicsView.  The view will create it's own scene and have convenience methods for creating all the child items as well.  From an api standpoint, only the view widget is really exposed.\n\n\nWhat's the best way to make different sized widgets the same size (so they would all appear the same size in the grid and not overlap)?\n\n\nIt depends what types of widgets they are.  If they are images\/pixmaps, you can just scale them to a certain size.  If they are actual widgets with controls, you probably don't want to scale them and should just set their actual height\/width using setGeometry.  Otherwise, all QGraphicsItem's support scaling.\n\n\nMy main QGraphicsWidget (on which the grid is displayed) doesn't take up the whole width of the view, what is the best way to achieve this?\n\n\nOn the view, you can get the .viewport() size, then just set the size of your graphics widget to the size of the viewport.  You'll have to override the resizeEvent on the QGraphicsView to also resize your QGraphicsWidgets whenever the view resizes.\n\n\nHow would I go about making my QGraphicsGrid \"responsive\"?\n\n\nFor this, you'd probably be better off not using a grid and computing the placement of each item in your graphics scene manually.  It depends somewhat on how you want your items placed.  Are some widgets supposed to be below or next to others?  Do you just want a tightly packed grid?  Can an item span two grid lines?  Does everything have to fit on a single \"page\", or is vertical scrolling allowed.  You'll have to answer these questions first before you get any good answers.  But generally, you know the size of the viewport.  If you have a list of graphics items, you can just iterate through them and set their position based off the items you've already placed.  Again, override the resizeEvent on the graphics view so that you can re-compute item positions whenever the view resizes.","Q_Score":0,"Tags":"python,c++,qt,qt4,pyqt4","A_Id":37598213,"CreationDate":"2016-06-02T12:58:00.000","Title":"Adjusting widget size in QGraphicsGridLayout","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Well I need to scale (kinda like changing the screen resolution on your PC) the TkInter window up and down and I have checked like 200 answers and they are all for Python 2.0 so please do any of you guys have any help on this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":53,"Q_Id":37607312,"Users Score":1,"Answer":"You can't do what you want. You can simulate it partly by setting up bindings that can grow and shrink the size of fonts as a window is resized, and you can double or halve the size of images. You can also have widgets like the canvas, text widget, and frames grown and shrink to fit. However, widgets in general won't scale. For example, checkboxes, radiobuttons, scrollbars, sliders will all stay the same size.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":37613354,"CreationDate":"2016-06-03T06:26:00.000","Title":"How can I scale the contents of a tkinter window up and down?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I tried a lot of technics but nothing work, I want to convert my .ui file to a .py file, using the pyuic4 in cmd, but the result is :\n    from PyQt4 import QtCore\nImportError: DLL load failed: %1 [...] is not a valid Win32 application\nI'm using a 64bits system with python27 and \"PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe\" from Riverbank, I think it's because I install a 64bits version but i'm not sure.\nIf someone could have an idea, it could be awesome ! :)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":127,"Q_Id":37623661,"Users Score":0,"Answer":"Maybe try PYQT 3. Version 4 has some bugs in it","Q_Score":0,"Tags":"python,qt,user-interface","A_Id":37623811,"CreationDate":"2016-06-03T21:24:00.000","Title":"Python Error When creating a .py file from a .ui file (from Qt designer)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Matlab function that takes a 3D binary object as input, saves it as temporary file, then loads a python script through cmd (I made this before Matlab's python integration). The python script loads and reorganizes the 3D data and displays them through VTK. \nThe python script also creates some VTK controls that I would like to control through Matlab GUI sliders rather than VTK sliders. \nIs there a way to open a realtime data flow between VTK and Matlab, either through Matlab's new python integration or python's Matlab engine API (or any other way)? I haven't found any way to control VTK actors other than VTK-created controls right in the VTK interactor window so far.\nEDIT: I also ran into an odd issue when trying to figure this out. When I run the VTK visualization with system(['pythonw ' folder '\\vizualize.pyw\" &']); (and adding the main() so that the script executes itself) everything runs smooth, but when I do it with py.vizualize.main() and attempt to close the vizualization window, it doesn't close but it does return control to matlab command line. On the second attempt, it kills the matlab window instead and then after a while itself. The scripts are identical.\nEDIT 2: Adding renderWin.Finalize() right after renderInteractor.Start() fixed this issue for some reason.\nThanks for any answers or ideas!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":204,"Q_Id":37632614,"Users Score":0,"Answer":"I kind of got it to work. Here's what I did:\n\nmatlab session running the GUI converts to shared session through matlab.engine.shareEngine('shared_matlab_session') and keeps track of the matlab GUI slider position in matlab_slider_pos variable\nthe python script connects to the session through MatEng=matlab.engine.connect_matlab('shared_matlab_session') before initializing VTK objects\nthe VTK render window adds an observer for TimerEvent that triggers SliderSync python callback function every 0.1 seconds\nthe SliderSync function checks if the current VTK slider value corresponds with result of calling MatEng.eval('matlab_slider_pos') and if it doesn't, update the VTK slider value along with the rest of VTK pipeline. Of course at this point the VTK slider is no longer needed and the function can directly update what needs updating.\n\nI really hope there is a more elegant way to view a 3D volume in matlab than the abomination I created (it works pretty smooth though). Comments are still welcome!","Q_Score":0,"Tags":"python,matlab,vtk","A_Id":37661211,"CreationDate":"2016-06-04T16:36:00.000","Title":"controlling VTK through Matlab","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I spent a lot of time trying to fugure out what Cython and Jython are and I'm still (more) confused as anyone who just started computer programming. I heard that Cython is an extension, but..is also and indepent language??\nWhat I think I've understood is that:\n\nCython\/Jython is just Python and you can use C or C++\/Java libraries respectively with just a little bit of Cython\/Jython syntax.\nIt's meant to speed up performance as well as improve code readability when a task would be more efficient to write in C or C++\/Java and, this is done by using statically typed variables.\n\nOr is Cython\/Jython just some sort of extension that is used sometimes but not independently? What I mean is, you'd still write everything in Python and then, for the tasks you'd rather use C or C++\/Java for, you'd use Cython\/Jython instead? (I know I still need Python installed and similar things as it's dependent.)\nBecause if it really is better, other than the barrier that it's still being developed since it's rather new, wouldn't the need for C or C++\/Java completely go away as these are as easy as Python but as powerful as C or C++\/Java?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3486,"Q_Id":37643172,"Users Score":0,"Answer":"Jython is a implementation of Python language on the Java Virtual Machine, so Jython is Python but is not CPython. Cython is an extension to CPython and has not much in common with Python except some similarities in Syntax.","Q_Score":3,"Tags":"java,python,c,jython,cython","A_Id":37643350,"CreationDate":"2016-06-05T14:44:00.000","Title":"Is Cython\/Jython an independent language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I spent a lot of time trying to fugure out what Cython and Jython are and I'm still (more) confused as anyone who just started computer programming. I heard that Cython is an extension, but..is also and indepent language??\nWhat I think I've understood is that:\n\nCython\/Jython is just Python and you can use C or C++\/Java libraries respectively with just a little bit of Cython\/Jython syntax.\nIt's meant to speed up performance as well as improve code readability when a task would be more efficient to write in C or C++\/Java and, this is done by using statically typed variables.\n\nOr is Cython\/Jython just some sort of extension that is used sometimes but not independently? What I mean is, you'd still write everything in Python and then, for the tasks you'd rather use C or C++\/Java for, you'd use Cython\/Jython instead? (I know I still need Python installed and similar things as it's dependent.)\nBecause if it really is better, other than the barrier that it's still being developed since it's rather new, wouldn't the need for C or C++\/Java completely go away as these are as easy as Python but as powerful as C or C++\/Java?","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":3486,"Q_Id":37643172,"Users Score":2,"Answer":"Ok. Jython is an implementation of Python that converts python source code into java bytecode or object code as most people call it. So you basically write your programs using the python syntax, but the output of the source code when compiled to an object code is the java bytecode\nCython on the other hand is an implementation where by standard modules in the python language have been translated into the C language. So here, when you basically use a module, it is the python standard module, but for efficiency sake, under the hood, its C language or code that is executed","Q_Score":3,"Tags":"java,python,c,jython,cython","A_Id":37643398,"CreationDate":"2016-06-05T14:44:00.000","Title":"Is Cython\/Jython an independent language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I spent a lot of time trying to fugure out what Cython and Jython are and I'm still (more) confused as anyone who just started computer programming. I heard that Cython is an extension, but..is also and indepent language??\nWhat I think I've understood is that:\n\nCython\/Jython is just Python and you can use C or C++\/Java libraries respectively with just a little bit of Cython\/Jython syntax.\nIt's meant to speed up performance as well as improve code readability when a task would be more efficient to write in C or C++\/Java and, this is done by using statically typed variables.\n\nOr is Cython\/Jython just some sort of extension that is used sometimes but not independently? What I mean is, you'd still write everything in Python and then, for the tasks you'd rather use C or C++\/Java for, you'd use Cython\/Jython instead? (I know I still need Python installed and similar things as it's dependent.)\nBecause if it really is better, other than the barrier that it's still being developed since it's rather new, wouldn't the need for C or C++\/Java completely go away as these are as easy as Python but as powerful as C or C++\/Java?","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":3486,"Q_Id":37643172,"Users Score":1,"Answer":"CPython is comparable to Jython. They're the implementation of the Python language. CPython is the de-facto standard and was written in C. Jython is written in Java and runs on the JVM. It also allows accessing the Java ecosystem to a great extent. There are also other implementation of the language, like PyPy or Pyston. \nCython is totally different. It allows us to write extensions for Python in C or Pyrex, a subset of the Python language. Cython speeds up the execution speed for the parts written with it.","Q_Score":3,"Tags":"java,python,c,jython,cython","A_Id":37643279,"CreationDate":"2016-06-05T14:44:00.000","Title":"Is Cython\/Jython an independent language?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a GUI in tkinter that uses one image as an overlay on top of another, but when I place the image over the lower one, the transparent area of the image appears as grey.\nI've searched for solutions to this, but all the results that I've found have pointed towards using PIL.\nIs it possible for me to use transparent, or partially transparent images in the python tkinter module without using PIL?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":234,"Q_Id":37667631,"Users Score":0,"Answer":"You could use some basic photoshop tools like the magic wand tool to remove the background, but keep in mind, some PNG format images have a faint background. This is either in the from of a watermark, or the image background was rendered with a lower opacity than the rest of the image. Your GUI may also have a layer placed above the images by default. Does it appear on each image seperatly when loaded into the GUI?","Q_Score":0,"Tags":"python,user-interface,tkinter,transparent","A_Id":37801513,"CreationDate":"2016-06-06T22:10:00.000","Title":"How can I make the background of an image appear transparent without PIL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Right now I have an image processing algorithm that is roughly 100 lines or so in Python. It takes about 500ms using numpy, PIL and scipy. I am looking to get it faster, and as the actual algorithm seems pretty optimized thus far, I'm wondering if using a different approach such as Cython would improve the times. I believe that I have several different things I could do:\n\nUse Cython to expose relevant parts of the C library to Python.\nUse Ctypes to just write everything in C but still have it pure Python (not leaning towards this at all)\nCreate an extension module in C\/C++ and them import it and call the functions. I'm not sure if I would be able to use numpy this way though.\nCreate a DLL and have Python load it. This doesn't get to use numpy or those modules, but would still be very efficient.\n\nI'm just looking for speed here, not worried about difficulty of the implementation. Is there any one option that is better in this case, are they all the same, or is it even worth doing?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":929,"Q_Id":37712561,"Users Score":6,"Answer":"It helps to know what you need to do here.\nIf you're not using ctypes for function calls, it's unlikely that it will save you anything to just have ctypes types involved. If you already have some DLL lying around with a \"solve it for me\" function, then sure, ctypes it is.\nCython creates extension modules, so anything you can do with Cython could also be done with an extension module, it just depends on how comfortable you are writing extensions by hand. Cython is more limited than writing extension by hand, and harder to \"see\" performance in (the rules for optimizing Cython are basically the opposite of optimizing CPython code, and if you forget to cdef the right things, you gain nothing), but Cython is generally simpler too.\nWriting a separate non-extension DLL is only worthwhile if you have non-Python uses for it; otherwise, a Python extension is basically just the DLL case, but better integrated.\nBasically, by definition, with infinite time and skill, a CPython extension will beat any other option on performance since it can do everything the others do, and more. It's just more work, and easy to make mistakes (because you're writing C, which is error prone).","Q_Score":5,"Tags":"python,cython,ctypes,python-extensions","A_Id":37712741,"CreationDate":"2016-06-08T20:43:00.000","Title":"Differences between Cython, extending C\/C++ with Python.h, etc","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using length based message framing with python twisted framework with a C# client running BeginRecieve async reads and I'm having trouble grabbing the value of the length of the message.\nThis is the twisted python code\n\nself.transport.write(pack(self.structFormat, len(string)) + string)\n\nAnd this is the C# code:\n\nint bytesRead = client.EndReceive(ar);\nif (bytesRead > 0)\n  {\n   int msg_size = BitConverter.ToInt32(state.buffer, 0);\n\nProblem is the len(string) value is not correct when I grab it via Bitconverter on the c# side.\nThe value should be 15 but its coming across as 251658240.\nAny insight would be much appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":72,"Q_Id":37718216,"Users Score":0,"Answer":"Sorry the question was badly asked. I did find the solution though.\n\nint netmsg_size = BitConverter.ToInt32(state.buffer, 0);\nint msg_size = IPAddress.NetworkToHostOrder(netmsg_size);\n\nThis converts the network integer back into a regular integer.","Q_Score":0,"Tags":"c#,python,sockets,twisted,beginreceive","A_Id":37736839,"CreationDate":"2016-06-09T06:19:00.000","Title":"Python Twisted frameowrk transport.write to a c# socket BeginReceive reading length based message framing value","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am having a problem with running pillow for python 3.4.2.\nI tried installing Pillow using 3 different files:\nPillow-3.2.0.win-amd64-py3.4.exe, \n Pillow-3.2.0-cp34-cp34m-win_amd64.whl,\n Pillow-3.2.0-cp34-none-win_amd64.whl. \nEvery time I try to import Image or tkimage I get the not a valid win32 error in shell. Also, the 2 wheel files said they were incompatible with my system when using pip to install so I had to extract the data and place manually.\nI am running windows 10 64bit but when I request what platform I'm running with python it says windows 8! In my system info from control panel it says the correct information though.\nPlease help if anyone knows the solution!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":115,"Q_Id":37753121,"Users Score":0,"Answer":"Solved:\nI finally figured it out! I had a 32 bit and a 64 bit version of python installed. I had pillow installed to my 32 bit directory, so when python ran from 32 bit was why I got the win32 error. And when I ran python 64bit it said module not found. Uninstalled both and reinstalled the 64 bit to the normal install direc in C, reinstalled 64 bit pillow and it worked!\nAfter updating pip it was able to read the wheel files.","Q_Score":0,"Tags":"python,python-imaging-library,pillow","A_Id":38139040,"CreationDate":"2016-06-10T16:31:00.000","Title":"Unable to use Pillow (not a valid WIN32 error)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is my first time posting a question here as most of my questions have already been answered by someone else!  I am working on a GUI application in python and am attempting to use pyinstaller to package it into a single folder and .exe for easier portability.  Currently, I am using windows 10 and anaconda3 to manage my python packages.  The application relies on tkinter, pillow, numpy, scikit-learn, opencv, ffmpeg, and matplotlib.  The application is formatted with a main GUI.py file that creates objects of a number of other files (many of which are stored in a subfolder as this GUI is replacing a command line utility that served the same purpose).  The issue I am running into (as you can see in the title) is that the .exe is throwing the error block:\n\nTraceback (most recent call last):\n    File \"site-packages\\PyInstaller\\loader\\rthooks\\pyi_rth_pkgres.py\", line 11, in \n    File \"c:\\users\\gurnben\\anaconda3\\envs\\opencv\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py\", line 389, in load_module\n      exec(bytecode, module.dict)\n    File \"site-packages\\setuptools-20.7.0-py3.5.egg\\pkg_resources__init__.py\", line 68, in \n    File \"site-packages\\setuptools-20.7.0-py3.5.egg\\pkg_resources\\extern__init__.py\", line 60, in load_module\n  ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.\n  Failed to execute script pyi_rth_pkgres\n\nWhen I look at the warn.txt it gives a massive list of missing packages including parts of some packages that are actually in the single folder package.\nI have, however, successfully gotten it to recognize the dll files from opencv and it is not listed among the missing (nor is ffmpeg however I did not see any ffmpeg files in the folder).  I had to pass in a custom path to get it to include the opencv files as they are not in anaconda at this time.  \nAny hints or ideas for next troubleshooting steps?  I am overly greatful for all of the help you an offer and I can upload any code, files, etc. that would help you diagnose the issue.  In the meantime I will continue searching for a solution myself!","AnswerCount":8,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":55660,"Q_Id":37815371,"Users Score":33,"Answer":"Extending Vikash Kumar's answer, build the application by adding the --hidden-import argument to the command. \nFor example, running the command given below worked for me. \n\"pyinstaller --hidden-import=pkg_resources.py2_warn example.py\" \nupdate: added missing \"=\"","Q_Score":33,"Tags":"python,opencv,ffmpeg,pyinstaller","A_Id":59979390,"CreationDate":"2016-06-14T14:49:00.000","Title":"Pyinstaller \"Failed to execute script pyi_rth_pkgres\" and missing packages","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is my first time posting a question here as most of my questions have already been answered by someone else!  I am working on a GUI application in python and am attempting to use pyinstaller to package it into a single folder and .exe for easier portability.  Currently, I am using windows 10 and anaconda3 to manage my python packages.  The application relies on tkinter, pillow, numpy, scikit-learn, opencv, ffmpeg, and matplotlib.  The application is formatted with a main GUI.py file that creates objects of a number of other files (many of which are stored in a subfolder as this GUI is replacing a command line utility that served the same purpose).  The issue I am running into (as you can see in the title) is that the .exe is throwing the error block:\n\nTraceback (most recent call last):\n    File \"site-packages\\PyInstaller\\loader\\rthooks\\pyi_rth_pkgres.py\", line 11, in \n    File \"c:\\users\\gurnben\\anaconda3\\envs\\opencv\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py\", line 389, in load_module\n      exec(bytecode, module.dict)\n    File \"site-packages\\setuptools-20.7.0-py3.5.egg\\pkg_resources__init__.py\", line 68, in \n    File \"site-packages\\setuptools-20.7.0-py3.5.egg\\pkg_resources\\extern__init__.py\", line 60, in load_module\n  ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.\n  Failed to execute script pyi_rth_pkgres\n\nWhen I look at the warn.txt it gives a massive list of missing packages including parts of some packages that are actually in the single folder package.\nI have, however, successfully gotten it to recognize the dll files from opencv and it is not listed among the missing (nor is ffmpeg however I did not see any ffmpeg files in the folder).  I had to pass in a custom path to get it to include the opencv files as they are not in anaconda at this time.  \nAny hints or ideas for next troubleshooting steps?  I am overly greatful for all of the help you an offer and I can upload any code, files, etc. that would help you diagnose the issue.  In the meantime I will continue searching for a solution myself!","AnswerCount":8,"Available Count":2,"Score":0.0748596907,"is_accepted":false,"ViewCount":55660,"Q_Id":37815371,"Users Score":3,"Answer":"this is because he did not copy a dependency.I solved it like this.\n\npyinstaller my_program.py\n\nthis creates a my_program.spec. it is a base configuration file.\nopen it with any text editor. search for\nhiddenimports=[]\nedit to.\nhiddenimports=[\"pkg_resources.py2_warn\"]\nnow let's call pyinstaller passing our configured file instead of our program\n\npyinstaller my_program.spec","Q_Score":33,"Tags":"python,opencv,ffmpeg,pyinstaller","A_Id":62305689,"CreationDate":"2016-06-14T14:49:00.000","Title":"Pyinstaller \"Failed to execute script pyi_rth_pkgres\" and missing packages","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a project (in Python)  that does video processing using OpenCV. Now I'm planning to implement that in my android phone. I read that Qpython supports python on android. So is there any way to import third party libs like OpenCV in Qpython.\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":7472,"Q_Id":37833638,"Users Score":1,"Answer":"You can install opencv from qpython libraries(install from QPypi).\nQPython --> Libraries --> QPypi --> opencv-qpython --> install\nUse it as\nimport cv","Q_Score":3,"Tags":"android,python,opencv,qpython","A_Id":45597300,"CreationDate":"2016-06-15T11:05:00.000","Title":"OpenCV in Qpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm developing a project (in Python)  that does video processing using OpenCV. Now I'm planning to implement that in my android phone. I read that Qpython supports python on android. So is there any way to import third party libs like OpenCV in Qpython.\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":7472,"Q_Id":37833638,"Users Score":0,"Answer":"In Qpython3 there is a pip program (not sure if on qpython too) but running that program you can \"pip install [your module]\" Worked for me installing sqlalchemy and youtube_dl","Q_Score":3,"Tags":"android,python,opencv,qpython","A_Id":38175636,"CreationDate":"2016-06-15T11:05:00.000","Title":"OpenCV in Qpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using Python 2.7 and PyQt4.\nSo I need a way to make a text of the QPushButton editable when click on it, like on QTextEdit.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":302,"Q_Id":37933629,"Users Score":1,"Answer":"There is no builtin way to edit a push button in the sense that you have a cursor and can type along.\nProbably the easiest solution is to bring up a QInputDialog. If that feels to heavy, you could also place a floating QLineEdit over or next to the QPushButton. Close that on <Enter> and set the typed text to the QPushButton.\nIf you really want an editable Button, you'll have to subclass QPushButton and implement the desired functionality yourself. To get started with this, you need to reimplement mousePressEvent() for starting your editing mode. Reimplement keyPressEvent() for handling key strokes. If you need to display a cursor, reimplement paintEvent(). I have no particular resource at hand that describes what exactly you have to do, but the terms above should be sufficient to look it up yourself.","Q_Score":1,"Tags":"python,pyqt4,qtextedit,qpushbutton","A_Id":37933711,"CreationDate":"2016-06-21T00:01:00.000","Title":"How to make QPushButton editable text when one click on it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a pygame based environment. In that I am importing a spherical ball blender based obj file. Using pykinect, I am trying to mould the object with inputs from a kinect for Xbox 360 camera.\nAll is working ok.\nHowever I wish to export the end product 3D moulded object and save it in a .dae, .obj and .stl formats. Currently by recording the end coordinates of the boundary of the 3D object trying to mimic it to export, but this is a very cumbersome process.\nCan someone suggest what could be done to be able to save the deformed file in the desired 3D formats?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":380,"Q_Id":37939412,"Users Score":0,"Answer":"If you are 'just' moving the locations of vertices (which is what moulding sounds like) then you can 'just' replace that block of the .obj etc file. You should be able to figure out where to cut and insert by looking at some files (I've done this with .obj but not the others so this may be harder than I suggest!) \nHowever you should really fix the normals which you can do by taking cross products of face edges. Also uv coordinates would need fixing if you use those and that's quite a bit harder.","Q_Score":0,"Tags":"python,numpy,pygame,blender,pykinect","A_Id":37956343,"CreationDate":"2016-06-21T08:37:00.000","Title":"How to export 3D files from python(pygame)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When using python and pygame: after loading the screen with the background image and blitting new objects (Text, circles, rectangles, etc.), is there a way to save the modified screen so as to be recalled later in the program?  Specifically, I am setting the background and blitting new objects and would like to save the screen image with all of the blits in intact so it can be used later in the program as a new background upon which sprites can be manipulated.  Any suggestions welcomed!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":271,"Q_Id":37976237,"Users Score":0,"Answer":"Blitting works both ways, meaning you can blit something onto the display screen, but you can also blit the screen onto another surface. So simply make a new surface the same size of your display surface and blit the screen onto that surface for later use.","Q_Score":1,"Tags":"python,background,pygame,screen,sprite","A_Id":37977559,"CreationDate":"2016-06-22T18:59:00.000","Title":"saving modified screens in python\/pygame for later use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a PySide application that should run on python2.7, on window,Linux and Docker container. The application contains Qtooltip and specific eventFilter that catches HoverEnter\\HoverLeave.\nThe application works well on windows 10 and ubuntu 14.04 desktop but when trying to run it inside Ubuntu 14.04 container both features didn't work well:\n\nThe tooltip - It would seem that the text is covered by other tooltip text or totally black.\nThe eventFilter - The application can't get the hover event (didn't appear).\n\nThe main difference that I saw was that when running on Ubuntu desktop, some GTk libraries are loaded to the python process (according to the maps files).\nI tried reproduce the problem by installing everything on Ubuntu server (without Gtk), and got the same effect as inside the container.\nEven after installing Gtk on the server, still no change.\nI think that I might have missed some dependencies, but can't find any documentation on the issue. \nThanks in advance,","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":70,"Q_Id":37993285,"Users Score":0,"Answer":"Ok, after several days of trying figure that this is what was needed:\nFor the tooltip problem:\n\nAdding WA_AlwaysShowToolTips \nChange the stylesheet show that the transparent feature will work only for the QPushButton background and not the entire widget.\n\nFor the event problem:\n\nAdd the attribute: WA_Hover\n\nEverything worked as should be after that","Q_Score":0,"Tags":"python-2.7,docker,ubuntu-14.04,pyside","A_Id":38057871,"CreationDate":"2016-06-23T13:37:00.000","Title":"Pyside fail to show tooltip and specific events in Linux","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Is it possible to orient a tk.Button or ttk.Button vertically? Smething like orienting a tk.Scrollbar in a way self.scrlbr = tk.Scrollbar(master, orient = vertical)?\nHave tried tk.Button(*args).pack(fill = tk.Y), but it does not provide desired effect - button still gets horizontally oriented.\nFound nothing in man pages, but maybe there is some not-staightforward way?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3538,"Q_Id":38008389,"Users Score":0,"Answer":"I found an answer that is a bit easier.\nfor example lets say you have 4 horizontal ttk.buttons, and you wish to place a vertical ttk.button next to them lets call our new button config.\nUsing the grid method for the buttons, the first vertical button is at col=0, row=0\nsecond at col=0, row=1 etc\nCreate a button with with=4 text=C\\no\\nn\\nf\\ni\\ng\\n, grid at col=1, row=0, rowspan=4,\nThere you have it. Simple and easy using standard tkinter.","Q_Score":5,"Tags":"python,button,tkinter","A_Id":68547819,"CreationDate":"2016-06-24T07:55:00.000","Title":"Is it possible to have a vertical-oriented button in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"After setting limited width size,strings which is too long get truncated in the dropdown of wxcombobox.\nself.namelist = wx.ComboBox(self, -1, \"\", size=(270,-1))\nIs there any way to make the combobox dropdown scrolls horizontally.So that we can see long strings.?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":217,"Q_Id":38009583,"Users Score":0,"Answer":"No, but you can use wx.combo.ComboCtrl instead which lets you implement the drop-down window yourself, and then you can make it do whatever you want.  It's not a perfect emulation of the wx.ComboBox, and fairly complex compared to the wx.ComboBox, so it may not be worth it to you for just adding horizontal scrolling.  You can see examples in the wxPython demo.","Q_Score":0,"Tags":"wxpython,wxwidgets","A_Id":38017758,"CreationDate":"2016-06-24T09:09:00.000","Title":"Can we set horizontal scrollbar for wxcombobox?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I recently formatted my hard drive and got rid of Windows and went to Linux.  I had a program that used to work fine before the reformat but isn't working fine now.\nI believe it was written for 3.4 and not 2.7 since I used import tkinter and not import Tkinter.  In either case the program won't run now that I have made the switch over.  In 2.7 it does nothing...it acts like it has run through the code and then stops and gives me back the cursor when it should be popping up a t\/Tkinter window displaying a graph.  In 3.4 I get the error saying numpy isn't installed.\nWhen I apt-cache policy python-numpy it comes up showing it 1:1.8.2 is installed.  When I do the same for scipy it shows 0.13.3 is installed.  Seeing from other websites when I check for cython it shows 0.20.1+git90-gee6e38e is installed.  When I check for tk it comes up 8.6.0 is installed.\nI'm a bit lost.  Why I do get the error code saying numpy isn't found when I got to run the program yet it is installed.  What do I have to do to get this program back up and running again.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":520,"Q_Id":38013224,"Users Score":2,"Answer":"If you use Ubuntu then you have 2 versions of python executables - python and python3. So I think you need to install dependencies for python3 version by sudo pip3 install numpy or sudo apt-get install python3-numpy if it exists in repos.","Q_Score":2,"Tags":"python,numpy","A_Id":38013321,"CreationDate":"2016-06-24T12:14:00.000","Title":"Install python dependencies not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm now practicing with Gtk by developing a file manager application similar to Thunar, and I simply can't figure out how to make the IconView items flow vertically instead of horizontally, like in Thunar or Nautilus' Compact View mode, as well as in Windows Explorer's List View Mode. Should I use TreeView istead?\nI'm practicing in Haskell bindings, the Gtk2Hs, but I'm also familiar with native C library and Python bindings (PyGtk), so explanations using these languages are also acceptable.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":113,"Q_Id":38103354,"Users Score":0,"Answer":"It finally seems that IconView has not such a feature right now, as Thunar uses its own control from libexo, while Caja\/Nautilus use their own controls from other libraries.","Q_Score":1,"Tags":"python,listview,gtk,pygtk,gtk2hs","A_Id":40487030,"CreationDate":"2016-06-29T15:01:00.000","Title":"How to make GtkListView items flow from top to bottom, like in Thunar or Nautilus Compact View Mode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a browser with Python GTK and Webkit for education purposes. I have GTK and it works, but I can't find how to get webkit for Mac OS X. I tried brew, pip3, easy_install. And I'm not sure if PyQT webkit port is the same as webkit.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2977,"Q_Id":38120223,"Users Score":0,"Answer":"For GTK3\nbrew install pygobject3\nOtherwise\nbrew install pygobject","Q_Score":3,"Tags":"linux,macos,python-3.x,webkit,gtk","A_Id":48846011,"CreationDate":"2016-06-30T10:17:00.000","Title":"How to get Webkit for Mac OS X","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Qpython3 on my Android tablet. I have a Python script for a talking alarm clock that I would like to run in the background and then go off at the time the user sets. The problem is, once I set the console running in the background, I can't figure out how to get back to it to stop the script (i.e. get the message to stop repeating).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1123,"Q_Id":38278626,"Users Score":1,"Answer":"Open the \"qpython3\" app then touch \"Console\" and in the top left corner touch \"No. 1\" or \"No. 2\" or ... then select your background running scripts and by touching \"X\" sing you can kill them.","Q_Score":0,"Tags":"android,qpython,qpython3","A_Id":38304956,"CreationDate":"2016-07-09T05:16:00.000","Title":"How do I stop a script that is running in the background in Qpython3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"After the installation of Kivy 1.9.1 on Windows using the commands of Kivy installation tutorials, I can't run the program using \"kivy ***.py\". I don't know how to set up the environment variables, and I can't find it on the official websites.\n\nKivy: 1.9.1\nPython: 3.4.4\nWindows 10\n\nPlease HELP!\nThanks","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":662,"Q_Id":38301047,"Users Score":1,"Answer":"Make sure you're running the command from the folder where the *.py file is located, \"kivy *.py\" should run from there.","Q_Score":0,"Tags":"python,environment-variables,kivy","A_Id":38301272,"CreationDate":"2016-07-11T07:09:00.000","Title":"How to run kivy after 1.9.1 on windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a GUI for an application, modeled off of one I have seen. This other application uses diamond-shaped radiobutton indicators from Python Tkinter, and I can't seem to find out how to use a diamond-shaped radiobutton in my program. All of my attempts at creating a radiobutton result in a circular shaped radioubtton. And thoughts? I'm running my GUI on Redhat and Windows, same problem for both.","AnswerCount":2,"Available Count":1,"Score":-0.2913126125,"is_accepted":false,"ViewCount":494,"Q_Id":38356263,"Users Score":-3,"Answer":"The forms toolkit offers precisely the components that it offers.  If you are not happy with round radio buttons, then code in OSF\/Motif, which offers diamond-shaped radio buttons.  Either that, or you could hack the internals of the widget (sorry, \"control\": I am so accustomed to professional [= UNIX] terminology).  The round button is probably represented as a pixmap somewhere: just overwrite that in place, lickety-split, with your own two-tone pixmap that effects a rough diamond shape.","Q_Score":0,"Tags":"python,tkinter","A_Id":38357614,"CreationDate":"2016-07-13T15:44:00.000","Title":"Diamond Shaped Radiobuttons in Python Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Gtk.Fixed and a viewport putting images that, sometimes, overlaps. How can I set the z-index like in html?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":611,"Q_Id":38419662,"Users Score":2,"Answer":"Gtk.Fixed doesn't support setting the z-order. It's not meant for overlapping widgets, so the z-order is arbitrary and probably depends on what order the widgets were added in.\nIt's not clear from your question what your intention is; if you are purposely overlapping widgets, use Gtk.Overlay instead. If you are not intending to overlap them, then you should use a more versatile container such as Gtk.Grid which will take the widgets' sizes into account.","Q_Score":1,"Tags":"python,gtk3,pygobject","A_Id":38427465,"CreationDate":"2016-07-17T09:14:00.000","Title":"PyGObject: Gtk.Fixed Z-order","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Gtk.Fixed and a viewport putting images that, sometimes, overlaps. How can I set the z-index like in html?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":611,"Q_Id":38419662,"Users Score":1,"Answer":"Like ptomato said, I had to use the Gtk.Overlay. I used an overlay with 3 Gtk.Layout, like layers and it works fine.","Q_Score":1,"Tags":"python,gtk3,pygobject","A_Id":38430240,"CreationDate":"2016-07-17T09:14:00.000","Title":"PyGObject: Gtk.Fixed Z-order","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What module must I use and where is the documentation for it? I think it is possible because I could to make a GUI using mobile basic on Nokia.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3521,"Q_Id":38480676,"Users Score":0,"Answer":"you can use we app gui or qsla4AApp, i recomended to use qsla4AApp","Q_Score":0,"Tags":"user-interface,qpython","A_Id":67756714,"CreationDate":"2016-07-20T11:58:00.000","Title":"How to make GUI using QPython 3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing an app in Python with the PySide library. I have a QTableWidget that gets updated about every second. The thing is, I want to be able to change the data manually, and I thought that if I could find out whether or not the user is changing the data in the cell, then I could just prevent the program from updating this cell. Otherwise I get \"kicked out\" of the cell at each update.\n\nIs this a good idea? Should I try something else and why?\nHow can I achieve my goal?\n\nMany thanks\n\nEDIT :\nI know there exists an itemChanged signal, but what I'd really like to know is if there is a way to tell when the user is writing a new value in the cell, in order not to kick them out while editing.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1437,"Q_Id":38484452,"Users Score":2,"Answer":"In Qt Document:\nvoid QTableWidget::itemChanged(QTableWidgetItem * item)\nThis signal is emitted whenever the data of item has changed.\nHope this will help you.\nEdit:\nQTableWidget uses a default itemdelegate(QItemDelegate instance) which has createEditor method and closeEditor signal.\nYou can reimplement createEditor which means edit starts, and connect the signal closeEditor which means the edit ends.\nThis may be the correct way.","Q_Score":2,"Tags":"python,qt,pyqt,pyside","A_Id":38486018,"CreationDate":"2016-07-20T14:44:00.000","Title":"How to tell when a QTableWidgetItem is being modified","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found this great module on within and downloaded it as a zip file. Once I extracted the zip file, i put the two modules inside the file(setup and the main one) on the module folder including an extra read me file I needed to run. I tried installing the setup file but I couldn't install it because the console couldn't find it. So I did some research and I tried using pip to install it as well, but that didn't work. So I was wondering if any of you could give me the steps to install it manually and with pip (keep in mind that the setup.py file needs to be installed in order for the main module to work).\nThanks!","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":51897,"Q_Id":38598880,"Users Score":1,"Answer":"Extract the zip file to the site-packages folder.\nFind the qpyplus folder in that Lib\/python3.2\/site-packages extract here that's it.Now you can directly use your module from REPL terminal by importing it.","Q_Score":14,"Tags":"python,module,qpython,qpython3","A_Id":39323863,"CreationDate":"2016-07-26T20:00:00.000","Title":"How do I install modules on qpython3 (Android port of python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the general method for 'doing something' after a period of user inactivity in tkinter?  In my case the 'do something' will be to go to the start screen (tk.frame) that is already instantiated.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":844,"Q_Id":38600625,"Users Score":0,"Answer":"I will admit that I have no experience in this, but maybe a sort of watchdog timer could work?  A timer would count up to your desired time, but anytime an element is activated it would reset the counter.  This concept is used in micro-controllers a lot but I'm not sure how you would apply it to python.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":38600746,"CreationDate":"2016-07-26T22:04:00.000","Title":"do something after a period of gui user inactivity tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been trying this for a bit and haven't found a solution that works for me\nI have a wx.scrolledcanvas that I'm trying to save to an image, however when i use the answers I've found they all save only the visible portion of the canvas, and not the full canvas. Is there any way to save the entirety of the scrolled canvas to a file?\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":224,"Q_Id":38670168,"Users Score":1,"Answer":"Refactor your code such that what you are drawing in your EVT_PAINT handler can be called passing it the wx.DC to be drawn upon, and then call that from your paint handler with the wx.PaintDC or whatever you are currently using.  When you want to save it to an image call the same code passing a wx.MemoryDC with a wx.Bitmap selected into it.  When it's done the bitmap will have the same contents as the window, and you can then save it to a file or whatever you need to do with it.","Q_Score":0,"Tags":"python,wxpython","A_Id":38679469,"CreationDate":"2016-07-30T03:48:00.000","Title":"Saving wxPython scrolledcanvas contents to image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to import everything from nodebox.graphics into my python 3.5 code but I get errors:\n\n\nImportError: No module named 'bezier'\n\n\nTo mention, this module exists in nodebox\/graphics. As I searched in python documentations, I have to add the nodebox and pyglet folders into the directory of my code but that did not work.\nI also didn't succeed in adding them to system directories.\nHow can I solve the problem and run my code properly?\nP.S. I'm currently using ubuntu 16.04 if it matters.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":730,"Q_Id":38671739,"Users Score":1,"Answer":"I had the same error. Placing all the .py files except (and this is important) the __init__.py file in the main libraries folder fixed it for me. The final path should look like ~\/lib\/python3.5\/site-packages\/bezier.py","Q_Score":0,"Tags":"linux,python-3.x,pyglet,nodebox","A_Id":42557054,"CreationDate":"2016-07-30T08:00:00.000","Title":"use nodebox as a module for python 3.5","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What is the difference between Kivy Camera and opencv ? I am asking this because in Kivy Camera the image gets adjusted according to frame size but in opencv this does not happen. Also I am not able to do motion detection in kivy camera whereas I found a great tutorial for motion detection on opencv. If someone can clarify the difference it would be appreciated ! Thanks :)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":386,"Q_Id":38774748,"Users Score":0,"Answer":"opencv is a computer vision framework (hence the c-v) which can interact with device cameras. Kivy is a cross-platform development tool which can interact with device cameras.  It makes sense that there are good motion detection tutorials for opencv but not kivy camera, since this isnt really what kivy is for.","Q_Score":0,"Tags":"python,opencv,camera,kivy,motion-detection","A_Id":38774932,"CreationDate":"2016-08-04T18:23:00.000","Title":"Difference between Kivy camera and opencv camera","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am building a GUI tkinter python3 application and attempting to compile it with py2app. For some reason when I try to launch the .app bundle in the dist folder it gives me this error:\nA main script could not be located in the Resources folder\nI was wondering why it is doing this, as it is rather frustrating, and I can not find anything about it anywhere. I copied my .py file into the resources folder (Networking.py). Previous to this error I also found an error in the Info.plist. In the key where it states the runtime executable, I found it was trying to get python2.7, which I have updated and am no longer using. I changed it to my current version, which the path for looks like this:\n\/Library\/Frameworks\/Python.framework\/Versions\/3.6\/Python\nIt may be worth noting that it had a strange path previously, which did not look like a proper path to me. It was @executable_path\/..\/Frameworks\/Python.framework\/Versions\/2.7\/PythonI removed this completely... Was this wrong? I have no idea about anything about XML, which is what it seemed to be...\nAlso when compiling this happened:\nerror: [Errno 1] Operation not permitted: '\/Users\/Ember\/dist\/Networking.app\/Contents\/MacOS\/Networking'\nAny help would be highly appreciated! Thanks!\nEDIT\nI actually figured out: a bit of a stupid mistake, but since I'm using python 3.x I have to type in python3 before doing it.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1292,"Q_Id":38803437,"Users Score":0,"Answer":"I actually figured out: a bit of a stupid mistake, but since I'm using python 3.x I have to type in python3 before doing it.","Q_Score":0,"Tags":"python,user-interface,tkinter,py2app","A_Id":39405027,"CreationDate":"2016-08-06T10:51:00.000","Title":"Py2app: A main script could not be located in the Resources folder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I will compile form designed by qt designer in eric6, but show \"Could not start pyuic5, Ensure that it is in the search path.\" But actually the PATH of  pyuic5.exe has been in the system PATH, and also the pyuic5.exe can be run by typing pyuic5 in the cmd of window7 .\nThe envirement is python3.5+qt5.7+pyqt5.7+eric6.\nWhy I could not compile form in eric6? How can fix the error?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":974,"Q_Id":38807068,"Users Score":0,"Answer":"Had the exact same issue. Looks like Eric wants pyuic5.bat (somewhere in the path)\nI created such a batch file with the following contents, and it worked\n\n@\"pyuic5.exe\" %1 %2 %3 %4 %5 %6 %7 %8 %9\n\nPS: In my setup these files are both located in a folder:\n\nC:\\Python35-32\\Scripts","Q_Score":0,"Tags":"python,qt,python-3.x,pyqt5","A_Id":40221119,"CreationDate":"2016-08-06T17:41:00.000","Title":"Compile form in eric6, but show \"Could not start pyuic5, Ensure that it is in the search path.\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make my python program run on other systems without python installation. I made use of tkinter to create a gui, after creating an exe file with pyinstaller it throws a fatal error \"Failed to run script\". I've checked my code several times and it works well. I don't know what's wrong.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":6275,"Q_Id":38838772,"Users Score":0,"Answer":"The error is very generic and at this point, it may not be possible to find the actual error what preventing the execution.\nIn order to get actual error please exclude '--windowed' or '--noconsole' parameters during installation and then execute with 'pyinstaller -filename.py --onefile'. Then on execution it will show exact error instead of 'Fatal error! Failed to execute script'. Then you can proceed accordingly.","Q_Score":0,"Tags":"python,user-interface,exe,pyinstaller","A_Id":67105487,"CreationDate":"2016-08-08T21:26:00.000","Title":"Fatal error! failed to execute script when creating executable file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using QPython on my Samsung Android V. I am studying from the book Think Python. The topic is about Adding New Functions such as: def print_lyrics:\nprint (\"I am a lumberjack and I work all day.\"\nEtc.\nBut when I attempt to run it I get an error saying, File \"\", line 1 error. \n1. I looked on Google but could not find the exact answer for this particular problem. I was about to look for a new app and delete QPython because I've been stuck for two days on this lesson. But I came here first. \n2. I tried different methods of doing this program function with no luck. \n3. I'm wondering if it just isn't available on the app, or am I failing to understand what I am doing wrong, or missing? \nThanks for your help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":474,"Q_Id":38866665,"Users Score":0,"Answer":"I am editing my last answer:\nI was mistaken when I read the text and the error was my fault. \nBe sure and read thoroughly to avoid mistakes.","Q_Score":0,"Tags":"syntax-error,stdin,qpython","A_Id":38874758,"CreationDate":"2016-08-10T07:19:00.000","Title":"File \"\", line 1 error In QPython When Running def Function","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to show an icon on Gio.MenuItem with set_icon() method. But set_icon() expects to receive a GIcon object.\nHow to create a GIcon object?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":90,"Q_Id":38927339,"Users Score":2,"Answer":"Gio.Icon is just an interface. It is implemented by Gio.ThemedIcon, Gio.FileIcon, Gio.BytesIcon, etc. So you would would use those.","Q_Score":1,"Tags":"python-3.x,gtk3,pygobject","A_Id":38931286,"CreationDate":"2016-08-12T22:38:00.000","Title":"How to instantiate GIcon","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using python2.7 Tkinter for executing Tcl.\nThe Tcl code has package require Tcl 8.5, while the tclsh loads Tcl 8.4 by default.\nCauses: version conflict for package \"Tcl\": have 8.4, need 8.5\nI have libtcl8.5.so installed at a custom location.\nTried adding it to LD_LIBRARY_PATH, TCL_LIBRARY, TCLLIBPATH. Nothing worked. It's like the tclsh completely ignores the envs.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":761,"Q_Id":38965457,"Users Score":0,"Answer":"What worked eventually:\n\n    tcl = Tkinter.tcl()\n    tcl.eval('package forget Tcl')\n    tcl.eval('package provide Tcl 8.5')\n    tcl.eval('package require Tcl')\n    8.5\nSuccess!","Q_Score":0,"Tags":"python,tcl,version","A_Id":38965465,"CreationDate":"2016-08-16T01:42:00.000","Title":"Python Tkinter: version conflict for package \"Tcl\": have 8.4, need 8.5","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a Windows program that so far has a .bat file calling a .pyw file, and I need functions from Java and C++. How can I do this?(I don't mind creating a new batch or python file, and I already have the header file for the C++ section and a .jar file for my java components. (For Java I use Eclipse Java Mars, and it's Java 8u101)) Thanks!!!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":455,"Q_Id":38968007,"Users Score":1,"Answer":"You can load C++ function and execute it from Python like BasicWolf explained in his answer. For Java, Jython might be a good approach. But then there's a problem - you will need to be dependent on Jython which is not up to date with the latest versions of Python. You will face compatibility issues with different libraries too. \nI would recommend compiling your C++ and Java functions to create individual binaries out of them. Then execute these binaries from within Python, passing the arguments as command line parameters. This way you can keep using CPython. You can interoperate with programs written in any language.","Q_Score":2,"Tags":"java,python,c++,python-2.7,batch-file","A_Id":38968156,"CreationDate":"2016-08-16T06:30:00.000","Title":"How do you call C++ and\\or Java functions from Python 2.7?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to determine if something is possible. I haven't written any code for this specifically yet. \nUsing wxPython I would like to set up a text box (possibly a staticText) with primarily un-editable text. However I need certain parts, individual words, to be editable similar to PDF document with added text boxes. \nThe ultimate goal is to visually display an XML file and allow a user to directly edit only element text and nothing else in-situ. I have a couple of other ways of doing this but they are very much sub-optimal. \nThanks for any input\/direction\/help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":12,"Q_Id":39021144,"Users Score":0,"Answer":"That's a nice idea, but wx' text boxes are either entirely read only, or editable.\nI think the way to go for it is to query your position inside the text box for each cursor movement, and toggle the text box state readonly\/editable according to you current position, current selection, etc..\nIt looks like a tough task, though... :-)","Q_Score":1,"Tags":"python,xml,text,wxwidgets","A_Id":39021238,"CreationDate":"2016-08-18T14:41:00.000","Title":"Trying to determine if a specific behavior is allowed in wxPython text","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to set a fixed width of a QHBoxLayout?\nFor example, when I have two small widgets in it that take up little space and I don't want the two to split over the entire screen width when I full screen the app. The widgets already have their widths set to their minimumSizeHint() widths.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":903,"Q_Id":39023221,"Users Score":0,"Answer":"Admission: I don't use PyQT, but I use Qt in C++. I believe it would work the same.\nThe trick here, is to as you run QHBoxLayout::addWidget(), you define a stretch factor (greater than zero) to the widgets you want to stretch. You define a zero-stretch factor (the default) to the ones you want to stay small.\nHave you run QWidget::setMaximumWidth() on the smallish widgets? That would also be useful, perhaps.","Q_Score":0,"Tags":"python,layout,pyqt4,spacing","A_Id":39023363,"CreationDate":"2016-08-18T16:26:00.000","Title":"PyQt4 GUI Box Layout Fixed Width","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Python and xlwings in same folder.  comtypes folder in xlwings folder\ncan't find module named 'com types'\n\nThe xlwings documentation says to install with pip.  This puts xlwings in the C:\\Python27 folder.  WinPython ends up in the Downloads\/WinPython-64bit-3.4.4-3Qtr5\/  (1.37GB, btw)  moved the xlwings to the WinPython installed folder.\nThis is way too difficult.  Is there a straightforward way to set all this up so I can run a python script and get import xlwings as xw to work?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":256,"Q_Id":39069794,"Users Score":0,"Answer":"maybe this would work better:\n\nclick on the \"WinPython Command Prompt\" icon of your WinPython distribution\nin the opening DOS windows, type: \n\n\npip install xlwings","Q_Score":1,"Tags":"python,xlwings,comtypes","A_Id":39083271,"CreationDate":"2016-08-21T23:43:00.000","Title":"win 10 WinPython Script import xlwings get errors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can i disable Alt+Tab combination, especially tab on my Tkinter App.\nI disabled Alt and F4 with - return \"break\" - but i can't disable Tab key with it.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1869,"Q_Id":39110800,"Users Score":0,"Answer":"Tkinter provides no option for this. Alt-tab is intercepted before tkinter ever sees it. If you want to do this, you'll have to find some platform-specific hooks.","Q_Score":0,"Tags":"python,python-3.x,tkinter","A_Id":39112160,"CreationDate":"2016-08-23T21:16:00.000","Title":"Disable Alt+Tab Combination on Tkinter App","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to add an image in the background of a Text widget in tkinter, but as far as I'm concerned, that is not possible. So, to work around this, I'm wondering if it is possible to make the background of a Text widget transparent.\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1618,"Q_Id":39197579,"Users Score":0,"Answer":"It is anyway not possible to do so (without canvas), but if you really need it here's a hack:\n\nGo to paint\nOpen the image you want and type in the text on it in whatever colour or font you want\nSet this image as your background in the frame that you want\nYou can then add whatever buttons you want and place them wherever you want. \n\nI know this is inconvenient but sometimes useful.","Q_Score":2,"Tags":"python,tkinter,widget,transparent,python-3.5","A_Id":42109832,"CreationDate":"2016-08-29T02:03:00.000","Title":"Make the background of 'Text' widget in tkinter transparent","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to add an image in the background of a Text widget in tkinter, but as far as I'm concerned, that is not possible. So, to work around this, I'm wondering if it is possible to make the background of a Text widget transparent.\nThanks in advance.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1618,"Q_Id":39197579,"Users Score":1,"Answer":"No, it is not possible to make the background of the text widget transparent.","Q_Score":2,"Tags":"python,tkinter,widget,transparent,python-3.5","A_Id":39197855,"CreationDate":"2016-08-29T02:03:00.000","Title":"Make the background of 'Text' widget in tkinter transparent","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am building a wxpython project, I have a list of elements that are a class instances. Each of this elements has an attribute title. In a ListBox I want to display only the titles, and when the title selected, after we GetSelection from listbox, the instance should be returned and not just the title. Is this achievable ?\nNote: Searching for the string is out of question because names(titles) may be recurring.\nThank you.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":38,"Q_Id":39257126,"Users Score":1,"Answer":"Put your instances in a list\nUse GetSelection to retrieve the index of the item you selected from the listbox\nGet the corresponding instance from that index in the list","Q_Score":0,"Tags":"python,listbox,wxpython","A_Id":39257327,"CreationDate":"2016-08-31T19:01:00.000","Title":"WxPython, How to fill ListBox with class attributes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a wxpython project where I am drawing a diagram on to a panel that I need to be able to zoom in\/out to this diagram(a directed acyclic graph in my case). I will achieve this by mouse scroll when the cursor is on the panel, however that is not a part of my question. I need an advice from an experienced person about the method I am using for zooming. So far I thought as doing,\n\nThere are lines, rectangles and texts inside rectangles within this diagram. So maybe I could increase\/decrease their length\/size with the chosen mouse event. But it is hard to keep it balanced because rectangles are connected with lines their angles should not change, and texts inside the rectanges should stay in the middle of them.\nOther method I thought of doing is to search for a built-in zoom method. Which I heard about something like Scale. However I have some questions about this method. Will this work on vector drawings(like mine) rather than images. And will it be scaling only the panel I chose and not the whole screen ? After I hear your advice about this, I will look deeper into this, but now I am a bit clueless.\n\nSorry if my question is too theoretical. But I felt I needed help in the area. Thanks in advance.\nNote: Zooming not necessarily applied by scrolling.\nNote2: My research also led me to FloatCanvas. Is this suitable to my needs ?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":686,"Q_Id":39334441,"Users Score":1,"Answer":"Yes, from your description FloatCanvas would certainly meet your needs.  \nAnother possibility to consider would be the wx.GraphicsContext and related classes.  It is vector-based (instead of raster) and supports the use of a transformation matrix which would make zooming, rotating, etc. very easy.  However, the actual drawing and management of the shapes and such would probably require more work for you than using FloatCanvas.","Q_Score":1,"Tags":"python,wxpython,zooming","A_Id":39335812,"CreationDate":"2016-09-05T16:20:00.000","Title":"WxPython zooming technique","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know where does tkinter load his fonts from.\nIs it from \/usr\/share\/fonts or does it have a specific folder ?\nthanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":67,"Q_Id":39336204,"Users Score":0,"Answer":"So as Bryan said, tkinter gets the fonts from the standard font locations of the OS. Putting fonts there will permit to tkinter to be able to load them.\nThanks Bryan","Q_Score":2,"Tags":"python,python-3.x,tkinter","A_Id":39337845,"CreationDate":"2016-09-05T18:50:00.000","Title":"Where does tkinter load his fonts from?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have added 2 LinearRegionItems to a pyqtgraph plot. When I move the boundary of 1 over the other, the boundary never overlaps the other.\nI would like to know how to allow overlapping. This is a functionality that I need, where I am selecting different regions of the data plot to be used later on.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":78,"Q_Id":39337545,"Users Score":0,"Answer":"Sorry, there was a bug in my code which was handling the case where a part of one LinearRegionItem overlapped with another LinearRegionItem.\nNow I see that one linearRegionItem can lie on top of another one.\nConsider this solved","Q_Score":1,"Tags":"python,pyqtgraph","A_Id":39413892,"CreationDate":"2016-09-05T20:48:00.000","Title":"How to get 2 or more LinearRegionItem to overlap each other","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to create a lot of .fla files automatically but I'm not sure where to start.\nThis is for an internal tool for a cartoon studio, they work with Flash CC, each file Flash is a scene for an episode (scene1, scene 2, scene 3 ...) and in each file, we have a .flv from the scene, a .wav, a .jpg, and a specific template (folder and layers organisations and few stuff like a safe frame etc)\nEvery external elements are in external folders\n\na folder with .flv\na folder with .wav\na folder with .jpg\n\nAnd everything is named incrementially like this \"video_sc1, video_sc2\" \"sound_sc1, sound_sc2\" etc.\nSo, is there a possibility to create a lot of .fla file (the same amount as detected in the .flv folder, for example) with all the \"corresponding\" stuff inside ?\nAnd finally obtaining something like this \"animfile_sc01.fla, animfile_sc02.fla ...\" without doing all this manually (very boring and time-consuming)\nI do some python, and very very little .jsfl, so, I'm not sure about the faisability of my project ( I use flash mainly for animation and graphics, not so much for coding).\nDo you have any hint or tip to show me ?\nThanks !\n(ps: my english is not perfect, but I can explain better if needed)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":223,"Q_Id":39371700,"Users Score":0,"Answer":"I've got the same issue.\nI suggest you see the structure of a fla.\nto do that take one of you fla and save it from animate into a .xfl\nIt's basically a folder what inside all the library and the content visible.\nIf you open the DOMDocument.xml you'll see the XML structure of your fla.\nIf you use visual basic or other software you may be able to \"recreate2 a DOMDocument.xml and all the other folder and the rebuild the fla.\nIt's a b it long g and tricky..but it may works","Q_Score":1,"Tags":"python,flash,actionscript,jsfl","A_Id":41182630,"CreationDate":"2016-09-07T13:48:00.000","Title":"Automatically creating hundreds of .fla files, who gather external ressources","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying reproduce the game \"Snake\" in pygame, using the pygame.blit function, instead of pygame.draw. My question is how to make an image follow another image. I mean, make the snake's body photo follow your head. In the current state of my program the head moves on its own.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":42,"Q_Id":39380527,"Users Score":0,"Answer":"Keep positions of snake segments on list (first segment is head).\nLater new position of head insert before first segment (and remove last segment). \nUse this list to blit snake segments.","Q_Score":0,"Tags":"python","A_Id":39380622,"CreationDate":"2016-09-07T23:40:00.000","Title":"Pygame: how to blit an image that follows another image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Alright, so I managed to use PyInstaller to build a homework assignment I made with Pygame. Cool. The executable works fine and everything.\nProblem is, alongside the executable, there is so much clutter. So many files, like pyds and dlls accompany the exe in the same directory, making it look so ugly.\nNow, I know that these files are important; the modules I used, such as Pygame, need them to work. Still, how do I make PyInstaller build my game, so that it puts the clutter into its own folder? I could just manually make a folder and move the files in there, but it stops the exe from working.\nIf this info would help any, I used Python 3.4.3 and am on Windows.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":4472,"Q_Id":39419108,"Users Score":2,"Answer":"Not trying to dig up this old question, but this was at the top of my Google search so it may be for others as well.\nIf you intend to distribute the program in some kind of folder, you can always just mark everything unnecessary as hidden in Windows, and it will remain hidden even if you compress or extract it.\nFor a program that I designed to be very user friendly, I just selected each file and folder that was not necessary to the user and hid them. If the user has show hidden files on (rarely default), they aren't likely to be intimidated by the mess of files that pyinstaller creates.","Q_Score":2,"Tags":"python,build,pygame,pyinstaller","A_Id":68652885,"CreationDate":"2016-09-09T20:15:00.000","Title":"How to remove clutter from PyInstaller one-folder build?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Let's say I need to make use of keypress events. The easiest solution I have so far is the Tkinter module (testing for cross platforms after the code is done).\nHowever, I suck at programming GUI so I am starting with a CLI first. Am I able to use Tkinter.bind() in CLI mode?\nI am on Python 2.7","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":35,"Q_Id":39482074,"Users Score":0,"Answer":"No, you are not able to use Tkinter's bind method for a CLI program.","Q_Score":0,"Tags":"python-2.7,tkinter,keypress","A_Id":39488864,"CreationDate":"2016-09-14T03:28:00.000","Title":"Can Tkinter keypress modules be used when in CLI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to add QLineEdit\/checkbox\/button in 2 layouts. So no matter which one I press in which ever window they both do the same thing, update each other as I type and so on.\nIs it possible or do I need to create second set of controls and then signal link each other?\nRegards\nDariusz","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":284,"Q_Id":39506856,"Users Score":1,"Answer":"A widget can only exist in one place at a time. You will need to link the two unfortunately. Do yourself a favor and do it properly via a model.\nIf it were possible for a widget to exist in multiple places, this would lead to a whole lot of problems: cyclic trees, multiple parents, etc.","Q_Score":1,"Tags":"python,pyqt,pyqt4","A_Id":39506951,"CreationDate":"2016-09-15T08:54:00.000","Title":"PyQt display 1 widget in 2 layouts?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to run a Kivy python file on Komodo IDE (for Mac) but its giving me this error \nimport kivy\nImportError: No module named kivy although if I drag-drop the file on the Kivy app its running normally,\nany ideas ?, thanks","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":141,"Q_Id":39532034,"Users Score":0,"Answer":"This only works for Komodo code intelligence.  Run time is still limited to PYTHONPATH.  To run a script that's using Kivy, even in your command line, the kivy source has to be on your PYTHONPATH.\nYou can add items to your PYTHONPATH in Komodo using Edit > Preferences > Environment then create a New environmental variable to append the kivy installation location to your $PYTHONPATH, ie $PYTHONPATH:install\/location\/kivy.\nIf you don't mind having it in your system though, I'd just do what @tuan333 suggest above, install it using pip, then make sure you're using THAT Python interpreter in Komodo.","Q_Score":1,"Tags":"python,python-3.x,kivy,komodo,kivy-language","A_Id":39537143,"CreationDate":"2016-09-16T12:53:00.000","Title":"Can't run kivy file on Komodo","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been making a small game for a homework assignment using Pygame with Livewires. I've been trying to debug it, but to no success; I can't get a look at the variables I want to look at before the main loop is executed. Though I can press F10 to skip over the main loop, that just stops the Autos and Watches window from working; apparently they can only records vars when the game is paused by the debugger. \nIs there a way for me to use the debugger to look at the vars in runtime? Because no matter what I do while the debugger is paused, I can't look at the data inside the game objects I want to take a look in","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1009,"Q_Id":39538259,"Users Score":0,"Answer":"Thanks to Jack Zhai's suggestion, I figured it out. \n\nWhen the breakpoint is hit, unpause the debugger (shortcut: F5)\nPlay to the point in the game you want to debug.\nRepause the debugger using Break All (shortcut: Ctrl-Alt-Break)\nPress F10 a few times; this makes it go a few more steps in the main livewires loop.\nIn the autos window, there is an entry that contains the a list of the game's objects. Look through it, until you find the one(s) you're looking for. In my case, the list of the objects was self._objects. The object I was looking for was the second, which in other words, was self._objects[1].\nThe dropdown arrows of the object(s) you're looking for show the object's members.  If you want to look at the object's properties in a less cumbersome way, use the Interactive Debugger to assign that object to a variable. That way, you can look at its values through typing objectNameHere.objectValueHere into the interactive debug console.\n\nIn my case, I had to type in player = self._objects[1] to get it assigned, then could see the player's x position by then entering player.x into the debug console.\n--\nI know this answer might only work for my specific problem, so if anyone else has a better one, please post it for others' sake.","Q_Score":1,"Tags":"python,visual-studio,debugging,pygame,livewires","A_Id":39582747,"CreationDate":"2016-09-16T18:45:00.000","Title":"How to debug Pygame application with Visual Studio during runtime","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to dynamically create and delete pages in a notebook. In the main class I successfully create and add pages with a button. The pages are a separate class of course, and have a button inside.\nI know I can put the button outside the notebook and delete them from the main class but I want to use page's own button to self destruct the whole page as it won't be needed any more.\nSorry I don't post any code but I'm posting from my cellphone. Also it seems to be a question not so specific to need a minimal working example.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":224,"Q_Id":39540563,"Users Score":0,"Answer":"As you've guessed, care needs to be taken when destroying UI objects from their own event handlers.  Not only is the current event handler still active, but there may be other pending events that are still in the queue, and if the target object has been destroyed when they are delivered then you can get a crash.\nThe best thing to do is to defer the destruction until after the current and possible pending event handlers have been completed and there is nothing waiting to be done on the UI object except for the destruction that you want to do.  And the best way to do that is to use wx.CallAfter.  It will call a function with parameters that you give it the next time the the event loop empties, so implicitly there is not anything else waiting to be done or sent to the UI object in question.\nIn your case it would be safe to do things like immediately remove the page from the notebook, and hide the page window.  Then use wx.CallAfter to call some function (perhaps in the notebook class) which calls the page window's Destroy method and does any other cleanup that is necessary.  The reason I suggest splitting these two sets of tasks is not because it will take a long time for the function to be called, but in some cases it may be long enough to flicker momentarily in a transitory state, so the appearance is less smooth for the users.","Q_Score":0,"Tags":"python,wxpython,wxnotebook","A_Id":39541649,"CreationDate":"2016-09-16T21:49:00.000","Title":"Self delete page in wx.Notebook","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a kivy app for the raspberry pi that can use a touch screen. I was able to get the demos to work with the touchscreen with just \"python ~\/kivy\/examples\/demo\/showcase\/main.py\". The issue comes when I need to start the app with \"sudo python main.py\", the touchscreen then ceases to work. \nThe app I am trying to write uses the rpi_ws281x library for controlling addressable leds which HAS to be run as root. Is there a way to run the kivy app as root while still enabling the touchscreen functionality? \nIf there isn't, is there a way to send data from the kivy app to say a script which is running sudo that controls the leds? \nI've looked a lot of places but no one seems to have had this problem before (or they could work around it by changing the privileges of other directories where they were accessing the sudo protected content). Any help is greatly appreciated!","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":989,"Q_Id":39542539,"Users Score":4,"Answer":"Well apparently I didn't look hard enough. The solution is to copy \"~\/.kivy\/config.ini\" to \"\/root\/.kivy\/config.ini\"\nSo the commands are \n\"sudo cp ~\/.kivy\/config.ini \/root\/.kivy\/config.ini\"\nAnd then everything works happily together!","Q_Score":1,"Tags":"python,raspberry-pi,kivy,led","A_Id":39542558,"CreationDate":"2016-09-17T03:22:00.000","Title":"Run Kivy app as root user with touch screen on raspberry pi","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"this is my first question. What I would like to achieve is in a normal window for the text-based game to be running, however I would also like to have a pygame window running as well that shows a map that updates. Thank you in advance.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":400,"Q_Id":39543888,"Users Score":0,"Answer":"The only way to have the text entries separate to the pygame window is to use someVar = input(\"A string\") so the text input is in the python shell or the command window\/Linux terminal and then have pygame reference that var.","Q_Score":0,"Tags":"python,pygame","A_Id":39551714,"CreationDate":"2016-09-17T07:06:00.000","Title":"Python\/Pygame: Can you run a program whilst having a Pygame window that can still update?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been installing PyautoGui on my WIN10 PC. But I am getting the following error, i have been getting a lot of errors jut to get this far. \ni have been reinstalling python so its destination folder is in  C:\\Python instead of C:\\Users\\Home\\AppData\\Local\\Programs\\Python\\Python35-32 mabye thats why ? How do i  fix this ?  \n\nC:\\Python\\Scripts>pip.exe install pyautogui Collecting pyautogui\n  Using cached PyAutoGUI-0.9.33.zip Collecting pymsgbox (from pyautogui)\n  Using cached PyMsgBox-1.0.3.zip Collecting PyTweening>=1.0.1 (from\n  pyautogui)   Using cached PyTweening-1.0.3.zip Collecting Pillow (from\n  pyautogui)   Using cached Pillow-3.3.1-cp35-cp35m-win32.whl Collecting\n  pyscreeze (from pyautogui)   Using cached PyScreeze-0.1.8.zip\n      Complete output from command python setup.py egg_info:\n      Traceback (most recent call last):\n        File \"\", line 1, in \n        File \"C:\\Users\\Home\\AppData\\Local\\Temp\\pip-build-kxm3249e\\pyscreeze\\setup.py\",\n  line 6, in \n          version=import('pyscreeze').version,\n        File \"c:\\users\\home\\appdata\\local\\temp\\pip-build-kxm3249e\\pyscreeze\\pyscreeze__init__.py\",\n  line 21, in \n          from PIL import Image\n      ImportError: No module named 'PIL'\nCommand \"python setup.py egg_info\" failed with error code 1 in\n  C:\\Users\\Home\\AppData\\Local\\Temp\\pip-build-kxm3249e\\pyscreeze\\","AnswerCount":6,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":10149,"Q_Id":39544944,"Users Score":2,"Answer":"I encountered the same error message as you did. This workaround worked for me. Try these steps in order...\n\nInstall PyScreeze 0.1.7. \nUpdate PyScreeze to 0.1.8.\nInstall PyAutoGui.\n\nI hope this helps.","Q_Score":3,"Tags":"python,pip,pyautogui","A_Id":39563987,"CreationDate":"2016-09-17T09:03:00.000","Title":"Installing PyAutoGUI Error in pip.exe install pyautogui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been installing PyautoGui on my WIN10 PC. But I am getting the following error, i have been getting a lot of errors jut to get this far. \ni have been reinstalling python so its destination folder is in  C:\\Python instead of C:\\Users\\Home\\AppData\\Local\\Programs\\Python\\Python35-32 mabye thats why ? How do i  fix this ?  \n\nC:\\Python\\Scripts>pip.exe install pyautogui Collecting pyautogui\n  Using cached PyAutoGUI-0.9.33.zip Collecting pymsgbox (from pyautogui)\n  Using cached PyMsgBox-1.0.3.zip Collecting PyTweening>=1.0.1 (from\n  pyautogui)   Using cached PyTweening-1.0.3.zip Collecting Pillow (from\n  pyautogui)   Using cached Pillow-3.3.1-cp35-cp35m-win32.whl Collecting\n  pyscreeze (from pyautogui)   Using cached PyScreeze-0.1.8.zip\n      Complete output from command python setup.py egg_info:\n      Traceback (most recent call last):\n        File \"\", line 1, in \n        File \"C:\\Users\\Home\\AppData\\Local\\Temp\\pip-build-kxm3249e\\pyscreeze\\setup.py\",\n  line 6, in \n          version=import('pyscreeze').version,\n        File \"c:\\users\\home\\appdata\\local\\temp\\pip-build-kxm3249e\\pyscreeze\\pyscreeze__init__.py\",\n  line 21, in \n          from PIL import Image\n      ImportError: No module named 'PIL'\nCommand \"python setup.py egg_info\" failed with error code 1 in\n  C:\\Users\\Home\\AppData\\Local\\Temp\\pip-build-kxm3249e\\pyscreeze\\","AnswerCount":6,"Available Count":3,"Score":0.0333209931,"is_accepted":false,"ViewCount":10149,"Q_Id":39544944,"Users Score":1,"Answer":"I'm happy to report that this installation error has been fixed as of version 0.9.34. All you have to do is install or update PyAutoGUI from PyPI.","Q_Score":3,"Tags":"python,pip,pyautogui","A_Id":42882370,"CreationDate":"2016-09-17T09:03:00.000","Title":"Installing PyAutoGUI Error in pip.exe install pyautogui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been installing PyautoGui on my WIN10 PC. But I am getting the following error, i have been getting a lot of errors jut to get this far. \ni have been reinstalling python so its destination folder is in  C:\\Python instead of C:\\Users\\Home\\AppData\\Local\\Programs\\Python\\Python35-32 mabye thats why ? How do i  fix this ?  \n\nC:\\Python\\Scripts>pip.exe install pyautogui Collecting pyautogui\n  Using cached PyAutoGUI-0.9.33.zip Collecting pymsgbox (from pyautogui)\n  Using cached PyMsgBox-1.0.3.zip Collecting PyTweening>=1.0.1 (from\n  pyautogui)   Using cached PyTweening-1.0.3.zip Collecting Pillow (from\n  pyautogui)   Using cached Pillow-3.3.1-cp35-cp35m-win32.whl Collecting\n  pyscreeze (from pyautogui)   Using cached PyScreeze-0.1.8.zip\n      Complete output from command python setup.py egg_info:\n      Traceback (most recent call last):\n        File \"\", line 1, in \n        File \"C:\\Users\\Home\\AppData\\Local\\Temp\\pip-build-kxm3249e\\pyscreeze\\setup.py\",\n  line 6, in \n          version=import('pyscreeze').version,\n        File \"c:\\users\\home\\appdata\\local\\temp\\pip-build-kxm3249e\\pyscreeze\\pyscreeze__init__.py\",\n  line 21, in \n          from PIL import Image\n      ImportError: No module named 'PIL'\nCommand \"python setup.py egg_info\" failed with error code 1 in\n  C:\\Users\\Home\\AppData\\Local\\Temp\\pip-build-kxm3249e\\pyscreeze\\","AnswerCount":6,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":10149,"Q_Id":39544944,"Users Score":2,"Answer":"Instead of letting PyautoGUI get all the packages for you.\nInstall all of them individually. Then, run the pip install --upgrade _packageName_ \nThen run pip install pyautogui.\nHope this helps.","Q_Score":3,"Tags":"python,pip,pyautogui","A_Id":40112934,"CreationDate":"2016-09-17T09:03:00.000","Title":"Installing PyAutoGUI Error in pip.exe install pyautogui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project that involves creating CUDA kernels in Python. Numba works quite well (what these guys have accomplished is quite incredible), and so does PyCUDA.\nMy problem is that I want to call a C device function from my Python generated kernel. I couldn't find a way to accomplish this. Numba can call CFFI modules but only in CPU code. In PyCUDA I can add my C device functions to the SourceModule, but I couldn't figure out how to include functions that already exist in another library.\nIs there a way to accomplish this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":604,"Q_Id":39555235,"Users Score":2,"Answer":"As far as I am aware, this isn't possible in either language. Neither exposes the necessary toolchain controls for separate compilation or APIs to do runtime linking of device code.","Q_Score":2,"Tags":"python,cuda,cython,numba,pycuda","A_Id":39557406,"CreationDate":"2016-09-18T07:38:00.000","Title":"Calling a C++ CUDA device function from a Python kernel","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a complete newbie to python transiting from C++. \nWhile learning C++, I was explained that header files tells about the working of the function or define them to the compiler so that it understands what means what i.e., iostream contains the definition of cin (nd much more) so that the compiler knows that it is a keyword and understands its function.\nHowever, python and java do not need header files.\n So basically how does the compiler understands the actual meaning\/function of 'print' or 'input' in python?????","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":2209,"Q_Id":39576478,"Users Score":4,"Answer":"Header files in C\/C++ are a \"copy paste\" mechanism. The included header file is literally written into the file while preprocessing (copy pasting the source code together).\nAfter that is done,  the compiler transaltes the source code. The linker then connects the function calls.\nThat is somewhat outdated and error prone -> can be really frustrating as well when sth doesnt work as expected.\nNewer languages have module systems, which are nicer (import simply does it).","Q_Score":2,"Tags":"python","A_Id":39576570,"CreationDate":"2016-09-19T15:08:00.000","Title":"Why Python and java does not need any header file whereas C and C++ needs them","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a complete newbie to python transiting from C++. \nWhile learning C++, I was explained that header files tells about the working of the function or define them to the compiler so that it understands what means what i.e., iostream contains the definition of cin (nd much more) so that the compiler knows that it is a keyword and understands its function.\nHowever, python and java do not need header files.\n So basically how does the compiler understands the actual meaning\/function of 'print' or 'input' in python?????","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":2209,"Q_Id":39576478,"Users Score":1,"Answer":"In Java and Python we use a similar keyword called import to add a package and use the methods in it. But in advanced languages like Java and Python few packages are imported by default.\ne.g. in Java java.lang.* is imported by default.","Q_Score":2,"Tags":"python","A_Id":39576943,"CreationDate":"2016-09-19T15:08:00.000","Title":"Why Python and java does not need any header file whereas C and C++ needs them","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a complete newbie to python transiting from C++. \nWhile learning C++, I was explained that header files tells about the working of the function or define them to the compiler so that it understands what means what i.e., iostream contains the definition of cin (nd much more) so that the compiler knows that it is a keyword and understands its function.\nHowever, python and java do not need header files.\n So basically how does the compiler understands the actual meaning\/function of 'print' or 'input' in python?????","AnswerCount":3,"Available Count":3,"Score":-0.0665680765,"is_accepted":false,"ViewCount":2209,"Q_Id":39576478,"Users Score":-1,"Answer":"Java and Python have import which is similar to include.\nSome inbuilt functions are built in and hence does not require any imports.","Q_Score":2,"Tags":"python","A_Id":39576524,"CreationDate":"2016-09-19T15:08:00.000","Title":"Why Python and java does not need any header file whereas C and C++ needs them","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to create a user interface without the help of python framework (like tinker or pygame) and use only vanilla python code? If yes, how?\nCan you briefly explain how python framework works?\nIs the code of different python framework different?\nIf the computer did not have the framework installed, will the program still runnable if the program uses a framework?\nThanks very much","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":4330,"Q_Id":39654954,"Users Score":1,"Answer":"Yes, after all tinker and pygame are just python classes packaged as modules.\nPython frameworks are a bunch of pre-tested and reusable modules that allow you to use and extend upon so you don't have to reinvent the wheel. \nYes, frameworks will have differences in usability and code.\nThe computer will always need the dependencies, though you can package these in various ways aka create a package that has all your dependencies for the program to run.","Q_Score":2,"Tags":"python,user-interface,frameworks","A_Id":39655710,"CreationDate":"2016-09-23T07:21:00.000","Title":"Making GUI with only python without framework?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an image editor created in tkinter. However, I would add a floating widgets that exist in PyQt. Is there any way to run integrated tkinter with PyQt?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":367,"Q_Id":39679473,"Users Score":0,"Answer":"No, there is no way to combine widgets from PyQt and Tkinter in a single app. At least, not without resorting to running each toolkit in a separate thread or process. You can't embed the widgets of one into the widgets of the other.","Q_Score":1,"Tags":"python,tkinter,pyqt,pyqt4","A_Id":39681979,"CreationDate":"2016-09-24T18:09:00.000","Title":"Using widgets intregrated. PyQT with Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an image editor created in tkinter. However, I would add a floating widgets that exist in PyQt. Is there any way to run integrated tkinter with PyQt?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":367,"Q_Id":39679473,"Users Score":1,"Answer":"I make a workaround that solved the problem. I used python subprocess for call the PyQT instance and the option QtCore.Qt.WindowStaysOnTopHint for app running on top of tkinter. It\u00b4s work.\nbut the best solution is to create a thread in python and call PyQt in this thread. In this case it is possible to pass an instance of tk for PyQt and make communication between the two. It\u00b4s work too. It\u00b4s fine.","Q_Score":1,"Tags":"python,tkinter,pyqt,pyqt4","A_Id":39689904,"CreationDate":"2016-09-24T18:09:00.000","Title":"Using widgets intregrated. PyQT with Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a model called widgetManager and 2 widget models called emailWidget and TextWidget. Now a single instance of widgetManager can have multiple instances of emailWidget and TextWidget. How can this be achieved with the following in mind\n\nTill now i only have two but there can be more in future\nThe order of widget is very important\n\nI have tried with adding two many-many relations in widgetManager but that seems impractical and not the best way to go around because if first condition.\nWhat i have in mind is maybe i can somehow make a base widget class and extend all the widgets from that class but i am not sure about that. Would be super helpful if someone can point me in the right direction. Thanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":27,"Q_Id":39691679,"Users Score":1,"Answer":"If I understood your description correctly, you want a relationship where there can be many emailWidget or TextWidget for one instance of widgetManager. \nWhat you can do in this case is add a ForeignKey field for widgetManager to emailWidget and TextWidget. This way, you can have many instances of the widgets while they refer to the same manager.\nI think you may have confused inheritance with model relationships when you said you want to extend widgets from a base class. Perhaps I'm wrong? \nNot sure what you mean't about order of the widget being important either..","Q_Score":0,"Tags":"python,django,django-models","A_Id":39692799,"CreationDate":"2016-09-25T20:46:00.000","Title":"Proper model defination in django for a widget manager","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm currently using PyGame to build games on python, however exporting becomes rather difficult as Py2Exe and Py2App are almost the only ways to do so and are not very effective. I tried to using the wonderful exporting mechanic in Processing (in Python mode), but this opened a Pandora's box of problems.\n\nHow do you import modules in Processing.py ? I read that if the module is in the form of a PY file it is simply to be located in the same folder as the sketch. But some modules, like PyGame, are more complex and require an installer or a wheel (WHL file, which is installed through PIP).\nDuring some testing, I tried to export a simple one-line program ( print('a') ) but the 'application.windows64' folder was missing an EXE file. I'm not an expert, but I think that might be a problem :)\n\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":218,"Q_Id":39713752,"Users Score":2,"Answer":"processing.py is not compatible with CPython (native python), nor with any c-language modules.","Q_Score":1,"Tags":"python,python-3.x,export,processing","A_Id":40960287,"CreationDate":"2016-09-26T23:12:00.000","Title":"Importing Complex Modules into Processing.py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"tkMessageBox.askyesno('Title', 'Message', icon=tkMessageBox.WARNING) on OS X just gives me the rocket icon.\nI know there is some weirdness with OS X and tkMessageBox icons because tkMessageBox.showerror() just shows the rocket icon, but tkMessageBox.showwarning shows a yellow triangle (with a small rocket in the corner)\nIs this is a bug?\nIs there some workaround to get a warning triangle and Yes\/No buttons without having to resort to making my own message box window from scratch?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1338,"Q_Id":39756822,"Users Score":2,"Answer":"You can use icon='warning' instead of icon=tkMessageBox.WARNING\nI just tried that on Windows. Sorry I don't have OSX to test","Q_Score":4,"Tags":"python,macos,tkinter,tkmessagebox","A_Id":69845490,"CreationDate":"2016-09-28T20:12:00.000","Title":"Why can't I change the icon on a tkMessagebox.askyesno() on OS X?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a program on the Raspberry Pi with a touchscreen display. \nI'm using Python Tkinter that has two entry widgets and one on screen keypad. I want to use the same keypad for entering data on both entry widgets. \nCan anyone tell me how can i check if an entry is selected? Similar like clicking on the Entry using the mouse and the cursor appears. How can I know that in Python Tkinter?\nThank you.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1831,"Q_Id":39768925,"Users Score":2,"Answer":"There is always a widget with the keyboard focus. You can query that with the focus_get method of the root window. It will return whatever widget has keyboard focus. That is the window that should receive input from your keypad.","Q_Score":1,"Tags":"python,tkinter,raspberry-pi,touchscreen,raspberry-pi3","A_Id":39770561,"CreationDate":"2016-09-29T11:23:00.000","Title":"Check if Entry widget is selected","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I finish a GTK interface with GTK3.18,and it works well,but when i change to GTK3.14 version,the interface turn out to be very bad,the size and the colore of the widgets is changed,and i find there is no enough information about the GTK3.14 version.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":48,"Q_Id":39855273,"Users Score":1,"Answer":"The CSS 'api' was basically undocumented and unstable before 3.20 so there isn't really any reasonable way to support all versions before it unless you make a separate theme for each version.","Q_Score":0,"Tags":"python,css,gtk","A_Id":39872085,"CreationDate":"2016-10-04T14:44:00.000","Title":"what's the difference between GTK 3.14 and 3.18 on the css load","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So i'm programming python program that uses wxPython for UI, with wx.TreeCtrl widget for selecting pictures(.png) on selected directory. I would like to add hover on treectrl item that works like tooltip, but instead of text it shows bitmap picture.\nIs there something that already allows this, or would i have to create something with wxWidgets? \nI am not too familiar with wxWidgets, so if i have to create something like that how hard would it be, lot of code is already using the treectrl, so it needs to be able to work same way.\nSo how would i have to go about doing this? And if there might be something i might be missing id be happy to know.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":160,"Q_Id":39891681,"Users Score":1,"Answer":"Take a look at the wx.lib.agw.supertooltip module. It should help you to create a tooltip-like window that displays custom rich content.\nAs for triggering the display of the tooltip, you can catch mouse events for the tree widget (be sure to call Skip so the tree widget can see the events too) and reset a timer each time the mouse moves.  If the timer expires because the mouse hasn't been moved in that long then you can use tree.HitTest to find the item that the cursor is on and then show the appropriate image for that item.","Q_Score":0,"Tags":"python,bitmap,wxpython","A_Id":39901257,"CreationDate":"2016-10-06T08:54:00.000","Title":"wxpython treectrl show bitmap picture on hover","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a simple application and deployed it on Sony Xperia Z and Galaxy Prime devices. On both it's really very hard (I've got to click many times before it reacts) to:\n\nput focus on a TextInput\nselect a ToggleButton\nclick a Button\netc.\n\nThe same time a ScrollView (that is the container for the mentioned widgets) works perfectly smooth. And when run on desktop then it's alright.\nI use kivy 1.9.1, python 2.7, build on Ubuntu 16 using buildozer. Don't know what else could I say... (Let me know, please)\nHave you experienced such an issue?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":77,"Q_Id":39925847,"Users Score":3,"Answer":"You should update to kivy 1.9.2-dev, the problem is fixed there. In buildozer.spec file, write requirement kivy==master.","Q_Score":0,"Tags":"android,python,kivy","A_Id":39929515,"CreationDate":"2016-10-07T21:09:00.000","Title":"Kivy - hard to select Widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":0,"Answer":"just go on cmd and type pip intall Tk interface,\ni thinks this is the full true name of tkinter module","Q_Score":41,"Tags":"python,tkinter,module","A_Id":68200579,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":0,"Answer":"I had to install python3-tk manually before it worked (via apt-get)","Q_Score":41,"Tags":"python,tkinter,module","A_Id":52298239,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0142847425,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":1,"Answer":"This just has to do with the version changes\npython 2.x: import tkinter as tk\npython 3.x: import Tkinter as tk","Q_Score":41,"Tags":"python,tkinter,module","A_Id":67446536,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0285636566,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":2,"Answer":"On a MacBook use brew install python-tk\nThe error will be sorted out.","Q_Score":41,"Tags":"python,tkinter,module","A_Id":67346820,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0285636566,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":2,"Answer":"import Tkinter as tk\nPython 3 changed tkinter (from python 2.7) to Tkinter","Q_Score":41,"Tags":"python,tkinter,module","A_Id":66579584,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0285636566,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":2,"Answer":"to find your package run:\n\nsudo yum search python|grep tk\n\nmine was:\n\nyum install python3-tkinter.x86_64","Q_Score":41,"Tags":"python,tkinter,module","A_Id":55162847,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":0,"Answer":"pip shown \nCould not find a version that satisfies the requirement python--tkinter (from versions: )\nNo matching distribution found for python--tkinter\nYou are using pip version 10.0.1, however version 19.0.3 is available.\nYou should consider upgrading via the python -m pip install --upgrade pip command.","Q_Score":41,"Tags":"python,tkinter,module","A_Id":55540040,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0142847425,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":1,"Answer":"import Tkinter as tk\nNotice the T. This was changed in python 3.x","Q_Score":41,"Tags":"python,tkinter,module","A_Id":67800600,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0428309231,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":3,"Answer":"Follow this guide to install \"tkinter\". However now with Python version 3.1 onwards, it is part of the standard python distribution.\nYou can also install it using sudo apt-get install python3-tk-dbg, if you are in virtualenv. (Same can be done for normal installation, not just virtualenv)","Q_Score":41,"Tags":"python,tkinter,module","A_Id":52841363,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:\n\ncollecting tkinter \nCould not find a version that satisfies the requirement tkinter (from versions:)\n  No matching distribution found for tkinter\n\nI have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?","AnswerCount":14,"Available Count":10,"Score":0.0142847425,"is_accepted":false,"ViewCount":98413,"Q_Id":39928710,"Users Score":1,"Answer":"I was able to fix this on Amazon Linux 2 with python2.7 by running this sudo yum install python-tools -y command.","Q_Score":41,"Tags":"python,tkinter,module","A_Id":62074234,"CreationDate":"2016-10-08T04:33:00.000","Title":"Why is there no tkinter distribution found?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've made an app using the Kivy cross-platform tool and I built the apk file using python-for-android. I want to store a secret-key locally in the application but since the apk file can be disassembled, How can I make sure my secret-key is safe?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":353,"Q_Id":39939523,"Users Score":1,"Answer":"You can't secure it because after, p4a compiles it into private.mp3.\nYou can rename that file from private.mp3 to private.tar.gz and still get access to all the codes and information.","Q_Score":0,"Tags":"android,python,security,kivy","A_Id":61085242,"CreationDate":"2016-10-09T02:52:00.000","Title":"Securing android application made by kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've made an app using the Kivy cross-platform tool and I built the apk file using python-for-android. I want to store a secret-key locally in the application but since the apk file can be disassembled, How can I make sure my secret-key is safe?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":353,"Q_Id":39939523,"Users Score":0,"Answer":"After dissembling my apk file, I figured out that python-for-android stores all of its stuff including the python installation and the project itself in a binary file named private.mp3 so the source is not fully open and I might be good to go.","Q_Score":0,"Tags":"android,python,security,kivy","A_Id":40034392,"CreationDate":"2016-10-09T02:52:00.000","Title":"Securing android application made by kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to compare two screenshots containing text. Basically both the screenshots contains some pretty formatted text. I want to compare if the same formatting being reflected in both the pictures as well as same text appearing at same location in both images. \nHow I am doing it right now is - \n\nApply bilateral filters to remove the underlines of text.\nApply threshold with value 180 as min value and clear them out\nApply Gaussian blur on the image to remove the unfilled space between the characters.\nApply threshold again with value 250 as min value.\nCompute contours in the images\nDraw rectangle bounding box around contours\nuse O(n^2) algo to find out max overlapped rectangle and compare text within it.\n\nHowever the problem is the contours appearing in both the images are different, i.e. in one of the image number of contours are 38 while other contains 53. I want to have a generic solution and don't want to depend upon the image content. However one thing for sure is the image is containing a well formatted text.\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1329,"Q_Id":40019315,"Users Score":0,"Answer":"I'm not sure to understand what do you want exactly but to get bounding box around word in image, i could do this :\n\nApply processing to get good a thresholding : only text, background in black, text in white. This step depends on the type and quality of your image.\nCompute the sum of each line. The sum should be different from 0 where there is text and all lines in the space between each line should be null (you can set a threshold on this value if there is some noise). You can find the top\/bottom line for each text line\nFor each text line found in step 2, compute the sum of each columns.  Same than step two, columns with word should be different from 0. You can find all spaces between words and letters. Remove all spaces which are too small to be a space between two words.\nCongratulation you have the top\/bottom line and first\/last columns of each words.","Q_Score":0,"Tags":"python,opencv,image-processing","A_Id":40022760,"CreationDate":"2016-10-13T11:07:00.000","Title":"putting bounding box around text in a image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a graphical interface with glade that contents a treeview. \nI want to have a button that is initially enabled by doing a simple click on a row of the treeview. \nI am using row-activated, but when I activate a row for the first time I have to double click the row.\nWhich signal should I use to detect the click to activate the row with a single click?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":721,"Q_Id":40033539,"Users Score":1,"Answer":"I know this is an old question, but for future reference, for Python3 and Gtk3 what worked for me was:\n\n    myTree.set_property('activate-on-single-click', True)","Q_Score":2,"Tags":"python,signals,glade","A_Id":57244185,"CreationDate":"2016-10-14T01:30:00.000","Title":"Tree view row activated with ONE click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to kivy. I want to know if there is a way to create a textinput with autocomplete functionality, that lets you select from a dictionary with 200 items. \nSimilar to the select2 that you have in HTML\/CSS","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1838,"Q_Id":40066446,"Users Score":2,"Answer":"You can implement it yourself, just bind the on_text event and change the suggestion_text property. you may also check for TAB key press event to know when to change the text to the suggested completion.","Q_Score":2,"Tags":"python-3.x,kivy","A_Id":40067336,"CreationDate":"2016-10-16T03:12:00.000","Title":"Kivy TextInput with autocomplete","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a text-based game in Python using Tkinter. All the time the window contains a Label and a few Buttons (mostly 3). If it didn't have GUI, I could just use Pickle or even Python i\/o (.txt file) to save data and later retrieve it.  But what is the best way to tell the program to load the exact widgets without losing bindings, buttons' commands, classes etc.?  P.S.: Buttons lead to cleaning the frame of widgets and summoning new widgets. I'm thinking of assigning a lambda (button's command) to a variable and then saving it (Pickle?) to be able to load it in the future and get the right point in the plot. Should I go for it or is there a better, alternative way to accomplish the thing? (If using lambda may work, I'd still be grateful to see your way of doing that.)","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":625,"Q_Id":40071582,"Users Score":1,"Answer":"You need to save stuff in some kind of config file. In generel I'd recommend JSON and YAML as file formats also ini for ease of parsing.\nAlso, do not forget about the windows registry (portability lost then though).","Q_Score":2,"Tags":"python,tkinter","A_Id":40071607,"CreationDate":"2016-10-16T14:46:00.000","Title":"In-game save feature (in tkinter game)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a game in panda3d with support for touch because I want it to be playable on my windows tablet also without attaching a keyboard.\nWhat I want to do is, find a way to draw 2d shapes that don't change when the camera is rotated. I want to add a dynamic analog pad so I must be able to animate it when the d-pad is used with mouse\/touch.\nAny help will be appreciated","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":239,"Q_Id":40077546,"Users Score":2,"Answer":"Make those objects children of base.render2d, base.aspect2d or base.pixel2d. For proper GUI elements take a look at DirectGUI, for \"I just want to throw these images up on the screen\" at CardMaker.","Q_Score":3,"Tags":"python,panda3d","A_Id":40102063,"CreationDate":"2016-10-17T02:09:00.000","Title":"How to draw onscreen controls in panda 3d?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to save the visibility state of a QDockWidget, when the dialog is closed. Even though, the widget is visible, isVisible will return false. \nWhat to do?\nUsing Python (2.7 in my case)","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":725,"Q_Id":40174747,"Users Score":1,"Answer":"This might be the problem: \nMaybe you call isVisible() from an onClose()-function. Means, your Widget was visible, but is not anymore, when you finally call the isVisible() function\nSolution\nCall isVisibleTo([ParentWidget]). This will give you the visibility value relative to e.g. your QMainWindow.","Q_Score":1,"Tags":"python,qt","A_Id":40174748,"CreationDate":"2016-10-21T10:52:00.000","Title":"Python Qt: Check visibility of widget \/ isVisible always return false","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing an app in Python 3.4 using tkinter. It is a timer but with two more functions. \n\nWhen time reaches zero app will shutdown computer (its for windows os generally)\nThe timer can be stopped when user inputs correct password. \n\nThe main window is borderless with blocked Quit button when time is running. But I encountered new problem. Applications can be killed in task manager. So my question is: Is there some way to hide or block from killing process in task manager?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":306,"Q_Id":40208629,"Users Score":1,"Answer":"OK, i have great idea. In my app for shutdown computer im using os.system('shutdown \/p \/f') but i could use different switches. shutdown \/s \/t xxx will do the same but in set time, and computer will shut because it will add scheduled task, and in task manager wont be name of my application which solves my problem :) And my application can be even closed, there is no need to make borderless window and using Quit button because 'shutdown' command works in background.\nI hope it is not a problem that i by myself found answer for my question. At least i think ive found correct answer. Will check this when ill back from work.\nI found 2 external programs that may help me, but i dont know how use them? Can anybody tell me how use nircmd or psexec? I need only shutdown function from them","Q_Score":0,"Tags":"python,tkinter","A_Id":40209914,"CreationDate":"2016-10-23T22:57:00.000","Title":"Is there some way to hide or block from kill app wrote in Python3.4?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"python2.7\nwhen I import Tkinter, it prompt no module named _tkinter, I don't have the limits of administrator, so I install tcl and tk, then recompile python with --with-tcltk-includes and --with-tcltk-libs parameter, but when running 'make', the error \"\"\"*** WARNING: renaming \"_tkinter\" since importing it failed: build\/lib.linux-x86_64-2.7\/_tkinter.so: undefined symbol: Tk_Init\"\"\" occurred, I really don't know how to deal with it\ncan somebody help me?\nthanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":648,"Q_Id":40214784,"Users Score":0,"Answer":"I had the same exact issue with Python-3.4.3. I followed Brice's solution and got halfway there. Not only did I require the -l flags after the -L flag as he suggested, but I discovered my LD_LIBRARY_PATH was inadequate when performing the 'make altinstall'. Be sure to include the same directory in LD_LIBRARY_PATH as used in your -L flag entry.","Q_Score":0,"Tags":"python-2.7,tkinter","A_Id":50161426,"CreationDate":"2016-10-24T09:19:00.000","Title":"undefined symbol: Tk_Init","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In normal Python (3.x) we always use showerror() from the tkinter module to display an error message but what should I do in PyQt5 to display exactly the same message type as well?","AnswerCount":6,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":56321,"Q_Id":40227047,"Users Score":4,"Answer":"Assuming you are in a QWidget from which you want to display an error message, you can simply use QMessageBox.critical(self, \"Title\", \"Message\"), replace self by another (main widget for example) if you are not is a QWidget class.","Q_Score":20,"Tags":"python,message,messagebox,pyqt5","A_Id":60393444,"CreationDate":"2016-10-24T20:32:00.000","Title":"Python PyQt5: How to show an error message with PyQt5","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a virtual console, which would use the systems builtin commands and then do the action and display output results on next line in console. This is all working, but how do I get the contents of the last line, and only the last line in the tkinter text widget? Thanks in advance. I am working in python 3.\nI have treed using text.get(text.linestart, text.lineend) To no avail. Have these been deprecated? It spits out an error saying that AttributeError: 'Text' object has no attribute 'linestart'","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2994,"Q_Id":40251259,"Users Score":1,"Answer":"You can apply modifiers to the text widget indicies, such as linestart and lineend as well as adding and subtracting characters. The index after the last character is \"end\".\nPutting that all together, you can get the start of the last line with \"end-1c linestart\".","Q_Score":3,"Tags":"python,python-3.x,tkinter,console","A_Id":40251792,"CreationDate":"2016-10-25T23:19:00.000","Title":"How to get the contents of last line in tkinter text widget (Python 3)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a virtual console, which would use the systems builtin commands and then do the action and display output results on next line in console. This is all working, but how do I get the contents of the last line, and only the last line in the tkinter text widget? Thanks in advance. I am working in python 3.\nI have treed using text.get(text.linestart, text.lineend) To no avail. Have these been deprecated? It spits out an error saying that AttributeError: 'Text' object has no attribute 'linestart'","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2994,"Q_Id":40251259,"Users Score":0,"Answer":"Test widget has a see(index) method.\ntext.see(END) will scroll the text to the last line.","Q_Score":3,"Tags":"python,python-3.x,tkinter,console","A_Id":56634803,"CreationDate":"2016-10-25T23:19:00.000","Title":"How to get the contents of last line in tkinter text widget (Python 3)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a hand controlled media player application in Python and through OpenCV.I want to embed gesture window of OpenCV in Tkinter frame so I can add further attributes to it.\nCan someone tell how to embed OpenCV camera window into Tkinter frame?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":747,"Q_Id":40269957,"Users Score":0,"Answer":"OpenCV window in Tkinter window is not good idea. Both windows use own mainloop (event loop) which can't work at the same time (or you have to use threading) and don't have contact one with other. \nProbably it is easier to get video frame and display in Tkinter window on Label or Canvas. You can use tk.after(miliseconds, function_name) to run periodically function which will update video frame in Tkinter window.","Q_Score":0,"Tags":"python,opencv,tkinter","A_Id":40271580,"CreationDate":"2016-10-26T18:46:00.000","Title":"opencv window in tkinter frame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have coded a program in Python 3.5 that uses the Tkinter import. I'm trying to figure out a way to run it on computers that don't have Python. First I tried freezing it but I haven't been able to because none of the freezing tools I found support Python 3.5. Then I tried possibly using a online idle but I couldn't find any that support Tkinter. I would prefer to be able to get a .exe file or something similar but if I could run it online that would be good too any ideas?\nEDIT\nSo I have now successfully downloaded PyInstaller using pip. My current problem is when I type this into the console: pyinstaller.exe --onefile --windowed Finder.py\nI get this error: 'pyinstaller.exe' is not recognized as an internal or external command,\noperable program or batch file.\nEDIT\nI have now found the pathway to pyinstaller.exe. Now when I try to use it it says Access is denied.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1343,"Q_Id":40325067,"Users Score":0,"Answer":"Try pyinstaller -F -w Finder.py as the command or you could check out CxFreeze.","Q_Score":1,"Tags":"python,tkinter,python-3.5,cx-freeze","A_Id":40326006,"CreationDate":"2016-10-30T00:46:00.000","Title":"How do I run a Python 3.5 program that uses Tkinter on a computer without Python installed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have coded a program in Python 3.5 that uses the Tkinter import. I'm trying to figure out a way to run it on computers that don't have Python. First I tried freezing it but I haven't been able to because none of the freezing tools I found support Python 3.5. Then I tried possibly using a online idle but I couldn't find any that support Tkinter. I would prefer to be able to get a .exe file or something similar but if I could run it online that would be good too any ideas?\nEDIT\nSo I have now successfully downloaded PyInstaller using pip. My current problem is when I type this into the console: pyinstaller.exe --onefile --windowed Finder.py\nI get this error: 'pyinstaller.exe' is not recognized as an internal or external command,\noperable program or batch file.\nEDIT\nI have now found the pathway to pyinstaller.exe. Now when I try to use it it says Access is denied.","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1343,"Q_Id":40325067,"Users Score":3,"Answer":"I finally figured it out after about three days of work. Fist I downloaded PyInstaleller in the zipped form and extracted it. Then I put my program in the PyInstaller folder. Then I opened a regular command prompt. I then typed cd then the location of the PyInstaller folder. Finally I typed pyinstaller.py --one file --windowed program.py. Then when I went into the PyInstaller folder there was a folder called program with the .exe file in the dist folder. Thanks everyone for all of your help!","Q_Score":1,"Tags":"python,tkinter,python-3.5,cx-freeze","A_Id":40349880,"CreationDate":"2016-10-30T00:46:00.000","Title":"How do I run a Python 3.5 program that uses Tkinter on a computer without Python installed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i have to double an image using python, \nSo i think i can replace each pixel of the image with a square formed by 4 pixels \nhow do i can do that and assign to each pixel of the little square different colors?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1504,"Q_Id":40341471,"Users Score":0,"Answer":"Is that a homework ? Working with a new target image, as suggested in the comments, is the easiest.\nBut theoretically, assuming your original image is represented as some 2 dimension table of pixels, you could do it without creating a new image:\nFirst double both dimensions of the original image (with the original image staying on \"upper left\" and occupying 1\/4 of the new image, and filling the other 3\/4 with blank or any value). \nThen take the lower right pixel from the original image, and write 4 identical pixels in the lower right of the resized image. \nThen take the original pixel directly at the the left of the previous original pixel, copy it on the 4 pixels directly at the left of the 4 previous new pixels. Repeat until you reach the left end of the line, then start the process again on the line above. \nAt some point you will overwrite pixels from the original image, but that doesn't matter since you will already have duplicated those in the new image. \nThat's pure theory, assuming you are not allowed to use external libraries such as Pillow.","Q_Score":1,"Tags":"python,image,python-3.x,python-3.5","A_Id":40343522,"CreationDate":"2016-10-31T11:41:00.000","Title":"Double an image using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've created a gameboy color emulator using C++ and am ready to start developing the frontend that will display the emulator's viewport, emit audio, and also display some debug information. \nI'm looking into using Kivy to create the UI frontend and boost.python (which looks pretty promising) to interop between the C++ core and the python UI.\nWhat I would like to have in my front end are:\n\nA window to show the emulator graphics. More specifically something that let's me update a raw bitmap (i.e. raw pixel data) on each frame. \nA window to display some debug information. More specifically I want a large scrollable text box to show the disassembled code and another one to show the memory.\nA way to emit audio that's generated by the emulator. The core doesn't support audio yet so I'm not sure what it'll look like on the C++ side.\nAccept keyboard input to control the game.\n\nWill Kivy allow me to do all of this? I see that it has dependencies on glew and sdl2 which should take care of the graphics and audio requirements, right? Are there widgets that will let me create the disassembly and memory viewer?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":253,"Q_Id":40355881,"Users Score":1,"Answer":"A window to show the emulator graphics, update a raw bitmap on each frame\n\nNot sure how exactly, but you have access to textures and to a huge part of OpenGL through Kivy and Python, so this could be doable.\n\nA window to display some debug information, large scrollable text box\n\nUse RecycleView and Label's core. There's an example for ListView, but since the new changes it's kind of broken. However, in a similar way it could be done for RecycleView\n\nA way to emit audio that's generated by the emulator\n\nShould work without problems if you can pass it to the provider. The only issue I see with built-in audio support in Kivy is pause and seek, because those afaik either aren't implemented (most probably) or are broken. However with Gstreamer it should work.\n\nAccept keyboard input to control the game.\n\nKeyboard and multitouch work out of the box with Kivy, you only need to (for keyboard) extend one method and (for touch) check for collisions with Widgets\n\nAre there widgets that will let me create the disassembly and memory viewer?\n\nNo. At least none that I know will do that out of the box. If by disassembly you mean text, dump it into a widget that can handle text. Memory viewer however isn't there and you'll need to create your own widget. That's not hard if you work with Kivy at least for a while.\nKivy by default doesn't do 3D. There are \"plugins\" that can allow you such thing, but I don't see any that's still maintained so there's this thing. Also I see the code isn't C, but C++ so I'm not sure how to bind those together. Cython should be the rescue here ^^","Q_Score":0,"Tags":"python,c++,kivy","A_Id":40359340,"CreationDate":"2016-11-01T07:38:00.000","Title":"Is it feasible to create an emulator front-end using Kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am the sole Matlab user on a team of C++\/C# developers. I am transitioning to Python, and was hoping that Cython could help me bridge the gap between my work and my colleagues' work. \nI originally thought that Cython could be used to compile Python code to a C source file, which could then be imported\/called from Python. I was hoping for two benefits from this:\n\nA speed boost in my programs, and\nA C source file that could be handed off to my colleagues for some slight polishing and then ultimately implemented in their (C++\/C#) packages. \n\nUnfortunately, it looks like the latter is not an option, but I'm not positive. It looks like the C source file is very bloated with lots of references to Python. I have a three-line Python script that declares a cdef char*, assigns the string \"hello world!\" to that variable, then prints it. The resulting C file is 2000 lines long. \nSo, my question is, is benefit #2 unobtainable with Cython? Is the C code generated with Cython only intended to be used by Python, or is there a way to remove the Python bloat and get a concise C translation of the Python code?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":430,"Q_Id":40363937,"Users Score":6,"Answer":"Cython's output is not intended for human consumption\nCython treats C as an intermediate language, in much the same way as LLVM treats LLVM IR as an intermediate language.  Cython's purpose is to produce Python extension modules, and C is just the most reasonable means to that end.  It will generally produce a maze of twisty little preprocessor directives, all totally unreadable.  You should not use Cython if you want C code that you can read.","Q_Score":3,"Tags":"python,c++,c,cython","A_Id":40364443,"CreationDate":"2016-11-01T16:07:00.000","Title":"Is Cython used for building C code or is it used for building Python extensions?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem shown below that wants to find the quickest way to get between any two points by using only the moves of a knight in chess. My first thought was to us the A* algorithm or Dijkstra's algorithm however, I don't know how to make sure only the moves of a knight are used. I would appreciate it if you could suggest a better algorithm or just some tips to help me. Thank you.\n\nWrite a function called answer(src, dest) which takes in two parameters: the source square, on which you start, and the destination square, which is where you need to land to solve the puzzle.  The function should return an integer representing the smallest number of moves it will take for you to travel from the source square to the destination square using a chess knight's moves (that is, two squares in any direction immediately followed by one square perpendicular to that direction, or vice versa, in an \"L\" shape).  Both the source and destination squares will be an integer between 0 and 63, inclusive, and are numbered like the example chessboard below:\n\n\n-------------------------\n| 0| 1| 2| 3| 4| 5| 6| 7|\n-------------------------\n| 8| 9|10|11|12|13|14|15|\n-------------------------\n|16|17|18|19|20|21|22|23|\n-------------------------\n|24|25|26|27|28|29|30|31|\n-------------------------\n|32|33|34|35|36|37|38|39|\n-------------------------\n|40|41|42|43|44|45|46|47|\n-------------------------\n|48|49|50|51|52|53|54|55|\n-------------------------\n|56|57|58|59|60|61|62|63|\n-------------------------","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":1507,"Q_Id":40454897,"Users Score":1,"Answer":"For this problem, simply doing a breadth-first search is enough (Dijkstra and BFS work in same way for unweighted graphs). To ensure that only the chess knight's moves are used, you'll have to define the moves in a proper way.\nNotice that a chess knight moves two squares to any direction, then one square perpendicular to that. This means it can move two squares left of right then one square up or down, or two squares up or down then one square left or right.\nThe calculation will be much easier if you identify the cells by rows (0 - 7) and columns (0 - 7) instead of 0 - 63. This can be done easily by dividing the cell index by 8 and using the quotient and remainder as row and column indices. So, if the knight is at position (x, y) now, its next possible positions can be any of (x - 2, y - 1), (x - 2, y + 1), (x + 2, y - 1), (x + 2, y + 1), (x - 1, y - 2), (x - 1, y + 2), (x + 1, y - 2), (x + 1, y + 2). Be careful that all of these 8 cells may not be inside the grid, so discard the locations that falls out of the board.","Q_Score":1,"Tags":"python,algorithm,path-finding","A_Id":40458170,"CreationDate":"2016-11-06T21:47:00.000","Title":"Simple algorithm to move from one tile to another using only a chess knight's moves","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0}]