Web Development
int64
0
1
Data Science and Machine Learning
int64
0
1
Question
stringlengths
35
6.31k
is_accepted
bool
2 classes
Q_Id
int64
5.14k
40.5M
Score
float64
-1
1.2
Other
int64
0
1
Database and SQL
int64
0
1
Users Score
int64
-6
163
Answer
stringlengths
19
4.91k
Python Basics and Environment
int64
0
1
ViewCount
int64
12
475k
System Administration and DevOps
int64
0
1
Q_Score
int64
0
346
CreationDate
stringlengths
23
23
Tags
stringlengths
6
68
Title
stringlengths
12
138
Networking and APIs
int64
0
1
Available Count
int64
1
31
AnswerCount
int64
1
35
A_Id
int64
5.3k
72.3M
GUI and Desktop Applications
int64
1
1
0
0
I 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?
true
9,998,274
1.2
0
0
5
from the newsgroups: I'm using Python 1.5 under Redhat Linux 5.0. I'm trying to figure out the best way to trap a SIGINT (or Ctrl-C) when using tkinter. To illustrate the problem I have, do the following ... -- Build Python-1.5 with tkinter enabled. -- Go into the Demo/tkinter/guido directory under the Python-1.5 build tree. -- Type "python imageview.py image-file", where "image-file" is the full pathname of a displayable image. -- Once the image pops up, make sure that the window focus is held by the xterm window from which the "python ..." command was just now invoked. -- Hit Ctrl-C. At this point, nothing happens. The Ctrl-C seems to be ignored. But now ... -- Without hitting any more keys on the keyboard, set the window focus to the displayed image window. As soon as that window gets the focus, the Ctrl-C takes effect. My question is this: is there any way to restructure the "imageview.py" program so that it will respond to SIGINT (Ctrl-C) immediately, without having to set the window focus to the displayed image first? Thanks in advance for any help you folks can give me. ---- 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 only handled by the Python interpreter. A quick workaround is to use after() to schedule a dummy function to be called once a second or so -- this will make it appear that your signal is handled in a timely manner. --Guido van Rossum
0
2,414
0
6
2012-04-03T17:23:00.000
python,tkinter,keyboardinterrupt
tkinter keyboard interrupt isn't handled until tkinter frame is raised
0
1
1
10,067,034
1
0
0
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. This 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. So my question is: Is there any possibility to run two (or more) scripts parallel in the Python interpreter? I 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.
false
10,000,524
0.197375
1
0
1
As of today, you cannot avoid GIL interactions when using python threads in the same process. You may want to have a look at multiprocessing module which is meant to easily spawn Python processes, thus not interacting with GIL. Another 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.
1
624
0
2
2012-04-03T20:04:00.000
c++,parallel-processing,boost-python,cpython
Running two python scripts parallel with boost::python
0
1
1
10,002,004
1
0
0
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. My 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? The benefit I am expecting: I 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.
false
10,013,904
0.099668
0
0
2
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. I 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.
0
6,264
0
5
2012-04-04T15:06:00.000
python,user-interface
Using web-server to substitute for GUI in python
0
2
4
10,014,865
1
0
0
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. My 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? The benefit I am expecting: I 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.
false
10,013,904
0.049958
0
0
1
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.
0
6,264
0
5
2012-04-04T15:06:00.000
python,user-interface
Using web-server to substitute for GUI in python
0
2
4
10,013,987
1
0
0
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? The 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.
false
10,018,767
0
0
0
0
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. To 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. It might be easier to start from scratch with an empty event box and draw even the image yourself.
0
212
0
0
2012-04-04T20:29:00.000
python,pygtk
How do I create a canvas selection tool?
0
1
1
10,057,082
1
0
0
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: -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.. OR -as the user scrolls down the listctrl its constantly populating with new data.. How would I implement one of these concepts? Thanks in advance for the help!
false
10,020,528
0
0
0
0
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. Scenario I: load all the log data into the memory and use wx.listctrl or wx.listview to display the lines. Scenario II: fetch data from the database when the wx view is updated. In 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? In 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.
0
1,254
0
1
2012-04-04T23:08:00.000
python,sqlite,wxpython,wxwidgets
Display large dataset from Sqlite database in Python wx
0
1
2
10,021,932
1
0
0
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. I'm thinking of using Tkinter but would be open to other environments. I 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.) Thanks.
false
10,045,312
0.197375
0
0
1
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. SciTE supports code folding, so it is certainly doable - it may even be a built in part of Scintilla. From the SciTE website: Scintilla is a free source code editing component. It comes with complete source code and a license that permits use in any free project or commercial product. As well as features found in standard text editing components, Scintilla includes features especially useful when editing and debugging source code. These include support for syntax styling, error indicators, code completion and call tips. The selection margin can contain markers like those used in debuggers to indicate breakpoints and the current line. Styling choices are more open than with many editors, allowing the use of proportional fonts, bold and italics, multiple foreground and background colours and multiple fonts. SciTE is a SCIntilla based Text Editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. It is best used for jobs with simple configurations - I use it for building test and demonstration programs as well as SciTE and Scintilla, themselves.
1
200
0
0
2012-04-06T15:03:00.000
python
Python: How to program an IDE Code collapsing?
0
1
1
10,045,462
1
0
0
I'm want to show in the GUI a small box (400x85) that shows in an HTML file over the web. The 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. It's not really necessary to load the whole QtWebKit class just to show an HTML page. It is possible to use IE's built in web engine? (Through an ActiveX Object or something?)
true
10,053,409
1.2
0
0
1
You can use Internet Explorer via ActiveQT. There is a c++ example in "yourqtdir\4.8.0\examples\activeqt\webbrowser".
0
326
0
0
2012-04-07T09:45:00.000
python,windows,qt4,pyqt4
An Internet browser Qt4 widget?
0
1
1
10,059,458
1
0
0
I am trying to learn OpenGL, and I'm using PyOpenGL and GLUT. What really bugs me, is that I can't figure out how to change the title bar icon. Has anyone had any success in changing this?
true
10,054,167
1.2
0
0
2
You don't. Remember: 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.
0
248
0
1
2012-04-07T11:45:00.000
python,opengl,freeglut
How do I replace the GLUT title bar icon when using pyopengl?
0
1
1
10,055,756
1
0
0
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!
false
10,093,879
0
0
0
0
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
0
3,812
0
4
2012-04-10T17:54:00.000
python,wxpython
wxPython GUI - can it be compared to Java GUI or Visual Studio GUI?
0
2
4
10,094,083
1
0
0
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!
false
10,093,879
0.049958
0
0
1
wxGlade will give you the GUI skeleton. You will still need a separate text editor (I recommend Geany) to fill in the handlers.
0
3,812
0
4
2012-04-10T17:54:00.000
python,wxpython
wxPython GUI - can it be compared to Java GUI or Visual Studio GUI?
0
2
4
10,093,925
1
0
0
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. I'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. Thanks!
false
10,104,261
0
0
0
0
Short: You can use both, no third party library is guaranteed to be distributed with all major distributions. Long: Gtk+ vs. Qt What do you want incorporate into your application. If it is just selecting a brush, selecting color you could pretty much use any gui toolkit. If you are going to run it as a web-based tool, Gtk+ has an html5 backend renderer (I don't know about Qt) A sidenote: I 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. Everything else boils down to personal preferences and there already exist some questions to tackling that issue.
0
810
0
1
2012-04-11T10:33:00.000
python,linux,qt,gtk
Framework for paint program
0
2
4
10,106,439
1
0
0
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. I'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. Thanks!
false
10,104,261
0.148885
0
0
3
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. Another 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.
0
810
0
1
2012-04-11T10:33:00.000
python,linux,qt,gtk
Framework for paint program
0
2
4
10,104,320
1
0
0
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)?
false
10,115,481
0
0
0
0
The icon size and the font can be set on the view widget with setIconSize and setFont.
1
748
0
1
2012-04-11T23:38:00.000
python,qt
Resizing row height of list widget
0
1
1
10,115,583
1
0
0
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.
false
10,132,427
1
0
0
22
What is the advantage of using the native C++ Qt over PyQt Speed/power/control. PyQt 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. However 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++. Choice 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. Please 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. --EDIT-- Personally, 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. Another 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. In 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.
0
17,063
0
14
2012-04-12T21:53:00.000
c++,python,qt,qt4,pyqt
What is the advantage of using the native C++ Qt over PyQt
0
3
4
10,132,617
1
0
0
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.
false
10,132,427
0.049958
0
0
1
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++. I 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++.
0
17,063
0
14
2012-04-12T21:53:00.000
c++,python,qt,qt4,pyqt
What is the advantage of using the native C++ Qt over PyQt
0
3
4
10,132,490
1
0
0
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.
false
10,132,427
1
0
0
6
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.
0
17,063
0
14
2012-04-12T21:53:00.000
c++,python,qt,qt4,pyqt
What is the advantage of using the native C++ Qt over PyQt
0
3
4
10,132,451
1
0
0
Is it possible to define a class with a __getitem__ that takes a tuple argument using the Python C-API? The sq_item member of the tp_as_sequence member of a PyTypeObject must be a ssizeargfunc, so I don't see how to do it. (But I assume that the NumPy ndarray does it.)
true
10,151,806
1.2
0
0
5
Yes, use tp_as_mapping instead. Its mp_subscript takes a PyObject * so you can use anything as index/key. To 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.
0
853
0
3
2012-04-14T07:16:00.000
python,python-c-api
__getitem__ method with tuple argument using Python C-API
0
1
1
10,152,614
1
0
0
Does anybody know if it's possible to put two lines of text in a single row using grid in TKinter? If I make the font small enough, can I distribute the text in two lines?
false
10,171,249
0.099668
0
0
1
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. For 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.
0
1,178
0
0
2012-04-16T09:00:00.000
python,text,grid,tkinter,row
Two lines of text in a single grid row
0
1
2
10,172,879
1
0
0
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. For this I'd like to use Qt4 and Python. What, in your opinion, is the most efficient way to proceed? In 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? Please advise.
false
10,178,875
0
0
0
0
I came here because I'm looking for a solution for the same task. Here is what I would (or hopefully will) try: Subclass QTextEdit, which can display both plain and rich text. supply two string properties, one containing Markdown source, the other generated HTML. For entering "edit mode" (however your UI will handle this) self.setText(self.markdown) self.setReadOnly(False) For leaving "edit mode": self.markdown = self.toPlainText() self.toHtml() # convert self.markdown to self.html # don't know yet how to achieve that self.setHtml(self.html) self.setReadOnly(True) For displaying the HTML one can use a CSS stylesheet. As UI interface I could imagine: clicking on the readonly display mode switches to edit mode, [Ctrl]-[Enter] triggers HTML generation.
0
1,474
0
0
2012-04-16T17:36:00.000
python,qt4,pyqt4,markdown,rtf
How to make an editor using markdowns with Qt4 and Python?
0
1
2
24,965,112
1
0
0
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'). I'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. Changing 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. Any suggestions as to how this actually works? Edit: I hadn't tried changing the font for the Label widget before, and that one actually works.
false
10,196,305
0
0
0
0
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.'
0
1,687
0
1
2012-04-17T17:47:00.000
python,fonts,styles,widget,ttk
How to changes fonts using ttk themed widgets in windows
0
1
2
10,249,969
1
0
0
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?
false
10,196,716
0
0
0
0
After inserting the row, call QTableWidget.scrollToBottom() to show that last row.
0
303
0
0
2012-04-17T18:16:00.000
python,pyqt4
Pyqt table widget updation
0
1
1
10,201,627
1
0
0
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). So 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. I already investigated this issue with Google and came out to these solutions: Use 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 ? Use "Python for .NET" -> the same question as above. What do you think, which way would be better ? or do you have another solution ? And the last but maybe most important question, did I understand the above mentioned points right, or do I mess up ? Many thanks in advance !!
true
10,208,960
1.2
1
0
2
I think you misunderstand Python. It's an interpreted1 language. You just provide the text source files and the interpreter will execute them. There 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++. For 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. Now, 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. 1Well, it's compiled into .pyc files... but then "compile" isn't really a well-defined term anyway. Why 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.
1
1,191
0
3
2012-04-18T12:02:00.000
c#,.net,python,interop,ironpython
C# .NET interoperabillity with managed Python (CPython) -> any problems?
0
2
2
10,210,229
1
0
0
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). So 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. I already investigated this issue with Google and came out to these solutions: Use 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 ? Use "Python for .NET" -> the same question as above. What do you think, which way would be better ? or do you have another solution ? And the last but maybe most important question, did I understand the above mentioned points right, or do I mess up ? Many thanks in advance !!
false
10,208,960
0.099668
1
0
1
Expose your Python code via COM and call that from C#. Used this avenue (both ways) many times.
1
1,191
0
3
2012-04-18T12:02:00.000
c#,.net,python,interop,ironpython
C# .NET interoperabillity with managed Python (CPython) -> any problems?
0
2
2
14,318,714
1
0
0
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. The 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. Plugin installation should just be a matter of copying the plugin script file into the ./plugins directory relative to the main executable. The 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). So I guess it's really two questions: What's the simplest way to share common controller code between multiple front ends from: a. Objective-C on a Mac? b. C++ on Windows? c. C/Python from Linux/BSD? What's the simplest way to implement plugins from my common controller to execute custom plugins?
false
10,244,713
0
0
0
0
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. If 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.
0
1,296
1
0
2012-04-20T10:44:00.000
c++,python,objective-c,plugins,cross-platform
Simplest way to write cross-platform application with Python plugin extensibility?
0
1
2
10,245,373
1
1
0
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?
true
10,258,703
1.2
0
0
2
Your users have to install SL4A and the language plugin (python?) on their phones, this is not a built-in functionality. Since 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.
1
1,128
0
6
2012-04-21T12:01:00.000
android,python
Running a Python app on real Android phone
0
1
2
10,258,955
1
0
0
I am trying to create a roguelike using the Text widget. I 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?
false
10,288,554
0.132549
0
0
2
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). A 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.
0
1,580
0
1
2012-04-23T21:24:00.000
python,python-3.x,tkinter
Finding The Current Size Of A tkinter.Text Widget
0
2
3
10,289,415
1
0
0
I am trying to create a roguelike using the Text widget. I 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?
true
10,288,554
1.2
0
0
0
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.
0
1,580
0
1
2012-04-23T21:24:00.000
python,python-3.x,tkinter
Finding The Current Size Of A tkinter.Text Widget
0
2
3
10,290,058
1
0
0
I'm creating message boxes in Tkinter using tkMessageBox.showwarning. Does 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?
true
10,295,384
1.2
0
0
1
No, the standard dialogs don't support that. If you want such a feature you'll have to build your own dialog out of a Toplevel window and other widgets.
0
410
0
2
2012-04-24T09:41:00.000
python,checkbox,tkinter,message
"do not show message again" checkbox in Tkinter warning message
0
1
1
10,296,668
1
0
0
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. Is 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?
true
10,305,327
1.2
0
0
8
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.
1
2,163
0
8
2012-04-24T20:12:00.000
python,python-c-extension
PyList_SetItem vs. PyList_SETITEM
0
1
1
10,305,714
1
0
0
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. I'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?
true
10,310,068
1.2
0
0
0
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. That 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. Bottom line: PyGame 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). Like 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.
0
1,238
0
0
2012-04-25T05:53:00.000
python,pygame
Using Pygame to make scrolling shoot-em-up
0
2
2
10,647,216
1
0
0
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. I'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?
false
10,310,068
0
0
0
0
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.
0
1,238
0
0
2012-04-25T05:53:00.000
python,pygame
Using Pygame to make scrolling shoot-em-up
0
2
2
10,315,791
1
0
0
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. What is the theory on how to handle that?
false
10,325,418
0.197375
0
0
1
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.
1
228
0
0
2012-04-25T23:52:00.000
python,collision-detection,pygame
Jump Through Polygon/Floor Collision Detection
0
1
1
11,217,539
1
0
0
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.
false
10,325,600
0
0
0
0
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. What 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.
1
118
0
0
2012-04-26T00:15:00.000
python,pywin32,robot
Trouble Running a File in PyWin
0
1
1
10,326,072
1
0
0
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. I want to do it in any area of the screen. Can you guys please guide me how to do that in Python? PS: If the method can work across all the platforms that would be much more appreciated. Thanks, Aashiq
false
10,328,943
0
0
0
0
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. How you then do it depends on what toolkit you choose.
0
185
0
1
2012-04-26T07:24:00.000
python-3.x,pixels
Grabbing pixel attributes in Python
0
1
1
10,331,335
1
0
0
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. I understand pygame doesn't have anything that would make a camera move. When 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.
false
10,343,052
0
0
0
0
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.
0
2,011
0
1
2012-04-27T00:01:00.000
python,animation,pygame
How would I go about making a camera like movement in pygame?
0
1
3
11,236,094
1
0
0
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.
false
10,364,900
0
0
0
0
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.
0
1,551
0
1
2012-04-28T15:25:00.000
python,events,wxpython,wxwidgets
wxPython caret move event
0
1
4
10,385,658
1
0
0
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? I've seen some posts about getting a Gtk.Label's pixbuf but those methods seem to be removed from Gtk3 (pixbuf_get_from_drawable)
false
10,369,496
0.197375
0
0
1
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.
0
377
0
6
2012-04-29T03:36:00.000
python,gtk,gtk3,pygobject
How do I set a Gtk.StatusIcon as Text
0
1
1
11,075,153
1
0
0
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!
false
10,421,194
0.099668
0
0
1
There is a tricky way to do that. Use a gridlayout and set cols to 1
0
2,021
0
3
2012-05-02T20:29:00.000
python,layout,python-2.7,boxlayout,kivy
How can I change the order of the BoxLayout in kivy?
0
1
2
22,755,884
1
0
0
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. I 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?
false
10,453,841
0
1
0
0
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.
1
314
0
0
2012-05-04T17:58:00.000
c++,python,stdout,stdin
Mixing python and C++ via std in and std out
0
2
2
10,453,984
1
0
0
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. I 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?
true
10,453,841
1.2
1
0
0
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.
1
314
0
0
2012-05-04T17:58:00.000
c++,python,stdout,stdin
Mixing python and C++ via std in and std out
0
2
2
10,454,012
1
0
0
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. One 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. I 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. Also I would like to know how to add an icon to an item in the tree from an external png file. I would appreciate any help that could be given with either of these problems.
false
10,463,702
0.099668
0
0
1
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).
0
1,518
0
0
2012-05-05T16:19:00.000
python,tree,wxpython
Multiple key press detection wxPython
0
1
2
10,464,339
1
0
0
Having a pygame.display window open, I call pygame.display.quit() upon it in order to destroy the window. Because 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. Can anyone point me to the root of this problem?
false
10,466,411
-0.066568
0
0
-1
Have you tried calling just pygame.quit() or pygame.init()? I don't believe there is a pygame.display.quit().
0
2,849
0
3
2012-05-05T22:12:00.000
python,pygame
Pygame display module init and quit
0
1
3
10,779,855
1
0
0
Is there any way to hide the screen of 'pygame.display' and to make it visible afterwards without calling 'pygame.display.quit()'?
true
10,466,590
1.2
0
0
5
No there isn't. All you can do is minimize the window using pygame.display.iconify().
0
7,611
0
6
2012-05-05T22:44:00.000
python,pygame
Hiding pygame display
0
1
4
10,466,840
1
0
0
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? Thanks
false
10,467,224
0
0
0
0
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.
0
1,726
0
1
2012-05-06T00:54:00.000
python,wxpython
Frame Inside a Frame WxPython
0
1
3
10,483,810
1
0
0
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.
true
10,496,168
1.2
0
0
0
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. There'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.
0
1,493
0
1
2012-05-08T09:40:00.000
python,pyqt4,qtablewidget
How to import/export QTableWidget to some file?
0
1
1
10,537,246
1
0
0
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... For 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? Let me show you the exact situation... My 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?
false
10,499,419
0
0
0
0
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.
1
9,182
0
6
2012-05-08T13:17:00.000
python,class,design-patterns
How to organize my Python code into multiple classes?
0
1
6
10,499,592
1
0
0
After creating a simple window/widget layout with Page (page.sourceforge.net) I found that the listbox curselection() call returns the proper index when releasing Button-1. When hit, it returns the previous index (the item which we just leave). Becasue 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
false
10,560,041
0.197375
0
0
1
Bind to the event <<ListboxSelect>> instead of <1>, this event will fire after the current selection has been updated. If 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.
0
875
0
1
2012-05-12T00:18:00.000
python,listbox,tkinter
Getting Tkinter listbox item when hit Button-1
0
1
1
10,560,466
1
0
0
I want to import a sprite sheet and select one sprite. How would I do this in Python/pygame?
false
10,560,446
0
0
0
0
The above code posted by aquasheep is brilliant! Although in lines: for i in range(0,sheet_rect.height-len_sprt_y,size[1]):#rows for i in range(0,sheet_rect.width-len_sprt_x,size[0]):#columns I 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.
0
13,966
0
9
2012-05-12T01:58:00.000
python,pygame
How do you select a sprite image from a sprite sheet in Python?
0
1
4
33,223,021
1
0
0
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. I know wxPython is for GUI programming. But what are Jython and IronPython? Please help me.
true
10,579,824
1.2
0
0
72
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.
1
37,688
0
41
2012-05-14T08:29:00.000
python,wxpython,jython,ironpython
What is the difference between Python vs Jython vs IronPython vs wxPython?
0
1
1
10,579,887
1
0
0
Is there a way to track elements properties in Tkinter canvas? Specifically, I want to know if at a certain coordinates set I have already created an element or not. I believe I can do this with tracking sets of elements in a dictinoary but I was hoping for something more elegant.
false
10,585,184
0.197375
0
0
1
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.
0
153
0
0
2012-05-14T14:20:00.000
python,canvas,tkinter
Tracking list on elements on canvas (tkinter)
0
1
1
10,585,691
1
0
0
Basically, I want the body of a Text widget to change when a StringVar does.
true
10,593,027
1.2
0
0
10
Short version is, you can't. At least, not without doing extra work. The text widget doesn't directly support a variable option. If 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. The 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.
0
5,546
0
5
2012-05-15T01:19:00.000
python,tkinter
How can I connect a StringVar to a Text widget in Python/Tkinter?
0
1
2
10,593,117
1
0
0
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) I want to convert part of the image from red to blue. Should I either use the surface.set to change to colour value, Or 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"? Which is more efficient to do? Thanks in advance :)
true
10,642,331
1.2
0
0
0
So Ian Mallett was correct: Efficient how? .set_at will be more space efficient, but obviously you're setting individual pixels every time you want to change. Loading an entirely new image at startup will be faster, but you'll use more space. I'd guess you're wanting the second, but . . . I wanted the second one, faster (even at the cost of more space). So its better to load the entire 'blue' image as well as the 'red' one, then switch between them as necessary. Thanks Ian!
0
106
0
0
2012-05-17T19:32:00.000
python-3.x,pygame,pixels
Python Pygame Changing Surfaces efficiently
0
1
1
10,856,777
1
0
0
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.
false
10,661,041
0.197375
0
0
1
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.
0
1,825
0
2
2012-05-18T23:41:00.000
python,macos,tkinter,glade
Glade with Tkinter?
0
1
1
21,465,072
1
0
0
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. Thank you very much in advance.
false
10,668,116
0
0
0
0
I actually recommend Tkinter for simple python game development tho.
0
26,041
0
12
2012-05-19T19:14:00.000
python,tkinter,pygame
pygame vs tkinter.
0
2
3
72,318,955
1
0
0
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. Thank you very much in advance.
false
10,668,116
0.066568
0
0
1
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
0
26,041
0
12
2012-05-19T19:14:00.000
python,tkinter,pygame
pygame vs tkinter.
0
2
3
64,797,294
1
0
0
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. I 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. This 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. It appears that nobody had to do something similar because I didn't found anything about it on the net.
true
10,681,740
1.2
0
0
2
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.
0
1,990
0
3
2012-05-21T08:23:00.000
python,c,gtk,pygobject,gtktreeview
Gtk.Treeview deselect row via signals and code
0
1
2
10,690,046
1
0
0
I wrote a diff and merge program in Python using the Tkinter UI framework. Running it on OS-X there are two problems: when starting it the window does not get displayed unless switching back and forth with other running apps. There has been a thread here recommending top.call('wm', 'attributes', '.', '-topmost', '1') which is no solution since it keeps the window on top of all - always. Other say that when packaging with py2app this behavior goes away - I tried and it does not! There is no way to change the Menu - The first entry is dictated by TK, so the first "About xxx" does bring up the TCL credits and can not be replaced with my own apps about info. So 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. Is that possible?
false
10,690,416
0
0
0
0
Try some variant of this command: self.createcommand('tkAboutDialog', self.aboutProgram) and put your app "about" dialog code in the aboutProgram() function.
0
382
0
1
2012-05-21T18:14:00.000
python,macos,cocoa,tkinter,tk
use a Tkinter frame in a Mac Cocoa app
0
1
1
11,246,589
1
0
0
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
false
10,707,815
0
0
0
0
If the specific strings are always the same, as in a programming language, then use GtkSourceView instead.
0
411
0
1
2012-05-22T18:22:00.000
python,pygtk
Highlight certain text in a PyGTK TextView
0
1
2
10,715,877
1
0
0
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. Sushma
true
10,732,171
1.2
0
0
1
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.
0
101
0
0
2012-05-24T06:20:00.000
wxpython
preserving the state of check boxex in customtreectrl
0
1
1
10,733,286
1
0
0
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. When 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. How 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?
true
10,742,317
1.2
0
0
2
You just have to set the fill and expand parameters of the Buttons to False (uncheck them in the Glade interface). You 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
0
787
0
0
2012-05-24T17:20:00.000
python,pygtk,glade
PyGTK/Glade keep button size standard
0
1
1
10,743,355
1
0
0
I have a problem with python to C code translation and further compilation. First, I installed MinGW, wrote `setup.py? script and translated python code (simplest helloworld) to C with Cython: python setup.py build_ext --inplace Then I tried to compile generated .c file: gcc.exe helloworld.c -mdll -IC:\Python27\include -IC:\Python27\PC -LC:\Python27\libs -LC:\Python27\PCbuild -lpython27 -lmsvcr90 No error occurred during compilation, but when I tried to launch generated a.exe file, I got the following error: a.exe is not a valid Win32 application I have no idea how to fix this problem. I'm running 32-bit Vista. P.S. Sorry for my poor English.
false
10,759,765
0.197375
0
0
2
The compiled file isn't an executable, it's a library (dll). python 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. then you should be able to import helloworld from python.
1
1,230
0
1
2012-05-25T18:40:00.000
python,c,gcc,mingw,cython
Cython and gcc: can't run compiled program
0
1
2
10,760,117
1
0
0
I googled and search stackoverflow before asking this question Answers that I don't expect: wxWidgets is the best Python GUIUse TkInter (BIM) for GUI development. Q. How to make a GUI without using any module/library? i.e make a GUI from scratch. Modules like tkinter not allowed.
false
10,763,814
0.099668
0
0
1
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.
0
2,003
0
1
2012-05-26T05:24:00.000
python,user-interface
Python custom GUI
0
1
2
10,763,834
1
0
0
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. The 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. So 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? One solution I thought of is to make a subfolder which would be searched for modules first. Another 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.
true
10,781,201
1.2
0
0
2
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 ? That way you still maintain your base system and only afterwards do you load up subsequent user mods.
0
68
0
0
2012-05-28T07:57:00.000
python,import,module
Telling a module to be imported first by the module itself?
0
1
1
10,781,228
1
0
0
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. The 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. What 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.
false
10,788,211
0.099668
0
0
1
Put the label in a container like GtkScrolledWindow.
0
291
0
0
2012-05-28T17:09:00.000
python,gtk3
Remove the size request of a widget (Python, Gtk3)
0
2
2
11,008,840
1
0
0
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. The 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. What 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.
true
10,788,211
1.2
0
0
1
Set the "ellipsize" property of label to True.
0
291
0
0
2012-05-28T17:09:00.000
python,gtk3
Remove the size request of a widget (Python, Gtk3)
0
2
2
33,259,216
1
0
0
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. Simply, its procedure is as following: Load 1st data Display on canvas Load another data Display on canvas, but it shows the first data. Please give me some hints, comments, and help. Thank you, guys.
false
10,805,751
0
0
0
0
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. The other possibility is that there is an error in your drawing code that is getting ignored.
0
583
0
0
2012-05-29T19:52:00.000
python,canvas,tkinter
How to apply to new data on tkinter's canvas
0
1
2
10,807,933
1
0
0
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. For my current situation I think I want to use alpha values but am not quite clear how. In 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). I 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. Thanks!
false
10,823,285
0.291313
0
0
3
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.) '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). To make the sprites disappear, I would just set them to non-visible, rather than playing around with alpha values.
0
399
0
1
2012-05-30T19:52:00.000
python,pygame
Pygame alpha values
0
2
2
10,823,436
1
0
0
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. For my current situation I think I want to use alpha values but am not quite clear how. In 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). I 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. Thanks!
false
10,823,285
0
0
0
0
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.
0
399
0
1
2012-05-30T19:52:00.000
python,pygame
Pygame alpha values
0
2
2
51,940,966
1
0
0
What is the best drag and drop GUI builder for wxPython? I've tried wxGLade, but I strongly dislike it.
true
10,824,112
1.2
0
0
0
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.
0
1,452
0
2
2012-05-30T20:54:00.000
user-interface,wxpython
Best drag and drop GUI builder for wxPython
0
1
1
10,824,301
1
0
0
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. However, 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?
false
10,825,597
0.197375
0
0
1
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. You 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). The 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. Next, 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. Finally, 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. I 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.
0
431
0
2
2012-05-30T23:16:00.000
python,wxpython,wx.textctrl
Select text over multiple TextCtrls in wxpython
0
1
1
16,593,067
1
0
0
With wxPython a password field could be created as: wx.TextCtrl(frm, -1, '', style=wx.TE_PASSWORD ) I'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.
false
10,836,062
0.197375
0
0
3
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.
0
5,172
0
4
2012-05-31T14:56:00.000
python,user-interface,wxpython
how to make wxpython password textctrl show chars?
0
2
3
10,837,325
1
0
0
With wxPython a password field could be created as: wx.TextCtrl(frm, -1, '', style=wx.TE_PASSWORD ) I'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.
false
10,836,062
-0.066568
0
0
-1
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. Hope this helps
0
5,172
0
4
2012-05-31T14:56:00.000
python,user-interface,wxpython
how to make wxpython password textctrl show chars?
0
2
3
10,836,512
1
0
0
My simple question is how can I use pygame.MOUSEBUTTONDOWN on a sprite or item to trigger an event? e.g. I have item_A and want music to start when I press the object with my mouse.
false
10,838,959
0
0
0
0
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.
0
18,074
0
2
2012-05-31T18:12:00.000
python,pygame,mouseevent,mouse
How to use pygame.MOUSEBUTTONDOWN?
0
1
3
10,839,038
1
0
0
I know there is a PyGTK class for a single-line entry, but what about multi-line entries (like entering a description of an item)? I've searched through the web, but didn't find anything.
true
10,840,917
1.2
0
0
12
TextView is the widget used to edit multi-line text.
1
3,074
0
7
2012-05-31T20:37:00.000
python,gtk,pygtk
multiline gtk entry in pygtk
0
1
1
10,843,649
1
0
0
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. I am running Mac OS X 10.6.8 I am using Python 2.7 (64 bit, but running with the 32 bit preferences) I am using wxPython (32 bit because that is all that wxPython has to offer on a Mac)
false
10,842,167
0
0
0
0
I had this problem for a long time. Try running it as admin.
0
586
1
0
2012-05-31T22:31:00.000
python,py2app
py2app installation error--Permission Denied
0
1
1
23,563,762
1
0
0
I want to impliment some kind of UI for my Python programs (some simple operations, nothing advanced). So 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). intuitively 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...) Thank you in advance!
false
10,859,023
0.379949
0
0
4
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
0
1,422
0
4
2012-06-02T01:02:00.000
python-3.x,tkinter,ncurses
python3 tkinter or ncurses
0
1
2
10,861,849
1
0
0
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 !) Since 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 :( Can you help me ? Thanks ! PyQt version : 4.4.3 Python version : 2.6
true
10,929,285
1.2
0
0
0
You can do this using the model->view framework, but it means implementing a custom model to support checkable data. You 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. You then set this as the model for the QComboBox using setModel(). This 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.
0
1,527
0
0
2012-06-07T09:39:00.000
python,qt,checkbox,combobox,pyqt
How to simply create a list of CheckBox which has a dropdown list like a ComboBox with PyQt?
0
1
1
10,930,835
1
0
0
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? I am using gtk.ListStore to store the data. I 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!
true
10,972,821
1.2
0
0
0
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. How trivial! All I needed to do was eat over it it seems.
0
135
0
0
2012-06-10T22:25:00.000
python,pygtk
Reordering in IconView (PyGtk)
0
1
1
10,973,513
1
0
0
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. If a file were named: hello&goodbye.txt, the button would read: hellogoodbye.txt I have no idea where the & character goes and would love a little help here.
true
10,984,263
1.2
0
0
5
The & character is a special symbol for those kinds of buttons. It defines what key you press to use a keyboard shortcut. &x - [Alt]+[x] hotkey shortcut. You can escape it by using a second: && -> '&' char
0
203
0
3
2012-06-11T16:46:00.000
python,wxpython
Python '&' Character is missing
0
1
2
10,984,306
1
0
0
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 :)
true
10,997,651
1.2
0
0
3
Two that come to mind for me are Tic-Tac-Toe and Higher or Lower
0
665
0
1
2012-06-12T13:24:00.000
python,graphics
simple game to make only using python
0
1
1
10,997,736
1
0
0
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. What 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. Thanks in advance. :)
false
11,027,366
0.379949
0
0
2
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.
0
284
0
0
2012-06-14T05:49:00.000
python,user-interface,wxpython,alignment,screen-resolution
wxPython : Adjusting the panels and sizers for different screen resolutions
0
1
1
11,036,132
1
0
0
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. Do 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. Thanks.
false
11,042,172
0
0
0
0
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.
0
4,531
0
16
2012-06-14T22:22:00.000
python,qt,mvvm,pyside,architectural-patterns
MVVM pattern with PySide
0
2
3
18,681,903
1
0
0
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. Do 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. Thanks.
false
11,042,172
-0.132549
0
0
-2
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.
0
4,531
0
16
2012-06-14T22:22:00.000
python,qt,mvvm,pyside,architectural-patterns
MVVM pattern with PySide
0
2
3
17,227,321
1
0
0
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. The 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). I 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.
false
11,046,283
0
0
0
0
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. You can add a close button which would simply close and remove the panel in the same way as your currently do.
0
69
0
0
2012-06-15T07:22:00.000
python,wxpython
Design substitute to popping up new frames on each click in WxPython
0
2
2
11,046,421
1
0
0
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. The 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). I 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.
false
11,046,283
0
0
0
0
Create a frame with two main elements: Your current feed A 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).
0
69
0
0
2012-06-15T07:22:00.000
python,wxpython
Design substitute to popping up new frames on each click in WxPython
0
2
2
11,052,052
1
0
0
I'm writing a physics simulating program, and found after() useful. I once would like to create a thread for physics calculation and simulation. But when I finally noticed that function, I used it instead. So, I'm curious about how Tkinter implements that function. Is it multi-threading?
true
11,046,836
1.2
0
0
5
It is not multithreaded. Tkinter 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). This 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.
1
718
0
1
2012-06-15T08:03:00.000
python,tkinter,python-multithreading
Python: Does after() in Tkinter have a multi-threading approach?
0
1
2
11,049,545
1
0
0
I have an application whose GUI is to be remade for ergonomic reasons. It was written in PyGTK and I am wondering if I should switch to PyQt to ease future developments or not. This 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. I am seeking advice on these two points : As regards the creation custom widgets, does PyQt provide better mechanisms than PyGTK, especially to slightly modify existing widgets. I 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 ?
false
11,047,821
0.039979
0
0
1
I also have no experience with GTK, but can offer some answers nevertheless: Qt is designed from the ground up to be object-oriented; almost everything in it has excellent support for subclassing. PyQt likewise. Qt 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.
0
8,254
0
12
2012-06-15T09:16:00.000
python,user-interface,pygtk,pyqt4
What are the advantages of PyQt over PyGTK and vice-versa?
0
4
5
11,803,878
1
0
0
I have an application whose GUI is to be remade for ergonomic reasons. It was written in PyGTK and I am wondering if I should switch to PyQt to ease future developments or not. This 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. I am seeking advice on these two points : As regards the creation custom widgets, does PyQt provide better mechanisms than PyGTK, especially to slightly modify existing widgets. I 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 ?
false
11,047,821
0.119427
0
0
3
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. If you just want looks, I'd say GTK+/PyGObject. If you are plannning on using anything PyQt has, use PyQt. As 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.
0
8,254
0
12
2012-06-15T09:16:00.000
python,user-interface,pygtk,pyqt4
What are the advantages of PyQt over PyGTK and vice-versa?
0
4
5
15,823,008
1
0
0
I have an application whose GUI is to be remade for ergonomic reasons. It was written in PyGTK and I am wondering if I should switch to PyQt to ease future developments or not. This 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. I am seeking advice on these two points : As regards the creation custom widgets, does PyQt provide better mechanisms than PyGTK, especially to slightly modify existing widgets. I 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 ?
false
11,047,821
0.039979
0
0
1
I can't compare, because I don't use GTK, but I'd suggest Qt. Qt 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. Now about PyQt, I wouldn't recommend it because of licensing issues. PySide seems like a better Qt→Python 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). Qt 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.
0
8,254
0
12
2012-06-15T09:16:00.000
python,user-interface,pygtk,pyqt4
What are the advantages of PyQt over PyGTK and vice-versa?
0
4
5
11,050,753
1
0
0
I have an application whose GUI is to be remade for ergonomic reasons. It was written in PyGTK and I am wondering if I should switch to PyQt to ease future developments or not. This 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. I am seeking advice on these two points : As regards the creation custom widgets, does PyQt provide better mechanisms than PyGTK, especially to slightly modify existing widgets. I 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 ?
false
11,047,821
0.039979
0
0
1
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...
0
8,254
0
12
2012-06-15T09:16:00.000
python,user-interface,pygtk,pyqt4
What are the advantages of PyQt over PyGTK and vice-versa?
0
4
5
11,899,802
1
0
0
I have a small GTK python application that imports a package (Twisted) that may not be loaded twice. If 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. If 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. Is it possible to have python-mode.el open a new shell window each time I execute a buffer?
false
11,066,684
0.197375
0
0
2
python-mode.el comes with a command py-execute-buffer-dedicated, opening a new and reserved process for it
0
1,178
1
1
2012-06-16T20:11:00.000
emacs,python-mode
Open new python shell on C-c C-c in python-mode.el
0
1
2
11,602,461
1
1
0
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. Specifically, 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. Does somebody have a working example of this?
true
11,071,287
1.2
0
0
0
The route I have chosen is to combine pyjs (old pyjamas) with web2py, via JSONRPC. So far it is working fine.
0
178
0
0
2012-06-17T12:28:00.000
python,tornado,pyjamas
Integration of pyjamas and tornado
0
1
2
11,453,702
1
0
0
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". The problem is that whenever I add these types of strings the drop down stops working. Any tips on this would be helpful this is my first GUI using PySide, QT Framework, andd QT Designer.
false
11,076,018
0.099668
0
0
1
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). I'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.
0
419
0
5
2012-06-18T01:09:00.000
python,qt,pyside,qt-designer
Qt not letting me create a menu item named after my app with the strings "About", "Preferences", or "Quit? Any tips?
0
1
2
11,092,105
1
0
0
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. Task: 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. I 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). i 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. I 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 ?? Any other suggestions on how this task can be achieved without starting a gazillion threads, are also welcome.. :) :) Thanks in advance for the help.. Cheers
false
11,079,785
0
0
0
0
The main thread creates a queue and a bunch of worker threads that are pulling tasks from the queue. As long as the queue is empty all worker threads block and do nothing. When a task is put into the queue a random worker thread acquires the task, does it job and sleeps as soon as its ready. That way you can reuse a thread over and over again without creating a new worker threads. When you need to stop the threads you put a kill object into the queue that tells the thread to shut down instead of blocking on the queue.
1
2,489
0
1
2012-06-18T09:08:00.000
python,multithreading
Notify the main thread when a thread is done
0
1
3
11,080,491
1
0
0
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. I'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? Thank you for any help/tips.
false
11,108,160
0
0
0
0
The problem is that the default Zoom and Pan don't resize the figure, they just change the limits and redraw the plot. What 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.
0
448
0
4
2012-06-19T19:38:00.000
python,image,matplotlib,scrolledwindow
Matplotlib zooming work in conjunction with wxPython ScrolledWindow
0
1
1
24,759,361
1
1
0
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. In particular, I'm talking about browser games vs. desktop games. I 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). For 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? Thanks! (* 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).
false
11,110,902
0.197375
0
0
1
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. Java applets eliminate all that mess. Presumably also flash or html5.
0
277
0
0
2012-06-19T23:27:00.000
java,python,flash
Game development: "Play Now" via website vs. download & install
0
1
1
11,113,116
1
0
0
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? I am using python 2.6 and what I need is some pointers and/or suggestions.
true
11,118,465
1.2
0
0
2
Take a look at the wxPython demo. I think the demos that you'll find the most helpful are the following: wx.Grid showing Editors and Renderers GridLabelRenderer which is from wx.lib.mixins.gridlabelrenderer Those will probably get you started. When you get stuck, ask on the wxPython mailing list. They'll be able to help you out.
0
585
0
2
2012-06-20T11:24:00.000
wxpython
How to draw border differently for each row in a Grid of wxPython?
0
1
1
11,120,703
1
1
0
The other day I came across a Python implementation called Jython. With Jython you can write Java applications with Python and compile them to pure Java. I was wondering: Android programming is done with Java. So, is it possible to make Android apps with Jython?
true
11,120,130
1.2
0
0
44
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.
0
34,891
0
64
2012-06-20T12:58:00.000
android,python,jython
Programming Android apps in jython
0
6
7
11,122,066
1
1
0
The other day I came across a Python implementation called Jython. With Jython you can write Java applications with Python and compile them to pure Java. I was wondering: Android programming is done with Java. So, is it possible to make Android apps with Jython?
false
11,120,130
-1
0
0
-6
sadly No. Mobile 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.
0
34,891
0
64
2012-06-20T12:58:00.000
android,python,jython
Programming Android apps in jython
0
6
7
26,718,708
1