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 was playing Terraria the other day and in a new update they make the game pause when it's minimized. Obviously it's written in a different programme to python, but I was wondering if it was possible to replicate the effects.
false
24,966,803
0
0
0
0
You can use the pygame.APPACTIVE event. From the documentation for the pygame.display.iconify: Then the display mode is set, several events are placed on the pygame event queue. pygame.QUIT is sent when the user has requested the program to shutdown. The window will receive pygame.ACTIVEEVENT events as the display gains and loses input focus [This is when the window is minimized]. If the display is set with the pygame.RESIZABLE flag, pygame.VIDEORESIZE events will be sent when the user adjusts the window dimensions. Hardware displays that draw direct to the screen will get pygame.VIDEOEXPOSE events when portions of the window must be redrawn. Look at the second example in furas' answer below, but don't use the polling approach of the first example for something like this, you don't want to spend time every frame trying to check if the window has been minimized.
0
1,031
0
1
2014-07-26T02:01:00.000
python-3.x,pygame
Is there a way in pygame to make a programme pause when it's minimized?
0
1
2
24,967,111
1
0
0
I want to visualize a computing process in kivy. The problem is that kivy freezes when the python function runs. Any ideas how to manage that problem. It is like a progress bar. The computation is running and the user should see that his PC did not hang up.
true
25,032,656
1.2
0
0
1
Run your computationally intensive stuff in one or more threads or separate sub-processes and have them periodically post some updates to the GUI to say how they are doing, (and the results at the end of course).
1
330
0
0
2014-07-30T08:59:00.000
python,kivy
manual update kivy screen when a user function is doing heavy computation
0
1
1
25,033,218
1
1
0
Got a bit of weird request here, however it's one which I can't really figure out the answer to. I'm writing a python application that displays web pages and locally stored images. What I need is a way of displaying a web page using python that is really lightweight and quite fast. The reason for this is that it is running on a Raspberry Pi. Of course I have many options, I can run it through web browser installed on the Raspbian distribution and run it as a separate process in python, I can download an Arch-Linux compatible browser and run it as a separate process in python and finally I can write my own native python file using Gtk or PyQt. All of these approaches have their downsides as well as serious overheads. The web browser must also be full screen when I have a web page to display, and minimised when I'm displaying an image. The main issue I have had with Gtk and PyQt is the way they have to be executed on the main thread - which is impossible as it doesn't align with my multithreaded architecture. The downside to using the web browsers that are pre-installed on raspbian, is that from python you lack control and it's slow. And finally, the issue with using an Arch-Linux browser is that it ends up being messy and hard to control. What I would Ideally need is a web browser that loads a web page almost instantaneously, or a multithreaded web browser that can handle multiple instances. This way I can buffer one web page in the background whilst another browser is being displayed. Do you guys have any advice to point me in the right direction? I would've thought that there would be a neat multithreaded python based solution by now, and I would think that's either because no one needs to do what I'm doing (less likely) - or I'm missing something big (more likely)! Any advice would be appreciated. James.
false
25,045,924
-0.066568
1
0
-1
i have written winks-up in vala. It's small and fast and compile well on raspbian. All the code was optimize to reduce memory occupation. isn't perfect but was better like nothing
0
1,135
0
0
2014-07-30T20:04:00.000
python,multithreading,web,browser,python-webbrowser
Lightweight Python Web Browser
0
2
3
31,276,859
1
1
0
Got a bit of weird request here, however it's one which I can't really figure out the answer to. I'm writing a python application that displays web pages and locally stored images. What I need is a way of displaying a web page using python that is really lightweight and quite fast. The reason for this is that it is running on a Raspberry Pi. Of course I have many options, I can run it through web browser installed on the Raspbian distribution and run it as a separate process in python, I can download an Arch-Linux compatible browser and run it as a separate process in python and finally I can write my own native python file using Gtk or PyQt. All of these approaches have their downsides as well as serious overheads. The web browser must also be full screen when I have a web page to display, and minimised when I'm displaying an image. The main issue I have had with Gtk and PyQt is the way they have to be executed on the main thread - which is impossible as it doesn't align with my multithreaded architecture. The downside to using the web browsers that are pre-installed on raspbian, is that from python you lack control and it's slow. And finally, the issue with using an Arch-Linux browser is that it ends up being messy and hard to control. What I would Ideally need is a web browser that loads a web page almost instantaneously, or a multithreaded web browser that can handle multiple instances. This way I can buffer one web page in the background whilst another browser is being displayed. Do you guys have any advice to point me in the right direction? I would've thought that there would be a neat multithreaded python based solution by now, and I would think that's either because no one needs to do what I'm doing (less likely) - or I'm missing something big (more likely)! Any advice would be appreciated. James.
false
25,045,924
0
1
0
0
I'd use PyQT to display the page but if the way PyQT use threads does not fit within you application, you may just write a minimalist (I'm speaking of ~10 lines of code here) web browser using PyQT, and fork it from your main application ?
0
1,135
0
0
2014-07-30T20:04:00.000
python,multithreading,web,browser,python-webbrowser
Lightweight Python Web Browser
0
2
3
25,051,761
1
0
0
I have a combobox in wxpython but I cant figure out how to align the text it contains to the right? I have tried to use wx.ComboBox(self, choices=["1","2","3"], style=wx.TEXT_ALIGNMENT_RIGHT) but that didnt work.
true
25,057,937
1.2
0
0
1
The widget probably doesn't support text alignment. If you want complete control over how it displays its contents, then you should probably switch to a custom drawn control, such as ComboCtrl.
0
835
0
0
2014-07-31T11:38:00.000
wxpython,wxwidgets
How do I right align the text in a wx.ComboBox?
0
1
1
25,059,718
1
0
0
I have 2 widgets, I need to copy all attributes (pos, size, canvas, etc.) from one widget to another somehow (and then move the last to new pos). Probably I can copy attributes one by one, but is there some built-in function? It seems Python's copy makes only shell copy (I can't move duplicate etc.) and deepcopy fails.
false
25,090,620
0.197375
0
0
2
One thing you can do is to make use of the copy function in python. This does not copy all the pos/size values but you will have all the attributes. Ex: from copy import copy new_box = copy(self.current_box) Hope this helps.
0
1,181
0
0
2014-08-02T00:59:00.000
python,widget,kivy,python-3.4
Can I copy attributes from one widget to another in Kivy?
0
2
2
32,950,247
1
0
0
I have 2 widgets, I need to copy all attributes (pos, size, canvas, etc.) from one widget to another somehow (and then move the last to new pos). Probably I can copy attributes one by one, but is there some built-in function? It seems Python's copy makes only shell copy (I can't move duplicate etc.) and deepcopy fails.
false
25,090,620
0.197375
0
0
2
I'm not aware of a pre-existing way to do this in general, but you could probably fairly easily make a function to do it. You can get a list of the widget properties through the properties() method of EventDispatcher, though you'd also need to manually keep track of any non-kivy-property attributes you want to copy, and might need to check to make sure it's safe to copy them all. Depending on the situation, there may also be other possibilities. For instance, if the widget is instantiated from a set of arguments in the first place and never really modified much, you could just save the argument list and use it to construct a new widget. There might also be more efficient alternatives - if you don't need to interact with the 'copy', you don't need to make a new widget at all, but could draw the original one to a Fbo and simply re-use its texture. This would be a more advanced use of kivy, but isn't that hard, let me know if you're interested in it but don't know how to do it.
0
1,181
0
0
2014-08-02T00:59:00.000
python,widget,kivy,python-3.4
Can I copy attributes from one widget to another in Kivy?
0
2
2
25,102,895
1
0
0
So I have been doing a lot of reading about execution environments (Python's, JVM...) and I am starting to implement one on my own. It is a register-based environment written in C. I have a basic byte code format defined and the execution is going pretty smooth so far. My question is how does VEs render GUIs. In a more detailed description about my work so far, my VE has a screen buffer (experimenting with it). Every time I poke it, I output the screen buffer completely to know the output. So far so good with basic calculations and stuff but I hit a bump when I wanted to understand how to render GUIs. I am nowhere with this. Any help would be appreciated. Even if I am thinking completely wrong about this, any pointers as a start in the right direction would be really great. Thanks.
true
25,129,311
1.2
0
0
1
All GUI toolkits on Python are a wrapper around C/C++ code. On Java there a some "pure" Java toolkits like Swing, but a the lowest level they depend on C code to do the drawing and handle user input. There's no special support for things like graphics in the Java VM. As for how the GUI gets rendered at the lowest level, it depends. On Windows, user mode software isn't allowed direct access the video hardware. Ultimately any C/C++ GUI code has to go through either GDI or Direct3D to do the rendering. The kernel mode GDI code is able to do all the rendering itself by writing to the framebuffer, but also supports acceleration by passing operations to display driver. On the other hand, the Direct3D kernel code passes pretty much everything to the driver which in turn passes everything on to the GPU. Almost all of the kernel mode code is written in C, while code running on the GPU is a mixture of hand coded assembly from and code written in higher level shading languages. Note that GPU assembly language is very different from Intel x86 assembly language, and varies considerably between manufacturers and GPU generations. I'm not sure what current practice is on Linux and other Unix type operating systems, but it used to be common to give the X server, which is a user mode process, direct access to the framebuffer. C code in the X server was ultimately responsible for rendering. Presumably this has changed at least somewhat now that GPU acceleration is more common.
0
357
0
0
2014-08-04T23:58:00.000
python,c++,user-interface,jvm,pyc
How do virtual machines render GUI?
0
1
1
25,132,319
1
1
0
I am working on a Kivy app for iOS and Android and need help with keeping the user persistently logged in, even after the app is closed or killed. I am using Parse to store user credentials. I've already added an on_pause method to the App class, but this only keeps the user logged in if the app is closed but not killed. Is there a best practice for securely allowing persistent user login with Kivy, even after an app is killed? Edit: I prefer a single Kivy solution that works for both an Android app and an iOS app, without the need to edit/add iOS or Android specific code.
false
25,147,323
0
0
0
0
The answer is essentially that you must simply save the data somewhere. The details will depend on your requirements, and aren't specific to kivy - you can look up normal android or python practices. I'm not sure exactly what android guarantees about permissions, but storing stuff in your app directory (on the main partition, not 'external' storage) should be inaccessible to other apps, though anything with root can view them. You can use normal python tools if you want to encrypt the data, and manage your own kivy gui for getting a decryption key/password from the user.
0
5,234
0
3
2014-08-05T20:02:00.000
android,python,ios,parse-platform,kivy
Saving login screen username and password for Kivy app
0
1
3
25,147,496
1
0
0
I wrote a program in Python, then created a GUI using Tkinter. When I use programs on my computer (like Microsoft Word), I don't need to access the GUI from the command line I just click the application icon. How do I put my program (the program itself is in the same .py file as the GUI) into an application icon that will start my program?
false
25,152,287
0
0
0
0
If you're using Windows, you can create a shortcut. Or you can just put your .py file on your desktop. If you want to make an .exe file I would suggest installing py2exe. I've compiled Tkinter Python scripts into .exes with py2exe many times.
1
2,183
0
0
2014-08-06T04:33:00.000
python
how to create an icon for my python application
0
1
2
25,152,320
1
0
0
I can't find a way to hide QComboBox items. So far the only way to filter its items out is to delete the existing ones (with .clear() method). And then to rebuild the entire QComboBox again using its .addItem() method. I would rather temporary hide the items. And when they are needed to unhide them back. Is hide/unhide on QCombobox items could be accomplished?
true
25,172,220
1.2
0
0
1
You can use the removeItem() method to remove an item from the QComboBox. void QComboBox::removeItem ( int index ) Removes the item at the given index from the combobox. This will update the current index if the index is removed. This function does nothing if index is out of range. If you don't know the index, use the findText() method. There are no hide/unhide methods for QComboBox items.
0
10,685
0
4
2014-08-07T00:03:00.000
python,pyqt
How to hide QComboBox items instead of clearing them out
0
1
7
25,172,853
1
0
0
Is there a way to set the withdrawed tk window to the top level, i.e. the active window, even though its withdrawed? Its so it will listen to keys.
false
25,176,025
0.197375
0
0
1
It can only respond to keyboard events if it has the focus. If it is withdrawn it cannot have the keyboard focus. So, no, you cannot have a withdrawn window be the active window.
0
246
0
0
2014-08-07T06:57:00.000
python,tkinter
TKinter Python - Set active window when withdrawed
0
1
1
25,183,356
1
0
0
I have main Layout and some Popups, I want keys to do some functions when main Layout is focused, some another functions for one Popup when it's opened, some another for another Popup etc. How can I do that the best way?
false
25,177,236
0.197375
0
0
1
I have done something similar, however I did not use popups. My application has a ScreenManager with many Screens, each screen has sub-menu's and each sub-menu of each screen requires it's own key mappings. To better handle the switching of these sets of key mappings, I created a KeyboardManager class and a KeyboardLayout class: The KeyboardManager class has the keyboard_handler() function which you give to the Window. The KeyboardLayout class would contain a dictionary of all the bindings, i.e. {'a': a_key_callback, 'esc': esc_key_callback} Each sub-menu in my app would have a KeyboardLayout instance, and in it I would define my key mappings into it's dictionary. When the sub-menu is brought up, I would attach the KeyboardLayout to the KeyboardManager (save a reference to the KeyboardLayout in the KeyboardManager). The KeyboardManager.keyboard_handler method then intercepts key events, looks up the function to be called in the currently attached KeyboardLayout and then calls that function. In the keyboard_handler you can decide what to do if a key mapping is not there. In your case, you would need one KeyboardLayout for the main layout and one for the popup. When the popup is opened, attach it's KeyboardLayout to the KeyboardManager, when you leave the popup, attach the main layout's KeyboardLayout back to the KeyboardManager. This is the method I applied and it worked very well for me. Very easy to manager once the classes are set up.
0
435
0
0
2014-08-07T08:04:00.000
python,keyboard,kivy,python-3.4
How can I use keyboard for different layouts in Kivy?
0
1
1
25,405,116
1
0
0
I have a QLineEdit with a PlaceholderText. I want to clear the PlaceholderText only when a person starts typing, else the blinking cursor and PlacehoderText both should be there in that QLineEdit. It is the first field of the page, so I have set the focus to this QLineEdit, but the PlaceholderText disappears as soon as this page is displayed. Please suggest if I'll have to add a SIGNAL/SLOT for this QLIneEdit, so that the PlaceholderText doesn't get cleared off.
false
25,187,640
0.099668
0
0
1
In PyQt4 it's not a bug but a feature. You can't edit this behaviour. In PyQt5, the placeholder text is shown until the text is not empty. A simple way to solve problem is to focus some way before QLintEdit. When the user press TAB button, next focus is QLintEdit.
0
256
0
2
2014-08-07T16:28:00.000
python,python-2.7,qt4,pyqt4
How to keep both cursor and PlaceholderText displayed at the same time in a QLineEdit?
0
1
2
25,195,595
1
0
0
I have made a desktop application in kivy and able to make single executable(.app) with pyinstaller. Now I wanted to give it to customers with the trial period of 10 days or so. The problem is how to make a trial version which stop working after 10 days of installation and even if the user un-install and install it again after trial period get over it should not work. Giving partial feature in trial version is not an option. Evnironment Mac OS and Python 2.7 with Kivy
true
25,269,845
1.2
0
0
4
You need a web server and a database to get this working. Create a licenses table in your database. Each time a new client pays for your software or asks for a trial, you generate a new long random license, insert it in the licenses table, associate it to the client's email address and send it to the client via email. Each time a client tries to install the software on their computers, you ask for a license and contact the webserver to ensure that the license exists and is still valid. Using that, people can still just create multiple emails and thus potentially get an infinite amount of trial versions. You can then try to add a file somewhere in the person's computer, a place where nobody would ever look for, and just paste the old license there so that when the app starts again (even from a new installation), it can read the license from there and contact the webserver without asking for a license. With this method, when your app contacts the server with an expired trial license, your server can reply with a "license expired" signal to let your app know that it has to ask for a non-trial license now, and the server should only accept non-trial licenses coming from that app from now on. This whole method breaks if your clients realize that your app is taking this information from a local file because they can just delete it when found. Another idea that comes to mind is to associate the MAC address of a laptop (or any other unique identifier you can think of) to one license instead of an email address, either at license-creation time (the client would need to send you his MAC address when asking for a trial) or at installation time (your app can check for the MAC address of the laptop it's running on).
1
2,478
0
7
2014-08-12T16:52:00.000
python,kivy,setup-deployment
How to make trial period for my python application?
0
2
3
61,918,928
1
0
0
I have made a desktop application in kivy and able to make single executable(.app) with pyinstaller. Now I wanted to give it to customers with the trial period of 10 days or so. The problem is how to make a trial version which stop working after 10 days of installation and even if the user un-install and install it again after trial period get over it should not work. Giving partial feature in trial version is not an option. Evnironment Mac OS and Python 2.7 with Kivy
false
25,269,845
0
0
0
0
My idea is Make a table in database Use datetime module and put system date in that table as begining date Use timedelta module timedelta(15)( for calculating the date that program needs to be expired here i used 15 day trial in code) and store it in table of database as expiry date Now each time your app start put this logic that it checks on if current date is matches with expiry if it does show error it is expired of your explicit logic Note:- make sure begining and expiry runs only once instead date will be changed again and again.
1
2,478
0
7
2014-08-12T16:52:00.000
python,kivy,setup-deployment
How to make trial period for my python application?
0
2
3
69,546,902
1
0
0
I'm writing a script that is dependent on knowing the geometry type of the loaded shapefile. but I've looked in the pyqgis cookbook and API and can't figure out how to call it. infact, I have trouble interpreting the API, so any light shed on that subject would be appreciated. Thank you
false
25,273,987
0.066568
0
0
1
QgsGeometry has the method wkbType that returns what you want.
0
8,852
0
7
2014-08-12T21:03:00.000
python,shapefile,qgis
How to get shapefile geometry type in PyQGIS?
0
1
3
29,585,421
1
0
0
I am using python to parse an Excel file and am accessing the application COM using excel = Dispatch('Excel.Application') at the beginning of a restart the code will find the application object just fine and I will be able to access the active workbook. The problem comes when I have had two instances of Excel open and I close the first. From then on every call to excel = Dispatch('Excel.Application') provides an application object that is different from the open instance of Excel. If I try excel.Visible=1 it opens a new Excel instance rather than showing the already open instance of excel. How do I get the COM object of the already open instance of Excel rather than creating a new instance?
true
25,298,281
1.2
0
1
2
When an application registers itself, only the first instance gets registered, until it dies and then the very next instance to register gets registered. There's no registration queue, so when your first instance dies, the second keeps unregistered, so any call to Excel.Application will launch a third instance and they'll keep using it until it dies too. In summary, the instances launched in between registered instances never get registered. If you need to reuse an instance, you must keep a pointer to it. That said, if you get an instance of an open Excel file, you might obtain a link to an unregistered Excel instance. For instance, if Excel 1 (registered) has workbook 1 open, and Excel 2 (unregistered) has workbook 2 open, if you ask for workbook 2, you'll get Excel 2's instance (e.g. through Workbook.Application).
0
1,075
0
3
2014-08-14T00:26:00.000
python,excel,com,win32com
win32com dispatch Won't Find Already Open Application Instance
0
1
1
25,308,893
1
0
0
I'm using PyGame on a Raspberry Pi, so I only have 512mb of RAM to work with. I have to load and display a lot of images in succession, though. I can't naively load all of these images into RAM as PyGame surfaces - I don't have enough RAM. The images themselves are fairly small, so I assume that PyGame surfaces are fairly big, and this is why I run out of RAM. I've tried loading from the disk every time I want to display an image, but that's obviously slow (noticeably so). Is there a reasonable way to display lots of images in succession in PyGame with limited RAM - either by keeping the size in memory of the PyGame surface as low as possible, or some other way?
false
25,349,639
0
0
0
0
If you change your files to bmp, it should help. If you have really that little ram, then you should lower the resolution of your files using an image editor such as Preview or Paintbrush. Also, space might be saved through more efficient programming, such as putting objects in a list and just calling a list update.
0
595
0
1
2014-08-17T13:32:00.000
python,pygame
Loading many images in PyGame with limited RAM
0
1
1
25,518,175
1
0
0
I'm currently tasked with the difficult problem of figuring out how to efficiently pack an image and some text within a single file. In doing so, I need to make the file relatively small (it shouldn't be much bigger than the size of the image file alone), and the process of accessing and saving the information should be relatively fast. Now, I have already found one way that works - converting the image to a string using pygame, storing it (and the text I need) within an python object, and then pickling the object. This works fine, but the file ends up being much MUCH larger than the image, since it's not being compressed. So to help with this, I then take the pickled object and compress it using gzip. Now I have another problem - the whole process is just a tad bit too slow, since I'll need to do hundreds of these files at a time, which can take several minutes (it shouldn't take longer than a 1/2 second to load a single file, and this method takes up to 2 seconds per file). I had an idea to somehow put the two separate files, as they are, into one file like how someone would with a .zip, but without the need to further compress the data. As long as the image remains in it's original, compressed format (in this case, .png), simply storing it's data with some text should theoretically be both fast and wouldn't use much more memory. The problem is, I don't know how I would go about doing this. Any ideas?
true
25,351,113
1.2
0
0
0
Alex Reynolds idea to use tar archives seems to be a perfect match.
1
49
0
0
2014-08-17T16:18:00.000
python,python-2.7,pygame
How would I go about serializing multiple file objects into one file?
0
1
1
25,352,369
1
0
0
I have a python script that works fine on my computer (Python 2.7 32 bit installed). It has the following imports : import mechanize from bs4 import BeautifulSoup from Tkinter import * import json import webbrowser I wanted to distribute this to others so I found that we can create exe files using py2exe. I wrote a script like this: from distutils.core import setup import py2exe setup(console=['notification.py'], options = {'py2exe' : { 'packages' : ['bs4', 'mechanize','Tkinter', 'json', 'webbrowser'] }}) This works fine on my computer but when I run it on Windows XP, I get this error - Traceback (most recent call last): File "notification.py", line 3, in File "Tkinter.pyc", line 38, in File "FixTk.pyc", line 65, in File "_tkinter.pyc", line 12, in File "_tkinter.pyc", line 10, in __load ImportError: DLL load failed: %1 is not a valid Win32 application. I tried searching other threads but found none that has the same problem. So please help me fix this issue.
false
25,368,320
0.099668
0
0
1
Well, I had installed both versions of Python 32 bit and 64 bit in my machine. When I was making it a stand alone probably some dlls were copied from the wrong library. So I completely uninstalled both versions and then installed 32 bit and it worked fine.
1
579
0
0
2014-08-18T16:56:00.000
python,tkinter,py2exe
exe generated from a python script with Py2exe does not work on xp
0
1
2
25,370,162
1
0
0
I'm trying to make an OpenGL in python/pygame but I don't know how to add shadow. I don't want to make a lot of darker images for my game. Can someone help me?
true
25,373,895
1.2
0
0
1
I am no expert in Python but you could try: Multiply the color of the image by a value like 0.1, 0.2, 0.3 (anything less that 1) which will give you a very dark texture. This would be the easiest method as it involves just reducing the color values of that texture. Or you could try a more complex method such as drawing a transparent black quad over the original image to give it the illusion of being in a shadow.
0
933
0
0
2014-08-19T00:12:00.000
python-2.7,opengl,pygame
How can you edit the brightness of images in PyGame?
0
1
1
25,383,333
1
0
0
I am looking for an efficient and smart way to send data between a C++-program and a Python-script. I have a C++ program which calculates some coordinates in-real-time 30Hz. And I wanna access these coordinates with a Python-script. My first idea was to simply create a .txt-file and write the coordinates to it, and then have Python open the file and read. But I figured that it must be a smarter and more efficient way using the RAM and not the harddrive. Does anyone have any good solutions for this? The C++ program should write 3coordinates (x,y,z) to some sort of buffer or file, and the Python program can open it and read them. Ideally the C++-program overwrites the coordinates every time and there's no problem with reading and writing to the file/buffer at the same time. Thank you for your help
false
25,383,624
0.197375
1
0
2
I think we can use Named Pipes for communication between a python and C++ program if the processes are on the same machine. However for different machines sockets are the best option.
0
20,489
0
13
2014-08-19T12:37:00.000
python,c++,cross-platform,buffer,communication
Communication between C++ and Python
0
1
2
34,848,899
1
0
0
I have a treeiter created with the treeiter = self.devices_treestore.append(parent_treeiter, column_values_list) call. How can I move it to another parent (with the whole subtree it holds)?
false
25,388,571
0
0
0
0
Assuming the new parent is at the same level of the tree, you could use treestore.swap, otherwise you may have to just remove all the rows in the subtree and reinsert them at the new position
0
102
0
0
2014-08-19T16:32:00.000
python,gtk,gtk3,pygobject
GTK+: Move tree element to another parent
0
1
1
25,463,540
1
0
0
I'm making a time series monitoring program. I'd like to change the color of a plot starting at half the range of the x-axis. For a 100 x 20 plot widget I would like to change last 50 data points to another color. How can I draw a custom vertical grid whenever every xx items of data are passed?
false
25,397,840
0.379949
0
0
2
For (1), you will have to break your data into two separate lines, and assign the colors individually. PyQtGraph does not yet support multiple colors per line. For (2), consider using pg.InfiniteLine or pg.VTickGroup.
0
1,047
0
2
2014-08-20T06:12:00.000
python,plot,widget,pyqt,pyqtgraph
How can I obtain a pyqtgraph plotwidget with variable colors and grids depending on the data?
0
1
1
25,578,618
1
0
0
Can python embedded into c++ allow you to run n python scripts concurrently? I am currently dealing with the dread which is the GIL. My project requires concurrency of at least 2 threads and the easy typing in Python would really help with code simplicity. Would embedding my Python code in a C++ script which deals with the threading circumvent the problems the GIL causes?
false
25,400,493
0
1
0
0
Only if you spawn separate interpreters. GIL is one-per-interpreter policy to protect interpreter internals. One interpreter will run one line at a time. The only other way is to program at least one of your threads in pure C++ and offer a communication queue API to your python script or any way to communicate asynchronously really.
1
1,020
0
1
2014-08-20T08:50:00.000
python,c++,multithreading,cpython,gil
Python GIL: concurrent C++ embed
0
1
2
25,400,635
1
0
0
Is there a way of somehow putting a QGraphicsTextItem so that the text is always displayed undistorted and in the same size with respect to the user? Imagine a scene that is zoomed in and out, but has points that are marked with a dot and some text. If the texts is part of the scene it is zoomed with the scene and will be unreadable the most of the time.
true
25,408,726
1.2
0
0
1
You need to set QGraphicsItem::ItemIgnoresTransformations flag for text items. See the documentation: This flag is useful for keeping text label items horizontal and unscaled, so they will still be readable if the view is transformed.
0
74
0
1
2014-08-20T15:28:00.000
python,qt,qgraphicsview
Qt display text in QGraphicsView undistorted, even in IgnoreAspectRatio views
0
1
1
25,409,718
1
0
0
This seems to be a dumb question, but how do I ssh into the kivy-remote-shell? I'm trying to use buildozer and seem to be able to get the application built and deployed with the command, buildozer -v android debug deploy run, which ends with the application being pushed, and displayed on my android phone, connected via USB. However, when I try ssh -p8000 admin@127.0.0.1 from a terminal on the ubuntu machine I pushed the app from I get Connection Refused. It seems to me that there should be a process on the host (ubuntu) machine in order to proxy the connection, or maybe I just don't see how this works? Am I missing something simple, or do I need to dig in a debug a bit more?
false
25,419,510
0
0
0
0
Don't know you found the answer or not. But what i have understood is that you are trying to connect android device from Ubuntu. If I am right then (go on reading) you are following wrong steps. First :- Your Ubuntu does not have ssh server by default so you get this error message. Second :- You are using 127.0.0.1 address i.e your Ubuntu machine itself. Method to do this shall be Give your android machine a static address or if it gets dynamic its OK. know the IP address of android and then from Ubuntu typessh -p8000 admin@IP_Of_andrid_device and this should solve the issue.
0
1,540
1
1
2014-08-21T06:23:00.000
android,python,ssh,kivy
How to connect to kivy-remote-shell?
0
3
3
41,788,451
1
0
0
This seems to be a dumb question, but how do I ssh into the kivy-remote-shell? I'm trying to use buildozer and seem to be able to get the application built and deployed with the command, buildozer -v android debug deploy run, which ends with the application being pushed, and displayed on my android phone, connected via USB. However, when I try ssh -p8000 admin@127.0.0.1 from a terminal on the ubuntu machine I pushed the app from I get Connection Refused. It seems to me that there should be a process on the host (ubuntu) machine in order to proxy the connection, or maybe I just don't see how this works? Am I missing something simple, or do I need to dig in a debug a bit more?
false
25,419,510
0.066568
0
0
1
127.0.0.1 This indicates something has gone wrong - 127.0.0.1 is a standard loopback address that simply refers to localhost, i.e. it's trying to ssh into your current computer. If this is the ip address suggested by kivy-remote-shell then there must be some other problem, though I don't know what - does it work on another device?
0
1,540
1
1
2014-08-21T06:23:00.000
android,python,ssh,kivy
How to connect to kivy-remote-shell?
0
3
3
25,423,631
1
0
0
This seems to be a dumb question, but how do I ssh into the kivy-remote-shell? I'm trying to use buildozer and seem to be able to get the application built and deployed with the command, buildozer -v android debug deploy run, which ends with the application being pushed, and displayed on my android phone, connected via USB. However, when I try ssh -p8000 admin@127.0.0.1 from a terminal on the ubuntu machine I pushed the app from I get Connection Refused. It seems to me that there should be a process on the host (ubuntu) machine in order to proxy the connection, or maybe I just don't see how this works? Am I missing something simple, or do I need to dig in a debug a bit more?
false
25,419,510
0.132549
0
0
2
When the app is running, the GUI will tell you what IP address and port to connect to.
0
1,540
1
1
2014-08-21T06:23:00.000
android,python,ssh,kivy
How to connect to kivy-remote-shell?
0
3
3
25,426,085
1
0
0
I am trying to port my code from pywin32 to openpyxl. But I can't find the way to change the color style on partial characters in the cell. In pywin32, I can use: Range(Cell).GetCharacters(Start, Length).Font.ColorIndex to do this. But it seems there is no such method like that in openpyxl?
false
25,439,007
0.197375
0
0
1
The simple answer is that a cell is the smallest item to which you can apply styles to. You can work around this restriction by embedding formatting within the text but this is even messier than it sounds.
0
1,007
0
3
2014-08-22T03:16:00.000
python,excel,openpyxl
openpyxl - style on characters
0
1
1
25,486,431
1
0
0
I have two screens and want to change the SlideTransition from my second to first screen to direction: 'right' while keeping the first to second transition the default. The docs only show how to change the transition for every transition. How would I make a transition unique to one screen, done in the kv file? Note: I have declared my screen manager screens in the kv file also.
true
25,459,285
1.2
0
0
0
There isn't a property that lets you simply do this - the transition is a property of the screenmanager, not of the screen. You could add your own screen change method for the screenmanager that knows about the screen names and internally sets the transition.
0
249
0
0
2014-08-23T06:55:00.000
python,kivy
Making unique screen transitions - kivy
0
1
1
25,461,440
1
0
1
I have an existing PyQt5/Python3.4 application that works great, and would now like to add "real-time" data graphing to it. Since matplotlib installation specifically looks for Python 3.2, and NumPhy / ipython each have there own Python version requirements, I thought I'd use a python distribution to avoid confusion. But out of all the distros (pythonxy, winpython, canopy epd) Anaconda is the only one that supports Python 3.4, however it only has PyQt 4.10.4. Is there a way I can install Anaconda, and use matplotlib from within my existing PyQt5 gui app? Would I be better off just using another charting package (pyqtgraph, pyqwt, guiqwt, chaco, etc) that might work out of the box with PyQt5/Python3.4?
false
25,468,397
0.049958
0
0
1
I use Anaconda and with Python v2.7.X and qt5 doesn't work. The work-around I found was Tools -> Preferences -> Python console -> External modules -> Library: PySlide
1
15,580
0
8
2014-08-24T03:57:00.000
matplotlib,anaconda,python-3.4,pyqt5
Using Anaconda Python 3.4 with PyQt5
0
1
4
44,932,618
1
0
0
I've got an Android app written in Kivy (Python), which stores local files that should survive an app update (adb install -r). If the files are stored in a subdirectory of the current directory ("data/data/app_name/files"), I see that they are deleted after update. However after some experiments I could "solve" this by storing the files in the "data/data/app_name/shared_prefs" directory, which seems to be persistent after updates. By the way, I didn't check but maybe the "data/data/app_name/databases" also is. Is there a cleaner way of doing things ? I need to test if I can create a new folder not called shared_prefs nor databases under "data/data/app_name", and if it is persistent. (this seems kind of a hack because those directories have another dedicated purpose, even though my app is not using them for this dedicated purpose right now) (NB: I don't want to keep the files outside the app private directory)
false
25,469,151
0
0
0
0
There is not a simple way (as in a build hook or similar) right now, but it's something we've specifically discussed in the last few days as the current situation has become a direct problem. I'm not sure what the resolution was, but there will probably be a change in python-for-android to fix it fairly soon. If you want to keep up to date with this, ask on the kivy mailing list or irc. In particular, knapper_tech was making these changes.
0
1,291
0
0
2014-08-24T06:38:00.000
android,python,local-storage,updates,kivy
Kivy on Android : keep local storage files after app updates
0
1
1
25,471,205
1
0
0
I have been trying something like this in VB. Private Sub python_Click() Shell "C:\Python25\python.exe ""C:\rowcount.py" End Sub This python script just creates a text file and this script works fine. But how to run a python script from vb button_click event as if the python script accepts run-time arguments. Something like the following e.g: Shell "C:\Python25\python.exe ""C:\rowcount.py -e -w -v COM6"
true
25,479,018
1.2
0
0
0
If you're on Windows just call the Python file by itself. If you're on Mac or *Nix then make it executeable with chmod a+x pythonfile.py, then call it. You may need to add python to the Path environment variable but that is always a convenient thing to have.
0
415
0
0
2014-08-25T04:24:00.000
python,vba,button
How to pass arguments to a python script on a button press from vb
0
1
1
25,479,346
1
0
0
Here is what I want to do: 1)Open an application with username 2)Give some inputs 3)Open 2nd window for the application with different username 4)Give some inputs again 5)Switch to first application window, do somethg 6)Switch to second application I am programming in python using the win32gui library. I have tried using the ShowWindow and SetForegroundWindow , but it doesnt work correctly, can someone please explain me what would be the way to do it in a very simple way?
false
25,535,893
-0.197375
0
0
-1
Call BringWindowToTop and SetActiveWindow functions.
0
2,967
0
3
2014-08-27T19:55:00.000
python,win32gui,showwindow,setforegroundwindow
How to use ShowWIndow() and SetForegroundWindow Correctly?
0
1
1
28,421,442
1
1
0
Edit<<<<<<< The question is: -How do you launch C code from python? (say, in a function) -How do you load Java code into python? (perhaps in a class?) -Can you simply work with these two in a python program or are there special considerations? -Will it be worth it, or will integrating cause too much lag? Being familiar with all three languages (C, Java and Python) and knowing that Python supports C libraries, (and apparently can integrate with Java also) I was wondering if Python could integrate a program using both languages? What I would like is fast flexible C functions while taking advantage of Java's extensive front-end libraries and coordinating the two in Python's clean, readable syntax. Is this possible? EDIT----> To be more specific, I would like to write and execute python code that integrates my own fast C functions. Then, call Java libraries like swing to create user interface and handle networking. Probably taking advantage of XML as well to aid in file manipulation.
false
25,577,470
0.099668
1
0
1
For C, you can use ctype module or SWIG. For Java, Jython is a good choice.
0
152
0
0
2014-08-29T23:24:00.000
python,c,language-interoperability
How do you use Python with C and Java simultaneously?
0
1
2
25,577,983
1
0
0
How can I efficiently detect collision between image layers and generated shapes? I need a fast and comprehensive method to detect collision between rotatable image layers and generated shapes. So far I have just been dividing images into a series of circles that contain the majority of the pixels and then testing each circle against other shapes. To enhance performance I created perimeter circles around each structure and only test these larger circles until two structures are close enough to collide. The real problem is that it is very difficult to collide a rotatable rectangle, for example, into one of these image structures. Filling a rectangle with circles also just does not seem efficient. Not to mention that I'm getting combinatoric explosions that make looping very complex and poor performance. Anyone know a better way to handle this type of collision? I write in Java, Python and C. I am willing to use C++ also.
false
25,587,180
0
1
0
0
Normally, sphere collisions are just filter for real collision tests. You can either: decide to limit collisions to that, for example if it's a game. implement real collisions and do the full math. You're basically intersecting the rotated edges of the two rectangles (16 cases). Intersect two edges as if they were lines, there will be only one point of intersection (unless they're parallel), if that point is inside the segment there's a collision. To limit complexity, you can use a quadtree/octree. Divide your space into four rectangles, then those rectangles into four etc ... until they're too small to contain an object or are empty. Put your collidable objects into the most specific part of the tree that will contain them. Two objects can only collide if they are in the same sub rectangle or one is in any parent of the other. Not sure that helps, but they're ideas.
0
170
0
0
2014-08-30T22:10:00.000
java,python,c,algorithm,collision-detection
Collision detection between image layers and shapes
0
1
1
25,588,001
1
0
0
my platform: ubuntu14.04 python 3.4.0 I moved my project from pyqt4 to pyqt5 and fond that I could not enable my IME in my program powered by pyqt5... Since there is no error raised, I could not focus to where the problem is. This problem is quite like "enable IME in Sublime on Linux". Anyone meet the same problem or have already fixed it?
true
25,621,349
1.2
0
0
0
The problem is caused by fcitx not QT5. Install libfcitx-qt5 and it will fix the problem.
0
382
0
0
2014-09-02T10:35:00.000
python,pyqt5
How to use IME(Input Method Editor) with pyqt5
0
1
1
25,676,913
1
0
0
I created a analog rpm gauge using the canvas widget of Tkinter and I want to import it in a wx GUI application (as a panel, maybe). Is there any way to do it or I must rewrite this widget in wx?
false
25,622,764
0.132549
0
0
2
There is no (simple) way to do that - WxWidgets is an abstraction over different toolkits in different systems, and use different mainloop functions, while Tkinter has its own mainloop - that is to start with. So making that work would at leas require: that you'd setup different threads able to run both mainloops in paralell, finding a way to get Tkinter to render the widget to an in memory bitmap create a custom widget in wx which would render that bitmap to the screen and map events on it back to Tkinter, if it is supposed to respond events So you are definitely better of writting the widget again.
0
408
0
2
2014-09-02T11:52:00.000
python,user-interface,tkinter,wxpython
import a tkinter widget in wxpython application as a panel
0
1
3
25,622,901
1
0
0
I'm trying to install Pygame and it returns me the following error "Python version 3.4 required which was not found in the registry". However I already have the Python 3.4.1 installed on my system. Does anyone know how to solve that problem? I've been using Windows 8.1 Thanks in advance.
false
25,625,097
0.291313
0
0
3
Are you using a 64-bit operating system? Try using the 32-bit installer.
1
1,096
0
2
2014-09-02T13:51:00.000
python-3.x,pygame
Error installing Pygame / Python 3.4.1
0
2
2
25,628,838
1
0
0
I'm trying to install Pygame and it returns me the following error "Python version 3.4 required which was not found in the registry". However I already have the Python 3.4.1 installed on my system. Does anyone know how to solve that problem? I've been using Windows 8.1 Thanks in advance.
false
25,625,097
0
0
0
0
Tips I can provide: Add Python to your Path file in the Advanced settings of your Environmental Variables (just search for it in the control panel) Something may have gone wrong with the download of Python, so re-install it. Also don't download the 64-bit version, just download the 32-bit version from the main pygame website Once that's sorted out, transfer the entire Pygame file to the site packages in the Python directory and open up the pygame file and go to this directory in command prompt. Finally, run the Pygame setup from the command prompt which should be something like: python setup.py But this will only work if the pygame setup file is called setup.py (it's been a while since I downloaded it), you added Python to the Path file and you're currently in the correct directory in command prompt. To test if it worked try importing pygame and see if you got an error or not.
1
1,096
0
2
2014-09-02T13:51:00.000
python-3.x,pygame
Error installing Pygame / Python 3.4.1
0
2
2
25,628,949
1
0
0
How I can remove or hide the default minimize or maximize button of a window created with kivy.
false
25,639,073
0
0
0
0
I'm not aware of a simple way to do this - it's not exposed in the kivy window api, and may not even be exposed in pygame (which is likely the backend you're using on desktop). Maybe you can look up the right way to do it on each system you target, e.g. I think you can hint it to X11, but I don't know if this is really plausible or nice. We're developing a new sdl2 backend, which is more flexible about some of these kinds of things, but I don't know if it would make this possible.
0
1,674
0
5
2014-09-03T07:53:00.000
python-2.7,user-interface,kivy
How to hide/remove the default minimize/maximize buttons on window developed with Kivy?
0
1
2
25,639,632
1
0
0
Comically enough, I was really annoyed when tkinter windows opened in the background on Mac. However, now I am on Linux, and I want tkinter to open in background. I don't know how to do this, and when I google how to do it, all I can find are a lot of angry Mac users who can't get tkinter to open in the foreground. I should note that I am using python2.7 and thus Tkinter not tkinter (very confusing).
true
25,648,912
1.2
0
0
0
I am using Linux Mint. In order to make a program not show up in the foreground (i.e. be hidden behind all of the other windows), one should use root.lower() as aforementioned in the comments. However, please note (and this seems to happen on multiple platforms) that root.lower() will not change the focus of the window. Therefore, even if you use .lower() and run the script, and if you press [alt] + [F4], for example, the Tkinter window that was just opened (even though you cannot see it) will be closed. I noticed, however, that it is prudent to place the root.lower() after attributes for the Tkinter root. For example, if you use root.attributes("-zoomed", True) to expand the window, be sure to place root.lower() after the root.attributes(..). Moreover, it did not work for me when I put root.lower() before root.attributes(..).
0
184
1
0
2014-09-03T16:04:00.000
python-2.7,tkinter
Start Tkinter in background
0
1
1
25,689,654
1
0
0
Basically, I have a large existing code base and I want to wrap all of the .h files in one particular directory using SWIG. Many of the classes in these .h files inherit from other classes defined elsewhere in the directory tree, and it would be a pain to track down each one of them by hand. Is there any way to get SWIG to automatically include these or to at least automate the creation of the .i file? I don't want to wrap any classes outside of my own code (such as the standard library), but these would end up being included if I used the -importall option.
false
25,671,624
0
0
0
0
There isn't a builtin way to generate the .i file automatically, or to populate the .i with all .h in a folder and all "other .h to make it work properly" Part of the reason is that "working properly" is completely arbitrary: if A is in that set of headers you want to export, and A derives from B, do you need to export B "for it to work properly"? Not at all. But you might want to. And even if A returns an instance of B, do you need to export B? No (so don't need import B.h in .i), the object returned by SWIG will be an opaque handle to the B instance, and although you won't be able to call any methods on it, you will be able to give it as argument to functions that accept B as a parameter. The most practical is to write a batch or python script to find a base set of the .h you want (a one liner if all in same folder), copy/paste into your .i, and manually cleanup so .i only contains what files you really want to export to target language, and add any missing ones to get certain features you want (like instantiate base classes etc). You can say "no I don't want to have to customize" all you want, you don't have a choice.
0
734
0
3
2014-09-04T17:30:00.000
python,c++,include,swig
How can I wrap many .h files with SWIG and include any dependencies?
0
1
1
25,690,665
1
1
0
I have installed it using the executable file downloaded from its webpage. I tried finding %AppData%\skins\ as suggested by blogs but I just couldn't find it. Has anybody been stuck here?
false
25,725,702
0
0
0
0
Click on the windows logo, write %appdata%, then open "Roaming"
0
2,831
0
1
2014-09-08T13:43:00.000
python,pyscripter
Changing theme in Pyscripter?
0
1
2
30,013,579
1
0
0
I am working with a GIS problem using a single input of a polygon shapefile. Consider an irregular polygon. I want to draw vertical lines across the extent of the polygon at equal spacing. How I intend to proceed is: Identify the bounding box (done using PyShp) Draw vertical Lines parallel to the left edge of the bounding box at equal spacing (How?) Clip the lines to the extent of the polygon (How, without using ArcPy?) Note: They are required to be only vertical, and not a graticule. Also, I do not intend to use ArcPy, and intend to perform the coding completing in Python (2.7) as this segment of code needs to go into a tool generated from PyQt.
false
25,742,903
0
0
0
0
Find the points/vertices that describe the line at the left edge - (x1, y1), (x2, y2) Add a constant to the x values - (x1+k, y1), (x2+k, y2) Find the y values on the polygon at the new x values - (x1+k, y3), (x2+k, y4) Draw the line between those two points.
0
1,014
0
0
2014-09-09T10:58:00.000
python,python-2.7,shapefile,bounding-box
Vertical lines in a polygon shapefile
0
1
2
25,744,305
1
0
0
This is pretty simple. I have a label along the bottom of my app. As a user scrolls through a treeview, the content of that label changes. Sometimes, the content is multiple lines long. Previously, the label would grow/shsrink to accommodate content. I didn't like this, so I wrapped the label in a frame, gave said frame a fixed height, and set grid_propagate(0). It looks great, but now my text has disappeared. How can I give the label a fixed size and retain the ability to update its text?
false
25,793,355
0
0
0
0
Rather then a Label use a Text inside the Frame and add a vertical scrollbar with the Text. Pack both the Text and the Scrollbar in the Frame, using examples online, and connect them up. Once you cancel propagate for the Frame it won't resize. You can then set the Frame to whatever size you want, even set the Text for a specific number of lines and columns of text before you cancel propagate for the Frame, and then you can display as much text as you want at the bottom allowing the user to scroll through if it is too big.
0
296
0
0
2014-09-11T17:12:00.000
python,tkinter,resize
Tkinter, enclosing_frame.grid_propogate(0) to prevent resizing also prevents updating label text
0
1
2
47,625,796
1
0
0
I'm using android version 4.4.2 and python 2.7 for UI automation. when I tried to capture view using UI automator/culebra/dump, I'm not able to capture QWERTY keypad view. Please help me on this I need to touch and type on qwerty keypad and I should be able to type alpha-numeric text and smileys. Also once typed, you should verify if what is displayed on the screen is what you intended to type. Thanks in advance.
false
25,841,900
0
0
0
0
QWERTY keyboard is webview and UiAutomator does not support webview at present. AndroidViewClient is based on UiAutomator and therefore does not capture the keyboard. If your objective is to just type the text, you can first detect if the focus is on the text field and then use device.type('your_text').
0
849
0
2
2014-09-15T06:19:00.000
android,python-2.7,dump,android-uiautomator,androidviewclient
In android view client I'm not able to capture qwerty keyboard in message
0
1
4
25,967,652
1
0
0
Is there a way to use the OS module in python to save a jpeg created by the screenshot() function in Kivy? I am on Android so I want to find a way to make it so that the screenshot() gets saved in /sdcard/Pictures. If I don't have to use the OS module, how would I do it? Please use examples and add code snippets that other users and I can use for future reference. I have been stuck on this issue for a long time. Thanks in advance!!!!
true
25,858,087
1.2
0
0
1
I want to find a way to make it so that the screenshot() gets saved in /sdcard/Pictures. The argument to screenshot is the filepath to save at, just write Window.screenshot('/sdcard/Pictures').
0
77
0
0
2014-09-15T22:52:00.000
android,python,python-2.7,kivy
How to use os module to save a jpeg to a cretin path- Using kivy screenshot()
0
1
1
25,858,139
1
1
0
The Studio app that is served on port 18010 shows with no theme. It only shows black text on a white background and with no images... that happens while the other counterpart LMS (on port 80) app shows fine. Where shall I start troubleshooting this problem?
false
26,011,567
0
0
0
0
port 18010 is forwaded via nginx, So you have to run studio collectstatic. ie..update_assets for cms(studio) in edx.
0
276
0
0
2014-09-24T07:59:00.000
python,django,django-templates,mako,edx
Edx Studio not showing with a theme
0
1
2
26,646,633
1
0
0
The goal is to have an application that runs on top of all other applications and windows in the desktop, and display a clickable control (say, an image button) that moves around the screen. The application must run as a service in the background and show thebutton (let's say) each hour, once clicked it disappears until the next hour. This application has to be written in Python. It looks like PyQt is one of the better options, but I'm not sure if it does support this sort of functionality and if it is a good alternative for modern Windows applications. What packages or frameworks are appropriate for this scenario? I have seen Pygl and PyGame but they seem to be limited to a window, is this correct?
false
26,026,865
0.197375
0
0
1
You actually don't need to create the program as a service. You can just start the application and not show the window immediately. You can use PyQt or wxPython. I'm more familiar with wxPython, so if you went that route, you could use a wx.Frame style flag such as wx.STAY_ON_TOP to get the functionality you want. I have created applications that load up in the system tray with just an icon. When you click the icon, it shows the frame. The rest of the time, the frame is hidden. I would try that route before looking at doing a service.
0
127
0
1
2014-09-24T21:30:00.000
python,windows,user-interface,desktop-application
How to make a clickable control that is always on top, in Windows using Python?
0
1
1
26,043,694
1
0
0
Does anyone know if it is possible to run python-gui apps, like wxPython, on a c9.io remote server? I have my home server set up with c9 via SSH, and no issues logging in and running apps in the terminal on the VM. However, when I try to run GUI apps, I get the following error message. Unable to access the X Display, is $DISPLAY set properly? After searching and searching, I can't seem to find a guide or anything in the docs that detail how to set $DISPLAY in the script. X display is installed and active on my server, but I don't know how to configure the c9 script to access it properly. Any assistance would be appreciated!
false
26,050,414
0.197375
0
0
1
I don't know if Cloud9 supports it but normally to run a remote GUI application you would have ssh forward the X11 communication over the ssh connection via a tunnel. So basically the application is running on the remote system and it is communicating with a local X11 server which provides you with the display and handling of the mouse and keyboard. If you run ssh with the -X parameter then it will attempt to set up the X11 tunnel and set $DISPLAY in the remote shell so any GUI applications you run there will know how to connect to the X11 tunnel. Bw aware however that this is something that can be turned off on the remote end, so ultimately it is up to Cloud9 whether they will allow you to do this.
0
686
1
0
2014-09-26T00:53:00.000
python-2.7,wxpython
Running Python GUI apps on C9.io
0
1
1
26,051,264
1
0
0
When creating a TextItem to be added to a plotItem in PyQtGraph, I know it is possible to format the text using html code, however I was wondering how to format the text (i.e. change font size) when updating the text through TextItem.setText()? or do I need to destroy/re-create a TextItem?
true
26,116,350
1.2
0
0
5
It is not documented, but the method you want is TextItem.setHtml().
0
1,991
0
1
2014-09-30T08:39:00.000
python,text,plot,formatting,pyqtgraph
How to set font size using TextItem.setText() in PyQtGraph?
0
1
2
26,129,313
1
0
0
If I have a QGridLayout and stack two widgets on top of each other, then they take up 50% of the layout each. However, if one of the widgets is a QLineEdit widget, then that widget takes up a much smaller portion of the layout than 50%. How do I add two widgets to a QGridLayout, then set the initial portions to something other than 50%/50%?
false
26,128,828
0
0
0
0
The default vertical size policy of QLineEditis QSizePolicy.Fixed. That means it will always have the same height and other widgets might take available space in the layout. So you might have to adjust the size policies of your widgets as Fenisko already demonstrated. However if you have two or more expanding widgets in your layout, all will have equal size. You can use QGridLayout.setRowStretch(int column, int stretch) and QGridLayout.setColumnStretch(int column, int stretch) of your layout to adjust proportions of rows and columns. Alterantively use QSizePolicy.setVerticalStretch(int stretch) and QSizePolicy.setHorizontalStretch(int stretch) of your widget's size policies.
0
3,186
0
1
2014-09-30T19:43:00.000
python-3.x,pyqt,pyside
What's the proper way to resize widgets in a layout?
0
1
2
26,194,380
1
0
0
I am trying to make a GUI in python using pyqt4 which incorporates a waterfall sink which is connected with an USRP. The problem is that the data should be shown in waterfall sink continuously which makes the GUI to freeze and I can not use the other buttons in meanwhile. I was checking to use threads, but till now what I understood is that in threads I can put just functions which will give an result at the end, but not the functions which will give results continuously and I want to see it in the main GUI. Any idea how to make it possible to see the continuous results from waterfall sink and not to freeze the main GUI.
false
26,138,460
0
0
0
0
There are several ways to do this, but basically either Breakup your waterfall sink into chunks of work, which the GUI can execute periodically. For example, instead of continuously updating the waterfall sink in a function that GUI calls, have only a "short" update (one "time step"), and have the function return right after; make the function called periodically via QTimer. Make the waterfall sink execute in a separate thread by using a QObject instantiated in a QThread instance; and make the sink function emit a signal at regular interval, say at every "time step" of the waterfall update.
1
352
0
0
2014-10-01T09:43:00.000
python,multithreading,pyqt,pyqt4,usrp
Using threads with python pyqt?
0
1
2
26,153,975
1
0
0
I have install Anaconda 2.0.1 on KDE desktop. When I run python and would see all modules installed, I have this message "Cannot mix incompatible Qt library (version 0x40801) with this library (version 0x40805)", Can I fix the problem if I unintall Qt library (version 0x40801)? How I do that? Or if someone have another suggestion,please help me, Thx very much
false
26,155,448
0
0
0
0
QT aggressively tries to find other QT installations on the system. It is likely finding the one installed by Linux. You likely can't remove this, as there are probably several programs that come with Linux that use QT, but is it possible to update it to the same version?
0
3,076
1
4
2014-10-02T06:26:00.000
python,qt,anaconda
Cannot mix incompatible Qt library (version 0x40801) with this library (version 0x40805)
0
1
2
26,186,264
1
0
0
I create an exe executable of my application made ​​in pyqt, and everything went well, but when I run the exe in windows before opening the application opens a console and while the application is open that console is also. I need someone to tell me how to make the console does not come out, or at least not visible. I've seen some answers to this problem but with C ++ with Python I have not seen anything
false
26,199,115
0
0
0
0
The best solution is in the post linked to in a comment to your post, but on Windows you can also set a property on a shortcut that starts the app, to have the console minimized. It still shows in taskbar, there id you need it, can be handy in some situations(like during dev to use same script as user will, but not have to bother evrytime start the app to manually minimize the console). In general best to use pythonw.exe or use .pyw extension for your script.
0
50
0
0
2014-10-05T02:35:00.000
python,windows,console,pyqt,exe
The exe executable of my application, also opens a console
0
1
1
26,208,237
1
0
0
I would like to do some basic audio-signalprocessing in kivy. For example, I would like to convolve a .wav file with an impulse response. I use SoundLoader.load('file.wav') to load the audio files. My question is: is it possible to convert an audio object into a list, so I can access each sample? Or does the SoundLoader class offer any possibilities of convolution, or any other audio processing?
false
26,201,740
0
0
0
0
Kivy is not really obviously designed for Audio or Signal Processing and doesn't need to be thats why you have python and its massive collections of libraries, you can use 'numpy', 'scipy', 'librosa', and so on.... with numpy you could get an array of the signal
0
1,453
0
1
2014-10-05T10:28:00.000
python,audio,kivy,convolution
Audio processing in kivy
0
1
3
54,000,026
1
0
0
I am trying to find Qt designer app on Mac. I installed anaconda package and conda reports that qt, sip, and pyqt are installed. Still I couldn't find the designer app in any of the folders. My Python app that uses pyqt works perfectly. I'm very new to macs and probably missing something very simple. I did search folder tree for anything named designer. I found QtDesigner.so (supposed to be executable?) at /Users/XXXX/anaconda/pkgs/pyqt-4.10.4-py27_0/lib/python2.7/site-packages/PyQt4 but it won't even run saying "cannot execute binary file" anaconda/bin doesn't have it. There's a folder anaconda/include/QtDesigner but noting I can run /anaconda/pkgs/qt-4.8.5-3/bin - no designer. I'm totally confused now.
false
26,226,730
0.044415
0
0
2
I found it in this location in my mac /Users/ramakrishna/Qt/5.11.1/clang_64/bin/Designer.app command "open -a designer" also works on mac shell command + space bar and invoke spot light search and typing designer also find the designer app
1
36,375
0
13
2014-10-07T00:16:00.000
python,macos,qt,pyqt,anaconda
Where is Qt designer app on Mac + Anaconda?
0
4
9
51,688,988
1
0
0
I am trying to find Qt designer app on Mac. I installed anaconda package and conda reports that qt, sip, and pyqt are installed. Still I couldn't find the designer app in any of the folders. My Python app that uses pyqt works perfectly. I'm very new to macs and probably missing something very simple. I did search folder tree for anything named designer. I found QtDesigner.so (supposed to be executable?) at /Users/XXXX/anaconda/pkgs/pyqt-4.10.4-py27_0/lib/python2.7/site-packages/PyQt4 but it won't even run saying "cannot execute binary file" anaconda/bin doesn't have it. There's a folder anaconda/include/QtDesigner but noting I can run /anaconda/pkgs/qt-4.8.5-3/bin - no designer. I'm totally confused now.
false
26,226,730
0.110656
0
0
5
OSX Yosemite 10.10.5 Qt 5.6 QtCreator 3.6.1 QtDesigner is part of my QtCreator. To use QtDesigner: Launch QtCreator, and from the menu bar (outside QtCreator), click on: File>New File or Project You will be presented with a New File or Project dialog window. In the Files And Classes section, select Qt. In the middle pane, select QtDesigner Form. Then click on the Choose button in the lower right corner. You will be presented with a QtDesigner Form dialog window. Then you can select Main Window or Dialog with Buttons Bottom, etc. Then click on the Continue button in the lower right corner. In the Location dialog window, use a name like mainwindow1.ui, and for the path you might want to step aside and create a directory called forms, e.g. $ mkdir /Users/7stud/qt_projects/forms, then enter that as the path. Enter any other details and click on Done. That will land you in QtCreator with the Design button selected (which I guess means you are in QtDesigner), and you will be able to drag and drop widgets onto your window. To convert the .ui file to a .py file that you can import into your python program: $ pyuic5 mainwindow1.ui -o mainwindow1.py -o => output file (default is stdout) That command converts the .ui file mainwindow1.ui to a .py file named mainwindow1.py. To re-open the file: File>Open File or Project. If you select a file with a .ui extension, it will be opened with QtCreator's Design button pre-selected, i.e. you will be inside QtDesigner.
1
36,375
0
13
2014-10-07T00:16:00.000
python,macos,qt,pyqt,anaconda
Where is Qt designer app on Mac + Anaconda?
0
4
9
36,830,816
1
0
0
I am trying to find Qt designer app on Mac. I installed anaconda package and conda reports that qt, sip, and pyqt are installed. Still I couldn't find the designer app in any of the folders. My Python app that uses pyqt works perfectly. I'm very new to macs and probably missing something very simple. I did search folder tree for anything named designer. I found QtDesigner.so (supposed to be executable?) at /Users/XXXX/anaconda/pkgs/pyqt-4.10.4-py27_0/lib/python2.7/site-packages/PyQt4 but it won't even run saying "cannot execute binary file" anaconda/bin doesn't have it. There's a folder anaconda/include/QtDesigner but noting I can run /anaconda/pkgs/qt-4.8.5-3/bin - no designer. I'm totally confused now.
false
26,226,730
0
0
0
0
I can't answer you question definitively as I don't have OSX installed anywhere, but perhaps I can help lead you in the right direction. 1) you are going to want to be looking for Designer, not QT Creator, as Designer is what comes bundled with PyQt4 (PyQt4 is what Anaconda comes packaged with) 2) in linux when you install Anaconda 2.1 to the default location, designer is going to be placed in home/user_name/anaconda/bin/ 3) typing 'designer' from a terminal launches designer in linux, so you may not have to bother searching around for it. Hopefully there is some consistency between linux and osx (windows designer is located in \Anaconda\Lib\site-packages\PyQt4). Best of luck.
1
36,375
0
13
2014-10-07T00:16:00.000
python,macos,qt,pyqt,anaconda
Where is Qt designer app on Mac + Anaconda?
0
4
9
27,385,758
1
0
0
I am trying to find Qt designer app on Mac. I installed anaconda package and conda reports that qt, sip, and pyqt are installed. Still I couldn't find the designer app in any of the folders. My Python app that uses pyqt works perfectly. I'm very new to macs and probably missing something very simple. I did search folder tree for anything named designer. I found QtDesigner.so (supposed to be executable?) at /Users/XXXX/anaconda/pkgs/pyqt-4.10.4-py27_0/lib/python2.7/site-packages/PyQt4 but it won't even run saying "cannot execute binary file" anaconda/bin doesn't have it. There's a folder anaconda/include/QtDesigner but noting I can run /anaconda/pkgs/qt-4.8.5-3/bin - no designer. I'm totally confused now.
false
26,226,730
1
0
0
18
You can try open -a Designer from your terminal to launch Qt Designer that comes with Anaconda (version 4.x). If you have Qt5.x, you may want to launch a newer version of Designer by open -a Designer-qt5.
1
36,375
0
13
2014-10-07T00:16:00.000
python,macos,qt,pyqt,anaconda
Where is Qt designer app on Mac + Anaconda?
0
4
9
41,113,866
1
0
0
I'm attempting to embed a python module within a larger c++ program (Relevant details:VS2005, WinXP Python 2.7). When I create a new instance of the class that includes 'python.h' and attempt to run my program I get the error message "The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.ll". I've read online that this happens because GetTickCount64 doesn't exist in XP so I made sure to add the correct windows headers to all of my files. However I still get the error and it occurs even if I comment out everything in the offending class except the include for Python.h. So to get to an actual question. I was wondering if Python itself could be calling or including GetTickCount64 and if so how to stop it from doing so. Thanks for any help!
false
26,285,393
0
0
0
0
Guess I posted to fast since I think I've got it sorted myself. For anyone else in the same position I downloaded the Python source and compiled with Windows XP flags in VS2005 and all seems well with the world.
0
505
0
0
2014-10-09T18:19:00.000
c++,python-2.7,windows-xp,gettickcount
GetTickCount64 error using Python and C++
0
1
1
26,286,120
1
0
0
I have inherited a wxPython app (story of my life of late) and you cannot make the window any smaller (but you can make it larger). What could be preventing it from being resized smaller? What could I grep for to find what is causing this? The window contains a Notebook with 2 tabs. One tab has a Grid and the other has a Panel and 3 Grids.
false
26,290,757
0
0
0
0
Well then, I would suppose that the code is handling the resize event, allowing you to make the window larger, but not smaller. Look for something like void handlerFuncName(wxSizeEvent& event) Also look for wxEVT_SIZE
0
193
0
1
2014-10-10T01:54:00.000
wxpython,wxwidgets
wxPython: what is preventing me from making a window smaller?
0
2
4
26,307,804
1
0
0
I have inherited a wxPython app (story of my life of late) and you cannot make the window any smaller (but you can make it larger). What could be preventing it from being resized smaller? What could I grep for to find what is causing this? The window contains a Notebook with 2 tabs. One tab has a Grid and the other has a Panel and 3 Grids.
false
26,290,757
0
0
0
0
It is likely a call to SetMinSize for your Dialog/Frame.
0
193
0
1
2014-10-10T01:54:00.000
wxpython,wxwidgets
wxPython: what is preventing me from making a window smaller?
0
2
4
26,292,854
1
0
0
I am making a GUI for a script in Python, using PySide Qt. I have a couple of checkboxes in the main window and I was wondering if it is possible to make them dependant to each other. What I mean is that, if I check one of them, all the others should become unchecked. So only one can be checked at a time. Is there a comfortable way to do this? Otherwise I would just write a function to uncheck the others.
true
26,293,638
1.2
0
0
1
use QButtonGroup to make them as a group and you might want to derive a class from this and override the basic check/uncheck depending on how you want the checkboxes to behave
0
2,086
0
0
2014-10-10T07:00:00.000
python,checkbox,pyqt,pyqt4,pyside
How to allow only one checkbox checked at a time?
0
1
1
26,311,689
1
0
0
I know this is probably something trivial, but I cannot seem to find the answer. I have just completed a fresh install of Scientific Linux 6.5 - which ships with Python 2.6 and Qt 4.6.2. I wish to use the Python interpreter python2.7.8 so downloaded this and installed. I use the QtDesigner for ease when making guis, so then need the PyQt bindings to go with it. I therefore downloaded SIP-4.16.3, configured with: python2.7 ./configure (in the sip download directory) to make the bindings for the newer version of python. Everything works fine so far. I then try to install PyQt4.11.2 in the same way: python2.7 ./configure --qmake=/usr/lib/qt4/bin/qmake -g (to pick up the qt4 version of qmake with static qt libraries) the configure script completes fine, but I get the following error during 'make': error: ‘PrintCurrentPage’ is not a member of ‘QAbstractPrintDialog’ ..../Downloads/PyQt-x11-gpl-4.11.2/QtGui/sipQtGuiQAbstractPrintDialog.cpp:1787: error: too many initializers for ‘sipEnumMemberDef’ make[1]: * [sipQtGuiQAbstractPrintDialog.o] Error 1 make[1]: Leaving directory `..../Downloads/PyQt-x11-gpl-4.11.2/QtGui' make: * [all] Error 2 I am at this point a little lost and have been bashing my head for a while, it must be something simple I have missed, any help would be great. Thanks in advance
false
26,301,635
0.197375
0
0
2
Search string 'PrintCurrentPage' in files of your PyQt-package. You will find it in 4 files. Remove corresponded lines with string 'PrintCurrentPage'
0
1,861
0
5
2014-10-10T14:21:00.000
python,linux,qt,installation,pyqt4
Installing PyQt4.11.2 on Scientific Linux 6.5
0
1
2
27,922,827
1
0
0
So I am writing a program for school, and I have to make a maths quiz, the quiz needs to be out of 10 questions. I have made a button that is defined with a command that generates a new questions, clears the text box, get the answer from the dictionary, and inserts the new question into the textbox. At the moment the user can press the button as many times as they want. I dont actually know how to count or monitor the amount of times a button in tkinter has been pressed. I would be very grateful if someone could provide me with some code for Python(3.1.4) that I could use to count the amount of times the button has been pressed.
false
26,315,848
0.099668
0
0
1
You need a variable in a global or class instance scope and a function that has access to the scope of the variable that increments the variable when called. Set the function as the command attribute of the Button so that the function is called when the button is clicked.
0
17,843
0
0
2014-10-11T14:44:00.000
python,button,user-interface,python-3.x,tkinter
How to count the number of times a button is clicked Python(tkinter)
0
1
2
26,315,912
1
1
0
I'm new developer in QPython (experienced with python), I want to open an url with user's default browser. I tried AndroidBrowser().open("...") but, to my surprise, I got Segmentation Fault! So I said OK, let's try to open it manually as activity, then I tried to import jnius and got Segmentation Fault as well. Any suggestion how to fix it or other ways to open the browser?
true
26,318,326
1.2
0
0
1
Apparently, this happens just in console mode, so in other QPython mods it works fine.
0
1,277
0
3
2014-10-11T19:16:00.000
android,segmentation-fault,android-browser,qpython,pyjnius
Open a URL with default broswer?
0
1
2
26,428,421
1
0
0
I'm trying to adequate the FontSize of my text into a width-height specific context. For instance, if I got a image (512x512 pixels) and I got for instance 140 characters. What would be the ideal FontSize? In the above case, a 50 pixels Fontsize seems to be ok but what happened if there's a lot more text? the text will not fit into the picture so it needs reduction. I've been trying to calculate this on my own without success. What I've tried is this: get total pixels, with a picture 512x512 = 262144 and divide into the length of the text. But that gives a big number. Even if I divided that number by 4 (thinking about a box-pixel-model for the font). Do you have any solutions for this? PS. I've been using truetype (if this is somehow useful) I've been using python for this purpose, and PIL for image manipulation. Thank you in advance.
false
26,319,382
0.53705
0
0
3
It's pretty tricky to do analytically. One way is trial and error. Choose a large font size and render the layout to see whether it fits Use bisection algorithm to converge on the largest font that fits
1
376
0
0
2014-10-11T21:22:00.000
python,fonts,truetype
Calculate fontsize
0
1
1
26,319,577
1
0
0
I am having a severe glitch after accidentally running an infinite loop in sublime text 3 with python. I was forced to kill the program (force quit) as it became unresponsive. I subsequently tried to reopen Sublime Text 3, however the application became stuck once more in what I can only assume to be an infinite loop, even though I did not build the file again. I am running Mac OS X version 10.9.5. I believe the problem may be with the fact that OS X reopens closed windows exactly to the state they were and this conflicts with IDEs, but even after unchecking the "Close open windows" option in System Preferences, ST3 remains broken. Any help? Because at this moment, ST3 is completely unusable for me.
true
26,321,861
1.2
0
0
1
You can try to edit the session file and start removing references to the offending code and see if that helps. On a mac it should be found here: ~/Library/Application Support/Sublime Text 2/Settings/Session.sublime_session This is just a guess, it might be in another file but it might point you in the right direction.
0
421
0
0
2014-10-12T04:26:00.000
python,macos,sublimetext3
Sublime text 3 refuses to load after executing infinite loop in Python
0
1
1
26,322,148
1
0
0
I was thinking of making a text-based game about detectives, case-solving, with complete freedom, loads of variables, etc. But before I get serious with it I need to know how to make rooms. E.g. you start in the hall and you type in "Go kitchen" and you go to the kitchen. I have achieved this by using import file when you type in "Go kitchen" (the file is the kitchen file), but if I want to go back and forth between them it gives an error. Is there something I am missing about this method? Is there a better way to do it? The simpler, the better, please.
true
26,323,942
1.2
0
0
3
Do not use import to implement application logic. In your use case, a room is the classic example of an object in object-oriented programming. You should have a class Room which defines the functionality for rooms. Individual rooms are instances of that class (later you can add subclasses, but I would not worry about that initially). Your application will have a "current room" as a variable. It will ask the room about its description and display that to the user. When the user types "go Kitchen", your application will ask the current room "hey, do you have a room named 'Kitchen' as a neighbor?" This method will return the appropriate room object, which your application then can set as the current room. From the above, you can see two functionalities (methods) rooms should have: "Give me your description" and "give me the adjacent room named 'X', if any". This should get you started.
1
486
0
0
2014-10-12T10:03:00.000
python
How best to implement rooms for a text-based game?
0
1
1
26,324,214
1
0
0
So I have 2 processing units, one runs on Python and the other runs of C++. The first one will generate a set of data of around 3 - 5 values, either as a list of ints or a string. I want this value to be passed to C++, what is the best method? Like do I have to create a file in python then load it in C++? or there are an another way? This process would repeat every second, so I wish the transmission to be fast enough.
false
26,379,658
0
1
0
0
I'd suggest using python's struct to pack your values in python which could be viewed as a 'struct' in c++, then send it from python to c++ using zeromq.
0
76
0
0
2014-10-15T09:59:00.000
python,c++
Transmitting data from Python to C++
0
1
1
26,379,890
1
0
0
I am writing long running program with simple GUI, the 99% of time I would like the program to work only as process, however sometimes I want to check the status, so is it possible to capture the keypress event in python? For example I want to show the program window when I press Ctrl+Shift+Alt+Q, I expect to use app on Windows Thank you
false
26,439,428
0
0
0
0
There are tutorials on how to create a key-logger with Python. They should help. But I do not know if that is the right way to go. Also you could register shortcuts under a key combination on Windows. You should be aware that Ctrl+Shift+Alt are handled independent of the keyboard layout and Q changes with the language. With pywin32 you should be able to do that using Ctrl+Shift+Alt+F1 for example.
0
145
0
0
2014-10-18T11:49:00.000
python,keypress
Python 3, capturing key combinations
0
1
1
26,440,943
1
0
0
I have some python scripts which are doing image processing work using its own numpy and scipy libraries. How can I use/call these scripts in Android application providing image input from camera captures and saving the images after processed. Is there some native support for Python like C++. What performance implications would be there if I compare with using C++ as a native support. Any help would be greatly appreciated.
false
26,480,009
-0.132549
0
0
-2
You need a Python Interpreter to run Python scripts,Pydroid Gives you access to compile Python scipts and comes with pip,So you could Install new Python Modules,it's the only app that gives a real Experience of Programming using python.
0
3,179
0
1
2014-10-21T06:12:00.000
android,python
Using Python scripts in Android for image processing
0
1
3
44,345,713
1
0
0
So I've been playing around with IDLE. Then the Lesson2 tells me to open the editor window, not the shell window. I'm not sure which is Editor? I have EDLE, Python Launcher (downloaded from python.org) and TextWranger...maybe I misunderstood about sth? :'(
false
26,572,932
0
0
0
0
IDLE combines several functionalities. It contains an interactive interpreter (the window where the >>> appears in, and in which you can bring code to execution immediately), and it's a small-scale IDE (integrated development environment), which means you can load, edit and save python-files, and launch them conveniently. This functionality is meant with "Editor". Probably just go to the Menu and pick something like "New File".
1
36
0
0
2014-10-26T12:21:00.000
python-3.x
Python Launcher is Editor?
0
1
1
26,572,955
1
0
0
So I have a QMessageBox that is not closable by the user. I want it to stay active until some work is done, and then close automatically. I tried MsgBox.close(), but it doesn't work. How do I close that MsgBox? Thanks in advance
true
26,627,776
1.2
0
0
5
Finally found an answer. Just used MsgBox.done(1) instead of close. Thanks
0
3,442
0
2
2014-10-29T10:20:00.000
python,pyqt,qmessagebox
PyQt close QMessageBox
0
1
1
26,627,916
1
0
0
I have a project that I'm compiling with py2exe. After compiling, everything seems to be working fine except for the sound, which for some reason isn't playing anything except a single pop sound in place of the actual sound. I know that relative paths are working, since all my other files (images, data-files, etc) are being loaded without any problems relative to the location of the application, and I'm not getting any error messages in the console (I compile with it showing, rather than with just the Pygame window alone). This is likely a path problem more than a Pygame problem, or possibly I'm missing a .dll but I don't know what the exact cause of this problem is.
true
26,665,058
1.2
0
0
1
Changing the sounds to .wav seemed to fix the problem. I tested many different other solutions, but this was the only one that seemed to actually work.
1
64
0
1
2014-10-30T23:16:00.000
python,python-2.7,pygame
Why do sounds work with Pygame before compiling with py2exe, but not after?
0
1
1
26,694,657
1
0
0
I am working on a program that gets the users index position when they are typing in a Text Widget in Tkinter and saves it into a variable. But when ever the index is 1.20 it ends up turning into 1.2 Is there a way to make sure the variable with the index 1.20 in it will stay 1.20? I have tried using float(). But that did not seem to work. Any ideas? And thank you in advance.
false
26,737,396
0.379949
0
0
2
The solution is simple: don't ever treat the index as a number, because it is not a number. It is a string that happens to look like a number. If you have code that is rounding the value (or truncating trailing zeros), somewhere you're treating it as a number.
0
91
0
0
2014-11-04T14:18:00.000
python,variables,indexing,tkinter,text-widget
How to prevent a number from being rounded down Python Tkinter
0
1
1
26,738,506
1
0
0
Context: In Python a main thread spawns a 2nd process (using multiprocessing module) and then launches a GUI (using PyQt4). At this point the main thread blocks until the GUI is closed. The 2nd process is always processing and ideally should emit signal(s) to specific slot(s) in the GUI in an asynchronous manner. Question: Which approach/tools are available in Python and PyQt4 to achieve that and how? Preferably in a soft-interrupt manner rather than polling. Abstractly speaking, the solution I can think of is a "tool/handler" instantiated in the main thread that grabs the available slots from the GUI instance and connects with the grabbed signals from the 2nd process, assuming I provide this tool some information of what to expect or hard coded. This could be instantiated to a 3rd process/thread.
false
26,746,379
0.039979
0
0
1
I had the same problem in C++. From a QApplication, I spawn a Service object. The object creates the Gui Widget but it's not its parent (the parent is QApplication then). To control the GuiWidget from the service widget, I just use signals and slots as usual and it works as expected. Note: The thread of GuiWidget and the one of the service are different. The service is a subclass of QObject. If you need multi process signal/slot mechanism, then try to use Apache Thrift or use a Qt-monitoring process which spawns 2 QProcess objects.
1
11,747
0
20
2014-11-04T22:37:00.000
python,pyqt,multiprocessing,signals,pyside
How to signal slots in a GUI from a different process?
0
1
5
30,091,826
1
0
0
I am using Tkinter and I am using the text widget with the wrap set to WORD. Which wraps the word when it hits the end if you are still typing it. But when it does do this the row index stays 1 until you hit the enter key. When it should be 2 because it is the second row. Does anyone know why it does this? Or How to fix it?
false
26,763,250
0
0
0
0
This is just how the tkinter text widget works. The index values are based on logical lines -- lines that end with a newline. Even though the line may wrap visually on the screen, the index won't switch from 1.x to 2.x until the first newline. Note that when computing an index relative to some other index, you have the option of counting lines by logical lines or display lines. For example, the relative index "1.0 + 2 display lines" may result in a different answer than "1.0 + 2 lines" depending on if the text is wrapped or not.
0
226
0
0
2014-11-05T17:20:00.000
python,indexing,tkinter,text-widget
Python Tkinter text widget index acting weird
0
1
1
26,766,737
1
0
0
I have a local directory full of geotiff files which make up a map of the UK. I'm using mapnik to render different images at various locations in the UK. I'm wondering what is the best way to approach this? I can create a single RasterSymbolizer then loop through the tiff directory and add each tiff as a seperate layer, then use mapniks zoom_to_box to render at the correct location. But would this cause the rendering time to be unnecessarily slow? I have no information on how the tiles fit together (other than the data in each individual tiff of course). I imagine there may be a way to setup some kind of vector file defining the tiff layout so I can quickly query that to find out which tile I need to render for a given bounding box?
false
26,801,277
0
0
0
0
You can either generate a big tiff file from the original tiffs with gdal_merge.py (you can find it in the python-gdal package on Debian or Ubuntu) or create a virtual file that mixes them all with gdal_merge-vrt. This second option saves space but probably is slower.
0
636
0
0
2014-11-07T12:29:00.000
python,mapnik,geotiff
mapnik and local tiff tiles
0
1
1
27,091,092
1
0
0
To achieve sense of nativeness in my Pyinstaller packaged Kivy Python application, I would like to create menu item in OSX menu bar. If using PyQt, I can easily achieve this. But as I am using Kivy, it seems like I have to resort to other ways. Any suggestion? I guess it will be in the range of PyObjc or AppleScript. Not sure though.
false
26,815,360
0.066568
0
0
1
If using PyQt, I can easily achieve this. But as I am using Kivy, it seems like I have to resort to other ways I don't see why you can't just use the PyQt method. Create a separate file that runs the icon that is called by your main Kivy app. Like PyQt I am sure that Kivy has an exit function that you could override and have it kill the icon thread on exiting the application. Only potential downside (that I can think of off the top of my head) is that it might run slower than implementing in PyObjC.
1
1,781
0
3
2014-11-08T08:45:00.000
python,macos,kivy,pyinstaller
How to create menu item in OSX Menubar using Pyinstaller packaged Kivy Python application?
0
1
3
28,491,679
1
0
0
guys, I am trying to find a python GUI library that can show and process 16bit greyscale image easily. I need to modify pixels. I have tried wxpython. It can show the images. But when I tried to convert a numpy array with single channel 16bit data to a string and loaded it in wxImage, it showed me that invalid buffer size. What's more, I have tried to decode the first element of data string in a wxImage instance that load the same image directly. Its value wasn't equal to the pixel (0,0) in numpy array. Could someone tell me how wxPython format its data string or introduce a better GUI library that can fix this? I know wxImage normally formats its pixel data with RGB. But I just need grey image. And I need to create a sophisticated UI. I think opencv can't meet my need.
true
26,831,593
1.2
0
0
0
You can use pyqt or pyside, but I would recommend pyqtgraph which is excellent for this sort of thing. You can build your ui in pyside and use pyqtgraph to manage image output
0
377
0
0
2014-11-09T18:20:00.000
python,numpy,wxpython
Python GUI library to show 16bit greyscale image
0
1
1
26,832,062
1
0
0
I am getting the following "error: only position independent executables (PIE) are supported." when trying to run scripts. Does QPython run on Android 5.0? Is it an issue with the 64bit version of Lollipop?
false
26,869,746
0
0
0
0
I think QPython doesn't support PIE yet.
0
493
0
1
2014-11-11T16:32:00.000
android-5.0-lollipop,qpython
QPython on Nexus 9: PIE error
0
1
1
26,902,933
1
0
0
When discovering Sublime 3 plugin API I found out the function show_quick_panel() that shows some panel implemented as view. Is there any method to construct a custom view by my own and then add it to the window?
true
26,891,117
1.2
0
0
1
No , one of the biggest limitation of Sublime Text right now is the ability to create a custom interface or packages/plugins - you have to use the quickPanel list or an input at the bottom of the screen.
0
61
0
1
2014-11-12T15:53:00.000
python,plugins,window,sublimetext
sublime add view to the window
0
1
1
26,892,999
1
0
0
Even after calling sdl2.mouse.SDL_ShowCursor(0), which effectively hides the cursor during runtime, when doing lengthy iterations (for my purposes, loading a large volume of images into RAM), the beachball cursor nonetheless appears. It is critical that this doesn't happen because what I'm writing is an experiment for coginitive psychology on visual attention—this kind of visual distraction absolutely cannot occur.
false
26,894,623
0
0
0
0
Solved this myself by calling sdl2.SDL_PumpEvents() once per loop.
0
90
0
0
2014-11-12T19:07:00.000
python,sdl,sdl-2,pysdl2
Pysdl2 on OSX How to prevent beachball cursor during long iteration loops
0
1
1
28,871,678
1
0
0
I am new to game development and am trying to develop a game with panda3d. Can we directly use Pygame modules along with Panda3d ones?
false
26,906,023
0
0
0
0
Yes. Both Panda3D and PyGame are Python modules that can be used in any (compatible) Python installation. There is (at least to my awareness) nothing about either library that prevents you from importing other Python modules. Depending on what you're trying to do, though, the answer may be more tricky. For instance, presumably both PyGame and Panda3D have their own main game loops, and using them together would require making one game loop run as a part of the other library's game loop. Sharing resources or graphics contexts would also be tricky, as both libraries manage their own graphics state. It would be a lot more tricky (but not necessarily impossible) if your question included, for example, drawing PyGame elements into a Panda3D window or vice versa.
0
1,355
0
0
2014-11-13T09:59:00.000
python,pygame,panda3d
How to use Panda3d and Pygame together
0
1
2
26,997,383
1
0
0
I have a kivy app that uses a kv file, main.py, and a py class that handles the database. Everything works fine in windows. When I run linux (ubuntu) I get a black window with the correct title, but there are no widgets in the window. What do I need to do different to run a kivy app, that was put together and runs windows, in Ubuntu? I am using the most current available version of kivy on both systems.
true
26,942,909
1.2
0
0
3
It sounds like your kv file isn't being loaded. Does it have the correct name, and is in the right directory? You can check the output in the terminal to see whether the file is loaded. Edit: One possibility is case sensitivity - windows is not case sensitive, linux generally is. Make sure the kv filename is all lowercase.
0
268
1
1
2014-11-15T05:33:00.000
python,ubuntu,kivy
Kivy app works on Windows 7 but not on ubuntu
0
1
1
26,946,523
1
0
0
I have some code that is running in the python console reading out text lines. Is it possible to feed the output of the python console to my Unity3D game script so that it can trigger some actions in my game? in other words: python console running in the background outputs commands that need to feed to my Unity game.
true
27,006,173
1.2
1
0
1
An efficient solution would be to use TCP sockets in both the Python script and the Unity-side script. Since the Python-side is serving the data, then designate it as the server socket and make the socket on the Unity-side the client. This solution will be much faster than writing and reading to a shared file.
1
1,040
0
0
2014-11-18T23:29:00.000
python,unity3d,unityscript
Feed Python output to Unity3D
0
1
2
27,021,007
1
1
0
I'm currently using Cheetah Templates with my python code and I'm passing in a number of floating point numbers. I'd like to truncate these floats to only two decimal places within the template, e.g. 0.2153406 would become 0.21 Is it possible to do this within the Cheetah template of do I have to pass in already truncated strings?
false
27,009,879
0.197375
0
0
3
I just discovered a solution via output from complex expressions using #echo: #echo '%.2f' % $my_float_var# This prints out my float in the variable $my_float_var with only two decimal places.
0
525
0
1
2014-11-19T05:49:00.000
python,templates,cheetah
How do I truncate floats to two decimal places in cheetah templates?
0
1
3
27,010,118
1
0
0
Have to make a program that given the option to input square or circle, user inputs width and a center x,y coordinate. What I don't understand is how to write code for if there are two shapes on a plane and how to identify if one is inside the other I'm super helpless, and have no background in computer science. Thank you!
false
27,033,206
0
0
0
0
You have to address Circle in Circle, Circle in Square, Square in Circle, and Square in Square. I suggest drawing some pictures with the centers marked, and observe their relationships. Circle in Circle: the distance between the centers has to be less than the difference in radius's. Circle in Square: Same as circle in circle I think Square in Circle: The radius of the circle must be larger than the distance from the center of the square to a corner PLUS the distance between centers Square in Square: you got this! solve yourself ;)
1
420
0
0
2014-11-20T06:31:00.000
python
Python Shapes on grid
0
1
1
27,036,097
1
0
0
I am trying to embed wxPython in a wxWidgets application and I get the following error: ../src/common/object.cpp(251): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxCommandEvent" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)? I've traced this up to: wxPyCoreAPIPtr = (wxPyCoreAPI*)PyCObject_Import("wx.core", "_wxPyCoreAPI"); So I'm guessing that this is failing because its trying to dlopen a .so that has already been loaded (the core wxwidgets library that is needed both by C and Python code). I can get the handle to the opened .so via dlopen's RTLD_NOLOAD flag. Is there any way to give that handle to Python and tell it to "load" that handle into the interpreter's context? Edit: just noticed, this problem is reproducible in the "embedded" sample in wxPython, using wxWidgets origin/WX_3_0_BRANCH, Python 2.7, wxPython origin/master. Also, it may be specific to gtk3 configurations... it seemed to be working when I compiled with gtk2.
false
27,112,799
0
0
0
0
The problem is that wxPython is compiled with gtk2 flag, wxWidgets gtk3. You can determine this in gdb by dumping one of the symbols near the assertion: info symbol __static_initialization_and_destruction_0 __static_initialization_and_destruction_0(int, int) in section .text of /usr/lib/libwx_gtk2u_core-3.0.so.0 To rebuild wxPython, you need to manually move the build directory somewhere else (or the reinstall will seem to work but in fact won't rebuild anything). then use: python setup.py build_ext WXPORT=gtk3 You should see that .so files are being build against gtk3: c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/gtk/wizard_wrap.o -L/usr/X11R6/lib -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 -o build/lib.linux-x86_64-2.7/wx/_wizard.so -pthread (note the wx_gtk3u_xxx files, vs: wx_gtk2u_xxx) then: python setup.py install WXPORT=gtk3 works!
0
280
0
0
2014-11-24T19:38:00.000
python,wxpython,wxwidgets,embedding,dlopen
Embedding Python -- loading already loaded module
0
1
1
27,114,219
1
0
0
I am trying to use the PyDEV console in eclipse for a demonstration of some Python code. For this demonstration I need to resize the default font size used in the PyDev console window. Some googling led me to change the 'General/Appearance/Colors and Fonts/Debug/Console Font', but that didn't work. I tried changing all candidates I could identify in the Colors and Font settings, but none of them influences the font size in the PyDev console window. Is there any way to achieve this? This is in eclipse 4.3.2 (kepler) with Pydev 3.8
false
27,122,732
0.099668
1
0
1
Solution: Help > Preferences > General > Appearance > Colors And Fonts > Structed Text Editors > Edit
0
2,839
1
1
2014-11-25T09:18:00.000
python,eclipse,fonts
How to change the console font size in Eclipse-PyDev
0
1
2
55,985,898
1
0
0
I have a random problem with Orange. I developed a widget and I have a button who opens a new window for some settings. The program works fine, but, at a some point, totally randomly, pythonw.exe stops working. It's only when I use the window for settings. The problem happens totally randomly, but more often when I open the window. I tried to make my window with OWW.OWBaseWidget, OWW.OWWidget and OWW.QDialog. I tried too with pythonw.exe and python.exe. I did the same thing that Set Colors of the widget Data Table in Data. But this one crashed too after a moment. So where is the problem? Orange? Python? Anything else? I have no error message. I have Windows 8.1, python 2.7 and Orange 2.7.8.
false
27,125,275
0
0
0
0
Is this helpful? I am on a french version of windows: Description Chemin d’accès de l’application défaillante : C:\Python27\pythonw.exe Signature du problème Nom d’événement du problème : APPCRASH Nom de l’application: pythonw.exe Version de l’application: 0.0.0.0 Horodatage de l’application: 4df4b9cc Nom du module par défaut: QtCore4.dll Version du module par défaut: 4.7.0.0 Horodateur du module par défaut: 4cbe7403 Code de l’exception: c0000005 Décalage de l’exception: 000c7f03 Version du système: 6.3.9600.2.0.0.768.101 Identificateur de paramètres régionaux: 4108 Information supplémentaire n° 1: 5861 Information supplémentaire n° 2: 5861822e1919d7c014bbb064c64908b2 Information supplémentaire n° 3: 84a0 Information supplémentaire n° 4: 84a09ea102a12ee665c500221db8c9d6 Informations complémentaires sur le problème ID de compartiment : 3a2b179ef07f0847bf9f72213260bff5 (-1296411611)
0
632
0
0
2014-11-25T11:20:00.000
python,orange
Orange Canvas: pythonw.exe has stopped working crashing
0
1
1
27,127,480
1
0
0
I want to change the interface of a written application. this application is written in python and GTK . I don't want to change the codes manually by myself but although I need an interface designer so I can import this application to it and the graphically apply my intended changes to it . I tried Glade and QTdesigner but they produce .ui file and I couldn't find a tool to convert back a .ui file to python code. plus that the don't open python files directly and didn't have import options. any solution will be appreciated. thanks
false
27,127,430
0
0
0
0
It really depends on the application. If the application uses *.glade or *.ui files you can - depending on how well it is designed re-arrange certain elements and swap out container types. If there are no such files, you are out of luck. Then the ui is "hard"-coded (as hard as python code can get..) and you have to modify the widget hirarchy by modifying python code yourself. There is no such editor being able to extract a layout/ui file from code itself. gtkinspector or formerly known as gtkparasite can modify properties of widgets on the fly but nothing that really modifies the python code of the running application. They sneak around the application code and modify the widget tree from back behind through means of the gtk module lib interface (correct me if I am wrong here, not totally sure).
0
285
0
0
2014-11-25T12:58:00.000
python,gtk
load an already written GTK python codes into a GUI designer
0
2
2
27,137,234
1
0
0
I want to change the interface of a written application. this application is written in python and GTK . I don't want to change the codes manually by myself but although I need an interface designer so I can import this application to it and the graphically apply my intended changes to it . I tried Glade and QTdesigner but they produce .ui file and I couldn't find a tool to convert back a .ui file to python code. plus that the don't open python files directly and didn't have import options. any solution will be appreciated. thanks
false
27,127,430
0
0
0
0
You can't. Glade had code generation features removed years ago, because that leads to unmaintainable code when it's patched by hand after generation, to add the program's internal logic. So either you: use Glade to generate a ui file, and have to change the python code anyway to use it or you'll have manually write some code to change the user interface In either way, you'll have some code to write. If you have lots of changes in the user interface, then convert your program to use Glade ui files. It will take some time, but changes will be easier afterwards. If you only have a couple of changes to do, just do them in the code, it will be faster to do.
0
285
0
0
2014-11-25T12:58:00.000
python,gtk
load an already written GTK python codes into a GUI designer
0
2
2
27,154,752
1
0
1
I would like to generate a uniformly random coordinate that is inside a convex bounding box defined by its (at least) 4 vertices (for the case of a tetrahedron). Can someone suggest an algorithm that I can use? Thanks! If a point is generated in a bounding box, how do you detect whether or not it is outside the geometry but inside the box?
true
27,192,467
1.2
0
0
3
There's a lot that's unspecified in your question, such as what distribution you want to use. For the sake of this answer, I'll assume a uniform distribution. The straightforward way to handle an arbitrary volume uniform distribution is to choose three uniformly random numbers as coordinates in the range of the bounding rectilinear solid enclosing your volume, then check to see if the chosen coordinate lies within the volume. If the coordinate is not within the volume, discard it and generate a new one. If this is not sufficient, due to its non-constant performance or whatever other reason, you'll need to constrain your problem (say, to only tetrahedra) and do a bunch of calculus to compute the necessary random distributions and model the dependencies between the axes. For example, you could start with the x axis and integrate the area of the intersecting shapes between the volume and the plane where x = t. This will give you a function p(x) which, when normalized, is the probability density function along the X axis. (If you want nonuniform distribution, you need to put that in the integrated function, too.) Then you need to do another set of integrals to determine p(y|x0), the probability distribution function on the Y axis given the chosen x coordinate. Finally, you'll need to determine p(z|x0,y0), the probability distribution function on the z axis. Once you have all this, you need to use whatever random number algorithm you have to choose random numbers in these distributions: first choose x0 from p(x), then use that to choose y0 from p(y|x0), then use those to choose z0 from p(z|x0,y0), and you'll have your result (x0, y0, z0). There are various algorithms to determine if a point is outside a volume, but a simple one could be: For each polygon face: Compute its characteristic planes. Use cross product to compute plane normals. One vertex of the face and the plane normal are sufficient to define the plane. Remember the right-hand rule and choose the points so that the plane normal consistently points into or out of the polyhedron. Check that the random point lies on the "inside" half-space of that plane. A half-space is the set of all points on one side of the plane. Compute the vector from the plane vertex to the random point. Compute the dot product between the plane normal and this vector. If you defined the plane normals to point out of the polyhedron, then all dot products must be negative. If you defined the plane normals to point into the polyhedron, then all dot products must be positive. Note that you only have to recompute characteristic planes when the volume moves, not for each random point. There are probably much better algorithms out there, and their discussion is outside the scope of this question and answer. This algorithm is what I could come up with with no research, and is probably as good as a bubble sort.
0
1,463
0
0
2014-11-28T16:11:00.000
python,random,spatial,coordinate
Generate a random point in space (x, y, z) with a boundary
0
1
1
27,192,613
1
0
0
With QPython on Kindle fire .. I use QEdit to write & save a .py file .. say bob.py .. But when I switch to Console, I can't IMPORT from bob .. Can someone tell me how to do this? John (new to QPython)
false
27,193,835
0
1
0
0
The comment from Yulia V got me thinking, maybe I just needed to append the location of "Scripts" to the sys.path, and Yep, that worked fine!! Thanks Yulia!
0
1,136
0
0
2014-11-28T17:56:00.000
qpython
How to import from saved QPython file?
0
2
2
27,197,253
1