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 want to add a reference to IronPython.dll to my project. I found this dll in C:\Program Files (x86)\IronPython 2.7\ and different dll's for different Net versions in C:\Program Files (x86)\IronPython 2.7\Platforms\ . What is the difference between these dll's and which one shall I use? The same story with Microsoft.Scripting.dll & Co.
true
18,827,760
1.2
0
0
3
The assemblies in the root (C:\Program Files (x86)\IronPython 2.7\) are for ipy.exe to use. Apps that embed IronPython should use the ones in the appropriate Platform directory (or NuGet, which will pick the right ones automatically). For now, the assemblies in the root are identical to the ones in Platforms\net40, but that is not in any way guaranteed and will almost certainly change in the future.
1
86
0
1
2013-09-16T12:13:00.000
python,.net,ironpython
IronPython.dll - which one to use?
0
1
1
18,834,374
1
0
0
I've been using pygame to make a game recently, and have ran into a little problem... Basically, I would like to be able to stretch the whole image that is on the screen (all the things that I have blitted to it) into the resolution which the user has resized the window to. I've searched a lot on the documentation for pygame and on stack overflow and I can't seem to find an answer... Is it even possible? The source code for my game is pretty big atm, if anyone needs it I'll be willing to post it. Sorry if I made my question a little unclear :)
true
18,835,940
1.2
0
0
4
Blit everything to a separate surface (not directly to the screen), let's call it main_surface. Then blit the main_surface to the screen. Call pygame.transform.scale(main_surface, (width, height) with the new width and height that you get from the VIDEORESIZE event to scale the main_surface and everything in it to the new window dimensions.
0
2,471
0
3
2013-09-16T19:37:00.000
python,pygame,resolution
Is there a way to stretch the whole display image to fit a given resolution?
0
1
1
18,950,357
1
0
0
[Edits noted:] I want to hook into the ScrolledText widget so that when a user clicks anywhere in the scrollbar (or even scrolls it with the mouse wheel, hopefully) I can have it call a callback function where I can [Add: "set a flag, and then return to let the ScrolledText widget do its thing."] [Delete: " do something first (like turn off automatic scrolling) before the scrolling action takes place."] Is this possible? Thanks
true
18,839,464
1.2
0
0
2
Do you want to do something like turning off automatic scrolling, or is that actually what you want to do? If you want to turn automatic scrolling on or off, just check the position of the text before inserting text. If it's at the end, add the text and autoscroll. If it's not at the end, add the text but don't scroll. This will work even if they scrolled by some other mechanism such as by using the page up / page down keys. You can check a couple of different ways. I think the way I've always done it (not at my desktop right now to check, and it's been a few years...) is to call dlineinfo on the last character. If the last character is not visible, this command will return None. You can also use the yview command to see if the viewable range extends to the bottom. It returns two numbers that are a fraction between zero and one, for the first and last visible line. While the user can't turn auto-scrolling on or off by clicking a button, this is arguably better because it will "just happen" when they scroll back to see something.
0
1,968
0
1
2013-09-17T00:29:00.000
python,tkinter,scrollbar
python tkinter - want to call a function when scrollbar clicked in ScrolledText widget
0
1
2
18,840,373
1
0
0
I need to hide the entire QTableWidget and show it. I didn't find the same function for both in its documentation. Do you have any idea?
true
18,872,300
1.2
0
0
1
QTableWidget is a QWidget. Just use the hide() function.
0
50
0
0
2013-09-18T12:28:00.000
c++,python,qt,qt4,pyqt
I need to hide QTableWidget by default
0
1
1
18,872,394
1
1
0
I'm new to Python (IronPython), I come from VS environment. I want to integrate Python with WPF and I understand that IronPython is good a solution for that. I've install IronPython on my computer, but i wonder if the project (Python+WPF) can run on a machine that IronPython is not installed on ? My computer has: Python, IronPython, .Net Freamwork Target Machine has: Python, .Net Freamwork
true
18,880,490
1.2
0
0
1
Absolutely, you just have to include the appropriate assemblies (IronPython.dll, IronPython.Modules.dll, Microsoft.Scripting.dll, and Microsoft.Dynamic.dll) and any standard library modules you may be using with your application.
1
223
0
1
2013-09-18T19:15:00.000
python,wpf,ironpython
Can IronPython run on machine that it does not installed on?
0
1
1
18,882,572
1
1
0
My application has an html-based front-end and uses python logic on the back-end. This application needs to run offline, not connected to the internet, so by "back-end" here I don't mean a server running remotely, but rather python logic running side-by-side in the same app as the browser/html engine. For Windows or Mac desktop apps, I build a Chromium Embedded Framework application, and then launch a sub-process which runs a CherryPy python application built using py2exe (or py2app). The client and the server then communicate using normal http. I'd like to achieve the same thing on both iOS and Android. I've researched several alternatives, but nothing seems to do quite what I need. Kivy is close, but as far as I can tell it doesn't offer a browser/html front-end, but rather provides its own layout engine on top of OpenGL. It has an extension mechanism, but that seems to be more about extending the python side, not the front-end side. On the other hand, I could start with PhoneGap and then add a python library as an extension (possibly using Kivy's mobile library build of python). Or for that matter I could just write a regular C++ app that embeds a browser and uses a python library build. On the third hand, I've played with using various python-to-javascript converters to get the back-end logic into something that can work with PhoneGap directly, but that approach gets pretty difficult given all of the python logic I have -- some of it just doesn't convert so easily. Do you know of apps that are displaying html and running python logic in the same app?
true
18,884,259
1.2
0
0
3
You could do a very simple kivy app, that would start a service (inside which you would do your "server" side, with a small engine like flask or bottle, but i guess cherryPy should work too), and in the main.py of the "kivy" app, don't import kivy, just import webbrowser and start a browser window to localhost:your port. This will use the android browser. edit: oh, services are android only for now, apparently ios 7 supports them too, but kivy-ios hasn't been updated to make use of them.
0
2,655
0
5
2013-09-18T23:57:00.000
android,python,ios,mobile,browser
combining html front-end and python "back-end" in mobile app
0
1
1
18,892,784
1
0
0
I'm building a project that depends on pyqt (e.g. VTK with pyqt). I'm getting an error like QtCoremod.sip: No such file (or something similar). What's going wrong?
false
18,922,009
0.26052
0
0
4
In Ubuntu, package python-qt4-dev was missing. I installed it and it fixes the problem.
1
2,960
0
1
2013-09-20T16:55:00.000
python,pyqt,python-sip
pyqt: unable to find QtCoremod.sip
0
1
3
20,581,575
1
0
0
I want to read/search in an XML document in a window of a wxPython application. A lot of text editors will highlight the content and maybe have support for block and unblock of XML elements. Is there a component that provides at this sort of functionality in wxPython?
false
18,923,762
0.197375
0
0
1
Take a look at the wxPython demo of the StyledTextCtrl. It's in wx.stc. Anyway, the demo labeled StyledTextCtrl_2 shows how to create syntax highlighting for a Python file using self.SetLexer(stc.STC_LEX_PYTHON). For XML, you would just need to change that line to self.SetLexer(stc.STC_LEX_XML). You should also look at PyShell / PyCrust or possibly Editra. The latter is a text editor created with wxPython that does this sort of thing.
0
678
0
0
2013-09-20T18:45:00.000
python,xml,wxpython,wxwidgets
How should I display an XML document in a wxPython UI?
0
1
1
18,925,053
1
0
0
I'm trying to add and delete rows to a GridBagSizer dynamically. Each row of the sizer has a collection of widgets with the rightmost being a 'delete' button which removes the row it's in when pressed. Another button outside the sizer adds a new bottom row of widgets to the sizer when pressed. I have a simple example app that works, but it's rather baroque and I'm hoping there's a simpler way. The working example detaches and destroys all widgets in the row being deleted, but this doesn't remove the blank row where the widgets used to be, even after sizer.Layout(). What I have done to get around this is detach all widgets in rows below the removed row and move them one row up. It works, but is there a better way? Ross
false
18,940,685
0.197375
0
0
1
This is a tip really. Use sizer.SetEmptyCellSize((0,0)) and your empty row will not take any space.
0
356
0
1
2013-09-22T05:32:00.000
wxpython
A better way of deleting and Adding GridBagSizer rows dynamically?
0
1
1
20,538,024
1
0
0
My simple Python app uses PyQt4 for its GUI and clicking a QPushButton causes the app to send a message via serial. GUI elements also update frequently. Question: I did not know how to implement multithreading. Will not having multithreaded process cause the app to be less responsive and less consistent in sending the serial communication especially when a GUI element will be updated at the same time the serial message is being sent?
false
18,981,428
0.197375
0
0
1
That depends. Your PC is idle 99.9995% of the time while you type; so it has a lot of CPU power to spend on background tasks. Most people don't notice this since the virus scanner typically eats 5-20% of the performance. But typing or clicking a button barely registers in the CPU load. OTOH, if you run a long task in the UI thread, then the UI locks up until the task is finished. So from a user perspective, the UI will be blocking while for the serial port, the world will be OK. Overall, this will be faster but it will feel sluggish. Multithreading is generally slower than doing everything in a single thread due to synchronization or locking. But a single thread doesn't scale. Eventually, you hit a brick wall (performance wise) and no trick will make that single thread execute faster.
0
105
0
1
2013-09-24T12:18:00.000
python,multithreading,python-2.7,pyqt,pyqt4
Is Multi-threading required for PyQt4 and Writing to Serial
0
1
1
18,983,482
1
0
0
I'm running Windows 7 32-bit. I've installed Python 3.2.2 and selected every module for installation (including Tcl/Tk). On my computer, I can run a script by double-clicking the .py file and it will find my Tkinter import just fine. If I run it from a command line, it says ImportError: No module named 'Tkinter'. I passed this script on to a coworker who also installed the same way, and she can't run the script at all even with double-clicking. Same Tkinter problem. Our PATHs are identical with C:\Python33 being the first item and tkinter shows in the lib folder. I'm running out of ideas. What's going on? Why is Tkinter so finicky with existing? Update: Apparently Tcl/Tk do not include Tkinter. The reason it worked for me was because I had installed a special Python package via our company's download system that happened to include it. This version was linked to .py extensions. In command prompt, however, my updated Python (with Tcl/Tk but without Tkinter) was the python of choice as selected by my PATH variable. My coworker did not have this special package installed so it did not work for her. I had thought it was my Python 3.3 that was running the script but it was not which is why it seemed like it worked for me. That said, if anyone else runs into this issue, check out the sys.executable and sys.version as indicated below to figure out just what is going on!
false
19,030,579
0.197375
0
0
2
ImportError: No module named 'Tkinter' In Python 3 Tkinter is changed to tkinter Try import tkinter as tk Hope it helps!
0
31,781
0
8
2013-09-26T14:08:00.000
python,python-3.x,tkinter,python-3.3,importerror
Tkinter Not Found
0
1
2
61,686,010
1
0
0
I'm writing a C++ python extension and I've been experiencing a SIGSEGV whenever I call (from C++) a virtually-inherited method of a certain class that is also a PyObject (i.e. it has a PyObject_HEAD). I finally remembered that python doesn't know anything about C++. Sure enough, GCC is putting a vtable pointer in the first 4 bytes of my object (you can tell because the first field of PyObject_HEAD is offset 4 bytes from the address of the object). When python INCREFs the object, it's actually altering the vtable pointer. My question: what should I do to fix this? Moving the virtual methods to a subsidiary class would solve it, but it seems like admitting defeat. Any other thoughts / experiences? (Python 2.7, GCC 4.7.2 on mingw32 / windows 7)
false
19,072,787
0
0
0
0
Python doesn't know about C++ but it does know about structures. So have Python call a pure C function that creates a structure. Instead the structure have a pointer to the C++ object. This way Python sees a pure C interface, but the implementation of the C interface creates a private internal object. We actually do this on one of my projects. It works and it's pretty portable.
1
226
0
1
2013-09-28T23:29:00.000
c++,python
I think python is overwriting my vtable (c++ extension)
0
1
1
19,073,978
1
0
0
Is there a way to get a float value (like 1.91, 1.92 and so on) using the tkinter Spinbox Widget in Python 3.x? Thanks in advance
true
19,078,656
1.2
0
0
10
Use the format and the increment options. Format takes a string format value; use something like %.2f for a floating point number truncated to two decimal places. The increment option specifies the increment value; the default is 1.0. Now, using get() on a Spinbox returns an instance of str. Typecast it to float to get a floating-point value.
0
3,803
0
8
2013-09-29T13:37:00.000
python,tkinter
Python Tkinter Spinbox with float
0
1
1
19,079,141
1
0
0
Consider following problem: I have a gtk / tk app which displays content from a website in a List(Store). I want to do the following things in order: display the window & start downloading show a progress bar on completion of the downloads add the data into the list(Store) This is the condition: the user has to be able to interact with the app while it is downloading. That means that the program is in the window's mainloop during the entire download. What does not work: urllib.urlopen() waits for the entire download to complete Popen() does not allow the communication I want between the two threads How to notify the program that the download has complete is the biggest question Since I am event driven anyway because of Tk/Gtk I might as well use signals My preferred way of solving this would be registering an additional signal "dl_done" and sending that signal to gtk when the download has finished. Is that even possible? Any suggestions are apreciated!
true
19,079,107
1.2
0
0
1
A simple solution is: to share a Queue object between the Gtk thread and the download thread when a download is complete, you put the data in the queue (eg. a tuple with the download URL and the downloaded contents) from the download thread in the Gtk thread, you set up a glib timer checking periodically if something new is in the queue (say, every 100 milliseconds for example) thanks to the "get_nowait" method of the Queue object. You can have multiple download threads, if needed.
0
97
0
0
2013-09-29T14:20:00.000
python,multithreading
Multithreading url requests in python
1
1
1
19,079,260
1
0
0
I'm using PyOpenGL to implement a small 2D game engine. I'm hesitating on the way I implement a Sprite class. I'm already keeping all the scene (tiled map) in a VBO, and all textures are kept in the same big texture. All the sprite's images are also in this texture. So I suppose that, for performance, I should include the sprite in the VBO, let say from position sprite_start_position. The first question is : since a sprite can have several stances (images), is it better to : setting only one entry in the VBO for the sprite, and modifying the texture coords in this entry accordingly to the stance, using glBufferSubData setting as many entries in the VBO as there are stances, but drawing only the current one with glDrawArrays other ? The second is the similar with sprite position. Must I : change the position of the right entry in the VBO with glBufferSubData use some glTranslate before glDrawArrays(GL_QUADS, sprite_start_position, 1) other ? I'm relatively new to OpenGL and I still feel a little lost in this API...
true
19,083,941
1.2
0
0
1
You really shouldn't have to worry about performance for simple sprite based 2D game. Your graphics card is capable of rendering tens or hundreds of thousands of triangles per second (or more!) which is way more than you are likely to need. Thus, it really doesn't matter much which method you choose to use for updating sprites. If you want to have animated sprites though, I recommend you look into 3D textures. They allow you to interpolate between animation frames, which makes your animations look even better! As a side note, you mentioned using glTranslate which is a function from OpenGL 1.x/2.x that has been removed from later versions of the API. I recommend that you try to use "modern OpenGL" (ie OpenGL 3.x/4.x). You can find plenty of information about the differences online. That said, it is still OK to use the older versions of the API if you have a specific reason for doing so, and if you do functions like glTranslate will continue to work.
0
442
0
0
2013-09-29T22:15:00.000
python,opengl,vbo,pyopengl
Fastest way to implement a sprite
0
1
1
19,084,756
1
0
0
I am using appium and using Sudoku app for Android on a Windows 7 machine using Python. If someone can help me find out what the app activity is to opening this and how they were able to figure that out
false
19,128,188
0
0
0
0
A simple VM emulate an Android device. Not dificult.
0
103
0
0
2013-10-02T00:31:00.000
android,python,appium
What is the android activity for opening sudoku and how do I find how to?
0
2
3
19,128,261
1
0
0
I am using appium and using Sudoku app for Android on a Windows 7 machine using Python. If someone can help me find out what the app activity is to opening this and how they were able to figure that out
true
19,128,188
1.2
0
0
0
You just need to run adb shell command in command prompt. After that , Open the Suduko app in your device(make sure your device is connected to your laptop/pc) and go back to the command prompt and run the below command : dumpsys window windows | grep -E 'mCurrentFocus' The Above command will give you the package name & activity name of the currently focused app.
0
103
0
0
2013-10-02T00:31:00.000
android,python,appium
What is the android activity for opening sudoku and how do I find how to?
0
2
3
51,240,166
1
0
0
My objective is to use a QSpinBox to display the numbers from 0 to 9999 with the increasement of 1 using 4-digits format. I managed to set the Maximum value 9999 by using setMaximum command. But I can't seems to find a way to display the values in 4digits format (eg. 0000, 0001,0002). Whenever i set the value to 0000 using setValue , the SpinBox display as 0. How do i display the numbers in 4-digits format (i.e adding leading zero as required) in QSpinBox?
false
19,172,262
0
0
0
0
To do what you want, just set the "prefix" attribute of the spinbox widget to "000". This will then pad values to be 0001, 0002, etc.
0
2,829
0
0
2013-10-04T02:31:00.000
python,pyqt,pyqt4,qwidget,qspinbox
PyQt4 QSpinBox value format
0
1
2
27,464,660
1
0
0
I am trying to use Cython to code my project. My plan is to write .dll in C++, and call them from Python via Cython. So I can have high computational performance of C++, while keeping the simplicity of development of Python. As I go further, I am a bit confused. As I understand, Cython wraps python code into C. The performance is improved since C has better calculation performance. Am I correct at this? If I am right above, then is it necessary to write .dll in C++ and call it from Python in order to improve the performance? If I write python code and wrap it into C, then call it from Python, does it perform better than calling .dll that written in C++?
false
19,181,984
0.664037
0
0
4
First of all, let me disband a few misconceptions that you seem to have. Calling a library from another program will speed up your library. No, no, no, no, no. This makes about as much sense as saying "driving a car at a set speed is slower than having a F1 racer drive a car at the same speed". It just makes no sense. When Python loads your library, it loads and processes it similar to how the kernel loads and processes it (in fact, the kernel does that in Python's case too). In fact, this "double loading" (which wasn't the original design for dynamic libraries) can slow down your library. I should emphasise that this is a tiny difference, and should not concern the ordinary programmer. Cython "wraps" Python code into C It doesn't. It compiles the python code into C, which is then compiled into a dynamic library for Python to load later. This may optimise your Python code somewhat, and give you the ability to interface with atomic C data types, with Python's magic sauce on top. While this is pretty cool, it doesn't give your code any "magical" abilities. I would also like to add that some tests have proven that Java is (drum roll) actually faster than C, C++, Python and other languages because the JVM is very optimised. That doesn't mean you should use Java (because it has other problems), but it should give perspective.
1
17,220
0
14
2013-10-04T13:06:00.000
c++,python,c,dll,cython
Cython VS C++ Performance Comparison?
0
1
1
19,182,661
1
0
0
I have always problems to close my Qt applications properly. What should one take care of when quitting from a Qt::Application? I want to compile a check-list that I can follow to exit all parts properly, depending what functionalities the program uses. For example, if I use QThreads, what needs to done to make sure they are shut down properly, and so on with all other parts that might need special care. I hope I am not the only one having such problems and it turns out to be useful for many.
false
19,227,318
0
0
0
0
There is no checklist beyond proper C++ design. A QThread doesn't, unfortunately, offer any sane default destruction behaviors. In C++ land, that's nominally a no-no. You need some QObject that owns your threads and, before vanishing itself, takes care to either quit or terminate them, followed by waiting on them before they get destroyed. Same goes for all the classes that you wrote yourself: they must act properly when destructed. Qt generally acts appropriately when the instances of its various classes are deleted, QThread is really a standout. Once you follow the base tenet of C++ design, namely that objects release resources upon destruction, you won't have any problems. Use smart pointers, including C++11 if available. QPointer, QSharedPointer, QScopedPointer are all your friends.
1
600
0
0
2013-10-07T14:22:00.000
c++,python,qt
Qt: Quit application -> checklist for proper clean up
0
1
2
19,238,373
1
0
0
Here is what I want to do. A user enters a search query "hello world". The text is searched for this query, when the sentence with "hello world" is found it is inserted in Text widget and shown to the user. I want to somehow highlight the words from the search query so they would look like this: "This is a simple hello world expression." How can I do it?
true
19,277,240
1.2
0
0
3
The text widget allows you to associate tags with a block of text. You do this with the tag_add method of a text widget object. You can then associate various attributes to a tag, such as a bold font, colors, underlining, etc. You configure the attributes of a tag with the tag_configure method of the text widget object.
0
796
0
1
2013-10-09T16:11:00.000
python,tkinter,text-widget
Tkinter: How to make found words bold in Text widget?
0
1
1
19,277,903
1
0
0
Could anyone suggest a python library which has the ability to construct simple 3D objects and interact(touch) them? Here's what I'm exactly looking into: To have a test object, square/rectangular box(or any object) on a ground plane. To have another sphere object of certain diameter. To simulate, i.e. the roll the sphere all over and all sides of the test object. To highlight or shade the parts of the test objects that are touched during the rolling process. (it won't roll all over, due to the ground plane restriction) Not interested to see any animations, just the end product of the test object which were touched by the sphere. Any suggestions on libraries or mathematical methods? Many thanks. p.s. In electrical engineering, this is one of the method to see which part of the building the lightning may be able to strike, i.e the "touched" area.
false
19,356,408
0.099668
0
0
1
Vtk is a very sophisticated framework, but it might be overkill.
0
1,707
0
0
2013-10-14T08:41:00.000
python,3d
Python: How to model 3D objects and interact them in 3D space?
0
1
2
19,362,585
1
0
0
I'm trying to wrap two C++ classes: Cluster and ClusterTree. ClusterTree has a method get_current_cluster() that instantiates a Cluster object, and returns a reference to it. ClusterTree owns the Cluster object, and manages its creation and deletion in C++. I've wrapped Cluster with cython, resulting in PyCluster. PyCluster should have two ways of creation: 1) By passing in two arrays, which then implies that Python should then automatically handle deletion (via __dealloc__) 2) By directly passing in a raw C++ pointer (created by ClusterTree's get_current_cluster()). In this case, ClusterTree then assumes responsibility of deleting the underlying pointer. from libcpp cimport bool from libcpp.vector cimport vector cdef extern from "../include/Cluster.h" namespace "Terran": cdef cppclass Cluster: Cluster(vector[vector[double]],vector[int]) except + cdef class PyCluster: cdef Cluster* __thisptr __autoDelete = True def __cinit__(self, vector[vector[double]] data, vector[int] period): self.__thisptr = new Cluster(data, period) @classmethod def __constructFromRawPointer(self, raw_ptr): self.__thisptr = raw_ptr self.__autoDelete = False def __dealloc__(self): if self.__autoDelete: del self.__thisptr cdef extern from "../include/ClusterTree.h" namespace "Terran": cdef cppclass ClusterTree: ClusterTree(vector[vector[double]],vector[int]) except + Cluster& getCurrentCluster() cdef class PyClusterTree: cdef ClusterTree *__thisptr def __cinit__(self, vector[vector[double]] data, vector[int] period): self.__thisptr = new ClusterTree(data,period) def __dealloc__(self): del self.__thisptr def get_current_cluster(self): cdef Cluster* ptr = &(self.__thisptr.getCurrentCluster()) return PyCluster.__constructFromRawPointer(ptr) This results in: Error compiling Cython file: ------------------------------------------------------------ ... def get_current_cluster(self): cdef Cluster* ptr = &(self.__thisptr.getCurrentCluster()) return PyCluster.__constructFromRawPointer(ptr) ^ ------------------------------------------------------------ terran.pyx:111:54: Cannot convert 'Cluster *' to Python object Note I cannot cdef __init__ or @classmethods.
false
19,370,230
0
0
0
0
I know this is an old question, but after my own recent struggles with Cython I thought I'd post an answer for the sake of posterity. It seems to me you could use a copy constructor to create a new PyCluster object from an existing Cluster object. Define the copy constructor in your C code, then call the copy constructor in the Python class definition (in this case, when a pointer is passed) using new. This will work, although it may not be the best or most performant solution.
0
857
0
0
2013-10-14T22:20:00.000
python,cython
Cython: overloaded constructor initialization using raw pointer
0
1
2
28,981,092
1
0
0
I have an hybrid c# object, with some instance properties and methods, and I pass it to IronPython. What I want is to syncronize the dispatch to the c# members, both static and dynamics, from Py code. I implemented the IDynamicMetaObjectProvider on the c# object, and I noticed that when Py invokes the static methods of my object, and with instance methods, defined at compile time vs dynamics, the method BindInvokeMember is never used, but it is always called the method BindGetMember. I'm a little confused, probably this thing can't be done?
true
19,397,436
1.2
1
0
0
IronPython will always use BindGetMember and then Invoke the result because that's how Python works - get the attribute from the object, then call it. Your BindGetMember implementation should return another dynamic object that implements BindInvokeMember, which will have the arguments you need.
0
216
0
1
2013-10-16T07:24:00.000
c#,ironpython,dynamic-language-runtime
Intercepting method invocation to c# objects
0
1
2
19,430,707
1
0
0
In 2D plane, I have a rectangle defined by 4 vertices, A, B, C and D. I now wish to find the integer points (coordinates are integer) that fall into rectangle ABCD. Before asking, what I did is extremely expensive in computation. Briefly, I was enumerating all the integer points and checked whether that point was in the rectangle or not. I found that it was too brutal to be used in my project, as I have many many point. How should this be done elegantly? UPDATE: Note that the rectangle can be of a random orientation, depending on the coordinates of the four points. Assuming nicely-placed is kinda cheating.
false
19,400,489
0
0
0
0
You can map the 4 vertices on the coordinate axis. Suppose the A(x1, y1),B(x2, y1), C(x1, y2),D(x2, y2) and x1 <= x2 && y1 <= y2, if and only if x1<= x <=x2 and y1 <= y <= y2, the point p(x,y) falls into rectangle ABCD.
0
1,554
0
4
2013-10-16T10:04:00.000
python,algorithm
Find integer points within a rectangle in Python?
0
1
2
19,400,758
1
0
0
I'm working on a X-plotter like widget that plots incomming data live. I already searched for an solution to realize a scrolling along the x-axis if the widget has to much values and so they don't fit. I had the folling approaches to realize it: derive from a widget that supports scrolling and child widgets and add my own widget while making it bigger and bigger during the live updates: -> Which parent do I need to use and how do I avoid to draw all the stuff that is currently not visible? modify my widget in a way that it supports the scrollbars itself -> but how? draw/handle my own scrollbars -> worstcase :( I really searched the web for suggestions or examples, but there is nothing about how to "construct" custom controls in a good way (beyond drawing something) esp. in the case of interaction... Sorry but I'm a newbie at GTK in general :/
true
19,411,111
1.2
0
0
2
Most widgets in Gtk do not have scrollbars. If you want to scroll the entire widget, you have to implement the GtkScrollable interface. Then, you add the widget to a GtkScrolledWindow. The scrolled window has the scrollbars, those GtkScrollbars are linked with GtkAdjustments which are passed to your custom widget through the GtkScrollable interface set_vadjustment and set_hadjustment. If you just want to add a scrollbar and control its behaviour yourself, then you need to somehow add a GtkScrollbar in your widget, which means you will need to make it a container too. The GtkScrollable approach is the following, first you implement vadjustment and hadjustment setters and getters, then when the GtkAdjustments are set, you set its lower and upper limits and the page size(how much of the widget is visible at once). After that, you connect their value-changed signal so you can refresh your widget when the scrollbars are dragged. A GtkScrollable doesn't get to check the scrollbars, only the adjustments that will be bound to the scrollbars. When drawing the widget you get the adjustments' value property in order to determine how much the scrollbars have shifted in the horizontal and vertical axes.
0
574
0
0
2013-10-16T18:34:00.000
python,gtk,custom-controls,scrollbar,pygtk
Python: Creating own Widget with scrollbars
0
1
1
19,477,901
1
0
0
Anyone who has worked with Multithreaded PyQt4 apps? I was just wondering if the inbuilt signal/slot mechanism coupled with QtThread of PyQt4 framework has any benefit over the standard Python threads (which are designed in my code to handle the UI components in a thread safe way offcourse) using event driven async callback. I am looking for any major speed or security concerns, any specific run-time exceptions or edge cases. (The UI is quite complex hence a re-write at a later stage would be very counter-productive). Thanks. Edit: I realize this might mean replicating some of the already present PyQt core functionality but it is ok if it allows more flexibility within the app.
false
19,492,277
0
0
0
0
There's no point really using Qt/PyQt if your're not using the signal-and-slot mechanism and rolling your own event loop. Basically, you'd be reimplementing the core of the framework itself. But I'm guessing this is not what you're asking about. It would be nice if you could clarify your question a bit, (because of which I've had to make a few assumptions) but here's the deal: I think you're a bit confused about what the signal and slot mechanism does. (or maybe not, forgive me for reiterating some stuff that might probably be obvious to you). The signals-and-slots do not implement threading for you (so the question of using signal/slots having any benefit over standard Python threads is moot) You're probably assuming that the signal-slot mechanism is multithreaded, and that a slot when called by a signal, executes in a new thread. Well, this is not the case. The signal and slot mechanism in Qt runs in a single event loop in Qt (implemented by QApplication), which itself runs in a single thread. So signals and slots are not replacements for multi-threading in any way. If there's a slot that blocks, then it will block your entire application. So any blocking I/O or time intensive functions should ideally be in a separate thread from the UI, and your slots should start execution of these threads. Now whether to use QThread or standard Python threads to implement your own threads is another issue, and it's been asked on StackOverflow before, but I tend to use QThreads for Qt apps. So if you have a button, and you want to start a file download with the Requests library when its clicked, you'll connect the clicked signal of the QPushButton to a slot say for example downloadButtonClicked, and that slot would start a new QThread which would take care of downloading the file using Requests. You can further connect the finished() signal from the QThread to know when the download is complete and to update your UI (I'll add a code example if this is indeed what you're asking about. So please clarify your question)
1
257
0
0
2013-10-21T10:39:00.000
python,multithreading,qt,thread-safety,pyqt
PyQt4: Conventional multithreaded UI over Signal/Slot mechanism?
0
1
2
19,494,905
1
0
0
I have a program that opens two separate windows, one of which is full screen. I would like to open the full screen window on the secondary display (this program will require at least 2 screens to be properly functional, but is not enforced) and the other window on the main display. Is there any way to do this in python 3 and tkinter?
true
19,509,244
1.2
0
0
0
Probably not a very portable solution, but what I have seen done in the past is to use absolute positioning (using wxPython, though). So if you have two monitors set at 1024X768 in a side by side setup, the first screen's x would be 0, and the second screen's x would be 1024 (or 768 if I have my x's and y's mixed up ;).
0
2,170
0
1
2013-10-22T04:54:00.000
python-3.x,window,tkinter,multiple-monitors
python 3 open window on screen 2 by default (multi displays)
0
1
1
19,516,336
1
0
0
I have a Qlineedit widget which i will use to accept the username. It will be displayed as soon as user launch the application. I want the Qlineedit widget ready for typing (ie, with cursor already in place) without needing the user to use mouse to click on the widget before typing. I have tried .setFocus() and .setCursorPosition(1) but doesn't seem to work. Which method should i use to set the cursor at the starting position of Qlineedit without user needing to click on it?
true
19,509,950
1.2
0
0
1
It was my mistake. I was trying to use setFocus before i add the widget to the layout. Now, I used the setFocus method after the wiget is added to the layout and it works fine.
0
148
0
0
2013-10-22T05:50:00.000
python,cursor,pyqt,qlineedit
Tkinter .focus_set() equivalent in PyQt4
0
1
1
19,513,341
1
0
0
I'm building a medical application that should respond to a RFID card scan (and pop up some information). I'm using PyQT to build this, btw. Could someone tell me what tool to use to simulate rfid scans on the machine ? I'm a little noob to this, but I'm assuming I'll use a USB based reader and I should be able to somehow hook to the reader to get some data. Help...
false
19,539,031
0
0
0
0
Unfortunately there is pretty much no way we can know how a particular rfid reader will work. Your best would just be to assume that it will fire off events somehow, and implement a fake rfid reader that sends off a string of data (that you expect to get from an rfid chip) when you want. Once you get an rfid reader, you can then wrap whatever library you have been provided to access it (or write your own) so that it matches the format/communications protocol you made up for your fake one. But the far simpler solution is to just get yourself an rfid reader and find out experimentally...
0
331
0
0
2013-10-23T10:22:00.000
python,winapi,pyqt,nfc,rfid
What tool to simulate rfid events on windows (python-win32 compatible?)
0
1
1
19,565,664
1
0
0
I have been playing with using tkinter to make overlays so some information would appear on top of the rest of the screen. I'd rather not have this window block the mouse. Is there any way I can have it so click events pass though my overlay? So the window below my tkinter app receives the event.
false
19,546,104
0.066568
0
0
1
One way to do this is build your own msg queue with a lightweight caller and scheduler to process msg and state of widget. This class or function is usually there without such name as queue manager because having back-end class is general-purpose item for application. Adding to simple event transfer queue could have this done which is what I am now doing.
0
2,078
0
4
2013-10-23T15:34:00.000
python,tkinter
How to make click events pass though a tkinter window?
0
2
3
52,703,943
1
0
0
I have been playing with using tkinter to make overlays so some information would appear on top of the rest of the screen. I'd rather not have this window block the mouse. Is there any way I can have it so click events pass though my overlay? So the window below my tkinter app receives the event.
true
19,546,104
1.2
0
0
2
No, there is nothing built in to tkinter that would allow you to do that. The best that you could hope for is to capture an event, then use some sort of platform-specific tool that lets you create new events, and use the coordinates from the captured event to generate a new, non-tkinter event.
0
2,078
0
4
2013-10-23T15:34:00.000
python,tkinter
How to make click events pass though a tkinter window?
0
2
3
19,547,637
1
0
0
I have the path to a file/folder. How can I get the icon image in the system for this file/folder? I'm writing a customized file browse model for a QTreeView and would like to display the icon like what the QFileSystemModel does.
true
19,552,495
1.2
0
0
2
AFAIK QFileSystemModel relies on QFileIconProvider to get the correct icon. You can do the same in your implementation by using the icon (const QFileInfo &info) method. This may work or not depending on the Desktop Environment you use.
0
688
0
1
2013-10-23T21:18:00.000
python,pyqt4,qfilesystemmodel
How do I retrieve the system icon for a file in python or qt?
0
1
1
19,566,575
1
0
0
The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.). So, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button. Do you know what is the difference between them? Why would you choose one or the other?
false
19,561,727
0
0
0
0
It is just a matter of the design of a GUI Window. So Tkinter is a really easy-to-use efficient and useful GUI toolkit. But it looks a bit outdated. Tkinter Ttk widgets are similar to that of Tkinter. It is basically a sub-module of Tkinter. So, in Tkinter Ttk, almost many widgets are the same but to use them is different. Tkinter Ttk widgets are more customizable and a lot of windows programs are done and designed using Tkinter
0
51,337
0
68
2013-10-24T09:14:00.000
python,tkinter,ttk
What is the difference between the widgets of tkinter and tkinter.ttk in Python?
0
3
6
67,762,390
1
0
0
The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.). So, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button. Do you know what is the difference between them? Why would you choose one or the other?
false
19,561,727
1
0
0
8
My opinion for beginners who are starting to learn Tkinter, is to use Tkinter widgets, because they're really easy to learn. But on the other hand Tkinter.ttk is a module designed to make Tkinter widgets look really perfectly, but is really hard to learn and there are no easy options there. Like there are no -fg, -bg. Perhaps, there are no new styles available in Tkinter. Style are only designed for ttk, and can be found in ttk. And Tkinter widgets really don't look like other native platform widgets. But ttk is nicer and smoother looking, and look like other native platforms. So if you are making apps for your own private use, then use Tkinter and also use some ttk if needed, because ttk supports much cooler widgets that can change the look of your app. And if you are making apps for public use, then go for both because Tkinter is needed for creating the window and some more important stuff, and for widgets go for ttk. But honestly, I say use both because there are no conflicts between the two; just use them both to your advantage. Honestly using ttk is a challenge! Because it has no Grid,Pack, Place and many other options that are normally available in Tkinter widgets. But wait!! Tkinter has those options! So use both! Try to make a nice app! That is the real difference between the two: Tkinter widgets are more configurable, and ttk is more modern and it is configurable with styles which are really handy shortcuts. And Tkinter is like the core of the window and ttk is styling. Think of it like this: Tkinter --- HTML, ttk --- CSS, Python --- JavaScript.
0
51,337
0
68
2013-10-24T09:14:00.000
python,tkinter,ttk
What is the difference between the widgets of tkinter and tkinter.ttk in Python?
0
3
6
53,561,414
1
0
0
The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.). So, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button. Do you know what is the difference between them? Why would you choose one or the other?
true
19,561,727
1.2
0
0
90
The widgets in tkinter are highly and easily configurable. You have almost complete control over how they look - border widths, fonts, images, colors, etc. ttk widgets use styles to define how they look, so it takes a bit more work if you want a non-standard button. ttk widgets are also a little under-documented. Understanding the underlying theme and layout engines (layout within the widgets themselves, not pack, grid and place) is a challenge. Generally speaking, the themed widgets will give you an application that looks more "native", but at the expense of a loss of configurability. My advice is to use ttk widgets if you want your GUI to look a little more modern, and the tkinter widgets if you need a bit more configurability. You can use them both in the same applications.
0
51,337
0
68
2013-10-24T09:14:00.000
python,tkinter,ttk
What is the difference between the widgets of tkinter and tkinter.ttk in Python?
0
3
6
19,564,114
1
0
0
I made a program, which uses tkinter to create a window where stuff happens. It contains images and loops to constantly shift and move the images. Now, when I close the window, the scripts are still running and it creates error messages that it has nowhere to place the images with new coordinates. I think that the loops are still running. So my question is, how do I close the program all together after clicking the x on the window. Is there a way to bind the x(close window) to terminate the program, or cat n ibe done inside a code, to see when the tkinter window is closed(to me this way seems to be bad, because it would keep checking for if the window is still existing or not). Thanks a lot!
false
19,624,968
0
0
0
0
I had the same issue caused by a top level window I had created and withdrawn but didn't destroy. Properly destroying it fixed my issue.
0
1,700
0
1
2013-10-27T23:30:00.000
python
Closing a python program window leaves program still running in the background
0
1
1
54,815,571
1
0
0
How do I load a TrueType font file in Tkinter without installing it in the font directories and beside the running script, like for example in Windows/Linux? I'm trying to create a script with the fonts not need to be installed separately and already included in my main package.
true
19,635,133
1.2
0
0
1
You cannot dynamically load fonts with tkinter.
1
1,254
0
1
2013-10-28T12:44:00.000
python,tkinter,truetype
Loading a TrueType font file in Tkinter without installing it in fonts folder
0
1
1
19,635,408
1
0
0
After some research I've decided to use wxWidgets to build user interfaces for my Python programs. I learnt this could be done in two ways: either I blend my "behind the scenes" raw Python code with interface related wxPython code, or I could separate the interface from the main code, creating a separated XRC file for the interface and just calling it in the main Python code. What should I do, should I learn wxPython or should I learn XRC code? I read some advantages of learning/using XRC: Separates the interface from the program logic. Dialog Blocks only outputs to C++ and XRC, not for Python. Ability to choose between different resource files at run time. XRC is a wxWidgets standard, so it can be generated and processed by any program that understands it. XML is easier to parse than most programming languages. But I think there are some disadvantages too: Documentation seems a lot bigger for wxPython. More people seems to learn and talk about wxPython, so support for. XRC may be scarce So, what would be the best to learn, XRC code or wxPython code?
true
19,671,933
1.2
0
0
2
You should learn wxPython. XRC does have its advantages, but it only covers the core widgets. If you want access to the rest of wxPython, then you'll have to figure out how to make XRC wrap the unsupported widgets, which is non-trivial and will require you to learn wxPython anyway. There are tons of wxPython tutorials, but only a few XRC tutorials. I've written about both, but I usually stick with wxPython code.
0
612
0
1
2013-10-30T00:55:00.000
python,user-interface,wxpython,xrc
Should I learn wxPython code or XRC code?
0
1
1
19,686,565
1
0
0
Is there any way to hide python shell while using a tkinter window or turtle window? While opening py file by clicking the py shell shows every time but I don't need it.
true
19,679,256
1.2
0
0
4
Start your Python program using pythonw.exe instead of python.exe. This is specifically designed for this.
0
550
0
2
2013-10-30T10:05:00.000
python,python-3.x,tkinter
Hide python shell while using tkinter window
0
1
1
19,679,336
1
0
0
I already import the projects but when I cleaned them, there's an error. Please help me to fix it. I'm stuck. Errors occurred during the build. Errors running builder 'Android Resource Manager' on project 'PyDroid'. java.lang.NullPointerException Errors running builder 'Android Resource Manager' on project 'Python32APK'. java.lang.NullPointerException Errors running builder 'Android Resource Manager' on project 'PythonAPK'. java.lang.NullPointerException
false
19,724,167
0
0
0
0
I had same problem, I removed project/s from package explorer and re-imported again. so go to your project right click and select delete (make sure don't delete from disk) and then go file/import and browse it again. If your project is on your work space, just cut and paste in different location and than import from there. hope this help.
0
418
0
1
2013-11-01T09:37:00.000
android,python,eclipse,workspace,sl4a
Error in building workspace For Eclipse for Python Android Programming
0
1
1
20,184,174
1
0
0
I'm trying to create Validators for inputs on forms. I learned already that in wxPython it is necessary to inherit from wx.Validator due to lack of support for standard wxTextValidator and others. My question is: how effectively check that string complies to simple rules (no regexp please) acceptableChars = ['a', 'b', ...] all(char in acceptableChars for char in string) is something like this efficient? and how to cleanly specify all alphanumeric or digits? or maybe is there any ready class or function? will overriding Validate method only keep the constraints while inputing data - I mean will it prevent user from entering digits into alphanumerical TextCtrl or will it check only at closing the modal diagog?
true
19,759,096
1.2
0
0
1
Validate() is called only when the dialog is about to close by default, but you may also call it yourself when the control loses focus. Finally, if your control doesn't accept some characters at all, you can also intercept wxEVT_CHAR events to prevent them from being entered. I do believe wxPython demo shows how to do it.
0
215
0
0
2013-11-03T22:42:00.000
python,wxpython,wxwidgets
Validating data in wxPython
0
1
2
19,760,286
1
0
0
I have PyQt application which uses SQLite files to store data and would like to allows multiple users to read and write to the same database. It uses QSqlDatabase and QSqlTableModels with item views for reading and editing. As is multiple users can launch the application and read/write to different tables. The issue is this: Say user1's application reads table A then user2 writes to index 0,0 on table A. Since user1 application has already read and cached that cell and doesn't see user2's change right away. The Qt item view's will update when the dataChanged signal emits but in this case the data is being changed by another application instance. Is there some way to trigger file changes by another application instance. What's the best way to handle this. I'm assuming this is really best solved by using an SQL server host connection rather than SQLite for the database, but in the realm of SQLite what would be my closest workaround option? Thanks
false
19,759,594
0
0
1
0
SQLite has no mechanism by which another user can be notified. You have to implement some communication mechanism outside of SQLite.
0
74
0
0
2013-11-03T23:40:00.000
python,sql,qt,sqlite
Signaling Cell Changes across multiple QSqlDatabase to the same SQliteFile
0
1
1
19,764,106
1
0
0
Pressing command-H in OSX immediately hides the active window. How do I achieve the same effect, programmatically, from Python? Specifically, I'd like to find a particular window that my application creates and then be able to show & hide it programmatically. I already know how to do this with pywin32 but I'm afraid my expertise there doesn't quite cover OSX as well. If it helps, the window in question is one created by pygame. I know that pygame has pygame.display.iconify() but that doesn't satisfy my requirements - the window doesn't disappear immediately, but rather the disappearance is animated, and there's no corresponding "uniconify" function that I can find.
false
19,787,324
0
0
0
0
Well, this ended up working. When I want to hide the window, I do pygame.display.quit() and make my code properly handle not having a display. When I want to show it, I do pygame.display.set_mode(...) with the former resolution. The net effect is that of hiding & showing the window. Unfortunately the window gets created in a different spot than where it started, and although apparently you can tell SDL to create the window in a particular spot, I haven't been able to find a way to get the window's location...
0
819
0
1
2013-11-05T10:55:00.000
python,macos,user-interface,pygame
hide pygame window on OSX
0
1
1
19,800,717
1
0
0
I am trying to develop GUI for a who wants to be a millionaire game using pygame. If the user is presented with the welcome screen and clicks new game, it should clear the welcome screen and bring up the main game screen. I tried using os.system('xxx.py') but it doesnt stay on, it just flashes and goes off. Any ideas on how to make this work? Thanks in anticipation.
false
19,864,484
0.53705
0
0
3
You probably shouldn't be trying to launch a new instance of your game. You should create a reset method which can be called to restart everything. It would clear all variables, set the game state back to the start, etc.
0
208
0
0
2013-11-08T16:55:00.000
python,pygame
Clear previous screen to show next screen pygame
0
1
1
19,864,546
1
0
0
I have a lot of code in Delphi I would like to use in python. In Delphi XE is an option to generate C / C + + files. obj Can I generate these files. Obj in Delphi and use it in python code python code to use it. obj will still be cross-platform? thank you
false
19,867,190
0.379949
0
0
2
Delphi generated .obj files cannot be consumed by Python because Python doesn't consume .obj files. You'd need to compile them to a library at the very least. At which point, emitting .obj files is pointless – you may as well just output a full module. I conclude that you'll need to compile your Delphi code to a library (DLL) or a COM object. To support multiple platforms, you'll need to compile separately for each platform. Which means that you'll only be able to support platforms on which Delphi compilers exist. FreePascal has wider platform support and may be a better choice. Obviously COM would restrict you to Windows. So the other option is a library. This can be consumed using ctypes or by making your module a Python extension module.
1
245
1
3
2013-11-08T19:37:00.000
c++,python,c,delphi,.obj
delphi code compiled to obj files to be used in python
0
1
1
19,867,378
1
0
0
I am still working on my text editor, and now I want to make it run faster. So I thought I may somehow get currently visible text, and parse it as I want. So is there a way to get currently visible lines? P.S. Or maybe there is another way to increase StyledTextCtrl's performance? Thanks.
true
19,896,965
1.2
0
0
2
Use GetFirstVisibleLine() to determine the first visible line. Lines are numbered starting at zero. Use LinesOnScreen() to determine how many lines are visible on the screen. You can use GetLine(line) to get a string of an individual line.
0
273
0
2
2013-11-11T00:16:00.000
python,performance,wxpython,scintilla
wxPython - StyledTextCtrl get currently visible lines
0
1
1
19,897,133
1
0
0
I'm working on an app that will display an image and some text. But I want to export the whole QT interface as a PDF (By pressing on a button on the UI itself). All the text and all the images just as it appears on the UI. Now if that isn't possible, maybe I can some how automatically create a jpg, save it and then somehow, using reportlab, to convert the jpg to a PDF. I have no idea where to start. Can any one please give me an example or even just a hint.
true
19,904,687
1.2
0
0
2
You can use QPixmap.grabWidget to capture you main window widget and QPrinter to produce a pdf file. A QPainter is needed to draw the pixmap to the printer.
0
1,204
0
1
2013-11-11T11:01:00.000
python,qt,pdf-generation,pyqt4
Creating a PDF from a QT application
0
1
1
19,905,659
1
0
0
I have created a QMainWindow in python with Qt library. When user clicks on the close button, I'm prompting a warning QMessageBox (Yes/No). I want to fully disable main window's functionality until user chooses yes or no -to the second window-. (I want something like "freezing" the main window.) I have tried "self.setEnabled(False)" for the main window, but user could still click on minimize and maximize buttons. Thank you in advance.
false
19,906,736
0
0
0
0
Nicolescu's answer is perfect and working. When you open popup/modal(QWidgets.QWidget) window, and want to disable parent window activiy, until the child is open, just use hist example. def init(self): self.setWindowModality(QtCore.Qt.ApplicationModal))
0
6,641
0
5
2013-11-11T12:46:00.000
python,qt,user-interface,pyqt
disable window functionality in pyqt
0
1
3
63,035,982
1
0
0
I've created a form in Qt Creator 4 and 'compile' it to python module with pyuic4. Everything is ok but when I call the class represented my for it contains over 20 form elements as a public members (including Spacers etc.). But I need only 5 of them. It's not fatal but annoying... Is there a way to declare an element in Qt Creator as private/hidden? I mean it has to be done in Qt Creator because if I'll make any changes and recompile .ui file all changes in .py file would be overwritten.
false
19,939,598
0
0
0
0
The pyuic tool uses the objectName to generate the names of the top-level class and its members. So to make a member "private", just prepend some underscores to the objectName property in the designer component.
0
96
0
0
2013-11-12T20:50:00.000
python,qt,pyqt,pyqt4
Qt Creator: how to hide members?
0
1
1
19,943,638
1
0
0
I've been searching for a library I can import and superimpose on my wxpython-based layout to give it a Flat-UI look. Does there exist libraries that can be used along with wxpython or just python?
true
19,978,119
1.2
0
0
1
You can use the custom widgets in wx.lib for the flat look, however there is no way to apply a "theme" to all the widgets in wxPython. Why? Because wxPython tries to wrap the native widgets on each platform, so it does its best to look native. If the native widgets are flat, then you'll see wxPython doing that too. Otherwise, you have to use the custom widgets. If you want your app to have the "flat" look on all platforms, then you'll probably want to take a look at some other toolkit that allows theming, like Kivy or Tkinter. I think PySide/PyQt might even allow a little theming too.
0
1,140
0
0
2013-11-14T12:51:00.000
python,wxpython
Are there Flat-UI libraries for wxpython or just python?
0
1
1
19,981,325
1
0
0
I have one button and when user clicks it I catch an event and in the handler function I call Disable() function on that button but it isnt greyed out... Only if I click on some other widget after that, button becomes greyed out... Anyone knows what could be the problem?
true
20,023,377
1.2
0
0
2
Sounds strange. Try one of these... Use wx.CallAfter(button.Disable) instead of button.Disable(). Call button.Refresh() after disabling it.
0
737
0
1
2013-11-16T20:19:00.000
python,wxpython
Button isnt greyed out when disabled
0
1
1
20,023,469
1
0
0
I want to place group of buttons ontop of a QLabel showing image, the question is how do I animate the fade in visibility of the QButtonGroup, I want to place my buttons at the bottom area so whenever pointer is at the bottom area the button group should animate to fully visible but if I move the pointer out of the bottom area, the button group should animate to a gradual fade out.
false
20,026,876
0
0
0
0
I did same thing with QLabels, QButtons and other Widgets. There are different solutions accordingly on what you need. In my case I just created a custom component with a QTimer and a QGraphicsOpacityEffect. The timer increases or decreases the opacity value (by a coefficient)..
0
107
0
0
2013-11-17T03:33:00.000
python,qt,pyqt4,fadein
animate visibility of QButtonGroup or layout containing it
0
1
1
20,217,728
1
0
0
I am using Python 2.4.3 and Qt Designer to make a GUI. When I press one of my buttons it goes off and does several serial processes. After each process I want to update the user by outputting text to the GUI, however, that text doesn't come out until I have completed all my processes. I have seen other questions regarding this same issue where processEvents() is recommended. Dumb question, what module do I have to import to get the processEvents() function that will make this work or is there one for Python 2.4.3? I am running on a Red Hat Linux machine. Thanks in advance.
false
20,052,953
0
0
0
0
Qt.qApp or QApplication.instance() yields the QApplication object which has a processEvents that you can call.
0
235
0
1
2013-11-18T16:37:00.000
python,qt,user-interface,python-2.4
Interrupting process in Qt to update GUI
0
1
2
20,053,291
1
0
0
I have searched to the point of confusion, so I need some guidance. I want to make a game on Android with Python - ONLY using my android device. I'm confused in the difference between Kivy and Sl4a and what steps i need to take in order to be able to program and run my game on my phone. I seem to only be able to find outdated or misleading information, so i apologize if this is simple. Any guidance is much appreciated. Thanks!
false
20,060,481
0.53705
0
0
3
I have searched to the point of confusion, so I need some guidance. I want to make a game on Android with Python - ONLY using my android device. As others have said, this is somewhere between 'really hard and annoying' and 'impossible'. Especially without a computer to do any of the process! I'm confused in the difference between Kivy and Sl4a Kivy is a cross-platform (linux, windows, osx, android, ios, maybe more) graphical framework for python. The same developers maintain a python-for-android project that lets you very easily compile a kivy program to an android apk. You can also do java api interaction etc. using the pyjnius project, which is also maintained by the same devs, and some apis (vibrate, accelerometer etc.) are already abstracted as a python module so you don't have to touch java. sl4a was originally (I think) a way to run python scripts on android. It has its own way to do some stuff with the android apis, but I don't know the details or what is possible. There are also some ways to package as an apk or to do some kinds of graphical work, but I'm not familiar with this either - I think they're much more limited as a graphical framework than kivy is (not that it sets out to be a full framework in the same way), but I don't know much about it, and at the very least the graphical stuff works in a quite different way that has advantages of its own. (Edit: Notice all the 'I think' in the previous paragraph? That's because I really don't know for sure and don't want to say something wrong. Don't take my word for it, try it!) Overall, kivy and sl4a (plus both of their related projects) are separate projects, with different focuses and technical capabilities. I personally think kivy is a more obvious choice for purposes other than basic scripting (though even simple sl4a scripts are useful to make tasker scripts etc.), but while some of kivy's advantages are arguably objective, some of my opinion is subjective. what steps i need to take in order to be able to program and run my game on my phone This is really a big topic on its own. Already knowing kivy, I reckon I could throw together a process to do it, but I'd absolutely not want to because it would need a horribly painful mishmash of other tools interacting in ways that are not a good user experience. In essence, I'd use text editors to create android files to run with kivy's interactive launcher (which is on the play store), and can probably in principle compile to an apk using kivy's online buildozer tools. However, I'll really stress that this is only in principle possible and I can't recommend trying - I think android really does not have a good set of tools for general purpose programming of this sort, and the os doesn't fit well with the multitasking of coding. If you just want to write scripts and run them, you may have more luck. You can look at apps like qpython and codepad2 lite, along with the sl4a stuff (and probably other apps, these are just a couple I've seen or tried recently) for apps that can let you edit and run these kinds of scripts. This might be usable for certain things, but even then I don't think it would be a fun experience if you also need to switch between reading docs in a different app etc. So overall...certain things are possible, but building full apps with (say) kivy is not likely to be an easy or pleasant experience with the current tools. Since you say you're constrained by circumstance and not choice, I suggest playing with qpython etc. and seeing what happens, but you aren't missing some fabulous ide that takes all the pain away.
0
2,130
0
0
2013-11-18T23:57:00.000
android,python,pygame,kivy,sl4a
Python programming from my phone?
0
1
1
20,061,233
1
0
0
what I want to do is to change the color of a QTableWidget item, when I hover with the mouse over the item of my QTableWidget.
false
20,064,975
0.049958
0
0
1
There are no events based on QTableWidgetItem, but you can do this: reimplement the mouseMoveEvent() of QTableWidget, you can get the mouse position; use itemAt() method to get the item under your mouse cursor; customize your item; This may simalute what you want.
0
13,694
0
1
2013-11-19T06:47:00.000
python,pyqt,qtablewidget,mousehover,qtablewidgetitem
How to catch mouse over event of QTableWidget item in pyqt?
0
1
4
20,068,068
1
0
0
I am using a Flexgridsizer that contains a mix of statictexts and buttons within it. My flexgridsizer contains 1 column of statictext that never changes, 3 columns that update constantly (sometimes a tenth of a second) and the last column has all buttons that remain the same -- I have about 12 rows. When I push "go" on my code, the three statictext columns update constantly. I do this by self.text1.SetLabel('newtext'). This works great. However, I initially set up the gridsizer so the statictext is centered. Therefore, when i run my code, after updating each cell, i run self.panel.Layout(). This helps get my columns centered again. The problem with this is that since I do so much updating, it causes my buttons in the last column to look like they are moving left and right (since it appears to be resetting the layout of the buttons). I want the buttons to "stay still". To fix this, I removed the self.panel.Layout() BUT this now makes all my text be right-justified. Is there any way to apply the Layout() to just specific columns of the gridsizer? I really need to keep the gridsizer if possible. I have also seen the "noautoresize" but one of my columns experiences texts of different lengths at each update. Any thoughts? Thanks!
true
20,085,750
1.2
0
0
1
Try setting the StaticText size to something specific, like (100, -1). That way it should stay the same unless you happen to apply a string that's greater than the size you set. I'm not sure what happens then, but probably it would get truncated. However, if you're updating it so fast that you can't read it to begin with, I don't think this will be an issue.
0
113
0
0
2013-11-20T01:38:00.000
python,text,grid,wxpython,alignment
wxpython update wx.statictext inside wx.gridsizer
0
1
1
20,100,885
1
0
0
So basically, I'm going to make a Brick Breaker type of game. Just my beginning CS Python class didn't teach much OO programming, and I was wondering how I could make this free moving ball register when it hits the slider. I think I have an idea, but I would like to see other peoples explanations.
false
20,086,958
0
0
0
0
You know the position of the two objects that can collide and compute the distance. When this is smaller than a threshold then they collide You use the Canvas.find_overlapping(*rectangle). to find out the figures on the canvas in a rectangle. I always prefer option 1. It helps dividing model and presentation to the user which do not always need to be linked.
0
147
0
0
2013-11-20T03:47:00.000
python,canvas
How can I make one canvas object collside with another canvas object using Tkinter?
0
1
1
20,093,393
1
0
0
I am using PyScripter version 2.5.3.0 X86. When I run a python script which has an error (ValueError), an error window popups with a annoying beep sound. Is it possible to disable this error window with the sound? Thanks
false
20,145,650
0
0
0
0
Disable the system sounds in the taskbar if working in windows. This only removes the beep however.
0
297
0
2
2013-11-22T13:05:00.000
python,pyscripter
Pyscripter: Disable error windows popup
0
1
1
22,344,568
1
0
0
I'm trying to create an application with tkinter, and I want the ability to connect it to a website and display what's there. It's sort of a web browser without the URL bar. Is it possible? If so, is there any documentation I could use? Do you have any source code I could learn from?
true
20,164,834
1.2
0
0
0
There is no tkinter widget for displaying the contents of a web page.
0
817
0
0
2013-11-23T16:33:00.000
python,tkinter,browser
Connection to Webpage and Tkinter
0
1
2
20,166,229
1
0
0
Pygame offers a pretty neat bitmask colliding function for sprites, but it's really slow when you are comparing large images. I've got my level image, which worked fine when it was 400x240, but when I changed the resolution to (a lot) bigger, suddenly the game was unplayable, as it was so slow. I was curious if there was a way to somehow crop the bitmask of a sprite, so it does not have to do as many calculations. Or, an alternative would be to split the whole stage sprite into different 'panels', and have the collision check for the closest one (or four or two, if he is on the edge of the panels). But I have no idea how to split an image into several sprites. Also, if you have any other suggestions, they would be appreciated. I have seen the many places on the internet saying not to bother with bitmask level collision, because it is far too slow, and that I should use tile based collision instead. Although, I think bitmask would make it a lot more flexible, and it would give the opportunity for level destruction (like in the worms games), so I would prefer it if it was bitmask. I think I've explained it enough not not need to post my code, but please tell me it you really need it. Many thanks!
true
20,173,519
1.2
0
0
0
Okay, I worked out a fix for it that actually wasn't any of these things... Basically, I realised that I was only colliding one pixel with the stage at a time, so I used the Mask.get_at() function. Kinda annoyed this didn't occur to me before. Although, I've heard that using this can be quite slow, so if somebody would be willing to offer a faster alternative of get_at() that'd be nice.
0
95
0
0
2013-11-24T10:31:00.000
python,optimization,pygame,bitmask
Pygame level bitmask checking optimisation?
0
1
1
20,182,011
1
0
0
Is there a way in pygame to look for a collision between the a particular side of a sprite and a particular side of another sprite in pygame? For example, if the top of sprite A collides with the bottom of Sprite B, return True. I am certain there is a way to do this, but I can't find any particular method in the documentation. Thanks!
false
20,180,594
0.039979
0
0
1
Like Furas has said, no, there is not way to get side collisions in Pygame past the point system he set up. And even that one wont give you what you want, because you can never be sure which direction the collision happened when dealing with rows, columns or corners of Rectangles. This is why most tutorials recommend saving your sprites initial direction. then moving in the opposite direction in case of a collision.
0
9,637
0
6
2013-11-24T20:30:00.000
python,pygame,sprite,collision
Pygame: Collision by Sides of Sprite
0
2
5
20,197,302
1
0
0
Is there a way in pygame to look for a collision between the a particular side of a sprite and a particular side of another sprite in pygame? For example, if the top of sprite A collides with the bottom of Sprite B, return True. I am certain there is a way to do this, but I can't find any particular method in the documentation. Thanks!
false
20,180,594
0
0
0
0
For objectA give the object this method: def is_collided_with(self, sprite): return self.rect.colliderect(sprite.rect) This return statement returns either True or False then in the main loop for collisions just do: if objectA.is_collided_with(ObjectB): Collision happened!
0
9,637
0
6
2013-11-24T20:30:00.000
python,pygame,sprite,collision
Pygame: Collision by Sides of Sprite
0
2
5
58,675,517
1
0
0
I have written a python script with a Tkinter GUI. I would like to create a desktop icon that will execute this script so that the end-user (not myself) will be able to double-click the icon and have the GUI load, rather than 'run' the script from the terminal or python shell and then have to F5 from there. Is there a way to do this? I have googled many arrangements of my question but most answers seem to be normal python scripts, not ones which are Tkinter based. I am using a Raspberry Pi with Wheezy and Python 2.7 Thanks in advance.
false
20,182,350
0.049958
0
0
1
Besides creating executable file other option is create simple .bat file: Open notepad Enter "C:\ProgramData\Anaconda3\python.exe" "C:\Users\Your ID\script.py" First part is path to python.exe, second to your python script save file as .bat file, ex. "open_program.bat" Now simply double click on saved .bat file icon should open your script.
0
7,292
0
3
2013-11-24T23:13:00.000
python,tkinter,raspberry-pi,desktop,shortcut
Create a desktop icon for a Tkinter script
0
2
4
62,213,416
1
0
0
I have written a python script with a Tkinter GUI. I would like to create a desktop icon that will execute this script so that the end-user (not myself) will be able to double-click the icon and have the GUI load, rather than 'run' the script from the terminal or python shell and then have to F5 from there. Is there a way to do this? I have googled many arrangements of my question but most answers seem to be normal python scripts, not ones which are Tkinter based. I am using a Raspberry Pi with Wheezy and Python 2.7 Thanks in advance.
false
20,182,350
-0.049958
0
0
-1
You can save the script as a .pyw file so the user can click on the file and the GUi would open
0
7,292
0
3
2013-11-24T23:13:00.000
python,tkinter,raspberry-pi,desktop,shortcut
Create a desktop icon for a Tkinter script
0
2
4
69,898,319
1
0
0
I want to build an application in wxPython which have multiple windows like MDI. I don't want use MDIParentFrame which is old. I've seen wx.aui too but I don't like it. What I want is a main frame that hase a menu and toolbar and more child windows. Child windows must minimize when main frame minimize and got focus when main frame clicked How do this ? Thanks all
false
20,213,112
0
0
0
0
You either use one of the MDI implementations that wxPython already has built-in or you reinvent the wheel and create your own widgets.
0
181
0
0
2013-11-26T09:31:00.000
python,wxpython,mdi
wxPython and MDI like app
0
1
1
20,219,489
1
0
0
Is there some example of people embedding ipython-qt console inside their C++/Qt application? I've only seen examples of people embedding that in PyQt applications. What I would like to do is at the end something like the console example available for PythonQt, where from a console with autocompletition, one can modify internal status of c++ variables. Maybe is it possible thanks to an additional layer of binding of C++ methods via Boost.Python?
false
20,247,408
0.197375
0
0
1
I have been looking to try and do something similar. I'm trying to at the very least use the ipython kernel in a c++ widget. So far the only stuff I have found online is importing modules into python. I have found nothing on the ipython github site either yet. But I'm still digging.
0
951
0
2
2013-11-27T16:09:00.000
c++,qt,boost,ipython
Embedding ipython qt-console as qwidget inside qt/c++ application
0
1
1
20,943,115
1
0
0
Assuming I have a line with coordinates x1,y1 and x2,y2, and I know the length of the hypotenuse connecting those two points (thus also knowing the angle of rotation of the line through trig), if the line is 1 pixel thick how can I find every pixel on that line and store it to a list? I first proposed the simple vector calculation, stating with x1,y1 and performing line/z*math.cos(angle),line/z*math.sin(angle) (for x1 and y1 respectively) until I reached point x2,y2, but the problem with that is finding variable 'z' such that every single pixel is covered without duplicating pixels. So what would be the best way of calculating this?
false
20,296,712
0
0
0
0
Using float you should get all points without duplications - but you need int. Using int you always get duplications - int(0.1) == int(0.2) == int(0.3) == etc.. So you have to check if point is on your list.
0
369
0
0
2013-11-30T04:57:00.000
python,pygame,lines,pixels
How can I find every pixel on a line with pygame?
0
1
2
20,298,727
1
1
1
I put goog_appengine inside android located at /mnt/sdcard I also put wsgiref folder at same location. from Qpython I manage to "send control key" + "d" I got sh $ I put command like the ff: "$python /mnt/sdcard/google_appengine/appcfg.py" But Igot ImportError: no module _csv I feel putting these is not same architecture " /usr/lib/python2.7/lib-dynload/_csv.x86_64-linux-gnu.so" That come from ubuntu 13.04. What to do next, Where I can find _csv module for Qpython+android_version. Is it possible to upload my code through android?
false
20,308,674
0
0
0
0
To install _csv or any other module, follow these steps. Here's what I did to install websocket (and all of its dependencies): To install websocket on the phone: Start QPython Click the big button Select “run local script” Select “pip_console.py” Type “pip install websocket”
0
840
0
0
2013-12-01T04:17:00.000
importerror,qpython
ImportError: No module named _csv . Qpython for android logs
0
2
2
31,173,939
1
1
1
I put goog_appengine inside android located at /mnt/sdcard I also put wsgiref folder at same location. from Qpython I manage to "send control key" + "d" I got sh $ I put command like the ff: "$python /mnt/sdcard/google_appengine/appcfg.py" But Igot ImportError: no module _csv I feel putting these is not same architecture " /usr/lib/python2.7/lib-dynload/_csv.x86_64-linux-gnu.so" That come from ubuntu 13.04. What to do next, Where I can find _csv module for Qpython+android_version. Is it possible to upload my code through android?
false
20,308,674
0
0
0
0
You can install _csv from QPython's system. ( You can find system icon in qpython's new version 0.9.6.2 )
0
840
0
0
2013-12-01T04:17:00.000
importerror,qpython
ImportError: No module named _csv . Qpython for android logs
0
2
2
21,482,814
1
0
0
I want to use pywinauto to write an auto-click script. I know I can use app.ListView2.Select(4) to select an item. So I tried to use select() or Check(), but it's not working. How can I doubleclick an item?
false
20,331,622
0
0
0
0
ListView in pywinauto inherited from HwndWrapper which has DoubleClick() method, try it. Also make sure you've tried Select(item) for ListView. (You've mentioned select())
0
2,317
0
0
2013-12-02T15:16:00.000
python,pywinauto
How to doubleclick a listview item with pywinauto?
0
1
1
20,384,256
1
0
0
I have stated time=pygame.time.get_ticks then when bliting thing to the screen I try window.blit(time, (0,0)) but where the time is supposed to be it just says built in function. Why is this??
false
20,362,190
0
0
0
0
Just to add a bit to furas answer. Since this function is called get_ticks, you need to do the actual action to get the ticks. There is one more thing that troubles me, you are trying to blit a integer to the screen, and this is not possible. What you need to do is create a surface from the string value of the miliseconds, and blit that.
0
244
0
0
2013-12-03T21:36:00.000
python,pygame
Trouble with pygame.time.get_ticks
0
1
2
20,385,564
1
0
0
I updated my MacBook to Mavericks, reinstalled Macports and all Python 2.7 modules I usually use. While running Python I get the following messages: when importing mlab: from mayavi import lab (process:1146): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. when running a mlab command such as mlab.mesh(), the display window opens, shows no content and freezes. I don't get this message while importing spectral, but I get it when running view_cube() the display window showing the image cube, freezes but shows the data cube. It seems there is something wrong with Xterm, but I can't figure it out. How can I keep the display window from freezing and get rid of the Gtk-WARNING? I checked locale and locale -a, but couldn't see anything unusual: locale: locale LANG= LC_COLLATE="C" LC_CTYPE="C" LC_MESSAGES="C" LC_MONETARY="C" LC_NUMERIC="C" LC_TIME="C" LC_ALL=
true
20,366,533
1.2
0
0
2
While using OS X Mavericks one has to use: ipython --pylab=wx instead of ipython --pylab=osx to avoid crashing the X11 window. I don't know why this works.
0
5,430
1
4
2013-12-04T03:57:00.000
python,gtk,mayavi,spectral
Gtk-WARNING **: Locale not supported by C library. while using several Python modules (mayavi, spectral)
0
1
1
20,513,075
1
0
0
I am looking to develop an application as a personal project. What I have in mind is a network-based application that would entail writing code for a typical client-server architecture using TCP Sockets as well as a heavy use of GUIs. I believe I have quite a few choices: Swing in Java, PyQt, PyGTK, wxpython and the like in Python. I was just wondering if anyone could direct me to which language would be better in the above respects.
true
20,367,296
1.2
0
0
1
I would suggest you go for JavaFX. It comes with the JDK and has a lot of good features. Plus, it can inter-operate with Swing, backwards and forwards. It allows you to use CSS to pretty-paint your UI. t gives you best of both the worlds.
0
101
0
0
2013-12-04T05:07:00.000
java,python,swing,user-interface
Which language has better support for developing GUIs coupled with network programming, Python or Java?
0
1
1
20,367,301
1
0
0
I am trying to disable only one item in a listbox with wxpython. I already searched in the Internet for a way to do this, but I found nothing... I hope you can give me a hint!
false
20,402,359
0
0
0
0
I don't think there's a direct way to do this, so the only way would be to do it by hand: catch click events, use the HitTest to find which item was selected, and then ignore the event if it's the "deactivated" item. (Tree Controls have the EVT_TREE_SEL_CHANGING which would be useful here, but there's no analog for a ListBox afaik.)
0
389
0
0
2013-12-05T14:17:00.000
listbox,wxpython
Disable only one item in a wxpython.listbox
0
2
2
20,416,806
1
0
0
I am trying to disable only one item in a listbox with wxpython. I already searched in the Internet for a way to do this, but I found nothing... I hope you can give me a hint!
false
20,402,359
0
0
0
0
You will need to bind to wx.EVT_LISTBOX and check if the selection is in your "deactivated" list. If so, set the selection to a different item in the control.
0
389
0
0
2013-12-05T14:17:00.000
listbox,wxpython
Disable only one item in a wxpython.listbox
0
2
2
20,426,709
1
0
0
I have two pyqt files that I made in qt4 designer. I put them both in a directory and created a file outside the directory, which I imported them with. The first file is a window with a button, that when clicked, should close the first window, and open the second window. I can import them, and launch them both at the same time, but I can't figure out how to have the button in the first window affect the other, yet alone have it close itself and spawn the other.
false
20,411,315
0
0
0
0
In the handler of the button-click in the first window, instantiate the second window and invoke its show-method, and then close (emit the close-signal to) the first window.
0
150
0
0
2013-12-05T21:38:00.000
python,qt,pyqt4
How to tie two windows together in pyqt4
0
1
1
20,411,550
1
0
0
I am currently using CustomTreeCtrl instead of the regular TreeCtrl because it allows me to have checkbox / radio button with the tree nodes. However, I realize the control itself catches event EVT_KEY_DOWN (whenever any key is pressed) to look for any matching tree nodes. I need the event EVT_KEY_DOWN for other purposes, so is there a way to disable the tree control from recognizing EVT_KEY_DOWN? Or would it work if I create my own CustomTreeCtrl that does not have self.Bind(wx.EVT_KEY_DOWN, self.onKeyDown) inside? How would I locate that Python file then (wx.lib.agw.customtreectrl) on Linux?
true
20,411,647
1.2
0
0
0
treeCtrl.Unbind(wx.EVT_KEY_DOWN) I think would work :P
0
230
0
0
2013-12-05T21:57:00.000
python,file,module,tree,wxpython
wxPython: CustomTreeCtrl disable checking for event EVT_KEY_DOWN
0
1
1
20,411,707
1
0
0
The wizard in wxpython automatically responds to keyboard accelerators for the buttons on the page (for example "Alt-N" to activate the next button). I want this but ... It only does this if there is at least one interactive widget on the visible wizard page. If the page only has static text then accelerator keystrokes don't do anything. The wizard also responds to keys that shouldn't do anything at all, eg "C" or "c" activates the cancel button whenever the focus is on an image button (note that it doesn't do that if the focus is on a text entry widget - in that case the corresponding character is entered into the text box). How can I change the behaviour of the wxpython wizard so that: "Alt-N" and "Alt-C" should activate the next and cancel buttons even on pages that only have static text controls "N" and "C" should NOT activate the next and cancel buttons regardless of which widget has the current focus.
false
20,421,648
0
0
0
0
The problem with Alt-N not having any effect seems to be a wxWidgets bug, so I don't think you can work around it in wxPython. Perhaps you could try to catch EVT_CHAR for them in the wizard itself and see if you get the event there. As for disabling some keys when some specific control has focus, you definitely should be able to catch EVT_KEY_DOWN in this control. Although I don't really understand why would you want to do this.
0
117
0
1
2013-12-06T10:30:00.000
wxpython,wxwidgets
How to make wx wizard respond to keyboard accelerators like a normal Microsoft Windows application
0
1
1
20,425,632
1
0
0
Is it possible to define an event object in pygame? What I am trying to do is loop through all the keyboard events in a method, I then want to call that method with an event as a parameter, but I first need to define it. Is this possible? Im using Pygame 3.3 and python 3.
false
20,442,022
0.197375
0
0
1
An event can be made with the command pygame.event.Event(type, dict). The type will be what you want it to return when the event.type() command is used on it. The dict will include every other attribute. An example: pygame.event.Event(pygame.MOUSEBUTTONDOWN, {'button':1}) would return a MOUSEBUTTONDOWN event with an attribute button of 1.
0
198
0
0
2013-12-07T13:41:00.000
python,pygame
Pygame event object
0
1
1
20,443,462
1
0
0
Im learning Kivy and would like to center an object inside of a parent object. I know I can access an object's own properties with the self keyword in the kv language, but is there a shortcut for accessing a parent widget's, say, size and position properties? Both root.size and parent.size are failing for me.
true
20,460,867
1.2
0
0
14
A widget keeps a reference to its parent in self.parent. So you can just so self.parent.size or self.parent.pos or whatever. Depending on what you're doing, it may be necessary or useful to make sure you check if self.parent is None first, so that your code doesn't fail for widgets with no parent.
0
5,845
0
11
2013-12-09T00:00:00.000
python,kivy
Accessing the parent object's size parameters in kivy widgets
0
1
1
20,470,745
1
0
0
I primarily program in Python and have always tried to steer clear of Java (no particular reason, really). Now I find myself in a position where I have to build an app for Android. My question is, is there any inherent difference in terms of speed, resource-consumption, access to hardware features etc if I build the app in Python, using SL4A or Kivy or some other platform(I still need to explore those options in detail)? Or should I Download the SDK Bundle and go about learning to build apps for Android exclusively?
false
20,463,104
0
0
0
0
From what I can tell, neither of the projects you mention is meant for building native Android apps. If you were really knowledgeable in Jython and Android, maybe you could finagle Jython to make native apps, but since you mention that you've never used Java, that's unlikely. Unfortunately, the only project that attempted to do it is dead (and turned into SL4A, maybe?). So TL;DR, if you want completely native, I-can't-believe-it's-not-Java experience, you have no choice. If not, you should specify what exactly you wan't to accomplish, maybe Python is good enough.
0
6,207
0
4
2013-12-09T04:21:00.000
android,python,mobile
Building apps for Android using Python
0
1
1
20,463,265
1
0
0
I'm creating a function that will cause a giraffe to move in a certain direction and distance (don't ask). If the user types "west" in the parameters, the turtle should move west however the direction is. But the turtle's angle changes every time, I can't fix a value for my turtle to turn to go a certain direction. I need to set the angle to, say, 90 so that it can move East. I can't find useful functions for this purpose. I tried to use Pen().degrees(90) but that didn't work. Does anyone know how I can do this?
false
20,502,766
-0.291313
0
0
-3
turtle.right(90) this will turn the turtle 90
0
18,276
0
6
2013-12-10T18:45:00.000
python,angle,turtle-graphics
Setting the angle of a turtle in Python
0
1
2
49,330,538
1
0
0
I have a wx.grid with size 1*3 (1 row, 3 columns). Cell 1*1 has value 3, cell 1*2 has value 5 and I want cell 1*3 to display sum of the other cells (3 + 5 = 8). And I want cell 1*3 to autoupdate its value as cell 1*1 and cell 1*2 changes. How to do this wit wxpython grid?
true
20,519,669
1.2
0
0
1
You will need to catch a cell related events. I would recommend EVT_GRID_EDITOR_HIDDEN as that event fires after you have left a cell where you had double-clicked it to start an edit. You could also use EVT_GRID_CELL_CHANGE, although just because you changed cells doesn't mean you did an edit. Either way, in the event handler, you would grab the first two cell values, sum them and insert them into the third cell.
0
163
0
0
2013-12-11T12:52:00.000
python,grid,wxpython,sum,auto-update
How to display sum of 2 cell values in another cell and autorefresh it as cell values change in wxpython grid?
0
1
1
20,523,503
1
0
0
I am trying to create a multiple choice quiz in Tkinter. Each question has between 2-4 different answers all displayed as checkboxes, how do I ensure the user can only tick one check box and not all of them? Thanks
false
20,528,082
0.099668
0
0
1
Don't use checkboxes; use radoibuttons instead. The behavior of checkboxes and radiobuttons is well established -- checkboxes allow you to select N of N choices, radiobuttons are designed to allow you to select exactly 1 of N. Don't violate this design pattern or your users will be confused. To make radiobuttons work, create a single StringVar and associate it with two or more radiobuttons. All of the radiobuttons that share the same variable will work as a set, allowing only one to be selected.
0
1,562
0
0
2013-12-11T19:19:00.000
python,validation,user-interface,checkbox,tkinter
Checkbox validation: how do i ensure user can only tick one box only?
0
1
2
20,528,169
1
0
1
Using VTK version 5.1, I'm having some issues with some models not displaying correctly in OpenGL. The process for getting the models into VTK is a bit roundabout, but gets there and is fairly simple. Each model is a manifold mesh comprised of only quads and tris. Blender models->custom export format containing points, point normals, and polygons Custom export format->Custom C++ parser->vtkPolyData vtkPolydata->vtkTriangleFilter->vtkStripper->vtkPolyDataNormals->final product As our final product was showing irregular and missing normals when it was rendered, I had VTK write the object to a plaintext file, which I then parsed back into Blender using python. Initial results were that the mesh was correct and matched the original model, however, when I used the Blender "select non-manifold" option, about 15% of the model showed to be nonmanifold. A bit of reading around online suggested the "remove doubles" as a solution, which did in fact solve the issue of making the mesh closed, but the normals were still irregular. So, I guess I'm hoping there are some additional options/functions/filters I can use to ensure the models are properly read and/or processed through the filters.
true
20,528,456
1.2
0
0
0
This was solved by requesting that Blender perform a triangulization of the mesh prior to the export operation. The mangling was due to Blender performing implicit triangulization of quads, resulting in faces which were stored as 4 non-coplanar points. By forcing explicit triangulation in advance, I was able to successfully perform the export and maintain model integrity/manifold-ness. The holes that were being experienced were due to the implicit triangulation not being copied by the exporter and thus causing loss of data.
0
175
0
0
2013-12-11T19:41:00.000
c++,python,opengl,blender,vtk
vtk Filters causing point doubling and mangling normal values
0
1
1
25,369,835
1
0
0
I have a wxPython GUI with a wx.stc.StyledTextCtrl text editor. It is possible that its content contain some unicode characters such as Greek letters. I have noticed that StyledTextCtrl.SaveFile() method works only when the content has no unicode characters. Otherwise the saved file ends up being an empty file. I tried calling StyledTextCtrl.SetCodePage(stc.STC_CP_UTF8) but it did not help either. So, I am not quite sure whether there is a bug in the StyledTextCtrl code, or that I am missing something. Any help is appreciated.
true
20,532,581
1.2
0
0
0
Saving code uses wxConvCurrent, so you could try setting it to wxConvUTF8 to ensure that UTF-8 is used even when it's not the encoding of the current locale (which is never the case under Windows). Unfortunately I'm not sure if you can change wxConvCurrent from Python. If you can't, the simplest solution would probably be to just write wxStyledTextCtrl::GetValue() to a file yourself instead of relying on its SaveFile() method. Don't forget to call SetSavePoint() after saving successfully if you do this.
0
255
0
1
2013-12-12T00:10:00.000
unicode,wxpython,wxwidgets,wxstyledtextctrl
An issue with calling w.stc.StyledTextCtrl.SaveFile with a unicode content
0
1
1
20,545,016
1
0
0
Is it possible to create a custom tooltip with no border using wx.TipWindow. I can do this with PopupTransientWindow but I could not figure out the which event to use to dismiss the popup when the mouse is moved away from a given rectangle bound(not clicked but moved away).
false
20,539,077
0
0
0
0
You may not be able to customize that particular control very well as it wraps the native widget (if it exists). Instead, I would recommend switching to BalloonTip or possibly better, the SuperToolTip. Both of these controls are generic, pure Python controls. That means that they usually have additional customization and they are definitely easier to modify yourself if you need to because they're Python instead of C++. There are demos of both of those controls in the wxPython demo package. You should check them out and see if they work better for you.
0
131
0
0
2013-12-12T09:03:00.000
wxpython
Tooltip without border in wxpython
0
1
1
20,569,837
1
0
0
I am working on a personal project in Python that involves creating a user-interface. For that purpose, I have chosen to go with PyQt4. As part of the GUI code, I need a widget in which we can append text but the requirement is that it should not allow to be edited. A QtGui.QTextEdit would solve the purpose of appending text but would not satisfy the second requirement. What widget can I use that satisfies both the requirements? Thanks
false
20,544,190
0.099668
0
0
1
You could have two TextEdit's, one that is set to readonly that displays the full text and a smaller one below it for entering text to append to the one above.
0
69
0
1
2013-12-12T12:55:00.000
python,user-interface,pyqt4
What is the ideal widget in PyQt4 in which we can append text but cannot edit it after the text gets populated?
0
2
2
20,544,425
1
0
0
I am working on a personal project in Python that involves creating a user-interface. For that purpose, I have chosen to go with PyQt4. As part of the GUI code, I need a widget in which we can append text but the requirement is that it should not allow to be edited. A QtGui.QTextEdit would solve the purpose of appending text but would not satisfy the second requirement. What widget can I use that satisfies both the requirements? Thanks
true
20,544,190
1.2
0
0
1
Edited by who ? If you don't want that a user can edit it, I think you just need to set the QTextEdit as readonly with QTextEdit.setReadOnly(True) If you don't want to edit again from the code, I think you just need to check if the control has some text in it: if no, add the text otherwise return an error (or whatever you need)
0
69
0
1
2013-12-12T12:55:00.000
python,user-interface,pyqt4
What is the ideal widget in PyQt4 in which we can append text but cannot edit it after the text gets populated?
0
2
2
20,544,331
1
0
0
I had a page that was working fine with respect to tab order, but since I added a scrolled panel to the page, you can only tab between the first control in the ScrolledPanel and the navigation buttons outside the ScrolledPanel.
false
20,561,820
0
0
0
0
I need to set wx.TAB_TRAVERSAL as a style on the ScrolledWindow. Apparently it's not set by default.
0
119
0
0
2013-12-13T08:08:00.000
python,wxpython,wxwidgets
wxWidgets ScrolledPanel tab order doesn't work
0
1
1
20,561,947
1
0
0
I have a 32-bit Windows 7 OS. Today, I tried downloading the PySide setup program. However, after I try running the downloaded file, I get the following error: "PySide Setup program invalid or damaged." Why am I getting this? I have recently started a course on building GUI applications with Python using the Qt framework, and need PySide for the same. I use Python 2.7 btw.
false
20,588,259
0
0
0
0
My solution to nearly the same exact problem was simply that it needed to be installed with admin privileges, so that might be your issue also.
0
1,660
0
2
2013-12-14T21:04:00.000
python,qt,user-interface,pyside
Pyside Installation Error
0
1
2
23,973,285
1
0
0
I have a program that generates a game board in Pygame. It draws the background, then randomly assigns Start and End squares, then randomly places three squares in between them. I need to fill in the space in between the five placed squares with other squares on a line. How would I go about doing this? I need the length of the line, and a list of points on the line to correctly place the squares. Thanks, Adam
true
20,601,473
1.2
0
0
1
There is no way using pygame that I know of that will allow you to do this. You will instead have to use plain old-fashioned algebra. You are going to be using the equation of the line that the squares are on. Ax, Ay, Bx, and By will be representing the coordinates of the different squares. All you have to do is get a y coordinate for an inputted x coordinate by using y=(Ay-By)/(Ax-Bx)*(x-Ax)+Ay, or get an x coordinate for an inputted y coordinate by using x=(Ay-By)/(Ax-Bx)*(x-Ay)+Ax. You will have to figure out which y or x coordinates to enter manually. To find the distance between the squares, simply use the distance formula: math.sqrt((Ax-Bx)**2+(Ay-By)**2)
0
1,185
0
0
2013-12-15T23:57:00.000
python,line,pygame,placement
How to get a list of all points in a line in Pygame
0
1
1
20,601,985
1
0
0
I am using pygame.font.Font.render() to render some text. I'd like the text to be translucent, ie have an alpha value other than 255, so I tried passing a color argument with an alpha value (eg (255, 0, 0, 150)) as the color argument for pygame.font.Font.render() but it didn't have any effect. I also tried using pygame.Surface.convert_alpha() on the resulting Surface object, but that didn't do anything either. Any ideas?
false
20,620,109
0.132549
0
0
2
You can change the transparency of the entire surface using a individual alpha value. Use surf=pygame.Surface((size,pygame.SRCALPHA). Now if you change the alpha value by setting surf.set_alpha(alpha) of the screen, the surface around the text wont be black anymore.
0
6,139
0
7
2013-12-16T20:19:00.000
python,pygame
How to render transparent text with alpha channel in PyGame?
0
1
3
68,090,814
1
0
0
I make Python3+Delphi app. I packed all files+dirs from Libs folder into python32.zip. It works. Do I need PYC files (and __pycache__ dirs) in that zip? If I pack PYC files, will Py3k work fasteer?
true
20,646,723
1.2
0
0
1
You don't need to include the pyc files, no. Assuming, that is, you are adding your zip file to sys.path and importing from that (the question could use more details along those lines), the Python zipimporter will gladly compile the bytecode for you on the fly. You should have a little faster startup time if you include the pyc files (or for a stand-alone application you might consider including .pyo files instead, which you can make in various ways, such as running python with the -O flag). That said this bytecode compilation is pretty fast, so depending on how many modules your application imports it might not make a noticeable difference. Try it for yourself and see.
1
284
0
0
2013-12-17T23:22:00.000
python,python4delphi
PythonNN.zip: are PYC files needed
0
1
1
20,648,897
1
0
0
Is there a way to establish a "supports-screens" kind of configuration to make my application available only for normal and large screens android devices.is there a way to do this with the build.py script?(i have bets on --intent-filters option but not sure how it might be used)
true
20,666,947
1.2
0
0
1
There is no way to do it from the build.py. However, you can change manually the templates/AndroidManifest.xml.tmpl and adapt it for your needs.
0
84
0
1
2013-12-18T19:40:00.000
android,python-2.7,kivy
screen support in kivy set to normal and large screens
0
1
1
22,365,294
1
0
0
I there any library in Python so that you can cut a certain part of an image (like a person) and paste it in other image?
false
20,682,797
0
0
0
0
You can use segmentation technique(seed based approach) in first image and then OpenCV library to place it onto another image by creating a mask.
0
266
0
0
2013-12-19T13:16:00.000
python-2.7,image-processing
Cut a certain part of an image and paste it in other image
0
1
1
20,689,518
1
0
0
Is it normal that Tkinter's Canvas' create_text 's font size doesn't change when I change the Canvas' scale with canvas.scale ? I thought that, as it is a high level GUI management system, I wouldn't have to resize manually the text done with create_text after a zooming. Isn't this strange, or am I wrong ?
false
20,689,760
0.197375
0
0
1
It's normal, even if not entirely what you want. The scale method just changes the coordinate lists, but text items only have one of those so they just get (optionally) translated. This also applies to image and bitmap items. And features of other items like the line width; they're not scaled.
0
500
0
0
2013-12-19T19:08:00.000
python,user-interface,canvas,tkinter,tcl
Tkinter, canvas, create_text and zooming
0
1
1
20,692,285
1
0
0
I am using Google Protobuf in my Python application. Experimenting with the protobufs I found that Protobuf Message Creation is much slower in CPP based python implementation as compared to Python based Python implementation. Message creation with PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp was upto 2-3 times slower as compared to pure python based Protobuf Message Creation. Is this expected? I found that SerializeToString and ParseFromString both are faster in the cpp verison. The difference in each case widens as the size of the Message increases. I am using python's standard timeit module to time these tasks. (Using Version 2.4.1 of google protobuf)
true
20,701,971
1.2
1
0
4
Yes, I believe this is expected. The pure-Python implementation stores all the fields in a dict. To construct a new message, it essentially just creates an empty dict, which is very fast. The C++ implementation actually initializes a C++ DynamicMessage object under the hood and then wraps it. DynamicMessage actually initializes all of the fields upfront, so even though it's implemented in C++, it's "slower" -- but this upfront initialization makes later operations faster. I believe you can improve performance further by compiling C++ versions of your protobuf objects and loading them in as another extension. If I recall correctly, the C++-backed Python protobuf implementation will then automatically used the compiled versions rather than DynamicMessage.
0
4,148
0
2
2013-12-20T10:52:00.000
c++,python,protocol-buffers
Performance of C++ based python implementation of Google Protobuf
0
1
1
20,713,817
1
0
0
I am currently working on creating a paint program using python and pygame. I am currently having trouble with creating the undo/redo function in the program. The way I was thinking of doing so would be to save the canvas image after each time the user releases the mouse, but I am not sure if the individual images would have to be saved in a temporary folder that is deleted after the program is closed. I have also read that this method can affect performance of the program so I am wondering if there are any other methods that will work more efficiently. Thank you.
false
20,827,199
0.099668
0
0
1
My suggestion is to have a buffer of the last operations that have been done. Each operation will consist of a sprite, and a position of where it is placed. You will be drawing the canvas, as well as all sprites from that buffer. When you have to many sprites in the buffer, you can blit the oldest onto the canvas, thus saving memory. The undo itself would be rather easy. Just remove the last sprite that was added. A redo would be slightly more difficult. Since instead of removing, I would have a pointer, that points to the last sprite that I will draw. If a new action will be added, only then I remove all the sprites that have been "invisible".
1
982
0
1
2013-12-29T16:15:00.000
python,pygame,paint,undo,redo
Paint Program in Python - Undo and Redo
0
1
2
20,828,238
1