[{"Question":"I have a problem shown below that wants to find the quickest way to get between any two points by using only the moves of a knight in chess. My first thought was to us the A* algorithm or Dijkstra's algorithm however, I don't know how to make sure only the moves of a knight are used. I would appreciate it if you could suggest a better algorithm or just some tips to help me. Thank you.\n\nWrite a function called answer(src, dest) which takes in two parameters: the source square, on which you start, and the destination square, which is where you need to land to solve the puzzle. The function should return an integer representing the smallest number of moves it will take for you to travel from the source square to the destination square using a chess knight's moves (that is, two squares in any direction immediately followed by one square perpendicular to that direction, or vice versa, in an \"L\" shape). Both the source and destination squares will be an integer between 0 and 63, inclusive, and are numbered like the example chessboard below:\n\n\n-------------------------\n| 0| 1| 2| 3| 4| 5| 6| 7|\n-------------------------\n| 8| 9|10|11|12|13|14|15|\n-------------------------\n|16|17|18|19|20|21|22|23|\n-------------------------\n|24|25|26|27|28|29|30|31|\n-------------------------\n|32|33|34|35|36|37|38|39|\n-------------------------\n|40|41|42|43|44|45|46|47|\n-------------------------\n|48|49|50|51|52|53|54|55|\n-------------------------\n|56|57|58|59|60|61|62|63|\n-------------------------","AnswerCount":4,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":1507,"Q_Id":40454897,"Users Score":2,"Answer":"Approach the problem in the following way:\nStep 1: Construct a graph where each square of the chess board is a vertex.\nStep 2: Place an edge between vertices exactly when there is a single knight-move from one square to another.\nStep 3: Apply Dijkstra's algorithm. Dijkstra's algorithm is an algorithm to find the length of a path between two vertices (squares).","Q_Score":1,"Tags":"python,algorithm,path-finding","A_Id":40458703,"CreationDate":"2016-11-06T21:47:00.000","Title":"Simple algorithm to move from one tile to another using only a chess knight's moves","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem shown below that wants to find the quickest way to get between any two points by using only the moves of a knight in chess. My first thought was to us the A* algorithm or Dijkstra's algorithm however, I don't know how to make sure only the moves of a knight are used. I would appreciate it if you could suggest a better algorithm or just some tips to help me. Thank you.\n\nWrite a function called answer(src, dest) which takes in two parameters: the source square, on which you start, and the destination square, which is where you need to land to solve the puzzle. The function should return an integer representing the smallest number of moves it will take for you to travel from the source square to the destination square using a chess knight's moves (that is, two squares in any direction immediately followed by one square perpendicular to that direction, or vice versa, in an \"L\" shape). Both the source and destination squares will be an integer between 0 and 63, inclusive, and are numbered like the example chessboard below:\n\n\n-------------------------\n| 0| 1| 2| 3| 4| 5| 6| 7|\n-------------------------\n| 8| 9|10|11|12|13|14|15|\n-------------------------\n|16|17|18|19|20|21|22|23|\n-------------------------\n|24|25|26|27|28|29|30|31|\n-------------------------\n|32|33|34|35|36|37|38|39|\n-------------------------\n|40|41|42|43|44|45|46|47|\n-------------------------\n|48|49|50|51|52|53|54|55|\n-------------------------\n|56|57|58|59|60|61|62|63|\n-------------------------","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":1507,"Q_Id":40454897,"Users Score":1,"Answer":"While User_Targaryen's answer is the best because it directly answers your question, I would recommend an algebraic solution, if your goal is computing is the delivery of an answer in the shortest amount of time.\nTo shorten the algorithm, use reflections about the x, y, and xy axes, so as to consider only positive (x, y) where x >= y, and place the starting move at the origin, coordinate (0, 0). This is one octant (one eighth) of the possible directions.\nA hint to discovering the solution is to use graph-paper or Dijkstra's algorithm with the restriction of reaching all points in the first octant up to 5 moves, and display this as a grid. Each cell of the grid should be labeled with a digit representing the minimum number of moves.\nLet me know if you would like to broaden your question and would like additional information.","Q_Score":1,"Tags":"python,algorithm,path-finding","A_Id":41089879,"CreationDate":"2016-11-06T21:47:00.000","Title":"Simple algorithm to move from one tile to another using only a chess knight's moves","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to build my kivy application against python3.\nFirst I downloaded the crystax ndk, and set the ANDROIDNDK to it's location. I added python3crystax to my requirements in the buildozer.spec and launched the build with:\n\nbuildozer android debug deploy run logcat\n\nThis command results in the following error:\n\nCommand failed: pip install --target=\/home\/cedric\/Documents\/Development\/python\/kivyapp\/.buildozer\/applibs python3crystax\n\nIf I try to install python3crystax manually with pip it seems, that this package dosen't even exists?\ntrying it with\n\nbuildozer android debug deploy run logcat\n\ncauses the following error:\n\nERROR: The colorama Python module could not be found, please install\n version 0.3.3 or higher\nERROR: The appdirs Python module could not be found, please install\n it.\nERROR: The sh Python module could not be found, please install version\n 1.10 or higher\nERROR: The jinja2 Python module could not be found, please install it.\n\nAll modules are installed with their current version.\nCan anybody help me to solve this problem?\nThanks Cedric","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":929,"Q_Id":40470825,"Users Score":3,"Answer":"Use buildozer android_new debug instead, you are using android which builds with the old toolchain and does not support python3.","Q_Score":2,"Tags":"android,python,kivy,buildozer","A_Id":40470942,"CreationDate":"2016-11-07T17:16:00.000","Title":"kivy buildozer cant compile application targeting python3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The sample app given by google for tensorflow on android is written in C++.\nI have a tensorflow application written in python. This application currently runs on desktop. I want to move the application to android platform. Can I use bazel to build the application that is written in python directly for android? Thanks.\nAlso sample tensorflow app in python on android will be much appreciated.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":534,"Q_Id":40472585,"Users Score":0,"Answer":"I tried to use python in my android application with some 3rd party terminals like SL4A and Qpython. Those will support to run the python files directly in our android application so we have to install SL4A apk's and we need to call that intent.But these will support for some level I guess.\nI tried to import tensorflow in that terminal it shows module not found. So I thought this tensorflow will not work in these terminals.\nSo I am trying to create one .pb file from the python files which are working in unix platform.So We need to include that output .pb file in our android application and we need to change the c++ code regarding that .pb file.I am thinking in this way.let see it will work or not.I will update soon if it working.","Q_Score":1,"Tags":"android,python,tensorflow","A_Id":40672019,"CreationDate":"2016-11-07T19:01:00.000","Title":"Tensorflow on android: directly build app in python?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In the python plugin, I'm developing, I need to retrieve the number of selected rows in a QTableWidget. I can loop through each row of the QTableWidget and check them whether it is selected or not. Instead, Is there a straightforward way to get the selected rows count of a QTableWidget in PyQt? \nSomething like:\n\nQTableWidget.selectedRowsCount()","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":10499,"Q_Id":40481810,"Users Score":1,"Answer":"len(tablewidget.selectedIndexes()) should probably do what you want.","Q_Score":2,"Tags":"python,pyqt,qtablewidget","A_Id":40492017,"CreationDate":"2016-11-08T08:03:00.000","Title":"Getting Selected Rows Count in QTableWidget - PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm about to start programming a game for my computing A level. The game will be a version of scrabble but won't have a board. It will be how many words can you make in an amount of time. The game will also have menus, buttons and logins for different users to access the game. I'm wanting to know if it would be better to use Tkinter or Pygame for this or if I can use aspects of both: eg Tkinter for menus and Pygame for the main loop. Any help would be much appreciated I'm quite new to both these ideas so please explain any specialist terminology. Thanks a lot","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3886,"Q_Id":40527057,"Users Score":0,"Answer":"Pygame is the best choice for games, tkinter is more friendly for make utilities softwares. Tkinter have limitations, you will be freeze in some steps and have double of time to figure out. You can also use Pyglet, is easiest than, but Pygame still the best choice, fast, lot of functionality, you can do all things you want.","Q_Score":0,"Tags":"python,tkinter,pygame","A_Id":40528039,"CreationDate":"2016-11-10T11:58:00.000","Title":"Tkinter or Pygame which should I use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm about to start programming a game for my computing A level. The game will be a version of scrabble but won't have a board. It will be how many words can you make in an amount of time. The game will also have menus, buttons and logins for different users to access the game. I'm wanting to know if it would be better to use Tkinter or Pygame for this or if I can use aspects of both: eg Tkinter for menus and Pygame for the main loop. Any help would be much appreciated I'm quite new to both these ideas so please explain any specialist terminology. Thanks a lot","AnswerCount":3,"Available Count":3,"Score":0.1325487884,"is_accepted":false,"ViewCount":3886,"Q_Id":40527057,"Users Score":2,"Answer":"SO, expanding the issue:\nI love Pygame, in that it offers a simple API for one to draw things on a screen-canvas, and a nice O.O. hierarchy and tooling for sprites and game objects on screen.\nOn the other hand, it did not evolve to have a nice installer for Python3 - in some platforms it is near impossible to get it working in Python3 (despite the Pygame code itself being Python3 ready). \nIt also does not offer any support for menus, or buttons, or even text-entry - you have to either use a third party module for that, or create allby hand yourself. Yu have to implement things like reading the keyboard code, drawing the corresponding glyph on the correct location on the canvas - and the keyboard reading is raw, and won't give you things like character composition provided by the O.S. - which might be important in a word related application.\nIn short: you need a fully featured app, and should be using tkinter for that. As for the mainloop: you have to use Tkinter's loop and implement \nafter event calls to get the control to parts of your code that have to initiate actions.\nPygame gives you full control of the mainloop - and I like that for learning purposes - but most gaming or GUI toolkits have their all mainloop, and you have to register your callbacks. \nIt is even possible to have an application that have the \"control screens\" - menus, buttons, logins, and so on, written in Tkinter and the main game screen, where the action takes place, made in Pygame. That won't solve Pygame's hard-to-install problems, and may look awkward for the players themselves.\nFor multimedia-stuff I am moving my projects to Pyglet, since it is a well behaved Python module,and have some capabilities pygame lacks. But Tkinter can do pretty nice things in its Canvas widget, and sure enough could hld your game.\n(You should have noted I emphasized Python3 a lot - so, while you did not ask, you should definitely use Python 3.5 (or 3.6) for your project - even if you choose Pygame - the abyss between Python versions is widening and Python 2 has a date to be discontinued)\nupdate: I just tried \"pip install pygame\" on a Python 3.5 virtualenv, and it did install flawlessly - so the project is alive and kicking, and installing may not be hard anymore.\nThat said, you'd still have to create all the code for menus and buttons.","Q_Score":0,"Tags":"python,tkinter,pygame","A_Id":40528139,"CreationDate":"2016-11-10T11:58:00.000","Title":"Tkinter or Pygame which should I use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm about to start programming a game for my computing A level. The game will be a version of scrabble but won't have a board. It will be how many words can you make in an amount of time. The game will also have menus, buttons and logins for different users to access the game. I'm wanting to know if it would be better to use Tkinter or Pygame for this or if I can use aspects of both: eg Tkinter for menus and Pygame for the main loop. Any help would be much appreciated I'm quite new to both these ideas so please explain any specialist terminology. Thanks a lot","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3886,"Q_Id":40527057,"Users Score":0,"Answer":"Have you ever used any of them ? If the answer to that is yes, then you should pick the more familiar one. The pick does not really matter if it is going to be a simple scrabble game with not a lot of animations. Personally, I think that Tkinter is easier.","Q_Score":0,"Tags":"python,tkinter,pygame","A_Id":40527429,"CreationDate":"2016-11-10T11:58:00.000","Title":"Tkinter or Pygame which should I use","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On Windows with wxPython 3.0.2 SetLayoutDirection works as expected in htmlWindow. SetLayoutDirection(2) will allow me to display RTL texts. However, with the same version on Mac it does not work. It is always the default LTR text flow. Plus GetLayoutDirection always returns 0 even after SetLayoutDirection(2) is supposedly set.\nWas this feature missed on the Mac build? Is there a fix or workaround?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":54,"Q_Id":40567190,"Users Score":0,"Answer":"I'm afraid RTL support simply is not implemented under Mac. I'll update the documentation to at least mention this for now, but this is all I can do.","Q_Score":0,"Tags":"wxpython,wxwidgets","A_Id":40645047,"CreationDate":"2016-11-12T20:14:00.000","Title":"wxPython SetLayoutDirection Doesn't Work On Mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to make the frame of my window look like the old windows 95 style.\nRight now when i create a window tkinter automatically adopts the style of my os (windows 10).\nIs there a way to change this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2232,"Q_Id":40578278,"Users Score":0,"Answer":"No, there is nothing specifically available to make the window border look different. Your only choice is to remove the border completely (eg: root.overrideredirect(True)) and draw the border yourself using a canvas and\/or images.","Q_Score":0,"Tags":"python,tkinter","A_Id":40579156,"CreationDate":"2016-11-13T20:08:00.000","Title":"Change tkinter window border style","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i want to change the shape of wx.TextCtrl widget used in wxpython. normal by default shape is a square box but i want to make all the corner having round curve.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":246,"Q_Id":40612573,"Users Score":3,"Answer":"This is not supported by the wx.TextCtrl out of the box. What you need to understand is that most of the core widgets are actually using the operating system's widgets and not drawing them itself. So if the native widget doesn't support this sort of thing, then wxPython's core widgets won't either.\nYou would need to create a custom widget that you draw yourself to get this functionality. Check out the wxPython demo for examples of custom widgets. All of the widgets in AGW are custom, for example.","Q_Score":1,"Tags":"python,wxpython,wx.textctrl","A_Id":40635172,"CreationDate":"2016-11-15T14:38:00.000","Title":"How to change shape of wx.TextCtrl widget in wxpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using Python 2.7, Ubuntu 16.04, Gtk3 (gi.repository). I have an Entry with an associated EntryCompletion and a ListStore. I would like to let the user autoselect the first result when pressing the Enter\/Intro\/Return key, without having to use the arrow keys to select an item, and then press Enter. How could this be done?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":163,"Q_Id":40617544,"Users Score":1,"Answer":"Have you tried EntryCompletion.set_inline_completion(True) ?\nThis may not be exactly what you were looking for as it will not select the complete first match. However, if you type far enough (to only have one choice), you can press Enter to autocomplete the rest.\nTell me your thoughts on this and\/or more details on what you are trying to do. Maybe there is another way to achieve the same functionality.","Q_Score":0,"Tags":"python,gtk3","A_Id":40634755,"CreationDate":"2016-11-15T18:53:00.000","Title":"Python GTK EntryCompletion select first result when Intro","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to transform my python code into an Android app. The problem I saw is I'm using openCV in the code, and I didn't found anything related to generate an APK while using openCV.\nThere is a way to generate an APK from python and openCV?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":292,"Q_Id":40664845,"Users Score":1,"Answer":"There is SL4A \/ PythonForAndroid but unfortunately it uses hardcoded Java RMI invocations for anything os related. That means that there are no OpenCV bindings. \nI guess you'll have to learn Java","Q_Score":1,"Tags":"android,python,opencv,apk","A_Id":40665287,"CreationDate":"2016-11-17T20:55:00.000","Title":"Python and openCV to android APK","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a Rubiks cube in Python and am running into the problem of checking whether 2 cubes are the same. I'm representing the sides of the cube as north, east, south, west, front, and back. I originally just had my function check if cube1.north = cube2.north, cube1.south = cube2.south, etc and if all where true then they are the same. This leaves out the cubes where cube1.north = cube2.south, cube1.south = cube2.north, etc. and many other scenarios where they are equal but the specific faces don't match up exactly. Does anyone have an idea on how to check if any 2 cubes are equal without tons of if statements for every possibility?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":151,"Q_Id":40667077,"Users Score":1,"Answer":"Why don't you try indexing the cube's faces according to which color they have at the center? Then you can just check whether the white-centered face on one cube matches the white-centered face on the other cube.\nIn other words, the north face will always have a white square at the center, the south face will always have a yellow square at the center, etc. Only operations that keep the orientation of the centers are allowed.","Q_Score":0,"Tags":"python,rubiks-cube","A_Id":40667361,"CreationDate":"2016-11-17T23:45:00.000","Title":"Python Rubiks Cube How to tell if 2 states are equal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"By default, Tkinter widgets will resize based on their children's sizes (i.e., Tkinter will not respect my width and height configurations). I know that using parent.pack_propagate(False) will prevent parent's children from modifying its dimensions, but what if I only want to prevent the children from changing one dimension, allowing it to modify another dimension? For example, how would I prevent a widget's children from modifying its width but allow it to change its height?\nOne hack-ish solution I came up with was to have a 1px tall frame with my requested width and add that to the parent, which prevented the other children from shrinking the width of the parent, but this seems like an inelegant solution. Is there any built-in solution to this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":828,"Q_Id":40700472,"Users Score":1,"Answer":"No, there is no way to constrain the geometry propagation in only one direction. \nIn my experience there are almost always better ways to solve layout problems than turning propagation off. There is no single best solution, it all depends on your specific layout needs.","Q_Score":0,"Tags":"python,tkinter,resize","A_Id":40700579,"CreationDate":"2016-11-20T03:44:00.000","Title":"Tkinter - Prevent children from changing parent width","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written game with base on c++ and which uses python scripts to calculate object properties and draw them. But main problem is that it won't run on pc's without python2.7 installed on them. I'm out of ideas. How i should do that, to make it run on pc's without python on them?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":158,"Q_Id":40703741,"Users Score":3,"Answer":"Make a game installer which will install all required dependencies.","Q_Score":0,"Tags":"python,c++,python-2.7","A_Id":40703761,"CreationDate":"2016-11-20T11:56:00.000","Title":"Running program on computers without python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use python's epoll but it can't use event.data.ptr like in c++.\nSometimes I will register class A.fd and sometimes I will register class B.fd.\nSo, when epoll.poll() returned, how can I know whether fd belongs to class A or B?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":171,"Q_Id":40703762,"Users Score":0,"Answer":"You can always maintain a separate map from fd to A or B. Then when an event gets triggered, lookup based on fd.\nDoesn't look like epoll has a richer interface, even in Python 3+","Q_Score":0,"Tags":"python,c++,epoll","A_Id":40704285,"CreationDate":"2016-11-20T11:58:00.000","Title":"python,epoll.register(fd, eventmask) only has two parameters, how could I to use event.data_ptr like c++?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to build an app for making UML diagrams. For visibility problems, I wish I could move classes using the mouse.\nSo here is my problem :\nDo you know how can I drag and drop a widget in a canvas using wxPython ?\nFound some things about ogl, but sound strange to me ... \nThx guys","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":84,"Q_Id":40762810,"Users Score":0,"Answer":"Take a look at the FloatCanvas sample in the wxPython demo. There is also a sample for the OGL package there. Either, or both of those would likely be suitable for diagrams depending on your needs.","Q_Score":0,"Tags":"wxpython","A_Id":40940273,"CreationDate":"2016-11-23T11:08:00.000","Title":"wxpython self made widget and drag and drop it in a canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to hold the keyboard keys on windows using python. I could simulate but could not hold the keys. I tried ctypes, AHK, Sendkeys but none of them worked. Is there any way to press and hold the keyboard keys until a release call. Any hint is appreciated.\nthanks in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":119,"Q_Id":40797767,"Users Score":0,"Answer":"From the AHK documentation: Send, {Rwin down}\nHolds the right Windows key down until {RWin Up} is sent. Down\/up can be combined with any key.","Q_Score":0,"Tags":"python,autohotkey,ctypes","A_Id":40817329,"CreationDate":"2016-11-25T04:31:00.000","Title":"Simulate Keyboard Keys on Windows not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When running my kivy app on Android Kivy Launcher it crashes instantly. I've looked everywhere for the logs, but couldn't find them. No .kivy folder is created, apps that view android logcat require root access and I couldn't get working adb logcat. Can someone explain to me how to use adb logcat to catch the error, or state another solution to my problem?\nPS: The app uses kivy 1.9.1 and py 3.4.4, runs fine on windows and my cellphone is a Xperia Z5 running Android Marshmallow 6.0.1","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1259,"Q_Id":40830517,"Users Score":2,"Answer":"Finally figured out how to use adb logcat. Install android studio 2.2. Connect your device to the PC via USB and enable debugging mode in the developer options. cd in command prompt to C:\\Users[user]\\AppData\\Local\\Android\\sdk\\platform-tools, and run adb devices. If the serial number of your android device appears, you're good to go. Then run adb logcat while executing the kivy app in your phone, and you'll get the realtime logs.","Q_Score":1,"Tags":"android,python,kivy,crash-reports","A_Id":40833444,"CreationDate":"2016-11-27T15:21:00.000","Title":"Cant find kivy logs when running with Kivy Launcher","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on my OpenCV project with Python which basically recognizes hand gestures. I want to do the same using Android. Is it possible? Is there any way to do so?\nI want to recognize very basic hand gestures using my Android device. Is it possible with Python & OpenCV with Android? Also share any other way possible.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":220,"Q_Id":40925079,"Users Score":1,"Answer":"This process can be done via NDK & OpenCV with Java support in Android Studio.\nYou need to compile NDK libraries and generate .so files. Then the project will work.","Q_Score":1,"Tags":"android,python,opencv,image-processing","A_Id":42197304,"CreationDate":"2016-12-02T04:57:00.000","Title":"How can I integrate my Python based OpenCV project in Android?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a code in Python that has various options such as Add, Remove, Search etc...\nCan i make a GUI using Tkinter that basically when it runs, it shows buttons with all the options, then when you click for example \"Add\" it appears a input box for the user to Add a new value, then goes back to the initial page etc... I do this very easily in Java using JOptionPane(not with buttons tho).. I tried searching for Menus in Tkinter but is not the ones i want (its the ones that appear on the top left of the page)...\nAppreciate all the help","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":883,"Q_Id":40942308,"Users Score":0,"Answer":"@Manny102030\nI got this code. basically what i want is to insert a Node in a Tree with the value that the user inputs in the Tkinter. I dont know if the value the user is inputting is actually being inserted because i cant figure how to call the function that i created to print the Tree (the function is also in the class BST). \nWhat i did was call the BST in the mainWindow class, then in the BST i call the window for the user to input, and when he clicks \"Ok\" it calls the function insert. Then in the insert i pass the value from the user to create the node to put in the tree... Any improvements\/any ideas on how to call the function to print the tree?\n\nclass mainWindow(object):\n def __init__(self,master):\n self.master = master\n self.b=Button(master,text=\"Add value\",command=self.popupAdd)\n self.b.pack()\n def popupAdd(self):\n self.w=BST(self.master)\n self.master.wait_window(self.w.top)\nclass BST(object):\n def __init__(self,master):\n self._root = None\n top=self.top=Toplevel(master)\n self.l=Label(top,text=\"Add a new value\")\n self.l.pack()\n self.e=Entry(top)\n self.e.pack()\n self.b=Button(top,text='Ok',command=self.insert)\n self.b.pack()\n def insert(self):\n novo = No(self.e.get()) #insert value in Node\n if self._root == None:\n self._root = novo\n else:\n pai = self._root\n temp = self._root\n while temp != None:\n if valor > temp.getValor():\n pai = temp\n temp = temp.getRight()\n elif (valor < temp.getValor()):\n pai = temp\n temp = temp.getLeft()\n else:\n temp = None\n print(\"Value Already exists\")\n if valor > pai.getValor():\n pai.setRight(novo)\n elif valor < pai.getValor():\n pai.setLeft(novo)\n self.top.destroy()\n def printTree(self, root):\n if root != None:\n self.printTree(root.getLeft())\n print(\" \" + str(root.getValor()), end=\"\")\n self.printTree(root.getRight())","Q_Score":0,"Tags":"python,python-3.x,user-interface,tkinter","A_Id":40949445,"CreationDate":"2016-12-02T23:18:00.000","Title":"Python TKinter Menu with Options","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to write a semi transparent click trough program to use like onion skin over my 3d application.\nthe one thing I couldn't find googling is how to make the window click trough. is there an attribute or something for it in tkinter? or maybe some way around it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":50,"Q_Id":40957941,"Users Score":0,"Answer":"You can use PyAutoGUI and Tkinter to:\n\nGet current mouse position relative to desktop coordinates.\nMinimize tkinter window or drag it out of the screen.\nSimulate click event when the window will be hidden.\nReturn back tkinter window.\n\nIt should work but I'm not sure how fast would it be.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":54459365,"CreationDate":"2016-12-04T11:06:00.000","Title":"python 3.4 tkinter, click trough window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering about this, so I did quite a bit of google searches, and came up with the SetWrapMode(self, mode) function. However, it was never really detailed, and there was nothing that really said how to use it. I ended up figuring it out, so I thought I'd post a thread here and answer my own question for anyone else who is wondering how to make an stc.StyledTextCtrl() have word wrap.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":265,"Q_Id":40980163,"Users Score":0,"Answer":"It would be more maintainable to use the constants stc.WRAP_NONE, stc.WRAP_WORD, stc.WRAP_CHAR and stc.WRAP_WHITESPACE instead of their numerical values.","Q_Score":1,"Tags":"python-2.7,wxpython,word-wrap","A_Id":64083696,"CreationDate":"2016-12-05T17:42:00.000","Title":"How to set up word wrap for an stc.StyledTextCtrl() in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering about this, so I did quite a bit of google searches, and came up with the SetWrapMode(self, mode) function. However, it was never really detailed, and there was nothing that really said how to use it. I ended up figuring it out, so I thought I'd post a thread here and answer my own question for anyone else who is wondering how to make an stc.StyledTextCtrl() have word wrap.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":265,"Q_Id":40980163,"Users Score":0,"Answer":"I see you answered your own question, and you are right in every way except for one small detail. There are actually several different wrap modes. The types and values corresponding to them are as follows:\n\n0: None\n1: Word Wrap\n2: Character Wrap\n3: White Space Wrap\n\nSo you cannot enter any value above 0 to get word wrap. In fact if you enter a value outside of the 0-3 you should just end up getting no wrap as the value shouldn't be recognized by Scintilla, which is what the stc library is.","Q_Score":1,"Tags":"python-2.7,wxpython,word-wrap","A_Id":40986021,"CreationDate":"2016-12-05T17:42:00.000","Title":"How to set up word wrap for an stc.StyledTextCtrl() in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to test the appearance of a window on a smaller monitor than the one I'm using on the development machine. \nI tried with set_geometry_hints() (setting minimum and maximum width and height), set_resizable(False), set_default_size(), and set_size_request(). However every time the window is bigger, because child widgets request a bigger size.\nI noticed on a smaller monitor with a resolution smaller than the request size, the widgets are truncated. I have to be sure this doesn't happen refactoring the GUI layout, so I want to simulate on my monitor.\nHow can I make the window smaller without truncating widgets?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1748,"Q_Id":40991949,"Users Score":2,"Answer":"Setting the window size request should be sufficient. If your UI makes the window larger that is the same as your widgets becoming truncated on a smaller monitor.\nTo prevent this you'll need to put widgets that grows your UI inside scrollable windows. Watch out for labels. You will need to get them to wrap properly.","Q_Score":2,"Tags":"python,gtk,gtk3,pygobject","A_Id":41002629,"CreationDate":"2016-12-06T09:31:00.000","Title":"Gtk3: set a fixed window size (smaller than the requested size from the child widgets)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want one or several gtk.Entry reply to a button created by me (gtk.Button) instead of a enter key.\nI\u00b4m using Python 2.7\nIs it possible?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":388,"Q_Id":41055536,"Users Score":0,"Answer":"I create a new Entry class adding this line: self.connect('focus-out-event', self.onEntryActivate )","Q_Score":0,"Tags":"python-2.7,gtk,gtkentry","A_Id":41364413,"CreationDate":"2016-12-09T07:51:00.000","Title":"How to simulate Enter key at gtk.entry to save info","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was told the setToolTip() doesn't work on all platforms, therefore, I'm trying to use setStatusTip() to display a status message instead. But unfortunately, with the TreeWidgetItem the status bar is not getting updated. Nothing happens when I hover over the item.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":334,"Q_Id":41102210,"Users Score":2,"Answer":"The mouse tracking needs to be True on the QTreeWidget class to enable the status tips.\nFor this you need to call setMouseTracking(True) on your QTreeWidget class.","Q_Score":1,"Tags":"python,user-interface,pyqt,pyqt4","A_Id":41130814,"CreationDate":"2016-12-12T13:40:00.000","Title":"Status message not appearing when using setStatusTip() function with a TreeWidgetItem","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently developing a cross platform GUI application with Python, and tkinter. \nAlthough I'm German, I want all button labels to be displayed in English. By now it is a strange mix because the messages in tkMessageBoxes are in English but button labels and file dialog boxes are in German. \nIs there a way to force Python \/ tkinter to use English labels only?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":988,"Q_Id":41103817,"Users Score":1,"Answer":"On both Linux and Windows, Tcl will use the value of the LANG environment variable if set to initialize the locale. So if you set LANG=en you will get an English locale. If this is not set, then on Windows it then examines the registry to identify the locale in use and configures from that. You can find the Tcl code doing this in the msgcat.tcl file (search for registry).\nIt will use LC_ALL, LC_MESSAGES or LANG in that order from the environment.","Q_Score":0,"Tags":"python,tkinter","A_Id":41110070,"CreationDate":"2016-12-12T15:09:00.000","Title":"Forcing tkinter to 'speak' English","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im trying to figure out how to change a string into a name of a Button.\nFor example if I had the string self._name = 'self._prentice', I would like to make self._prentice = tk.Button(master). I need to do it this way as the string could be any name and I need to create a way of storing this so I can later pack or destroy it. \nI've tried using exec, however I could only get it to work for integers and not buttons.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":44,"Q_Id":41104303,"Users Score":1,"Answer":"Use setattr:\nsetattr(self, '_prentice', tk.Button(master)).","Q_Score":0,"Tags":"python,string,tkinter","A_Id":41104418,"CreationDate":"2016-12-12T15:36:00.000","Title":"Changing a string into the name of a button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a VS12 project and exposed some of the classes to Python using boost-python. After some linkage issues my project finally builds correctly and generates a MySDK.lib and MySDK.dll. I called the Boost Python module the same as the library i.e. BOOST_PYTHON_MODULE(MySDK). Are these .lib and .dll all I need to use MySDK from Python?\nI'm using Pycharm Community but can't find a way to import the generated MySDK.lib and MySDK.dll as a Python library module.\nSaddly there isn't much information of what to do after the Boost Python coding exercise.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":610,"Q_Id":41105062,"Users Score":1,"Answer":"I changed my VS12 project output file extension to .pyd (Right Click on Project -> Properties -> Linker -> General -> Output File -> changed to $(OutDir)$(TargetName).pyd) and now I can load the library in Python from the command line but still can't from Pycharm.\nAfter that, made the directory where the .pyd (along with .lib and .dll) is located under the Path variable. Then Pycharm is able to successfully load and run my custom boost-python library.\nUPDATE The pyd that Python understands and can load is simply the dll renamed to pyd. Therefore, an even cleaner way is to leave the VS12 project as is generating the original $(OutDir)$(TargetName)$(TargetExt) i.e. dll output and simply add a Post-Build Event that copies the dll into a pyd:\n(Right Click on Project -> Properties -> Configuration Properties -> Build Events -> Post-Build Event -> Command Line) and add copy $(OutDir)$(TargetName)$(TargetExt) $(OutDir)$(TargetName).pyd","Q_Score":0,"Tags":"python,c++,visual-studio-2012,pycharm,boost-python","A_Id":41107779,"CreationDate":"2016-12-12T16:18:00.000","Title":"Boost-Python C++ project builds, How to use the new library from Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make my program executable.\nI used TkInter to write the GUI, and I read somewhere that you have to save your file as .pyw to hide the console when the program is executed.\nThe problem is that after making it an executable with PyInstaller, the console shows up again, even though the file converted was .pyw.\nHow can I hide the console also in the .exe file?","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":37029,"Q_Id":41129537,"Users Score":1,"Answer":"From The PyInstaller Documentation:\n\nUsing a Console Window\nBy default the bootloader creates a command-line console (a terminal\nwindow in GNU\/Linux and Mac OS, a command window in Windows). It gives\nthis window to the Python interpreter for its standard input and\noutput. Your script\u2019s use of print and input() are directed here.\nError messages from Python and default logging output also appear in\nthe console window.\nAn option for Windows and Mac OS is to tell PyInstaller to not provide\na console window. The bootloader starts Python with no target for\nstandard output or input. Do this when your script has a graphical\ninterface for user input and can properly report its own diagnostics.\nAs noted in the CPython tutorial Appendix, for Windows a file\nextention of .pyw suppresses the console window that normally appears.\nLikewise, a console window will not be provided when using a\nmyscript.pyw script with PyInstaller.","Q_Score":16,"Tags":"python,tkinter,exe","A_Id":68670515,"CreationDate":"2016-12-13T19:58:00.000","Title":"Hide the console of an .exe file created with PyInstaller","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make my program executable.\nI used TkInter to write the GUI, and I read somewhere that you have to save your file as .pyw to hide the console when the program is executed.\nThe problem is that after making it an executable with PyInstaller, the console shows up again, even though the file converted was .pyw.\nHow can I hide the console also in the .exe file?","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":37029,"Q_Id":41129537,"Users Score":50,"Answer":"Did you try --windowed command line flag ?","Q_Score":16,"Tags":"python,tkinter,exe","A_Id":41129758,"CreationDate":"2016-12-13T19:58:00.000","Title":"Hide the console of an .exe file created with PyInstaller","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running Android Studio 2.2.3\nI need to run Python scripts during my development to process some data files. The final apk does not need to run Python in the device.\nAt the moment I run the scripts from a terminal or from PyDev for Eclipse, but I was looking for a way of doing it from Android Studio.\nThere seems to be a way to do this, as when I right-click on a .py file and select the 'Run' option, an 'Edit configuration' dialog opens where I can configure several options. The problem is that I cannot specify the Python interpreter, having to select it from a combo box of already configured Python SDKs. While there is no interpreter selected, there is an error message stating \"Error: Please select a module with a valid Python SDK\". \nI managed to create Java modules for my project, but not Python ones (I do have the Python Community Edition plugin installed).Does anybody know how to achieve this?.\nTIA.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":25025,"Q_Id":41166406,"Users Score":6,"Answer":"If you only need to run the scripts and not to edit them, the easiest way to do so is to configure an external tool through Settings | Tools | External Tools. This doesn't require the Python plugin or any Python-specific configuration; you can simply specify the command line to execute. External tools appear as items in the Tools menu, and you can also assign keyboard shortcuts to them using Settings | Keymap.","Q_Score":9,"Tags":"python,android-studio","A_Id":41166600,"CreationDate":"2016-12-15T14:19:00.000","Title":"Running Python scripts inside Android Studio","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a C++ project that invokes the same function in each python script. But each script does very different things that need access to the C++ project's internal classes. \nSo I need a python wrapper so I pass a C++ object to the python script and I need a way to run the python script's function from the C++ project too.\nFrom what I understand with Cython and Shed Skin they are utilities to make C++ classes into a python class but not necessarily share run time objects back and forth between the languages.\nWhat can I do?","AnswerCount":1,"Available Count":1,"Score":-0.3799489623,"is_accepted":false,"ViewCount":115,"Q_Id":41249703,"Users Score":-2,"Answer":"Thank you Maverick for your question.\nCython is not a way of using C++ classes into python.Cython is simply python with c data types.Means that you can use c data types in your python program which in turn turns your python code to execute faster.Also you can build extensions in python using cython.\nNow comming to the problem in the question,you can use boost library for your task.In boost you just need to write a wrapper to use your c++ object in python or vice versa.You just need to compile it to a shared library which can be done by tools like jam,cython etc.I am not going into details of how you are going to do it as you can find many tutorials for the same.","Q_Score":0,"Tags":"python,c++,cython","A_Id":41251029,"CreationDate":"2016-12-20T19:18:00.000","Title":"Compile python scripts with C++ project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am building a Kivy application that makes use of the cefpython widget for kivy.\nUpon execution of my program, whenever I add a Text Input widget into the view, my application crashes with the error : Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported\nI'm in a fix as I can't seem to figure out how to work around all this.\ncefpython version : 31.2\nkivy version : 1.9.1\nkivy-garden version : 0.1.4\npygame version : 1.9.1release","AnswerCount":1,"Available Count":1,"Score":-0.3799489623,"is_accepted":false,"ViewCount":1223,"Q_Id":41277033,"Users Score":-2,"Answer":"another way you can implement another toolkit or framework in kivy is by using Threads,,i tried that with tkinter and it worked","Q_Score":2,"Tags":"python,gtk,kivy,chromium-embedded,cefpython","A_Id":41285599,"CreationDate":"2016-12-22T06:31:00.000","Title":"Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported (Kivy Application)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently embedding Python3 into my C++ application.\nWe also ships a defined version of Python3. Currently Py_Initialize finds the system python in \/usr\/lib\/python3.5 (which we do not want). I could not yet figure out how I can strip the search path before calling Py_Initialize and force it to search in my custom path.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":34,"Q_Id":41304164,"Users Score":2,"Answer":"It can be done with Py_SetPythonHome.","Q_Score":1,"Tags":"python-3.5,python-embedding","A_Id":41304207,"CreationDate":"2016-12-23T15:38:00.000","Title":"Embedding specific Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a Wizard in Tkinter. Almost each of the steps shoud I have the same footer with the button for navigation and cancelling. How can I achieve this? Should I create a Frame? And in general, should all the steps be created as different frames?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4441,"Q_Id":41332955,"Users Score":0,"Answer":"I recommend using one main window with the buttons and put the rest of the widgets in different labelframes that appear and disappear upon execution of different functions by the buttons","Q_Score":3,"Tags":"python,python-3.x,tkinter","A_Id":60816826,"CreationDate":"2016-12-26T14:57:00.000","Title":"Creating a wizard in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am planning to use wxformbuilder to design application user interface. It's great tool and I like wxPython.\nBut i don't see gizmos widgets anywhere on the UI. I am particularly interested in gizmos.TreeListCtrl widget which supports tree with multi column entries.\nAnybody has tried intergrating gizmos widget with wxformbuilder? is it possible even?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":201,"Q_Id":41338712,"Users Score":1,"Answer":"Okay this is what i did, i added regular wxTreeCtrl from wxFB, then in the property pane under subclass, changed name to TreeListCtrl and header to wx.gizmos.\nAdditional settings (like adding multiple columns and all) needs to be done manually in the derived frame class in init\nEvent handlers can be added through wxFB and work correctly.","Q_Score":0,"Tags":"wxpython,wxformbuilder","A_Id":41374082,"CreationDate":"2016-12-27T03:39:00.000","Title":"how to integrate gizmos widgets in wxformbuilder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i am trying to design UI using wxFormBuilder. I have added wxFrame -> wxGridBagSizer -> wxSplitterWindow.\nAfter this point wxFormBuilder is not allowing me to put any windows under splitter window. I tried putting almost every widget. I also tried putting sizers under splitter window. But nothing is working.\nAll the widgets go at the same level as spliter window.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":556,"Q_Id":41339450,"Users Score":2,"Answer":"In formbuilder, the wxSplitterWindow control accepts 2 (and only 2) children. Those children can be either wxPanels or wxScrolledWindows. You can then add a sizer any other controls to those you want to those children. \nIf you use panels for the children, make sure to use the wxPanel from the \"Containers\" page and not the panel from the \"Forms\" page.\nIf you want to know which items are allowed to children for a certain control, you can look at the file objtypes.xml in the xml folder of the wxFormbuilder of the application.","Q_Score":0,"Tags":"wxpython,wxwidgets,wxformbuilder","A_Id":41344951,"CreationDate":"2016-12-27T05:23:00.000","Title":"wxformbuilder does not allow putting windows under wxsplitterwindow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've made a simulation using Vpython and I want to create a GUI using PYGAME. \nI was wondering if it's possible to embed that simulation made using Vpython into my GUI.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":41381825,"Users Score":0,"Answer":"I don't know anything about pygame, but I'm guessing that the interaction processing of pygame and the interaction processing of VPython would be incompatible with each other.","Q_Score":0,"Tags":"python,pygame,vpython","A_Id":42990373,"CreationDate":"2016-12-29T14:39:00.000","Title":"Is it possible to overlap different modules in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning to use Kivy, so I walked through the Pong tutorial and started messing around with the code. So, I removed everything but the bouncing ball and decided to generate multiple balls on demand. The problem I am having is that while I can place balls where I want them when application is already running (for example, adding a ball on touch works fine), but when I add balls in the app build() they don't get placed right. Here is the code I have. The balls placed on touch, correctly start from the center. But the ball added in build() starts from the lower left corner. Why? I wanted to add more moving widgets with different properties, but I cannot seem to figure out how to place them on application start.\n\n#:kivy 1.0.9\n:\n canvas:\n Ellipse:\n pos: self.center\n size: 10, 10\n\n:\n size: 50, 50\n canvas:\n Ellipse:\n pos: self.pos\n size: self.size\n\n\nfrom random import randint\n\nfrom kivy.app import App\nfrom kivy.uix.widget import Widget\nfrom kivy.properties import NumericProperty, ReferenceListProperty, ListProperty\nfrom kivy.vector import Vector\nfrom kivy.clock import Clock\n\n\nclass World(Widget):\n agents = ListProperty()\n\n def add(self):\n agent = Agent()\n agent.center = self.center\n agent.velocity = Vector(4, 0).rotate(randint(0, 360))\n self.agents.append(agent)\n self.add_widget(agent)\n\n def on_touch_down(self, touch):\n self.add()\n\n def update(self, dt):\n for agent in self.agents:\n agent.move()\n if agent.y < 0 or agent.top > self.height:\n agent.velocity_y *= -1\n if agent.x < 0 or agent.right > self.width:\n agent.velocity_x *= -1\n\n\nclass Agent(Widget):\n velocity_x = NumericProperty(0)\n velocity_y = NumericProperty(0)\n velocity = ReferenceListProperty(velocity_x, velocity_y)\n\n def move(self):\n self.pos = Vector(*self.velocity) + self.pos\n\n\nclass WorldApp(App):\n def build(self):\n world = World()\n # add one ball by default\n world.add()\n Clock.schedule_interval(world.update, 1.0\/60.0)\n return world\n\n\nif __name__ == '__main__':\n WorldApp().run()","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1337,"Q_Id":41387433,"Users Score":2,"Answer":"Found the answer. The default widget size is 100, 100. By the time I add the initial ball, the World widget is not rendered and therefore has a default size. But it is possible to pass the windows size in the Widget constructor. So changing the World instantiation to \n\nworld = World(size=Window.size)\n\nsolved the problem","Q_Score":1,"Tags":"python,kivy","A_Id":41388282,"CreationDate":"2016-12-29T21:26:00.000","Title":"Center widgets in Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Situation:\nMy gimp python plug-in shows the user a drop down box with two options [\".jpg\", \".png\"].\nQuestion:\nHow to show a second input window with conditional content based on first input?\n\n.jpg --> \"Quality\" range slider [0 - 100]\n.png --> \"Compression\" range slider [0 - 9]\n\n\nIn different words:\nHow to trigger a (registered) plug-in WITH user-input-window from within the main function of a plug-in?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":404,"Q_Id":41409731,"Users Score":2,"Answer":"Either you build a full GUI with PyGTK (or perhaps tkinter) or you find another way. Typically for this if you stick to the auto-generated dialogs you have the choice between: \n\na somewhat clumsy dialog that asks for both parameters and will ignore one or the other depending of the image format, \ntwo menu entries for two different dialogs, one for PNG and one for JPG.\n\nOn the other hand, I have always use compression level 9 in my PNGs (AFAIK the only benefit of other levels is CPU time, but this is moot in modern machines) so your dialog could only ask for the JPEG quality which would mak it less clumsy.\nHowever... JPEG quality isn't all there is to it and there are actually many options (chroma sub-sampling being IMHO at least as important as quality), and to satisfy all needs you could end up with a rather complex dialog. So you could either:\n\nJust save with the current user's default settings (gimp_file_save())\nGet these settings from some .ini file (they are less likely to change than other parameters of your script)\nNot save the image and let the user Save\/Export to his\/her liking (if this isn't a batch processing script)","Q_Score":2,"Tags":"python,plugins,gimp,python-fu","A_Id":41410753,"CreationDate":"2016-12-31T15:43:00.000","Title":"gimp python plug in: how to trigger another user input","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"TLDR first:\nWhen using \"wx.adv.DatePickerCtrl(self)\", get \"AttributeError: 'module' object has no attribute 'adv'\"\nlonger story:\nJust learning wxPython, trying to write a date picker using DatePickerCtrl.\nFound example with 'wx.DatePickerCtrl'. apparently it is only valid for version 2.8 (which I could not find anywhere).\nQuick search shows it been replaced by wx.adv.DatePickerCtrl(self) in version 3. Now get the above massage (AttributeError: 'module' object has no attribute 'adv')\n(system: windows 10, python 2.7.10 32bit, wx 3.0.2.0 msw)\nCan anyone help?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2732,"Q_Id":41442259,"Users Score":2,"Answer":"wx.DatePickerCtrl is not included with the current download of wxPython. Just add an import wx.adv and you will be fine.","Q_Score":4,"Tags":"python,python-2.7,wxpython","A_Id":48085369,"CreationDate":"2017-01-03T11:16:00.000","Title":"wxpython does not have 'adv'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I convert the following files into one executable? \n\nA main.py file that imports five other python scripts\nFive python scripts that each have their own GUI\nA background image is used in the main.py file\n\nI am using Python 3.5.2. I have tried py2exe, cx_Freeze and pyinstaller but none seem to work, or I am doing something very wrong. Please could you help with clear steps. \nIt seems I have to downgrade to Python 3.4 in order to convert successfully but I don't really want to downgrade.\nI am using tkinter for GUI and the Python math module for rounding-off numbers.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":119,"Q_Id":41506824,"Users Score":0,"Answer":"I've had some success with pyinstaller and a program using enaml (Qt backend) for the GUI. \nFor pyinstaller it helps to use the --debug option or make a .spec file and set debug=True. Also, pyinstaller has the option to make a single folder with an exe in the folder instead of a single exe, this might be easier to debug. You can distribute your single-folder programme by making a single-exe installer with software like InnoSetup.","Q_Score":0,"Tags":"python,tkinter,exe,python-3.5,pyinstaller","A_Id":41507288,"CreationDate":"2017-01-06T13:30:00.000","Title":"How to covert multiple Python 3.5.2 scripts and an image into one executable?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"there.\nUsing pyglet.image.ImageGrid(), is there any way to start off the grid from the top left, instead of the bottom left?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":248,"Q_Id":41517033,"Users Score":0,"Answer":"So, the only 'awfull' solution I currently have is:\n\nTo verticaly flip the image on the drive\nLoad the image as a texture and flip it back with get_texture()\nPut it into an ImageGrid()\nReverse() the ImageGrid-sequence","Q_Score":0,"Tags":"python,image,pyglet","A_Id":41517667,"CreationDate":"2017-01-07T01:58:00.000","Title":"Pyglet.image.ImageGrid() - indexing from top left","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know that PILLOW can convert an image from say jpg to png using the save method but is there a way to convert the image to another format and just keep it as an Image object without actually saving it as another file?\nSo I want to convert a user supplied image to common format for working with in the program because certain tools I am using only support png.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":300,"Q_Id":41520206,"Users Score":2,"Answer":"jpg and png are just compression techniques for saving an image to a file. An image as an object, is just an array of RGB(or any other colorspace\/format used by the library which you used to read the file) values of all the pixels.\nSo technically, you can use the image object as the common format for working with other tools. But you need to keep in mind about the colorspace which is used by each library. Like, OpenCV considers an image object in BGR format, so you need to convert the image object to this format before you use it in OpenCV.","Q_Score":1,"Tags":"python,python-3.x,python-imaging-library,pillow","A_Id":41520265,"CreationDate":"2017-01-07T10:05:00.000","Title":"How to convert an image with PILLOW temporarily?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to make APK file from Kivy and python? I know it's possible to use buildozer and python-for-android, but it's only possible on Linux OS. So, is there anyway to do it on windows?\nI use Python 3.4.4 and Kivy 1.9.1","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":371,"Q_Id":41522781,"Users Score":1,"Answer":"currently no, for now linux is the only option we have","Q_Score":1,"Tags":"android,python,linux,windows,kivy","A_Id":41527028,"CreationDate":"2017-01-07T14:58:00.000","Title":"How to make APK standalone from Kivy and python on WINDOWS?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When Smartsheet is updated by another used using the GUI, another user viewing the sheet will get visual notification that the sheet has been updated - requiring a save and\/or refresh.\nIs there a way to trigger this functionality from the API.\nI'm using the Python SDK 2.0 and Python 3.5\nThanks.\nCraig","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":164,"Q_Id":41538435,"Users Score":0,"Answer":"The GUI indicator will eventually alert you to a change regardless of where the update came from. Sometimes, that change can be a little delayed in the UI itself though.","Q_Score":0,"Tags":"python,smartsheet-api","A_Id":41707000,"CreationDate":"2017-01-08T22:08:00.000","Title":"Is there a way to show the sheet has been updated remotely via the API?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been developing games in Python & Pygame for a while now, Though one thing that's been in mind is my dislike to pygame's performance and lack of tools and libraries.\nI've always known LibGDX for it's popularity and how much I've seen it on this site. Though recently I found out that it supports JVM Languages so that I can use it with python under the Jpython interpreter.\nSince I have more knowledge on using python, I'm planning on learning LibGDX for it. Though I already know a decent amount of Java and it wouldn't be an incredibly extra amount of work If I we're to just finish learning more Java.\nThough I do prefer Python for how much I've been working in it.\nWhat I'm asking\nI was wondering if there was any downsides to using LibGDX In python (JPython) instead of it's main and popular language Java. One that comes to mind are performance issues, would it be slower to develop with LibGDX in Jython than in Java? Another that comes to mind would be cross-platform exportation, are you unable to export to android or IOS using Python(Jython)?\nAnybody really knowledge on LibGDX or Jython & LibGDX be able to answer this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1107,"Q_Id":41538808,"Users Score":6,"Answer":"You might have a hard time finding examples of Jython + LibGDX. I would guess it would also be hard to find many people here on SO that have any experience with Jython + LibGDX.\nAnother issue is cross platform development. Jython might use JVM, but android does not give you JVM. I don't know how well Jython works with Dalvik.\nIf I remember correctly LibGDX uses Intel Multi-OS Engine for iOS. I have no idea how that works with Jython. In any case, getting help will be hard.\nWhen it comes to performance of Jython + LibGDX vs. java + LibGDX I don't think there is a big difference. On desktop that is, it might not even work on other platforms.\nIf you want to develop for desktop only, don't need help and is fine with only seeing java examples and tutorials then I would say go for it. \nIn any other case go with java. The time and energy you would need learning Jython + LibGDX would be much better spend learning java + LibGDX.","Q_Score":6,"Tags":"java,python,performance,libgdx,jython-2.7","A_Id":41544716,"CreationDate":"2017-01-08T22:58:00.000","Title":"Is LIBGDX Slower in python than Java","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python funtion that draws a Fractal to a PIL.Image, but i want to vary the parameters of the function in realtime and to plot it to the screen. How can i plot the image and keep updating the ploted image each time the parametes of the function vary","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":382,"Q_Id":41595193,"Users Score":2,"Answer":"Use matplotlib, wxPython, PyQt, PyGame, Tk\/TCL or some other lib to display the image.\nDraw as many images as you need, whenever you need, using any lib you need, and then display it on a screen using one of above mentioned or some other GUI libs.\nIf you are working with plots and math functions, matplotlib will help you most. You might even totally use it, forgoing PIL completely.\nIf you want to stick to PIL only, you will have to write your own show() function, that will use some external imaging software which will seemlessly change to show another image when you send it. Perhaps Irfan View would do.","Q_Score":0,"Tags":"python,python-imaging-library,fractals","A_Id":41595337,"CreationDate":"2017-01-11T15:51:00.000","Title":"Draw multiple PIL.Image in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to make QAction stay down after it is clicked. Ideally it could toggle between two states: On (down) and Off (up)?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1747,"Q_Id":41596658,"Users Score":1,"Answer":"What you are looking for is a toggle button. This is implemented in Qt via the checkable property: if an action is checkable, then when the action is in a button the button is a toggle button; when the action is in a menu item you see a checkmark; etc.","Q_Score":0,"Tags":"python,pyqt,qaction","A_Id":41606857,"CreationDate":"2017-01-11T17:05:00.000","Title":"How to make toggle-able QAction","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been studying python and looking for ways to install and use some GUI framework I can use. I have read of native tkinter, and QtPy, Kivy, wxPython etc, but getting problems installing them.\nRecently I read about Anaconda, and want to give it a try. But is it going to solve my issue for GUI framework ? I am seeing some frameworks in the list, however not sure, which one of them is GUI framework. Or is their no GUI framework included ( other than tkinter of course )","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":25141,"Q_Id":41620621,"Users Score":4,"Answer":"Try libraries traitsUI and Enaml. These are both supported in anaconda and both open-source projects from the company Enthought (many anaconda employees\/founders are closely tied to Enthought). These libraries make use of underlying backends (wx, qt, tk) and facilitate much faster GUI dev than does working with those core frameworks directly.","Q_Score":1,"Tags":"python,anaconda","A_Id":41620776,"CreationDate":"2017-01-12T18:41:00.000","Title":"Is there a GUI framework available in anaconda (python )?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been playing around with the Kivy Pong tutorial, getting up to speed with the framework, seeing if I could implement a few ideas. I have removed most of the Pong functionality, so I could have only bouncing ball on the screen and added some code to generate multiple bouncing balls on the screen, generated on touch. That worked fine. I then added some extra canvas instructions, so I would have a line drawn indicating the direction the ball is moving. This is where things got weird. The first ball acts just as it should, bouncing around the screen. But any following clicks generate balls that go off screen, randomly change direction and speed and in general behave chaotically. I have been looking at my code and I cannot seem to find any indication of what might be going wrong. I keep all the references to the widgets, I add them to the root widget, I don't seem to be sharing any information between them... Anyway, here is the code, maybe someone can enlighten me. Using latest kivy and python 3.6.\n\nfrom random import randint\n\nfrom kivy.app import App\n\nfrom kivy.clock import Clock\nfrom kivy.config import Config\nfrom kivy.vector import Vector\nfrom kivy.uix.widget import Widget\nfrom kivy.properties import AliasProperty, ListProperty, NumericProperty, ReferenceListProperty\n\n\nclass Playground(Widget):\n critters = ListProperty([])\n\n def update(self, dt):\n for critter in self.critters:\n critter.move()\n if (critter.y self.height):\n critter.v_y *= -1\n if (critter.x self.width):\n critter.v_x *= -1\n self.score.text = \"{}\".format(len(self.critters))\n\n def on_touch_down(self, touch):\n critter = Critter()\n critter.pos = touch.x, touch.y\n self.critters.append(critter)\n self.add_widget(critter)\n\n\nclass Critter(Widget):\n angle = NumericProperty(0)\n v_x = NumericProperty(0)\n v_y = NumericProperty(0)\n velocity = ReferenceListProperty(v_x, v_y)\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.velocity = Vector(5, 0).rotate(randint(0, 360))\n self.angle = Vector(*self.velocity).angle(Vector(1, 0))\n\n def move(self):\n self.pos = Vector(*self.velocity) + self.pos\n self.angle = Vector(*self.velocity).angle(Vector(1, 0))\n\n\nclass WorldApp(App):\n def build(self):\n game = Playground()\n Clock.schedule_interval(game.update, 1.0\/60.0)\n return game\n\nif __name__ == '__main__':\n Config.set('kivy', 'desktop', 1)\n Config.set('kivy', 'exit_on_escape', 1)\n Config.set('graphics', 'resizable', 0)\n WorldApp().run()\n\nand the KV file\n\n\n score: score\n\n canvas:\n Color:\n rgb: 0.0, 0.1, 0.0\n Rectangle\n pos: self.pos\n size: self.size\n\n Label:\n id: score\n pos: self.parent.width - self.size[0], self.parent.height - self.size[1]\n font_size: 16\n size: self.texture_size\n\n\n\n size: 30, 30\n canvas:\n Rotate:\n angle: self.angle\n origin: self.center\n axis: 0, 0, 1\n Color:\n rgb: 0.5, 0.0, 0.0\n Ellipse:\n pos: self.pos\n size: self.size\n Color:\n rgb: 1, 1, 0.0\n Line:\n width: 2\n points: self.center[0], self.center[1], self.center[0] + self.size[0] \/ 2, self.center[1]","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":706,"Q_Id":41624151,"Users Score":3,"Answer":"I'm not sure if it's causing your problem, but your Rotate instructions aren't bounded by the widget rule and will affect any later widgets - so the Rotate of each Critter is applied to every later one.\nTo avoid this, add PushMatrix: at the top of the canvas rule and PopMatrix: at the bottom. These instructions effectively save and later revert to the initial rotation state before your change.","Q_Score":2,"Tags":"python,kivy","A_Id":41625421,"CreationDate":"2017-01-12T22:27:00.000","Title":"Kivy widgets behaving erratically","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got an issue with Python2.7 and PyGame. It has only just started happening so not sure what's going on.\nI've been coding a simple platform game and upon running the script it would immediately print out \"160 20\" (without quotes) and then start the PyGame script. On exiting the script using the \"esc\" key it crashed and a \"python.exe has stopped working\" dialog box appeared. I've also noticed that to exit the script while it's running I have to press \"ctrl-c\" twice as though there are two scripts running.\nThe funny thing is that this only seems to happen if set_mode is called in the script. \nAnother problem started when I decided to mess about with fullscreen. I used \"DS = pygame.display.set_mode((W, H), FULLSCREEN|HWSURFACE|DOUBLEBUF)\" and was able to get the game into fullscreen, now however any script I run with set_mode in automatically goes into fullscreen regardless of the parameters. \nTotally bizarre!\nAny thoughts?\nPS. I tried uninstalling both PyGame and Python and then re-installing.\nAnt","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":41635899,"Users Score":0,"Answer":"Strange!\nI've fixed the issue by giving my platform game script a new name and deleting the *.pyc file that was generated.\nGood now I can get on with making the game!\nAnt","Q_Score":0,"Tags":"python-2.7,pygame","A_Id":41636016,"CreationDate":"2017-01-13T13:37:00.000","Title":"Python2.7 PyGame set_mode issue and crash on script termination","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I usually create a canvas, the (0, 0) coord is place on the top left corner of it. Now I want to set it on the bottom left corner. I think I have to set the \"scrollbarregion\" but I can't understand how to do it.\nCan someone explain?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4720,"Q_Id":41652978,"Users Score":0,"Answer":"You could create a couple of variables that hold the size of the screen. then replace (0,0) with (self.screenWidth-0, self.sceenHeight-0)","Q_Score":3,"Tags":"python,tkinter","A_Id":41653041,"CreationDate":"2017-01-14T17:38:00.000","Title":"Tkinter: Set 0, 0 coords on the bottom of a canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to use libFTDI (www.intra2net.com\/en\/developer\/libftdi\/download\/libftdi1-1.2.tar.bz2)\nfor a project that I'm working on. All my current modules have been written in python2 and so i want libFTDI to work with python2 too, but the installation process automatically selects python3.5. Cmake is used to build the project. I can't seem to get it to work and apparently no one else has faced this problem before.\nAny help would be appreciated!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":401,"Q_Id":41680144,"Users Score":1,"Answer":"It worked after i uninstalled all versions of python3 and the python3-dev package.","Q_Score":0,"Tags":"python,linux,cmake,ftdi","A_Id":41735460,"CreationDate":"2017-01-16T15:50:00.000","Title":"Is there a way to force libFTDI to make the python packages according to python2.7 instead of python3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have the latest version of Python 3 and PyAutoGUI module on Windows 7 x64. Hotkeys like ALT + F4, CTRL + SHIFT + ESC works pretty well, but, from what I noticed, doesn't works CTRL + C and CTRL + V at all!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3053,"Q_Id":41683334,"Users Score":0,"Answer":"Have you tried using CTRL + SHFT + C and CTRL + SHFT + V?\nIf not, those should work. When I was copying from the terminal, it worked to do CTRL SHFT C.","Q_Score":1,"Tags":"python,module,keyboard,hotkeys,emulation","A_Id":55424469,"CreationDate":"2017-01-16T19:02:00.000","Title":"Doesn't works CTRL+V in PyAutoGUI, Python 3 on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have the latest version of Python 3 and PyAutoGUI module on Windows 7 x64. Hotkeys like ALT + F4, CTRL + SHIFT + ESC works pretty well, but, from what I noticed, doesn't works CTRL + C and CTRL + V at all!","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":3053,"Q_Id":41683334,"Users Score":1,"Answer":"choose \"EN\" default keyboard layout in your OS","Q_Score":1,"Tags":"python,module,keyboard,hotkeys,emulation","A_Id":64219957,"CreationDate":"2017-01-16T19:02:00.000","Title":"Doesn't works CTRL+V in PyAutoGUI, Python 3 on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Welcome!\nI am trying to create my own gui app using PyQT(5 i guess). Well, mainwindow consists of menubar, statusbar and central widget. Central widget is QTabWidget. In each tab there is it's own workplace widget.\nthe program itself allows to create a pipline of OpenFOAM stages, set the options for each process and launch it. It's all is to be made in one widget that is the only widget in a tab. \nThe problem i encountered is connected to QLayout. I am using QHBoxLayouts and QVBoxLayouts combination on each step of launching the task. When I make initial self.setLayout(somelayout1) it works fine. But as i make next steps in different methods of this widget's class self.setLayout(somelayout2), self.setLayout(somelayout3) and so on, the new layout becomes being drawn on the top of all the previous layouts. More than this: all the layers' parts of previous layouts that not covered by new one are remain active!\nhaven't found any working method for disabling old layout of the widget, or better: removing it. Already tried even creating a layout container of 1 element and influencing it with self.layout().removeItem(0) and self.layout().setLayout(newlayout) (or .inserLayout(newlayout), but there is no difference.\nIs there any working method to change the layout of the widget without appearing the old one on a backside?\nthanks for any help.\np.s.: self.setStyleSheet(\"QWidget { background-color: rgb(255, 255, 255) }\")\nneither QObjectCleanupHandler().add(self.layout()) both make no effect.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":651,"Q_Id":41701694,"Users Score":1,"Answer":"The way to ensure deleting widget from old layout is using sip.delete(somewidget). This will delete C++ object itself(because sometimes it keeps existing on it's own)","Q_Score":0,"Tags":"python,c++,qt,layout,pyqt","A_Id":42113740,"CreationDate":"2017-01-17T16:00:00.000","Title":"re-setting layout for widget pyqt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I, as it will soon be obvious, am a total newb when it comes to Python.\nI am running python version 3.5 on Windows 10, 64 bit.\nI installed the PyAutoGui module for a small project I am working on. At first, everything worked perfectly. But now it appears that PyAutoGui is crashing when it clicks. I suspect that it's because PyAutoGui is only intended for use up to Python 3.4.\nIn order to rectify this, I downloaded Python 3.4. Unfortunately, however, when I try to install PyAutoGui (using pip install pyautogui), it tells me that it's already been installed because it sees it in the Python 3.5 folder.\nMy question is this: How do I install PyAutoGui in Python 3.4 with it already installed in Python 3.5?\nAssume that I know virtually nothing about how to install a module manually without using pip\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1047,"Q_Id":41710540,"Users Score":0,"Answer":"If you have multiple versions of Python installed you need to find your versions and rename them and their Pips. \nIn windows the path is, C:\\\\Users\\USERNAME\\AppData\\Local\\Programs\\Python\\Python3x-32. The x should be replaced with the Python version and USERNAME with your username. On Mac it's located in \/usr\/local\/bin\/python. On Linux it should be in \/usr\/bin\/python. The location might vary depending on OS and Python version. \nRename the files python.exe\/python and pip.exe\/pip so that each file is different. I named mine python35.exe, python2.exe and python.exe(for 3.5, 2.7 and 3.6). \nNow when you execute your pip command use, pip34 install pyautogui or whatever you named the file. \nOr if you really want to you can go the painful way of renaming all the path variables, but I won't explain that here.","Q_Score":1,"Tags":"python,python-3.x,pip,pyautogui","A_Id":41710713,"CreationDate":"2017-01-18T02:43:00.000","Title":"Installing PyAutoGui on multiple versions of Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been using turtle package in python idle. Now I have switched to using Jupyter notebook.\nHow can I make turtle inline instead of opening a separate graphic screen. I am totally clueless about. Any pointers and advice will be highly appreciated.","AnswerCount":4,"Available Count":1,"Score":-0.1488850336,"is_accepted":false,"ViewCount":10154,"Q_Id":41778173,"Users Score":-3,"Answer":"It seems you can get turtle module to work, if you run the Jupyter Notebook cell containing the code twice. Not sure why it works, but it does!","Q_Score":10,"Tags":"python,python-3.x,jupyter-notebook,turtle-graphics","A_Id":47085929,"CreationDate":"2017-01-21T10:22:00.000","Title":"Make turtle graphics inline","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was having problems trying to install pygame on a mac where python was installed with anaconda. I searched in SO and no solution worked. But it seems I have worked it out (haven't checked yet throughly ) so I write it here","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1489,"Q_Id":41779485,"Users Score":1,"Answer":"First, tlatorre does not have a Osx version it seems. So I did this:\nanaconda search -t conda pygame\nand you can see in the reply several places (including tlatorre) with pygame. \nYou can see that tlatorre only has linux-64 version. Also quasiben seems to have a Osx version but I tried it and there was some incompatibility with python 3.5*\nso I tried CogSci (which seems to have linux windows and osx versions\nconda install -c CogSci pygame=1.9.2\nand it seems that it has been installed. (my apologies if it is not, - I am going to check from now on)","Q_Score":1,"Tags":"python,pygame","A_Id":41779486,"CreationDate":"2017-01-21T12:41:00.000","Title":"Install pygame with anaconda on mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a checkbutton inside of a menu widget in python with tkinter. (Using python 3.5.2). I know that with normal checkbuttons you can select or deselect the checkbuttons using checkbutton.select() and checkbutton.deselect(). I need to know how to do this with the checkbuttons that I have in the menu object.\nI have tried the menu.entrybutton.configure(id, coption) method but there is no coption for selecting and deselecting checkbuttons within the menu. \nAny help would be appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2380,"Q_Id":41793953,"Users Score":2,"Answer":"You should assign an IntVar (or possibly StringVar) to the checkbutton when you create it, via its variable= configuration option. You call .get() on this var to check the button's state, and .set() to change its state.","Q_Score":0,"Tags":"python,tkinter","A_Id":41794262,"CreationDate":"2017-01-22T17:26:00.000","Title":"Selecting and deselecting tkinter Menu Checkbutton widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hello to the Stack Overflow Community! I am an amateur coder & student and am developing a UI for my superiors at my 'school.' I have been bothered by the Python Shell window opening as well and was wondering if there was a way to remove that window without having my Tkinter program shut down.\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1351,"Q_Id":41795111,"Users Score":0,"Answer":"If you run in IDLE then don't bother Python Shell - IDLE is used only to develop code. \nLater you don't need IDLE to run it and you will no see Python Shell.","Q_Score":2,"Tags":"python,macos,python-3.x,tkinter","A_Id":41905609,"CreationDate":"2017-01-22T19:16:00.000","Title":"How can I remove the Python Shell window while using Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hello to the Stack Overflow Community! I am an amateur coder & student and am developing a UI for my superiors at my 'school.' I have been bothered by the Python Shell window opening as well and was wondering if there was a way to remove that window without having my Tkinter program shut down.\nThanks!","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1351,"Q_Id":41795111,"Users Score":1,"Answer":"Rename you main script to have the extension .pyw. This file type, when executed, is by default run by pythonw.exe instead of python.exe, and it doesn't show the console.\nYou will need some means to report debug errors, though. Just an advice.","Q_Score":2,"Tags":"python,macos,python-3.x,tkinter","A_Id":41795153,"CreationDate":"2017-01-22T19:16:00.000","Title":"How can I remove the Python Shell window while using Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In tkinter, is there a way for me to reference a widget within a grid by its row and column, in the same way that you would be able to reference an item within a list (or list of lists) by knowing its position in the list?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1890,"Q_Id":41814376,"Users Score":0,"Answer":"Actually, I realised that I could solve my own problem in a much simpler way, by literally making a list of lists, with each sub-list containing all of the widgets for a single row, and therefore I can refer to each item through it's row and column.","Q_Score":1,"Tags":"python,tkinter","A_Id":41822268,"CreationDate":"2017-01-23T19:46:00.000","Title":"Find an item by its position in a grid tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In tkinter, is there a way for me to reference a widget within a grid by its row and column, in the same way that you would be able to reference an item within a list (or list of lists) by knowing its position in the list?","AnswerCount":2,"Available Count":2,"Score":0.4621171573,"is_accepted":false,"ViewCount":1890,"Q_Id":41814376,"Users Score":5,"Answer":"You can call the .grid_slaves(row, column) method on the parent widget; this will return a list (possibly empty) of the widgets in that cell.\nYou could also iterate over all of the child widgets (.grid_slaves() with no parameters, or .winfo_children()) and call .grid_info() on each one. This returns a dictionary with 'row' and 'column' keys, along with various other grid parameters.","Q_Score":1,"Tags":"python,tkinter","A_Id":41814789,"CreationDate":"2017-01-23T19:46:00.000","Title":"Find an item by its position in a grid tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Say I have a grid that looks something like this:\n0 1 2 3 \n4 5 6 7\nImagine that we have a w by h grid, where the tiles are numbered starting at 1 in the top left corner. Imagine someone else has stored the values w (for width) and h (for height), that they have read in from a text file. You have access to these stored values, as long as you call them w and h. Write a program to return: the row number of a tile number given by the user. Use integer division, \/\/, which returns only a whole number and truncates any remainder. Start counting rows at row 0.\nsum = ((t - 1) \/\/ h) + 1 answers the question if the tiles start at 1, but I can't figure it out when the tiles start at 0.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":808,"Q_Id":41876074,"Users Score":0,"Answer":"You just divide the tile number by the number of tiles in a row w: row = t\/\/w\nTo get the column do: col = t%w\nI assume both row and column start at zero. If not, just add 1 where you need.","Q_Score":0,"Tags":"python,grid,tiles","A_Id":41876242,"CreationDate":"2017-01-26T14:46:00.000","Title":"Figuring out a Row of a Tile number in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hi I know this is a pretty basic design question. But I don't realy get it....\nI write it in Python with PySide, but I think this is more a language unrelated question.\nA simplified example what I want to do:\nI Have a Gui with a button that opens a file dialog. \nIn this one I choose a folder.\nThe code scans the suffixes of the files in the folder and returns the 3 needed one. lets say .mp3, .txt and .mov and shows them in the gui.\nTo this point the seperation should be no problem I would have a Gui class that runs the code of the core class, gets the three files as return values and sets up the gui.\nWhat I am wondering about is what happens when there are more then one files matching the .mp3 suffix. I would want to have a pop up with a combobox to select the one I want to use. But I don't realy get how to implement it without adding gui code to the core class.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":48,"Q_Id":41889588,"Users Score":1,"Answer":"Well maybe have the function in the Core module return some specifier that such a thing has happened (found multiple) along with the given names, then display the choice to the user and call a function in the Core module that returns relevant information about that file.\nBear in mind you do not have to be dogmatic regarding such restrictions, there are some situations where having code in the GUI is much less of a hassle than having to integrate some way of it to work in between modules.\nThis is where you make a decision how to go about writing the code, bearing in mind how important this feature is to you, how testable\/maintainable you need it to be.","Q_Score":0,"Tags":"python,user-interface,model-view-controller,interface","A_Id":41889758,"CreationDate":"2017-01-27T08:24:00.000","Title":"clean divide Code and Gui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on embedding some python code into into a kdb database by creating c extensions. To do this I need to compile my code into a shared library and within my kdb q script load the shared library. This issue I am having is when I try to import the numpy module. I get an error saying the PyType_GenericNew is undefined. This occurs at runtime not compile time. \nThe shared library I am building is linked with libpython3.5m.so but I guess this does not export the symbols golbally. When I made a test executable which imports numpy in the main() it runs fine. I was able to fix this issue in the shared library by calling dlopen(\"libpython3.5m.so\", RTLD_NOW | RTLD_GLOBAL). I don't however really like this solution since it is not very robust. Say for instance I changed my compile options to like against libpython3.4m. Then I would need to change the source code as well so dlopen opens libpython3.4m.\nIs there a way to tell gcc when I link using the -lpython3.5m option to export all the symbols globally? This way I can skip the dlopen.\nOtherwise is there something in the python c api which can tell me the path to the python shared library of which I am currently using? Ie something like dlopen(Py_GetLibraryPath(), RTLD_NOW | RTLD_GLOBAL)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":220,"Q_Id":41910758,"Users Score":0,"Answer":"Your problem has nothing to do with exporting symbols, but with the dynamic linker locating PyType_GenericNew. If libpython3.5m.so is in your library path, and your dynamic linker doesn't find it, running strace ldd .\/program will provide a hint as to where it's looking, and a well-placed symbolic link may sort you out.","Q_Score":0,"Tags":"python,c,linux,gcc,shared-libraries","A_Id":42325888,"CreationDate":"2017-01-28T14:13:00.000","Title":"Get full path to shared object with python c api","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a beginner and have 2 issues, which may be related to each other.\n1. I am using PyCharm, and when I put\n \"from PyQt4 import QtCore, QtGui, uic\"\nI get a red line under each word (except from & import) saying \"unresolved reference\".\n\nI have PyQ4\/Designer installed (I know it is because I have made a GUI), but when I click 'view code' for the GUI, it says \"unable to launch C:\/Python34\/Lib\/site-packages\/PyQt4\\uic\"\n\nMaybe a path issue??? Like I said, I am very new to Python\/Qt and really do not know how to check the path and\/or change it if it is wrong. I downloaded Python 3.6.0, PyChamr2016.3.2, Qt4.8.7","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1774,"Q_Id":41912691,"Users Score":0,"Answer":"Since you do seem to have PyQt installed my guess is that you have multiple Python versions installed (version 3.4 and version 3.6) and that PyQt is only installed under 3.6, but that PyCharm and the Designer are configured to use 3.4.\nI don't know how to change the Python interpreter in the Qt Designer as I never use it. However in PyCharm open the settings and look for the \"Project Interpeter\" tab. There you can configure the default Python interpreter that is used for your project. It even shows the installed packages for that interpreter. \nWhen you run a Python program from PyCharm, the first line in the output shows which Python interpreter was used. This way you can check if it is as expected. If it is still not correct, it can be that you have overridden it in your Run Configuration. Select \"Edit Configuration\" from the \"Run\" menu. This will open a dialog with Run Configuration settings for the Python script that you last executed. Check the \"Python Interpreter\" there and change it if needed.","Q_Score":1,"Tags":"python,python-3.x,pyqt,pycharm","A_Id":41919317,"CreationDate":"2017-01-28T17:29:00.000","Title":"PyCharm not recognizing PyQT4 and PyQt4 not allowing me to 'view code'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been using PyQt for years and would love to be able to use for an iOS app now that both apparently support it. However, I have never had any luck with pyqtdeploy. The tutorial is hard to follow and the build errors difficult to read.\nHas anyone had any success with this? Or possibly with another PyQt5 deployment method for iOS?\nThank you!\nEDIT\nI installed everything with homebrew: qt5@5.8.0, python3@3.6.0 pyqt5@5.7.1; and pyqtdeploy-1.3.1 installed with pip3. I also tried the pyqtdeploy-1.3.2.dev1612281206 snapshot installed from source. I ran into so many problems that I wasn't interested in getting into troubleshooting a specific problem. The wording of the tutorial is just difficult to follow, it's hard to tell which file he is talking about and in what directory, and where the SYSROOT variable should point, where the qmake symlinks go, etc. There are also lots of build errors for missing files which I was unable to track down, for example \"\/$SYSROOT\/lib\/python3.5\/_bootlocale.py\", or some arc file which I can't pull up right now. It also seems to top out at python3.5 and doesn't work with python3.6 which is all the hombres offers right now. It just seems like such a mess that I would simply ask if anyone has actually had success with it and start from there.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":5869,"Q_Id":41918757,"Users Score":4,"Answer":"We'll, I'm answering my own question now that I've had some success with pyqtdeploy and iOS. I got to the stage of signing the app but don't have a developer certificate at the moment so it of course failed. I have not yet deployed to the iphone simulator because pyqtdeploy does not prepare the correct architecture when deploying to the iPhone simulator.\nAs a beginner with pyqtdeploy the tutorial was an inadequate starting point. I had to skip to the chapter about building the sysroot. So I would say this is mostly a documentation issue.","Q_Score":5,"Tags":"ios,python-3.x,pyqt5","A_Id":41990062,"CreationDate":"2017-01-29T07:53:00.000","Title":"Has anyone had success deploying pyqt to iOS with pyqtdeploy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have installed Python 3.5.2 (32-bit) and Python 3.3 pygame -1.9.2a0 on Windows 10. When I run IDLE (python shell) and try to import pygame i get 'No module named pygame' error. I have found sys.path in the shell but pygame is not there. How can I set the variable for pygame OR how I can resolve this problem.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1603,"Q_Id":41919127,"Users Score":0,"Answer":"Installed pygame \"pygame-1.9.3-cp35-cp35m-win32.whl\" using 'pip' resolved this. Pip installer comes with python 3 and runs with windows command prompt(not in python shell).","Q_Score":0,"Tags":"python-3.x,pygame","A_Id":41920172,"CreationDate":"2017-01-29T08:50:00.000","Title":"Pygame No module named pygame error in windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to add a Circular progress bar to my Python GUI using Tkinter, but I didn't find any documentation for Circular progress bars with Tkinter.\nHow can I create a Circular progress bar in Tkinter or is this not possible?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":6856,"Q_Id":41943823,"Users Score":1,"Answer":"Tkinter does not have any support for circular progress bars. You will have to draw your own using a series of images, or a drawing on a canvas.","Q_Score":4,"Tags":"python,tkinter,progress-bar","A_Id":41944019,"CreationDate":"2017-01-30T19:21:00.000","Title":"Circular progress bar using Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In Tkinter, I need to be able to move text in a certain degrees, not to a new x and y coordinate. is there any way I could do this? Any help is greatly appreciated!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":116,"Q_Id":42080763,"Users Score":1,"Answer":"No, you cannot rotate text on a canvas. \nFrom the canonical documentation: \n\nIndividual items may be moved or scaled using widget commands described below, but they may not be rotated.","Q_Score":0,"Tags":"python,tkinter","A_Id":42080815,"CreationDate":"2017-02-07T02:39:00.000","Title":"Tkinter c.move text with degrees?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Well, need to translate c# code into IronPython. The current problem is to find the best way to traslate initialization like this for example:\ncase SomeObject.FieldCase: new SomeObject { Width = 600, Height = 400 }.Export(model_, stream); break;\nDo you have any ideas to make it similar? I'm interesting only in object initialization code, case statement was translated. For translation we use Roslyn, so we can get all syntax nodes. In other cases I make smth like that:\nmodel = new Model; \n model.SomeField = field;\n model.SomeField2 = field2;\nBut this way is not so easy to develop.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":356,"Q_Id":42109930,"Users Score":2,"Answer":"Found. IronPython can use c# classes, using import and change initializer invocation \nvalue= new SomeObject { Name = name } \nto \nvalue = SomeObject(Name = name)","Q_Score":1,"Tags":"c#,python-2.7,ironpython,roslyn","A_Id":42208014,"CreationDate":"2017-02-08T10:00:00.000","Title":"Object initialization in IronPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Just a quick question. I have been using Tkinter in Python in order to create Windows. My code is a bit all over the place when it is one file...\nIs it possible to call a window that will be located in a different file?\nFor example,\nWindow1.py opens a window, there is a button in that window that should initiate window 2, which is located in Window2.py. Does the code physically have to be in the same file for it to work together?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3316,"Q_Id":42144827,"Users Score":0,"Answer":"The answer to this question is yes.\nTo link two python files, use:\nIf you are in python 3, use exec(open(r\"example\").read())\nIf you are in python 2, use open(r\"example\")\n-\nNote: the python 2 example works both in python 2 and 3\n-\nThey do not need to be in the same file, just simply use their location.\ne.g. if I had a program on my desktop, I would use\nexec(open(r\"C:\/Users\/MyName\/Desktop\/program\").read())","Q_Score":0,"Tags":"python,windows,python-3.x,tkinter","A_Id":42145121,"CreationDate":"2017-02-09T19:01:00.000","Title":"Can you link multiple Python files?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to Python and took on a small project for the firehouse.\nI am looking to make a \"Calls YTD\" Sign.\nThe initial thought was a raspberry Pi connected to the a touch screen.\nAfter some playing around and learning how to use python a little I realized one very important fact... I am way over my head.\nLooking for some direction.\nIn order for this to display on the touch screen I will need to build it into a GUI. Should I stop right there and instead get a 12x12 LED and keep it more simple? \nOtherwise the goal would be to display the current call number \"61\" for example, with an up and down arrow to simply advance or retract a number .\nAdding the ability to display last years call volume would be cool but not necessary.\nWhat I am looking for ultimately, is some direction if python and raspberry pi is the way to go or should I head in another direction.\nThank you in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":67,"Q_Id":42179424,"Users Score":0,"Answer":"For a gui you could always take a look into Tkinter.\nYou could test the gui without having the actual raspberry pi.\nSwitching to leds would require an LED matrix, which is more demanding in terms of electrical engineering. Raspberry pi would be my recommendation.","Q_Score":0,"Tags":"python,raspberry-pi,touch","A_Id":42180008,"CreationDate":"2017-02-11T18:11:00.000","Title":"Counter Display Design","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have developed a Kivy application and was wondering if it was possible to deploy it as a WebApp. I've tried using flask but it is running into some problems. I run the Kivy Application by calling the App builder class while flask does something similar. So can anyone direct me to any tutorials or other information about deploying a Kivy Application in a web browser?\nI just need the GUI to display in a web browser so I believe the html doesn't need to be too extravagant.\nThank you!","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":7754,"Q_Id":42183014,"Users Score":10,"Answer":"Kivy does not currently support working in a browser.\nThere are some experiments to do it, but the result is very slow, to open and to use, and doesn't work in all browsers, more work is needed, and it's not a priority to us, if you want a web app, use a web technology.","Q_Score":5,"Tags":"python,web-applications,kivy","A_Id":42185476,"CreationDate":"2017-02-12T00:47:00.000","Title":"How do I deploy a Kivy GUI Application as a WebApp in a Web Browser?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am creating a small program, and I would like to know the simplest way to make a GUI. I tried wxPython, however, it only supports 2.6 and 2.7. Are there any good, simple ones for Windows, python 3.X?","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":629,"Q_Id":42193707,"Users Score":0,"Answer":"The best module for me is PyQt. You have all kinds of stuff, from regular GUI to 3D OpenGL and graphs and designer with all that. If not that try with tkinter, I had better experience with PyQt but you can try both and see which is better for your needs !","Q_Score":0,"Tags":"python,python-3.x,user-interface,input","A_Id":42193735,"CreationDate":"2017-02-12T21:52:00.000","Title":"Creating a GUI in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using PyGame, so I backdated to Python 3.2. I would like to use a number generator that's cryptographically secure in my game, because I can. I tried importing the secrets module, but it's not in the 3.2 Python version.\nHow do I use both the PyGame and secrets modules in the same program? Maybe by scripting a switch in Python versions in a function?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":243,"Q_Id":42262714,"Users Score":0,"Answer":"I know it says python 3.2 on the packages but I am currently running python 3.6 and it works fine. Just download python 3.6 and install pygame.","Q_Score":0,"Tags":"python,pygame,compatibility","A_Id":42279070,"CreationDate":"2017-02-16T00:34:00.000","Title":"Using secrets module with PyGame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have started to play with Python and I went directly to Python 3.6.\nI have two Python environments now in my system: Python 2..6.6 and Python 3.6\nPython 2.6.6 is under: \nwhich python\n\/usr\/bin\/python\nAnd Python 3.6 is under \/opt\/python3\/bin\nMy problem is that if I try to import tkinter in Python 3.6 it does not work:\n.\/python3.6\nPython 3.6.0 (default, Feb 16 2017, 17:37:36)\n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\n\n\nimport tkinter\n Traceback (most recent call last):\n File \"\", line 1, in \n File \"\/opt\/python3\/lib\/python3.6\/tkinter\/init.py\", line 36, in \n import _tkinter # If this fails your Python may not be configured for Tk\n ModuleNotFoundError: ****No module named '_tkinter'****\n\n\n\nIf I do in Python 2.6 it works:\npython\nPython 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)\n[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\n\n\nimport Tkinter\n\n\n\nPLEASE NOTE, I know that the module is lower case t in Python 3 so instead of import Tkinter, I am typing import tkinter.\nMy question is: How do I install tkinter in Python 3 in CentOS.\nThis I what have tried so far:\nyum install python3-tk\nLoaded plugins: fastestmirror, refresh-packagekit, security\nLoading mirror speeds from cached hostfile\n * base: mirror.us.leaseweb.net\n * extras: mirror.us.leaseweb.net\n * updates: mirror.us.leaseweb.net\nSetting up Install Process\nNo package python3-tk available.\nError: Nothing to do\nHow do I install in CentOS 6 the module tkinter and make Python 3 able to use it?\nThanks for any feedback.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2402,"Q_Id":42295171,"Users Score":0,"Answer":"If you want to install tkinter in order to use matplotlib you may try \n\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\n\nIt worked for me","Q_Score":3,"Tags":"tkinter,python-3.6","A_Id":42347600,"CreationDate":"2017-02-17T10:12:00.000","Title":"How to install tkinter in python 3.6 in CentOS release 6.4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"How would I\n1. Access windows explorer\n2. Use it to to gain the path to a file. For example when I click \"open\" it pastes the address of the selected file into an entry box\nI'm using tkinter if that helps at all.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":742,"Q_Id":42304636,"Users Score":1,"Answer":"Import tkinter.filedialog with a statement such as from tkinter import filedialog (3.x) or import FileDialog as filedialog (2.x). This module is not properly documented in the CPython docs, nor anywhere else I know of, so read the code to determine which of the ask... methods you want to use. In 3.x, the code is Lib\/tkinter\/filedialog.py. In 2.x, Lib\/libtk\/FileDialog.py.\nEDIT: From what you said, you may want either askopenfilename or askopenfilenames. I believe these return names without opening the files. The functions without name actually open the files.","Q_Score":0,"Tags":"python,windows,tkinter,explorer","A_Id":42306129,"CreationDate":"2017-02-17T18:03:00.000","Title":"Use Windows explorer to get the path to a file in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My intention is to add a vertical bar to IDLE to indicate preferred line length at column 80.\nI have tried to find a configuration option for the Text tkinter widget that would allow this but have found nothing.\nI was hoping it would be a simple configuration option so I could just add a another item the text_options dictionary within EditorWindow.py found within Python\\Lib\\idlelib.\nI am not sure how styles\/themes work but do they have the capability to change the background colour of only 1 column in a Text widget?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":395,"Q_Id":42309798,"Users Score":0,"Answer":"Outline of possible solution:\n\nCreate a 1-pixel wide Frame, with a contrasting background color, as a child of the Text.\nUse .place() to position the Frame at an appropriate horizontal coordinate.\n\nPossible issues:\n\nI don't see any easy way to get the coordinate for a particular column. Text.bbox(\"1.80\") looks promising, but doesn't work unless there actually are 80 characters in the line already. You may have to insert a dummy 80-character line at first, call update_idletasks to get the Text to calculate positions, call bbox to get the coordinates, then delete the dummy text. Repeat whenever the display font is changed.\nThe line would necessarily appear on top of any text or selection region, which isn't quite the visual appearance I'd expect for a feature like this.","Q_Score":0,"Tags":"python,tkinter,python-idle","A_Id":42333708,"CreationDate":"2017-02-18T00:48:00.000","Title":"Adding a vertical bar or other marker to tkinter Text widgets at a particular column","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i am using optical flow to track some features i am a begineer and was tol to follow these steps\n\nMatch good features to track \nDoing Lucas-Kanade Algorithm on them\nFind homography between 1-st frame and current frame\nDo camera calibration\nDecompose homography map\n\nNow what i don't understand is the homography part because you find the features and track them using Lucas-Kanade, now the homography is used to compute camera motion(rotation and translation\u2014between two images). but isn't that what the Lucas-Kanade does? or the Lucas-Kanade just tracks them and the homography makes the calculations? I am struggling to understand the difference between them, Thanks in advance.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1959,"Q_Id":42350006,"Users Score":2,"Answer":"Optical flow: detect motions from one frame to the next. This is either sparse (few positions of interest are tracked, such as in the LKDemo.cpp example) or dense (one motion per position for many positions(e.g. all pixels) such as Farneback demos in openCV).\nRegardless of whether you have dense or sparse flow, there are different kinds of transforms that optical flow methods may try to estimate. The most common transform is translation. This is just the offset of postion from frame-to-frame. This can be visualized as vectors per frame, or as color when the flow is dense and high resolution.\nOne is not limited to only estimating translation per position. You can also estimate rotation for example (how a point is rotating, from frame to frame), or how it is skewed. In affine optical flow, you estimate a full affine transform per position (change translation, rotation, skew and scale). Affine flow is a classical and powerful technique that is much misunderstood, and probably used far less then it should.\nAffine transforms are given most economically by a 2x3 matrix: 6 degrees of freedom, compared to the regular 2 d.o.f. of regular translational optical flow.\nLeaving the topic of optical flow, An even more general family of transforms is called \"Homographies\" or \"projective transforms\". They require a 3x3 transform, and have 8 d.o.f. The affine family is not enough to describe the sort of deformation a plane undergoes, when you view it with projective distortion. \nHomographies are commonly estimated from many matched points between frames. In that sense, it uses the output of regular translational optical flow(but where the affine approach is often used under the hood to improve the results).\nAll of this only scratches the surface...","Q_Score":2,"Tags":"python-2.7,computer-vision,homography,opticalflow","A_Id":51124327,"CreationDate":"2017-02-20T16:46:00.000","Title":"Homography and Lucas Kanade what is the difference?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making an small audio editor interface, it needs to have a dialog box with 3-4 button options along with activate option, when the user clicks on activate,another dialog box will be popped asking him for his Mac address and a code, i heard Visual basic is good for making .exe but does it give me full control over the application?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":431,"Q_Id":42358632,"Users Score":2,"Answer":"You have to think about where your strengths lie. If you are a strong Python coder then go in that direction. if you are a strong VB coder then go in that direction. I would argue that neither of the options you are thinking of using would be ideal. \nI would actually recommend C# within Visual Studio 2015 community. Python isn't natively compiled to an EXE and there are more hoops to jump though to get a compiled executable. \nRecently I used C# and Visual Studio 2015 community to create myself a similar small GUI interface for the work I was doing. I have previously used Python with QT. The extra hoops I had to work through to get an EXE from python definatly made the choice of python at the time a downside. \nC# has a large amount of libraries available for it using the NUGET libraries in Visual Studio. VB is quite dated (but still quite usable) compare to C#. \nPython also has a large number of currently supported opensource libaries.","Q_Score":1,"Tags":"python,vb.net,tkinter","A_Id":42358885,"CreationDate":"2017-02-21T04:20:00.000","Title":"Which is Easier to create an .exe file ,Vb or python with tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making an small audio editor interface, it needs to have a dialog box with 3-4 button options along with activate option, when the user clicks on activate,another dialog box will be popped asking him for his Mac address and a code, i heard Visual basic is good for making .exe but does it give me full control over the application?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":431,"Q_Id":42358632,"Users Score":2,"Answer":"As you don't have any experience on C# (As mentioned in a comment) then you should go with VB.Net. I guess it has all the features you described you needed. But I would recommend you to learn C# as soon as possible if you want to become a good Coder because C# language is similar to many other famous\/ popular and strong Coding Languages so it will be easier to learn other languages too when you would need them.\n\nI too don't have much knowledge about C# and am trying to learn it. Believe me it's much more convenient than VB.Net as per my few experience.","Q_Score":1,"Tags":"python,vb.net,tkinter","A_Id":42362613,"CreationDate":"2017-02-21T04:20:00.000","Title":"Which is Easier to create an .exe file ,Vb or python with tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Tkinter window with a couple of widgets, they are all formatted with \n.grid(), but because one of the widget is a large canvas, the column is stretched out. When assigning a button to that coulmn, it stretches as wide as the widget which is not ideal, is there a way of putting more that one button in the same column?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":187,"Q_Id":42457692,"Users Score":0,"Answer":"Yes. Put a frame in the column, and put as many things as you want in the frame.\nThere are other solutions to the problem. For example, if you have 10 narrow buttons and one wide canvas, you can have the canvas span 10 columns rather than fill a single column.","Q_Score":1,"Tags":"python,canvas,tkinter","A_Id":42457856,"CreationDate":"2017-02-25T15:05:00.000","Title":"Is a grid within a grid possible?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on building my application on windows with python 3.5.2, I built the python with VC++ Redistributable 2015.24021 installed. \nAnd I don't want the customer to having to install redist themselves, so I figured that cx_freeze include_msvcr option might be the way to go. However, even if I use include_msvcr option, the .exe is still not executable on windows without redist. \nI can see there is a VCRUNTIME140.dll which was copied from my built python 3.5.2, and executing it on machines without redist complains about missing api-ms-win-crt-stdio-l1-1-0.dll. \nI can find this .dll file on my build machine, so here are some quick questions. \n\nIs it expected that include_msvcr won't bundle dependent .dll files like the abovementioned one?\nIs there any workaround? Like adding the dll to include_files? Where should I put as destination for the dll?\n\nThanks a lot.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1364,"Q_Id":42516811,"Users Score":0,"Answer":"I noticed the same issue on some of my builds; one build went well and the other didn't. \nSo after a bit of searching, I found out that adding import requests suddenly added pywintypes36.dll and VCRUNTIME140.dll to the previously wrong build.\nNo idea why, and I won't say adding this import is a definitive solution, but some packages such as requests seems to ease cx_Freeze's dependency detection.","Q_Score":6,"Tags":"windows,python-3.x,dll,cx-freeze","A_Id":52225827,"CreationDate":"2017-02-28T19:04:00.000","Title":"cx_freeze include_msvcr does not bundle windows VC2015 runtime","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm relatively inexperienced with C++, but I need to build a framework to shuffle some data around. Not necessarily relevant, but the general flow path of my data needs to go like this:\n\nData is generated in a python script\nThe python object is passed to a compiled C++ extension\nThe C++ extension makes some changes and passes the data (presumably a pointer?) to compiled C++\/CUDA code (.exe)\nC++\/CUDA .exe does stuff\nData is handled back in the python script and sent to more python functions\n\nStep 3. is where I'm having trouble. How would I go about calling the .exe containing the CUDA code in a way that it can access the data that is seen in the C++ python extension? I assume I should be able to pass a pointer somehow, but I'm having trouble finding resources that explain how. I've seen references to creating shared memory, but I'm unclear on the details there, as well.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":636,"Q_Id":42540201,"Users Score":3,"Answer":"There are many ways two executables can exchange data.\nSome examples:\n\nwrite\/read data to\/from a shared file (don't forget locking so they don't stumble on eachother).\nuse TCP or UDP sockets between the processes to exchange data.\nuse shared memory.\nif one application starts the other you can pass data via commandline arguments or in the environment.\nuse pipes between the processes.\nuse Unix domain sockets between the processes.\n\nAnd there are more options but the above are probably the most common ones.\nWhat you need to research is IPC (Inter-Process Communication).","Q_Score":0,"Tags":"python,c++","A_Id":42540332,"CreationDate":"2017-03-01T19:19:00.000","Title":"Pass Data from One .exe to Another","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My problem is when somebody runs my tkinter gui (in Windows 7) and has larger display settings (125%), the gui doesn't look well (buttons are closer to each other, end of text cannot be seen, etc.). I use place method with x - y coordinates to place the widgets.\nMaybe using pack method could solve this, but it is easier to use place for me, because there are lots of labels and buttons with exact places.\nAnother solution can be if the display settings could be checked with pywin32 and resize everything if needed. If it is possible, please confirm and help, what is the related function or if you have any other idea\/advice, please share it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":213,"Q_Id":42552096,"Users Score":0,"Answer":"This is one of the reasons why place is a poor choice. You should switch to using grid and\/or pack. They are specifically designed to handle different screen sizes, different resolutions, different widget styles, and different fonts.","Q_Score":0,"Tags":"python,windows,tkinter,size,display","A_Id":42555744,"CreationDate":"2017-03-02T09:55:00.000","Title":"Python tkinter - windows larger display settings","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having some problems with using PyInstaller to package a project. I have used it successfully in the past for simpler scripts, but I am attempting to package a larger project (pyqt4 gui that calls multiple scrips and modules) and I get the following error:\n\nIOError: [Errno 13] Permission denied: 'C\\Users\\username\\AppData\\Roaming\\pyinstaller\\bincache01_py27_64bi\\qt4_plugins\\imageformats\\qsvg4.dll'\n\nI'm running pyinstaller from a command prompt with admin privileges. I've checked the permission on the file in question and I definitely have all permissions for that file.\nI haven't been able to find anything that's helped, most of the people reporting similar issues seemed to solved them by running from a command prompt with admin privileges. If anyone has any ideas or advice that would be greatly appreciated. \nThank you.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2161,"Q_Id":42560179,"Users Score":1,"Answer":"Had the same issue, pyinstaller -F script.py without the build on the command prompt worked for me.","Q_Score":3,"Tags":"python,pyinstaller","A_Id":53063002,"CreationDate":"2017-03-02T16:01:00.000","Title":"Permissions Error with PyInstaller (running as admin)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a game as a school project with tkinter.I got a 800 lines long code, and I want to add a 4rd button in the title bar of one of my windows(not the main one). Is it possible and ,if yes, how can I manage to do it ?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":328,"Q_Id":42579614,"Users Score":2,"Answer":"It is not possible to add buttons to the titlebar of a window in Tkinter.","Q_Score":0,"Tags":"python,tkinter","A_Id":42579716,"CreationDate":"2017-03-03T13:03:00.000","Title":"Add a button in the title bar in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I get images from aws and assign them to QPixmap variables. I want to show their information as width height and file size. However I could not find a way to get file size of them. I converted them to QImage and used byteCount method however, although the file size of the image is 735 byte, it returns 3952 byte which is equal to width*height*4.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":985,"Q_Id":42580176,"Users Score":1,"Answer":"When you load image into QPixmap or QImage, it is converted from file format to internal representation. Because of that, QImage.byteCount() returns number of bytes used to store image. As you already mentioned, it is equals to width*height*4. Here, digit 4 is color depth (bytes per pixel). You can get it via QImage.depth() method. Note that it will return number of bits, so you have to divide it by 8 to get bytes.\nSo, if you want to get file size, you can either use len(data) (as suggested by ekhumoro) or load it to QFile and call size() (if you have\/save it on hard drive).","Q_Score":0,"Tags":"python,pyqt4,qpixmap","A_Id":42604577,"CreationDate":"2017-03-03T13:28:00.000","Title":"How can I find the file size of image which is read as QPixmap?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Let's get the formalities out of the way: This is about Python 2.7.x running on Windows 7.\nI'm creating a subclass of the Tkinter listbox widget, and one of the things I need the subclass to provide is a property containing the index (line number) of the line that is currently active (i.e. has the focus). I know that Tkinter supports the constant tk.ACTIVE for all listbox methods that take an index, but in my custom widget this property needs to always be an integer, never a string.\nI've scoured the documents but there doesn't seem to be method that will return the index of the active line, nor a way to \"convert\" tk.ACTIVE to its effective index number. Methods like curselection() or selection_includes() are not helpful because this listbox is always going to have a selectmode of tk.EXTENDED -- which means any number of lines may be selected and further that the current active line may or may not be among them.\nI considered using an event binding to wait for arrow keys, mouse clicks, etc. and look for changes to the curselection() tuple, but this is not quite helpful or straightforward either. E.g. suppose the user shift-clicks to select a range -- he may go top-to-bottom or bottom-to-top, and either way the tuple will just show the range, not which line is active.\nSo then: is there any way at all (overt or sneaky, simple or complex) to get the equivalent index number for the tk.ACTIVE line?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":717,"Q_Id":42582335,"Users Score":3,"Answer":"The way to get the line number of the active line of the listbox is to use the index method: listbox.index(tk.ACTIVE).","Q_Score":1,"Tags":"python,python-2.7,tkinter,listbox","A_Id":42582872,"CreationDate":"2017-03-03T15:09:00.000","Title":"\"Convert\" tk.ACTIVE to the index (line number) in a listbox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"ImportError: DLL load failed: %1 is not a valid Win32 application. I have researched for 2 days but unable to resolve. Need help!!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":99,"Q_Id":42590945,"Users Score":0,"Answer":"Make sure that your Python, cx_Oracle and Oracle Client are all 64-bit or all 32-bit. If one of them is different you can get this error.","Q_Score":0,"Tags":"python,python-2.7,cx-oracle","A_Id":42602641,"CreationDate":"2017-03-04T01:12:00.000","Title":"ImportError when importing cx_Oracle python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to know how to get a progress-bar\/seeker for the QMediaPlayer module on PyQt5... So on my music player application I can have a progress bar for the songs. Thank You in Advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1095,"Q_Id":42602039,"Users Score":2,"Answer":"Your question is a bit broad, bit in general this is what you should do:\n\nCreate a QProgressBar\nCreate your QMediaPlayer\nListen to the currentMediaChanged() signal of your QMediaPlayer module; in your handler fetch the duration of the current media, divide by 1000 to get the length in seconds, set this as the maximum value of your QProgressBar; reset the progressbar.\nListen to the positionChanged() signal of your QMediaPlayer; in the handler fetch the current position; again divide by 1000 and set the value in your QProgressBar with setValue.\n\nThis should give you a progressbar that is automatically updated by the QMediaPlayer.\nYou may wish to disable the text in the progressbar as a percentage isn't really useful for a song playback. Unfortunately there doesn't seem to be an easy way to print the time in the progressbar.","Q_Score":1,"Tags":"qt,python-3.x,user-interface,pyqt5,qmediaplayer","A_Id":42602957,"CreationDate":"2017-03-04T22:17:00.000","Title":"Connect QProgressBar or QSlider to QMediaPlayer for song progress","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a lo-fi, low-resolution (1024x576) game and I was hoping I could get away with just doing supersampling (render the game at 2048x1152 then scale down) instead of proper anti-aliasing.\nTrouble is, I don't see any way to render the OpenGL commands to a memory surface instead of the display surface. Is there a way?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1021,"Q_Id":42617832,"Users Score":0,"Answer":"Do not forget: Display objects inherit from Surfaces. So you can blit the screen to another Surface and scale it down! Create a subprocess using the corresponding module, initialize Display with the dummy video driver (as seen in the headless_no_windows_needed.py Pygame example), send the Surface converted to a simple list using PixelArray, through IPC, recieve it in the main process, and blit it to a Display without OPENGL flag. You can also use FBOs.","Q_Score":1,"Tags":"python,python-3.x,opengl,pygame","A_Id":47053412,"CreationDate":"2017-03-06T04:58:00.000","Title":"Using Pygame + PyOpenGL, draw to a Surface instead of straight to the display?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"By default text in Button is centered but I want it to be aligned to the left so when I type more text than the button can display it wont cut the start of the sentence\/word. Thanks for help.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":8956,"Q_Id":42626496,"Users Score":9,"Answer":"You can use anchor=\"w\" when defining the button. However, some platforms may ignore that. For example, on older version of OSX the text will always be centered.","Q_Score":3,"Tags":"python,python-3.x,button,tkinter","A_Id":42626791,"CreationDate":"2017-03-06T13:09:00.000","Title":"Align text in tkinter Button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I get Geany to autocomplete an object's constraints?\nFor example, I type:\nself.window.set_position(gtk.WIN_\nAnd I want the list of possible constraints to show up such as WIN_POS_NONE and WIN_POS_CENTER etc. \nNOTE: CTRL+SPACE or CTRL+SHIFT+SPACE does not show constraints.\nAutocompletion works fine for functions and symbols, just not constraints, unless I've used it once already before. This saves me the time of looking at documentation. Sometimes I can partially remember the constraint, and it would be nice to be able to browse the options.\nI would basically like it to work like it does in Sublime Text, which is a near-perfect editor for me, but I'm looking for something free\/opensource to use.\nEDIT: I've also tried Ninja-IDE which can also display constraints, but it locks up sometimes and is not as lightweight as Geany...\nEDIT 2: I'm not looking for an alternative to Geany, I'm looking to make this functionality work via a mod or plug-in.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2193,"Q_Id":42678184,"Users Score":0,"Answer":"From what I have been able to find, this is beyond what Geany can do. I asked how to get Geany to do this and I am not looking for any alternatives to Geany, nor am I interested in using anything else. Therefore, this is the accepted answer, unless someone posts a way to make it work in Geany, at that point I will change the accepted answer.","Q_Score":8,"Tags":"python,autocomplete,geany","A_Id":42867379,"CreationDate":"2017-03-08T17:38:00.000","Title":"Geany autocomplete Python constraints","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a program where pictures are displayed to the user. Some of these pictures are, however, too long and run off the canvas. The canvas is a set size(width=600, height=150). I am wondering if there is anything to make sure the longer pictures do not exceed this width and are shrunk down when they do so they fit.\nThe images are in .gif format.\nI have tried using subsample() and zoom() but these seem to shrink the images even when they already fit on the canvas making them too small.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":218,"Q_Id":42683208,"Users Score":0,"Answer":"subsample and zoom are the only way to resize images with the tkinter PhotoImage objects. Whey you call them, they will always shrink or grow the image. It is up to you to determine which one to call, and what arguments that will give you the closest approximation to the desired size.","Q_Score":0,"Tags":"python,image,canvas,tkinter,resize","A_Id":42683329,"CreationDate":"2017-03-08T22:34:00.000","Title":"Is there a way, without PIL, to have an images put onto a Canvas to always be resized to fit in?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to find a way to change Textinput text box position and vertical size, but I can't find an example... anyone knows?\nI need to change the position of the text box from the automatic position to my own.\nIs there a position key like the text, size, height? And if so, how the cordinates are written?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":471,"Q_Id":42783876,"Users Score":0,"Answer":"I don't think you can do that.\nYou can embed the TextInput in another layout, position that layout and make the TextInput as big as the parent.","Q_Score":0,"Tags":"python,position,kivy","A_Id":42783947,"CreationDate":"2017-03-14T10:47:00.000","Title":"python kivy textinput text box position","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been working on a media player in python that uses pygame.mixer to play music and PyQt4 to build the UI.\nI'm currently using a while loop to check if a song is finished so the next song can be loaded in from the queue. In order to make sure that the user can still interact with the PyQt buttons while the while loop is running, I have put QtCore.QCoreApplication.processEvents() into the while loop.\nHowever, now when I close the main window while music is playing, the program does not stop (as it normally does) and the music keeps playing. \nThe program also can't detect the app.aboutToQuit.connect() command while the music is playing (meaning it can when music isn't playing).\nAny help would be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":157,"Q_Id":42809895,"Users Score":0,"Answer":"I found the answer to this issue a while ago so thought I should put it here for anyone else.\nI gave the program an internal exit button in the ui, then made the button call os._exit(0). It worked perfectly then.\nChecking the Python and PyQt documentation gave no comment on closing a application window while a while loop is being performed.\nAny other solutions would be appreciated though.","Q_Score":0,"Tags":"python,python-3.x,pyqt,pygame,pyqt4","A_Id":53130954,"CreationDate":"2017-03-15T12:33:00.000","Title":"Shutting down a Python program using PyQt and PyGame.music()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to deactivate a spinbox if a radiobutton is chosen? I've tried several things, but either the spinbox is deactived all the time or it wont deactivate at all.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":403,"Q_Id":42814029,"Users Score":0,"Answer":"I have no idea what you have been doing (perhaps you should mention what exactly instead of writing \"tried several things\" ;)) but yes, you can. In the slot-signal view select the radiobutton and drag a connection to the spinbox. For the signal emitted by the radiobutton choose toggled(bool). For the slot in the spinbox you need to check the Show signals and slots inherited from QWidget first (at the bottom of the connection dialog) in order to display all possible slots and then select either setDisabled(bool) or setEnabled(bool).","Q_Score":0,"Tags":"python,qt-designer,qspinbox,qradiobutton","A_Id":42814203,"CreationDate":"2017-03-15T15:25:00.000","Title":"Deactivate a spinbox in Qt Designer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Before I get reamed for this, I know there are some posts detailing how to clear ALL the output from a cell, but I'm interested in only clearing part of it.\nLet me provide some background. I am creating a word-guessing game like LINGO where the user is prompted to guess a five-letter word, then using CSS to provide some visual feedback as to which letters are in the correct position, and which letters are in the word but in the wrong position. The way my program is structured, it displays the feedback after each guess and then prompts the user again and displays the guess. So something like this:\nGuess a word: word\nFEEDBACK\nguess again: word\nFEEDBACK\n...\nYou get the picture. My goal is to come as close to duplicating LINGO as possible, which would mean removing the user input from the screen after it has been submitted and having it show a sequence of feedback. This to me means one of three things:\n1) Find a way to clear part of the output\n2) Find a way to prompt the user for text input without displaying it on the screen\n3) Cache the user input, delete the all the output after each iteration, and display the cached guesses.\nI've researched 1 and 2 and haven't been able to find anything. 3 would be a PITA so before I went to the trouble I thought I would ask.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":538,"Q_Id":42819741,"Users Score":0,"Answer":"1 think is either not possible or very difficult - it's hard in regular python, never mind Jupyter. In regular python, you'd probably use something like curses but I tried it in Jupyter and it affects the console Jupyter is running from - not the stdout in the notebook.\nIf you really wanted 2, you could probably write your own version of input that uses carriage return \\r after stripping the trailing newline via writing a function that loops listening for keystrokes and submitting once a newline is pressed. The carriage return should mean that the next line overwrites the previous line. \n3 Caching the input shouldn't be too difficult though I presume? Just store them in an array or something then you can display them back to the user after using IPython.display.clear_output.","Q_Score":0,"Tags":"ipython,anaconda,ipython-notebook,jupyter-notebook,jupyter","A_Id":42832210,"CreationDate":"2017-03-15T20:10:00.000","Title":"Clear part of an IPython cell's output","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a really simple, pseudo GUI using pythondialogue (its a wrapper for whiptail for bash), I need it to be cross platform between linux and Mac OSX. The main issue is its really hard to find information on pythondialogue, the only documentation seems to be on their own site. I would just use whiptail, but I'm learning python so using this to hone my python skills. \nWhat I like about pythondialogue (and whiptail) is that its not really a GUI, just a dialogue inside the CLI, so it can used purely through the command line such as if you SSH to the computer you want to run it on. Can tkinter do this too? \nEither way, a big thing I'm wondering is what benefits tkinter would provide over regular pythondialogue. Obviously the difference is it lets you create proper GUI applications, but would it be wisest to only create a GUI application in cases where its absolutely necessary? \ntkinter sounds like the easiest way to code GUIs in python. What disadvantages does it have to PyQt or wxPython. I wan't to start developing mobile apps as soon as possible and I see iOS and android apps can be written using python and Qt can be used to write both Android and iOS apps. So with this in mind, would learning PyQt mean I would also be developing the skills I'll need to create iOS and android apps? If so, this is most definitely what I'm going to do.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1504,"Q_Id":42828585,"Users Score":0,"Answer":"Learning PyQt will definitely help you learn to create IOS and Android apps. Even more, PyQt comes with QtDesinger which is a visual editor for creating apps with minimal coding. Tkinter in my perspective is for very light GUI programming. If you feel like you want to make money of these apps, I would highly advise you to check out Kivy.","Q_Score":0,"Tags":"user-interface,pyqt,wxpython","A_Id":43019627,"CreationDate":"2017-03-16T08:17:00.000","Title":"Python - pythondiologue vs. tkinker vs. wxPython vs. pyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I dynamically hide and show widget without removing it from parent widget (such as using the property \"visible\" in over UI frameworks)?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":550,"Q_Id":42858256,"Users Score":0,"Answer":"just like the way Toast works in kivyMD, you can try and implement that feature. you have to use animation to hide the widget far from the screen and then call a function to display it.Go through the kivymd toast to see how you can do it","Q_Score":1,"Tags":"python,user-interface,kivy","A_Id":42865590,"CreationDate":"2017-03-17T13:00:00.000","Title":"Dynamically hide and show widget in KivyMD","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have registered two images, let's say fixed and moving are Registered. After registration I want to measure overlap ratio etc. \nThe SimpleITK has overlap measure filters and to use overlap_measures_filter.Execute(fixed, moving) and hausdroff_measures_filter.Execute() we need to segment the image and we need labels in input. But the image is hard to segment using just thresholding or connected component filters. \nNow the question is then how can we evaluate registration accuracy using SimpleITK with just fixed image and the registered image.(without segmentation ad labeling the image)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":363,"Q_Id":42884375,"Users Score":0,"Answer":"If I understand your question correctly, you want the impossible: to have Hausdorff distance measure as if the image were segmented, but without segmenting it because the segmentation is hard.","Q_Score":1,"Tags":"python,image,itk,elastix,simpleitk","A_Id":42889299,"CreationDate":"2017-03-19T08:17:00.000","Title":"Image Registration accuracy evaluation (Hausdroff distance) using SimpleITK without segmenting the image","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"createConstraint method in pybullet allows to constrain one joint position w.r.t. another. Is there a way to use this function in order to prevent an object moving e.g. outside of a sphere?\nSo far I am checking the object position every timestep and change the position manually in case of violated constraints.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1314,"Q_Id":42910531,"Users Score":1,"Answer":"In fact there is a working example in the file examples\/pybullet\/constraint.py of pybullet.","Q_Score":0,"Tags":"python,physics,scientific-computing","A_Id":43048476,"CreationDate":"2017-03-20T17:47:00.000","Title":"How to use pybullet createConstraint for constraining world frame position of an object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently using the sony QX1 for wireless transfers for large images. The camera is being triggered over the USB port. Pictures from the camera are being transferred with URLLib to a raspberry pi. (I can't use the api to trigger the camera. It has to be from this external source.)\nThe camera is triggered around every 2.5 seconds. Through timing testing it seems like I'm able to get the larger picture back to the pi at ~ 3.2 seconds per image. \nI've noticed that when the camera is triggered my transfer is terminated. I'm assuming this has to do with the embedded design of the camera itself and there isn't a way to get around this but please correct me if I'm wrong!\nDoes the camera support the range header? Basically I grab the image size from the header. I'm trying to grab the beginning X bytes until the camera triggers again then grab the next X bytes until I get the entire image. \nThanks for the help and let me know if I need to give a deeper explanation of what is going on here.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":108,"Q_Id":42932916,"Users Score":0,"Answer":"I don't know about the range header, but it will still not allow you to take more pictures than your downloadspeed allows (unless you have some larger than 2.5 seconds intervals now and then). \nMaybe you can reduce the image resolution to a size that fits into the 2.5 sec interval? Or (just some thinking outside of the box:-) use 2 QX1's switching, so you get a 5 second interval for each...","Q_Score":0,"Tags":"python,http,urllib,sony,sony-camera-api","A_Id":43143860,"CreationDate":"2017-03-21T16:27:00.000","Title":"Python wireless transfers with SonyQX1","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"so I am trying to install kivy on my mac.From their instructions page, I am on step 2, and have to enter the command $ USE_OSX_FRAMEWORKS=0 pip install kivy. However, when I put this in terminal, I get the error error: command '\/usr\/bin\/clang' failed with exit status 1, and as a result Failed building wheel for kivy. Does anyone know how to address this issue?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1854,"Q_Id":42940941,"Users Score":1,"Answer":"Just had this issue, and was able to fix it following the directions on the kivy mac OS X install page, with one modification as follows:\n$ brew install pkg-config sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer\n$ pip3 install Cython==0.25.2\n$ pip3 install kivy\npip3 is my reference to pip for Python 3.6 as I have two different versions of python on my system. May just be pip install for you.\nHope this helps!","Q_Score":1,"Tags":"macos,kivy,python-3.4","A_Id":46702178,"CreationDate":"2017-03-22T01:04:00.000","Title":"Trying to install kivy for python on mac os 10.12","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Whenever I create a new wing file in the wing IDE interface, I find the \"run code\" (play symbol) button is greyed out and I can't click it unless I save the file somewhere on my computer. It didn't used to to this.\nThis is annoying because it forces you to save every single code you write even if it's just 5 lines you've written to test something out.\nI can't recall exactly when the button changed, I didn't notice it immediately. But I've updated both my wing IDE and python to the latest version. I've also shifted the directory that I keep all my python saves in, but I can't see why that would matter.\nI've taken a look through settings, but I couldn't make much sense of it. I'm new to programming.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1614,"Q_Id":42988797,"Users Score":0,"Answer":"Wing has never been able to debug an unsaved file. I suspect you used Wing 101 previously and now use Wing Personal or Wing Pro where the toolbar buttons are a bit different and run things in the debugger instead of evaluating in the Python Shell. \nYou can still evaluate the file or a selection in the file in the Python Shell using the items in the Source menu. As of Wing 6 you can also debug things you execute in this way by enabling debug in the Python Shell's Options menu.\nYou can also select a range in the file, click on the active range icon in top right of the Python Shell to make it the active range and then use the cog icon that appears in top right of the Python Shell whenever you want to reevaluate the range as you edit it in the editor.","Q_Score":2,"Tags":"python,python-3.6,wing-ide","A_Id":43001067,"CreationDate":"2017-03-23T23:26:00.000","Title":"Wing ide \"run\" button is greyed out unless I save the file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Ive written some wxpython code to display a progress bar\/gauge. Ive noticed that if i run my code by itself, i can simply call self.gauge.Pulse() one time (with no timer running) and the gauge will pulse\/move in a green bar.\nHowever, when running my code as part of a larger body of code, the bar becomes a solid blue color and self.gauge.Pulse() does not pulse the bar. Just stays constant.\nThe larger body of code does contain other wxFrames.\nIs there some kind of frame style flag or something else that would disable the \"auto pulse\" feature and turn the bar from green to blue?\nthis is windows 7, btw\nthanks guys","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":339,"Q_Id":43012974,"Users Score":0,"Answer":"It looks like your \"larger body of code\" is not using the correct manifest and so uses the old, \"classic\" controls instead of the \"themed\" controls implemented by comctl32.dll v6. To check this easily, just compare the look of the buttons in the 2 cases, this should make it clear whether you use the correct manifest or not.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":43017687,"CreationDate":"2017-03-25T05:39:00.000","Title":"wxpython gauge styles and pulse","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to detect a double click on another window in wxwidgets?\nIn my quest to switch to linux I wanna build a program that reacts to double click on the desktop and the file manager and displays a menu.\nSame as listary does on Windows.\nIs this something that can be done with wxwidgets (preferably wxpython) under linux? What about on Windows?","AnswerCount":2,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":208,"Q_Id":43030168,"Users Score":-1,"Answer":"You can try to use FindWindow() and then Bind() the event handler.","Q_Score":0,"Tags":"linux,wxpython,wxwidgets","A_Id":43030860,"CreationDate":"2017-03-26T14:42:00.000","Title":"wxwidgets detect mouse click on another window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to detect a double click on another window in wxwidgets?\nIn my quest to switch to linux I wanna build a program that reacts to double click on the desktop and the file manager and displays a menu.\nSame as listary does on Windows.\nIs this something that can be done with wxwidgets (preferably wxpython) under linux? What about on Windows?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":208,"Q_Id":43030168,"Users Score":2,"Answer":"You can't receive mouse clicks, or any other events, for windows of another process unless you capture the mouse (and never release it, which would be a bad idea).","Q_Score":0,"Tags":"linux,wxpython,wxwidgets","A_Id":43031796,"CreationDate":"2017-03-26T14:42:00.000","Title":"wxwidgets detect mouse click on another window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with pylint under Eclipse for my python code.\nI have some warnings given by pylint that I want to be marked as errors.\nGraphically it consists in a red cross instead of a yellow warning panel.\nAny idea ?\nPS : The warning I want more severe is W0102, ie dangerous-default-value","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":145,"Q_Id":43070869,"Users Score":0,"Answer":"In PyDev you can choose the severity of each of the message types in PyLint (i.e.: Fatal, Errors, Warnings, Conventions, Refactor) -- you can do that in the PyLint preferences page inside PyDev, but there's nothing related to changing the message type of a single item into an error.\nI.e.: if you need to change the message type of some message from the Warning message type to the Error message type, PyLint itself should support that (and if\/when it does, you should configure the parameters to pass to PyLint in the preferences page).","Q_Score":0,"Tags":"python,eclipse,pydev,pylint","A_Id":43074661,"CreationDate":"2017-03-28T13:25:00.000","Title":"Turn a pylint warning as an error under Eclipse\/pydev","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been working on a note taking program for myself and it is going well however I have had a lot of problems with getting all my widgets placed where I want them using the .pack() or .grid() options. \nAfter looking around I found that I could use the .place() option instead. Before I decided to use .place() I found countless forum post saying \"don't use .place()!\". \nI was at a stand still with my other options so I decided to give .place() a try. It turns out .place() is exactly what I needed to fix my layout issues and I just don't understand why everyone is hating on .place() so much.\nIs there something inherently wrong with .place()? Or do people just prefer to use .pack() and .grid() for some practical reason other than ease of use?","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":573,"Q_Id":43072375,"Users Score":6,"Answer":"I'm not sure what evidence you have that says everyone says not to use place. I suspect if you're judging by stackoverflow posts, you're mostly reading my opinion a hundred times rather than a hundred different opinions. \nI recommend against place mainly because it requires more work to make a UI that is responsive to changes in fonts, resolutions, and window sizes. While it's possible to write a GUI that uses place and is responsive to those things, it requires a lot of work to get right.\nOne advantage that both pack and grid have over place is that they allow tkinter to properly configure the size of the root and Toplevel windows. With place you must hard-code a size. Tkinter is remarkably good at making windows to be the exact right size without you having to decide on explicit sizes. \nIn addition, long term maintenance of applications that use place is difficult. If you want to add a new widget, you will almost certainly have to adjust every other widget. With grid and pack it's much easier to add and remove widgets without having to change the layout of all of the other widgets. If I've learned anything over years of using tk and tkinter is that my widget layout changes a lot during development.\nplace is mostly useful for edge cases. For example, if you want to center a single widget inside another widget, place is fantastic. Also, if you want to place a widget such that it is independent of other widgets, place is great for that too.","Q_Score":9,"Tags":"python,tkinter","A_Id":43073588,"CreationDate":"2017-03-28T14:32:00.000","Title":"Why do people say \"Don't use place()\"?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My issue currently is that of emulating keystroke input to an arbitrary program (such as a running game).\nCurrently I am using win32 libraries on Windows to find windows (win32gui.FindWindow) and grab focus (via win32gui.SetForegroundWindow), then send keyboard input (win32api.keybd_event).\nThis works if I am only sending input to a single program, but I wish to parallelize, playing multiple games simultaneously. This does not work with my current method as both applications demand \"focus\" for the keys to go to the right application, thus interfering with each other.\nIdeally I would like something that sends input to a given window, that does not require focus , and is independent of input given to other windows or the currently focused window.","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":658,"Q_Id":43082900,"Users Score":-1,"Answer":"My understanding is, only the foreground window get the focus and can handle keyboard input to play. Not sure in make sense to send input to background window or not....","Q_Score":0,"Tags":"python,linux,windows","A_Id":43091219,"CreationDate":"2017-03-29T01:52:00.000","Title":"Keyboard output to multiple programs simultaneously?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I return a process id of a lengthy process started using Thread in Python before the thread completes its execution?\n\nI'm using Tkinter GUI so I can't start a lengthy process on the main thread so instead I start one on a separate thread.\nThe thread in turn calls subprocess.popen. This process should run for like 5 -6 hours.\nBut When I press stopbutton I need this process to stop but I am unable to return the process id of the process created using subprocess.popen.\n\nIs there any solution to this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":254,"Q_Id":43141252,"Users Score":0,"Answer":"If you are using subprocess.Popen simply to spin off another process, there is no reason you need to do so from another thread. A sub-process created this way does not block your main thread. You can continue to do other things while the sub-process is running. You simply keep a reference to the Popen object returned.\nThe Popen object has all the facilities you need for monitoring \/ interacting with the sub-process. You can read and write to its standard input and output (via stdin and stdout members, if created with PIPE); you can monitor readability \/ writability of stdin and stdout (with select module); you can check whether the sub-process is still in existence with poll, reap its exit status with wait; you can stop it with terminate (or kill depending on how emphatic you wish to be).\nThere are certainly times when it might be advantageous to do this from another thread -- for example, if you need significant interaction with the sub-process and implementing that in the main thread would over-complicate your logic. In that case, it would be best to arrange a mechanism whereby you signal to your other \"monitoring\" thread that it's time to shutdown and allow the monitoring thread to execute terminate or kill on the sub-process.","Q_Score":1,"Tags":"python,multithreading,subprocess","A_Id":43145849,"CreationDate":"2017-03-31T12:55:00.000","Title":"How to return a process id of a lengthy process started using Thread in python before the thread completes its execution","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have been using pycrypto on my windows machine running python 2.7. \nWhen I tried to install pycrypto on qpython2.7 via pip I got Runtime error (\"autoconf error\"). For reference I am running qpython on stock android nougat with no root access.\nIs there any way to install pycrypto for qpython \nNot a problem ended up using pyaes instead of pycrypto.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":467,"Q_Id":43169738,"Users Score":0,"Answer":"Qpython didn't support pycrypto now, we will consider to support it as soon after we have delivered our brand new version which we were developing.","Q_Score":1,"Tags":"android,pycrypto,qpython","A_Id":43861801,"CreationDate":"2017-04-02T14:52:00.000","Title":"How to install pycrypto on qpython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can keep a frame on top of a parent using style:\n\nwx.FRAME_FLOAT_ON_PARENT\n\nBut it loses focus if this parent opens other child windows.\nIs there a way to keep it on top of all windows of this given application?\nI cannot use wx.STAY_ON_TOP because when I Alt-Tab to other process it's always on top.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":489,"Q_Id":43217058,"Users Score":1,"Answer":"The easiest solutions (without seeing the code) would probably be to\n1. Bind the frame to EVT_KILL_FOCUS and then call frame.SetFocus() from the bound event. The downside is that having multiple widgets on that frame can complicate things as you would have to bind to each widget. To get the frame that has the focus call wx.GetActiveWindow().\n2. Bind the other windows to EVT_ACTIVATE and then call frame.SetFocus() to re-activate the correct frame. \n3. Try to call frame.ShowWithoutActivating on the other frames that you are showing to prevent them from receiving the focus.\n4. Some combination of the above","Q_Score":1,"Tags":"wxpython","A_Id":43230207,"CreationDate":"2017-04-04T20:26:00.000","Title":"How do I keep wx.Frame on top not only it's parent frame but all other child frames parent opens?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program of tic tac toe in Python that I wish to post on SoloLearn, which is a mobile application that runs code in different languages (i.e. Java, C++, Python, etc.) \nHowever, even though my program requires multiple inputs, from hopefully two users, it ends after the first input.\nThe prompt used is what I see too often on these type of apps, It states that the program requires input but you must enter all of the input somehow all at once.\nIs there any way to obtain multiple user inputs from mobile apps that run such code.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":101,"Q_Id":43293738,"Users Score":0,"Answer":"the sololearn playground allows multiple inputs\nenter each input on a new line in the input prompt\ninfinite loop works not though","Q_Score":1,"Tags":"android,python,mobile,input,user-input","A_Id":46112131,"CreationDate":"2017-04-08T11:51:00.000","Title":"Obtain multiple user inputs from mobile apps that run code like SoloLearn?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working for the first time towards the implementation of a very simple GUI in PyQt5, which embeds a matplotlib plot and few buttons for interaction.\nI do not really know how to work with classes so I'm making a lot of mistakes, i.e. even if the functionality is simple, I have to iterate a lot between small corrections and verification.\nFor some reason I would like to debug, however, the whole process is made much, much slower by the fact that at any other try, the python kernel dies and it needs restarting (all done automatically) several times.\nThat is, every time I try something that should last maybe 5 secs, I end up spending a minute.\nAnybody know where to look to spot what is causing these constant death\/rebirth circles?\nI have been using spyder for some time now and I never experienced this behaviour before, so I'm drawn to think it might have to do with PyQt, but that's about how far I can go.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":14340,"Q_Id":43328064,"Users Score":1,"Answer":"I had a similar problem and found that my application only worked when the graphics settings inside Spyder are set to inline. This can be done at Tools -> Preferences -> IPython console -> Graphics, now change the Backends to inline. \nHope this helps.","Q_Score":3,"Tags":"python,pyqt,spyder","A_Id":54673251,"CreationDate":"2017-04-10T16:09:00.000","Title":"Spyder + Python 3.5 - how to debug kernel died, restarting?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have search far and wide on how you can paint the background color of a button or GenButton with a pattern such as lines or cross hatch. I have seen examples of wx DirectContext so that you can draw objects with patterns instead of just solid colors but it seems that this is only for specific shapes and not the color of button objects. Does the dc or gc library allow to paint on these objects. I know that I have to create an event handler for OnPaint and OnResize but I may be missing some steps so that it applies this to the button itself.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":616,"Q_Id":43352757,"Users Score":1,"Answer":"The wxPython package uses native widgets in its core widgets as much as possible. Thus, the wx.Button widget is going to be a native widget that you can only modify via the methods mentioned in the documentation. As Igor mentioned, you can try using SetBackgroundColour() or SetForegroundColour(), although depending on your platform's button widget, they may or may not work.\nWhat you really want is a custom widget. I recommend checking out the GenericButtons, PlateButton and GradientButton for examples. You might even be able to use a GenericButton directly and paint its background as you mentioned.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":43353997,"CreationDate":"2017-04-11T17:38:00.000","Title":"WxPython: Setting the background of buttons with wx.Brush","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have search far and wide on how you can paint the background color of a button or GenButton with a pattern such as lines or cross hatch. I have seen examples of wx DirectContext so that you can draw objects with patterns instead of just solid colors but it seems that this is only for specific shapes and not the color of button objects. Does the dc or gc library allow to paint on these objects. I know that I have to create an event handler for OnPaint and OnResize but I may be missing some steps so that it applies this to the button itself.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":616,"Q_Id":43352757,"Users Score":0,"Answer":"wx.Button object represents a native control. And so unfortunately you can't manipulate how the native control paints itself.\nYou can try SetBackgroundColour()\/SetForegroundColour() but this is as far as you can go.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":43353634,"CreationDate":"2017-04-11T17:38:00.000","Title":"WxPython: Setting the background of buttons with wx.Brush","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a game using the Pygame development module. When a user for my game presses the left key, I would like my character to \"face\" left and when the user presses the right key, I would like my character to be flipped and \"face\" the right. The character is one I drew and imported in. I am aware of the flip function in Pygame, but I think there will be errors. If the character starts off facing the left, and the user presses the right key, the character will be flipped and will move to the right. However, if he\/she lets go of the right key and then presses it again, the character will flip and face the left, but will continue to move to the right. Is there any way to solve this problem? I already know how to move the character; I am having problems with flipping it. Also, another idea I have considered is the diplay blitting one image when the key is pressed, and then blitting another when the other key is presses. But I do not knoww how to make the original image disappear. Any thoughts on this as well? Thank you.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":346,"Q_Id":43377434,"Users Score":1,"Answer":"You have to remember the face direction ( self.face_direction = RIGHT ) on click flip only if direction is wrong. \nAlternatively, save the flipped image in face_flipped_right. Then either show original image or flipped ( flipping is nondestructive)","Q_Score":0,"Tags":"python,pygame","A_Id":43377665,"CreationDate":"2017-04-12T18:50:00.000","Title":"Trying to flip a character in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been working quite a bit with tkinter in Python. I was wondering if there is a way to combine another program into my python GUI script. Here is specifically what I am trying to accomplish:\n\nPython GUI Opens \nLeft side of GUI is custom content (buttons etc.)\nRight side is parented MS Word document (When I move the root window the MS Word document moves accordingly)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":43,"Q_Id":43384639,"Users Score":0,"Answer":"You can't do what you want.\nIn a very, very limited sense you can embed a very few applications on linux, but for all intents and purposes you simply cannot embed a non-tkinter graphical application inside a tkinter window.","Q_Score":0,"Tags":"python,user-interface,tkinter,ms-word","A_Id":43390991,"CreationDate":"2017-04-13T06:04:00.000","Title":"How to parent programs to tkinter windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have worked with python 3 for a few months. Just a few days ago I have installed pygame and have been doing early tutorials. In two separate situations when I run a python script, the mac halts with a spinning ball and I need to cmd-opt-esc to abort it. I have done googling and not found similar complaints. As one example, I'm running the Chimp game and it loads a chimp image in a new little window, then spinning ball. Restarting the mac didn't help. Sound familiar, and\/or does anyone here have guidance?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":43404175,"Users Score":0,"Answer":"Found out the problem:\n-- The basic issue was a simple one. The chimp program tries to locate its support files (two images and two sounds) in a subdirectory called \/data. \n-- It was attempting to load a file using that path, and of course had a failure.\n-- So I got it working OK after fixing that.\n-- The only question that remains is why the python\/idle processes totally crash with a spinning ball when the script encounters a missing file error!\nThanks \nEric","Q_Score":0,"Tags":"python-3.x,crash","A_Id":43421764,"CreationDate":"2017-04-14T01:54:00.000","Title":"How avoid Pygame crashing a new mac pro with spinning ball","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Pretty much the subject line says it all. I just want to be able to turn off the line, undisplay it. I don't want to delete the line or the tag reference to the line. I want to use a checkbutton and once the line is drawn, done through a database, I want to be able to turn on and off the line with the checkbutton, without having to replace the tag in the line list everytime I turn the line back on, err in that case I would have to redraw the line from scratch. How do I turn I line off? I haven't tried but I don't think the disable feature is for the this purpose.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":141,"Q_Id":43439038,"Users Score":2,"Answer":"You can use the canvas's .itemconfig() method to switch your line between state=HIDDEN and state=NORMAL.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":43439285,"CreationDate":"2017-04-16T15:53:00.000","Title":"Turn off tkinter canvas line, but not delete the line","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I run my program, it displays a UI with many things on, some of those 'things' are images, that change depending on a user input. The input is recorded before the pyqt program is ran, and the images change using a different script, which also runs before the pyqt program. But for some reason the resource file doesnt care what the images look like, and only displays the images that were there when the resource file was compiled. Any tips? Just looking for some commands or something that I don't know about.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":848,"Q_Id":43479947,"Users Score":0,"Answer":"Resource files(.qrc) are used to place static files such as icons, sounds, videos, etc. These are converted into python code with the pyrcc4 or pyrcc5 command and are loaded into ram, so they can not be modified online. In the case of C++ they are loaded into the executable. In both cases they can not be modified.","Q_Score":0,"Tags":"python,pyqt5","A_Id":43481749,"CreationDate":"2017-04-18T18:45:00.000","Title":"PyQt5 How to update resource files after they've been compiled?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using PIL for my project and I have ImageDraw object.\nI want to get the image that is drawn on ImageDraw object. How do I get the image ?","AnswerCount":2,"Available Count":1,"Score":0.4621171573,"is_accepted":false,"ViewCount":9781,"Q_Id":43486077,"Users Score":5,"Answer":"It's simply:\noriginal_image = edited_image._image\nThe im object gets passed into ImageDraw, then gets saved into the class variable _image. That's about it.","Q_Score":12,"Tags":"python-3.x,python-imaging-library","A_Id":68526524,"CreationDate":"2017-04-19T03:56:00.000","Title":"How to get image from ImageDraw in PIL?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I find if two rects collide on a certain side? (e.g. rect1.rect.top, rect2.rect.bottom) I've tried rect1.rect.colliderect(rect2) and pygame.sprite.collide_rect(rect1, rect2), but they don't find the individual side collisions.","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":1087,"Q_Id":43522463,"Users Score":3,"Answer":"Never mind, I found the answer. if rect1.rect.bottom >= rect2.rect.top and rect1.rect.bottom <= rect2.rect.bottom:","Q_Score":2,"Tags":"python,pygame,collision","A_Id":43522823,"CreationDate":"2017-04-20T14:31:00.000","Title":"Pygame - Rect collision by side","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to move an image from its center using pygame. I loaded the image using pygame but I have the top corner coordinates of the image. how do i get the coordinates of center.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1167,"Q_Id":43549448,"Users Score":0,"Answer":"You can also query the size of the image. Adjust the corner coordinates by half of the size in each direction.","Q_Score":0,"Tags":"python,image,pygame","A_Id":43549524,"CreationDate":"2017-04-21T18:13:00.000","Title":"Finding the position of center using pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a pong game in code skulptor, i have created an exit game button, but i need some sort of function to exit the whole entire game. The pong game is complete and this is the only feature left, thanks for all the help in advance as i'm rather new to python :)","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":513,"Q_Id":43551724,"Users Score":1,"Answer":"Use exit(). It's compatible with both Codeskulptor and normal Python so you can implement it in other programs in and out of Codeskulptor too.","Q_Score":0,"Tags":"python,codeskulptor","A_Id":65641998,"CreationDate":"2017-04-21T20:45:00.000","Title":"How to exit a simplegui frame in codeskulptor?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using the Pi3 and the last jessie-lite OS, and I want to manage the brightness of the screen like Kodi does with the dim screensaver. \nAfter some google searching I found some tips but nothing works.\nI'll be using an external light sensor and I want to manage the brightness proportionally at the value sent by the light sensor.\nFor the moment, I develop in Python2.7 but the issue can use another language or by shell.\nThank you very much!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":678,"Q_Id":43651565,"Users Score":0,"Answer":"ideally what you want would have been for the Kodi json api to support setting the screensaver, from what I understand it doesn't.\nthat said if your familiar with Python, and I'm not, you can develop a plug in that opens a socket (or communicates otherwise) with your program running on your pi, because from what I understand plugins have the ability to set the screensaver.\nin other words, make a plug in that sends and receives message to and from the pi. \nthis is not really an answer because im not familiar with creating Kodi plugins, but I know it's possible because there are other plugins that do it...","Q_Score":1,"Tags":"python,raspberry-pi,screen,light,kodi","A_Id":43728785,"CreationDate":"2017-04-27T07:43:00.000","Title":"Dim a display with a raspberry","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I think cocos2d-x should support python because it is a project forked from cocos2d. But according to their website, the only scripted languages they support are javascript and lua. So does it support python or not? If not, why?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1099,"Q_Id":43669707,"Users Score":1,"Answer":"No it does not support python. Currently python is only used for compiling and generating in cocos2d-x. C++ and javascript are the best languages to develop with cocos2d-x, lua's documentation is poor and few developers are using it.","Q_Score":1,"Tags":"python,cocos2d-x","A_Id":43671941,"CreationDate":"2017-04-27T23:48:00.000","Title":"Does cocos2d-x support python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I think cocos2d-x should support python because it is a project forked from cocos2d. But according to their website, the only scripted languages they support are javascript and lua. So does it support python or not? If not, why?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1099,"Q_Id":43669707,"Users Score":2,"Answer":"No, you can't use python. You can use C++, javascript and Lua for development.\nCocos2d-x is a port of an Objective-C library which itself was a port of a Python library.\ncocos2d, written in python language comes in starting of 2008 and after that in mid 2008 due to popularity of iphone, Cocos2D was ported to ObjectiveC for use on iOS. During the end of 2010 cocos2d-x comes that is written in C++ language.","Q_Score":1,"Tags":"python,cocos2d-x","A_Id":43677712,"CreationDate":"2017-04-27T23:48:00.000","Title":"Does cocos2d-x support python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Our task is to create a turtle that always stays within a rectangle.\nIt would be really great if you could show me how I can make a turtle run away from a line another turtle has created.\nPlease don't fix the problem for me.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":220,"Q_Id":43866696,"Users Score":0,"Answer":"First, you need the bounds of the rectangle in some form -- it can be the lower left position plus a width and height or it can be the lower left position and the upper right position, etc. (It could even be the formulas of the four lines that make up the rectangle.)\nThen write a predicate function that tests if an (x,y) position is fully within the rectangle or not. You can simply do a series of comparisons to make sure x is greater than the lower left x and less than the upper right x, and ditto for y. Typically returning True or False.\nIf the predicate returns False, indicating you've touched or crossed some line of the rectangle, then turn around and go in the opposite direction (or some other recovery technique.) You can also consider first using turtle's undo feature to eliminate the move that made you touch the line.\nIf you'd like example code that does the above, please indicate such.","Q_Score":1,"Tags":"python-3.x,turtle-graphics","A_Id":43875556,"CreationDate":"2017-05-09T09:56:00.000","Title":"How can I make a turtle not touch a line?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning Python through Pythonista on the iPhone. The first thing I did was make a simple touch-screen joystick (controller). Im starting to work on the actual game, but i don't know how to merge or overlay the 2 scenes. (One is the actual game, the other is the controller I made in another file.) I have already tried importing and running it, but it seems like only 1 could be run at once, the controller file or the game file. Any help is appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":528,"Q_Id":43896486,"Users Score":0,"Answer":"Instead of putting the joystick on a separate scene, you should draw it on a scene.Node. Then in your game scene, you can add it like another sprite, using Scene.add_child().\nTo convert the touch positions to the nodes coordinate system, you can use Node.point_from_scene(), and to convert back to the scene\u2019s coordinate system, you use Node.point_to_scene()","Q_Score":0,"Tags":"python,2d-games,pythonista","A_Id":48909025,"CreationDate":"2017-05-10T15:12:00.000","Title":"Running multiple scenes in Pythonista","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How many instances of pygame.Surface is it reasonable to use simultaneously?\nMore precisely, how costly is it to:\n\nHold a surface in memory?\nBlit a surface onto another?\n\nConsequently, how many surfaces can be kept in a list (or any other container), and how many surfaces can be blitted at every frame, with respect for other operations related to the application?\n\nSince this might be too broad, here is a concrete situation. I want to make an animated background, with repeating patterns. I want every element of the pattern to move independently, so I use one surface for each of them.\nIf I want to display one hundred elements, is it still acceptable to use one surface per element?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":43924479,"Users Score":2,"Answer":"I've made games that have had arrays with over ten thousand surfaces in it. It ran just fine. You shouldn't be afraid to use a lot of surfaces, go crazy.\nIf you've ever seen the game Don't Starve, I was making a game similar to it. I had fifteen different biomes, and I had multiple ground tiles for each biome for variation. That alone pushed it over 100 surfaces. I then had a bunch of different plants, like trees, berry bushes, carnivorous happyplants, etc. There was a large variety of these, and you could have a hundred of them loaded at one time in some locations. Again, each of these had variations. I also had many moving entities, like giant spiders and stuff like that. Some types of entities required over a hundred surfaces, just for all the animations that might occur from their variety of possible actions.\nAll in all, I probably had a maximum of a thousand surfaces being displayed at one time, and over twenty thousand loaded. The game worked just fine, and it would even run at 60 fps; but not without the extensive use of threads, as expected.\nThe conclusion: Assume there is no limit, because there may as well not be any.","Q_Score":2,"Tags":"python,performance,pygame,pygame-surface","A_Id":43940127,"CreationDate":"2017-05-11T19:57:00.000","Title":"How many surfaces is reasonable?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using pygame and am using the code pygame.mouse.get_pos(), but need to turn this into two seperate strings: one where x = the x coordinate, and one where y = the y coordinate. Thanks for the help.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":899,"Q_Id":43928229,"Users Score":1,"Answer":"You can use map:\nx, y = map(str, pygame.mouse.get_pos())","Q_Score":1,"Tags":"python,pygame,cursor,coordinates,python-3.2","A_Id":43928789,"CreationDate":"2017-05-12T02:08:00.000","Title":"pygame.mouse.get_pos() into two separate strings","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm bringing you this issue: I'm trying to create a program to run in Windows using PyQT, to work on a pen drive. My idea is: I plug my pen drive, and everything that I need to run the program is there, including Python 3, PyQT, etc.. I don't want the user to install all the requirements, I just want one executable that install all the programs necessary and then, there will be the executable to open the program. Considering, of course, that Python 3 is not installed in this Windows Machine\nJust wondering how can I do it? Do you guys have any idea? \nThanks, \nGus.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":322,"Q_Id":43939873,"Users Score":0,"Answer":"Just an idea - not sure if that would work under your specific conditions (PyQT etc), but couldn't you run it from the pen drive directly? As in create a Python virtual environment (for example using venv, with all the dependencies) on the pendrive and then call your program using the python interpreter in the installed virtual environment.\nOr use the virtual environment and it's interpreter to install the dependencies?","Q_Score":0,"Tags":"python,windows","A_Id":43940430,"CreationDate":"2017-05-12T14:11:00.000","Title":"Creating a \"pen drive program\" with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to understand what eventlet.tpool is useful for. The docs say that tpool.execute() lets you take a blocking function and run it in a new thread. However, the tpool.execute() method itself blocks until the thread is complete! So how is this possibly useful? If I have some blocking\/long running function myfunc() and call it directly, it will block. If I call it inside tpool.execute(myfunc) then the tpool.execute(myfunc) call will block. What exactly is the difference? \nThe only thing I can guess is that when myfunc() is called directly, it not only blocks this coroutine but also prevents other coroutines from running, while calling tpool.execute() will block the current coroutine but somehow yields so that other coroutines can run. Is this the case? Otherwise I don't see how tpool can be useful.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1179,"Q_Id":43947405,"Users Score":5,"Answer":"You wrote the answer yourself, I can only rephrase it.\nWith regard to Eventlet, Gevent, Twisted, Asyncio and other cooperative multitasking libraries we use term \"blocking\" to denote that it blocks everything. Unpatched time.sleep(1) will block all coroutines\/greenthreads as opposed to OS threads semantics where it would only block caller OS thread and allow other OS threads to continue.\nTo differentiate things that block OS thread from things that block coroutine\/greenthread we use term \"yielding\". A yielding function is one that allows execution to rest of coroutines, while blocking (due to Python execution semantics) only caller coroutine.\nArmed with that powerful terminology, tpool.execute() turns blocking call into yielding one.\nCombined with eventlet.spawn(tpool.execute, fun, ...) it would not block even the caller coroutine. Maybe you find this a helpful combination.\nAnd patches are always welcome. Eventlet is a great library because it contains combined effort of many great people.","Q_Score":2,"Tags":"python,multithreading,coroutine,eventlet","A_Id":43962169,"CreationDate":"2017-05-12T22:42:00.000","Title":"How is eventlet tpool useful?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there some sort of backward compatibility with the pyuic5 shell command?\nI updated to pyQt5 a while ago, but I have a few projects running with pyQt4 on a separate python 3.4 environment. Unfortunately the pyuic4 shell command is now unavailable.\nHow can I convert .ui files to pyQt4 compatible code?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":350,"Q_Id":43965401,"Users Score":0,"Answer":"PyQt5 is not compatibile with PyQt4, hence pyuic5 is also not backward compatible. \nYou can install pyqt4-dev-tools package on a debian based system which includes the pyuic4 utility","Q_Score":0,"Tags":"python-3.x,pyqt5,pyuic","A_Id":43965546,"CreationDate":"2017-05-14T15:01:00.000","Title":"pyuic5 backward compatibility","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to create a dialog with wx.Dialog.\nI have two questions on that.\nDo I have to set a wx.Frame as a parent window or can I use my wx.Dialog as the main window?\nAre the Sizers usables in a wx.Dialog without parent?\nThank you for your answers.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":137,"Q_Id":43968046,"Users Score":0,"Answer":"Yes you can. Pass None as the parent. This should have no impact on sizer behavior. Just be sure to destroy the dialog after it closes to prevent an orphaned dialog.","Q_Score":0,"Tags":"wxpython","A_Id":43990763,"CreationDate":"2017-05-14T19:33:00.000","Title":"Basic questions about wx.Dialog","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a small tkinter game that uses turtle for graphics. It's a simulation of the Triangle Peg Game from Cracker Barrel that is able to tell the player the next best move to make at any point in the game, among other features. Pegs are just instances of a subclass of turtle.RawPen, and I keep plenty of plain instances of RawPen around to draw arrows representing moves.\nI noticed that when I restart the game (which calls turtle.bye()) to kill the turtle window, that memory consumption actually increases, as turtles don't seem to be deleted. Even if I call window.clear() beforehand, which clears _turtles in window.__dict__, there are still references to the turtles. I ensured that all the references that I make to them are deleted during restart, so that's not the issue. Is there any way to truly delete a turtle so it can be garbage collected?","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":19821,"Q_Id":43972351,"Users Score":2,"Answer":"Deleting all my references to objects in the canvas (including, of course, the TurtleWindow) and then destroying the canvas with canvas.destroy() did the trick. Perhaps there are other solutions, but this was the best that I could think of. I appreciate everyone's help, as it will serve me well in the future, at least with objects not created using the turtle API.","Q_Score":9,"Tags":"python,turtle-graphics","A_Id":44012869,"CreationDate":"2017-05-15T05:52:00.000","Title":"How to fully delete a turtle","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started to to something with opengl in pygame, but I'm stuck at the point where gluLookAt takes world coordinates to orient the camera, but I want to move the camera with the mouse, so I have values like \"mouse moved 12 pixels to the right\".\nAt the moment I have gluLookAt(player_object.x, player_object.y, player_object.z, lookat_x, lookat_y, -100, 0, 1, 0) but I don't know how to convert the movement of the mouse to these coordinates.\nMaybe someone knows the answer or a formula to convert it. (I use python, but I think it's easy to port code or just a formula)","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":198,"Q_Id":43988174,"Users Score":1,"Answer":"You need to compute the player forward vector:\nThe forward vector is the vector that points in the forward direction seen from the player's eyes - it tells you in which direction the eyes of the player are looking.\nThe local forward vector (I call it lfw for now) is probably (0,0,1) because you specified the y axis as \"up\".\nThe world forward vector (called wfv for now) is: (rotationMatrix * lfw); \nThat is the direction which the player is looking at in world coordinates because you multiplied it with the players rotationMatrix.\nThe final lookAt position is: position + wfv ( means: make one step from position in the forward direction --> yields the point after you took the step.)\nHope this helps a bit","Q_Score":0,"Tags":"python,opengl,math,pygame","A_Id":43988562,"CreationDate":"2017-05-15T20:22:00.000","Title":"opengl gluLookAt with orientation in degrees instead of coordinates","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can gtk filechooser set to be folder-restricted?\nA normal filechooser will display all folder files tree starting from \/ (root), what I need is, to allow filechooser displaying only from \/media folder only. So, the top visible folder is only \/media, not everything else like \/home, \/usr, etc.\nThank you for all your kindly help.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":518,"Q_Id":44023311,"Users Score":0,"Answer":"Limiting directory changes isn't directly available in FileChooser, but there are a few ways:\n\nYou can define file filters (Gtk.FileFilter) but those basically filter on the file extension (or mime type).\nMore interesting is that, when changing the folder, a signal is emitted called 'current_folder_changed'. So, you could bind a function to that signal and take action. Mind: if you programmatically change the folder as a result of this signal, the signal will probably be called again, so you have to temporarily block the signal while doing that.","Q_Score":0,"Tags":"python,ubuntu,gtk,gtk3","A_Id":44053546,"CreationDate":"2017-05-17T11:16:00.000","Title":"Python gtk3 filechooser restrict folder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I am trying to make a program in c++, but i cant make the program because in one part of the code I need to run a python program from c++ and I dont know how to do it. I've been trying many ways of doing it but none of them worked. So the code should look sometihnglike this:somethingtoruntheprogram(\"pytestx.py\"); or something close to that. Id prefer doing it without python.h. I just need to execute this program, I need to run the program because I have redirected output and input from the python program with sys.stdout and sys.stdin to text files and then I need to take data from those text files and compare them. I am using windows.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":362,"Q_Id":44023863,"Users Score":0,"Answer":"There's POSIX popen and on Windows _popen, which is halfway between exec and system. It offers the required control over stdin and stdout, which system does not. But on the other hand, it's not as complicated as the exec family of functions.","Q_Score":0,"Tags":"python,c++,python-3.x,c++11","A_Id":44025218,"CreationDate":"2017-05-17T11:41:00.000","Title":"How to run a python program from c++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm doing a project for a year 11 physics class and I'm trying to make a battery that generates electrons. This is the code:\nelectron = sphere(radius = 1, color = color.yellow, vel = vec(-1,0,0));\nwhile battery.voltage > 0:\n eb = electron.clone(pos=vec(0,0,0), vel = vec(-1,0,0));\nI'm trying to make \"eb\" constantly, but it only applies eb.pos = eb.pos + eb.vel * deltat; apply to a the first electron. Is there any way to do this without making 600 different electron objects?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":86,"Q_Id":44033590,"Users Score":0,"Answer":"You could change the attribute that is modified directly to the electron object instead of creating it all the time. Apply the modifications to electron and add the computing action in the while. Is it what you meant?","Q_Score":0,"Tags":"vpython","A_Id":44033675,"CreationDate":"2017-05-17T19:47:00.000","Title":"making objects constantly in a while loop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Okay, so I'm using Pygame, and I created a code that tracks the mouse on my Pygame display. However, when I pull up another window over the Pygame one, it stops tracking the mouse position. I was wondering, is there any way to continue tracking the mouse even when my Pygame window is not the active one?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":61,"Q_Id":44034748,"Users Score":1,"Answer":"Okay, so I figured it out. I was going about it the wrong way.\npygame.mouse.get_pos()\nis what I was using, and that only tracks the position of the mouse on the Pygame surface created. So if there's another window there, the mouse isn't actually on the Pygame surface. I ended up installing the module \"win32api\" and using\nimport win32api\nmouse = win32api.GetCursorPos()\nx1 = mouse[0]\ny1 = mouse[1]\nfor the x and y coordinates of the mouse position on the computer display. I realized afterward that there were questions answering what I needed to know, I just wasn't asking quite the right question.","Q_Score":2,"Tags":"python,python-3.x,pygame","A_Id":44073263,"CreationDate":"2017-05-17T21:05:00.000","Title":"Continue tracking mouse with Pygame even when Pygame window isn't active","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The question I have is, is it possible to run a Pymunk simulation without having the screen to visualize it pop up? \nI'm working on a research project that involves Pymunk and Pygame. The goal is to develop an agent that can infer certain properties about physics simulations involving objects and agents within the Pymunk space.\nPart of the project requires a comparison of many different simulations and the fact that a screen pops up so I can view each simulation causes the problem to take too much time (as I have to view each sim before being able to collect the data from it).\nI'd like to basically run each sim in the background as fast as possible to just collect the physical data. There is no need for me to actually visualize the simulations at certain points.\nLet me know if I've been clear enough or this is a duplicate. Though, I searched for an answer here, I have not found one.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":269,"Q_Id":44035526,"Users Score":2,"Answer":"Pymunk itself doesn't depend on any visualization. You move the simulation forward with the space.step method, and you can call it as many times as you want, for example 1000 times with a dt of 0.1 to move the simulation forward 100 units (seconds).\nIf you want to see something you have the option to read out the state and draw it at that time. \nThe pygame integration provided with pymunk is just for those that want an quick and easy way to get something on screen. If you don't want anything drawn you absolutely not need to use it. \nJust be aware that it is not the same to call space.step 100 times with a dt of 0.01 and calling it with a dt of 1 (the later will give a much less accurate simulation)","Q_Score":1,"Tags":"python,pygame,artificial-intelligence,simulation,pymunk","A_Id":44059670,"CreationDate":"2017-05-17T22:06:00.000","Title":"Possible To Run Pymunk Simulation Without Screen (as in without actually seeing it)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I create an .exe file by cx_freeze and copy all the .dll file I can find to the folder which includes that .exe.\nThe problem is I can run the .exe on my computer perfectly but can't run on another computer by using the same folder. I have tried 3 different computers and all pop up the error message \"This application failed to start because it could not find or load the Qt platform plugin \"windows\" in \"\".\"\nIt really confuses me why the problem exists on another computer but doesn't exist on mine.","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":12076,"Q_Id":44040630,"Users Score":18,"Answer":"I solved it by copy and paste \"platforms\" folder to the .exe folder. In my case, because I have installed Anaconda IDE, the path of this folder is Anaconda3\/Library\/plugins\/platforms.\nHope this will help you.","Q_Score":5,"Tags":"python,windows,qt,python-3.6,cx-freeze","A_Id":44041557,"CreationDate":"2017-05-18T06:54:00.000","Title":"Could not find or load the Qt platform plugin \"windows\" -- cx_freeze(.exe)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I create an .exe file by cx_freeze and copy all the .dll file I can find to the folder which includes that .exe.\nThe problem is I can run the .exe on my computer perfectly but can't run on another computer by using the same folder. I have tried 3 different computers and all pop up the error message \"This application failed to start because it could not find or load the Qt platform plugin \"windows\" in \"\".\"\nIt really confuses me why the problem exists on another computer but doesn't exist on mine.","AnswerCount":2,"Available Count":2,"Score":0.2913126125,"is_accepted":false,"ViewCount":12076,"Q_Id":44040630,"Users Score":3,"Answer":"I ran into the same error and solved it with a different method than those mentioned in other posts. Hopefully this will help future readers.\nBUILD:\nWindows 10 (64bit) Minicoda (using python 3.9.4) (pkgs are from conda-forge channel) pyqt 5.12.3\nVScode 1.56.2\nMy scenario:\nI was building a GUI application for some embedded work. I had two machines that were used for development (same OS and architecture), one had zero internet connection. After packaging up my environment and installing on the offline machine, I ran into the error that you got.\nSolution:\nlocate the qt.conf file in your conda environment. for me: C:\\Users\"name\"\\miniconda3\\envs\"env_name\"\\qt.conf\nMake sure the paths are correct. I needed to update the \"name\" as this was left over from the old machine.\nHopefully this helps someone.","Q_Score":5,"Tags":"python,windows,qt,python-3.6,cx-freeze","A_Id":67828390,"CreationDate":"2017-05-18T06:54:00.000","Title":"Could not find or load the Qt platform plugin \"windows\" -- cx_freeze(.exe)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a frame around the area that is selected (it contains Qlabel), and a frame around the buttons\/objects by the bottom of the screen. I want my screen to STAY this ratio even if I drag it out or upload a very large image to Qlabel. How do I do this? I tried messing around with the \"minimum size\" for the bottom frame but that did nothing.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":54,"Q_Id":44165218,"Users Score":1,"Answer":"On Qt Designer, check the \"scalable\" feature in Qlabel.\nAlso to make it expandable, make sure you properly set the layout of the frame.","Q_Score":1,"Tags":"python,user-interface,pyqt,qt-creator,qt-designer","A_Id":44184047,"CreationDate":"2017-05-24T17:38:00.000","Title":"How to stop image from being pushed off screen?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a GUI interface that will be using a 7\" touch display with a raspberry pi 3. I want the GUI to take the place of the desktop, I do not want it displayed in a window on the desktop. any thoughts on how to do that. I have read the raspberry pi documentation to edit the rc.local script to start the application at login, but I can not figure out how to set up the python GUI with out creating a window","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":737,"Q_Id":44186905,"Users Score":0,"Answer":"Your pi boots up and displays a console - just text - by running a program (getty). Then you run another application called a graphical display manager which then runs a window manager. On a pi it is usually gnome but there are many others,.. this window manager is what displays your GUI window. What you want is obviously possible, it is just that it is non-trivial to do. What you are talking about is either kiosk-mode application still running 'on the desktop' as you say but which obscures the desktop completely and does not allow you to switch or de-focus or an even more complicated JeOS like Kodi\/XBMC bare metal installation running without your current window manager. Your python would have to do the job of the display manager and the window manager and it would be very, very slow. \nUse a really light window manager and go kiosk mode. Or you could go with text! There are libraries eg ncurses but I'm not sure how that would work with your touch screen display.","Q_Score":1,"Tags":"python,user-interface,raspberry-pi3","A_Id":44188711,"CreationDate":"2017-05-25T17:55:00.000","Title":"how to replace the desktop interface with a python application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm implementing a recycleview in kivy. It is possible have multiple (one or more) viewclass depending the dataset data? i would like to have in the same list multiple layouts (eg. one line viewclass1 (one label and two buttons) and another line viewclass2 (one label and two TextInput). Thank you.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1077,"Q_Id":44227380,"Users Score":0,"Answer":"I don't think you can have lines with different viewclasses in a single RecycleView. RecycleView ,by design, has only one viewclass because it is meant for a large collection of homogeneous items.\nFor what you are looking for the most straightforward way is probably to use ScrollView and to define a custom add_line(self, type): function to dynamically add each line specifying the type.","Q_Score":2,"Tags":"python,layout,kivy,kivy-language","A_Id":55109529,"CreationDate":"2017-05-28T12:35:00.000","Title":"multiple viewclass (Kivy - Recycleview)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm implementing a recycleview in kivy. It is possible have multiple (one or more) viewclass depending the dataset data? i would like to have in the same list multiple layouts (eg. one line viewclass1 (one label and two buttons) and another line viewclass2 (one label and two TextInput). Thank you.","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1077,"Q_Id":44227380,"Users Score":1,"Answer":"You can create a widget that extends a layout and then you could add the widgets you need programmatically.","Q_Score":2,"Tags":"python,layout,kivy,kivy-language","A_Id":44798573,"CreationDate":"2017-05-28T12:35:00.000","Title":"multiple viewclass (Kivy - Recycleview)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know, that's a long title. However any shorter title would be a duplicate of the tons of other questions of this kind here on StackOverflow.\nI am searching for a scripting language I could embed into my Android application. The user would write a script. Later on I trigger a specific function of this script and process its returned result. The triggering and processing should run without any console - like - gui just in the background while the user is viewing a beautiful android activity. This is what I would like to achieve. However I did not find a language for Android that suits my needs. It should be:\n\nEasy (like Python, etc.)\nProvide direct access to popular android\/java methods (like sl4a does with the Android() module)\nlightweight (as far as possible)\nThere must be a way to call the script (or if not possible, a function defined in the script) and get the returned value from Java\nwould be good, if the language had a good documentation\n\nI found no language, which suits all my needs.\nI found:\n\ndeelang - no built-in access to popular Android SDK methods and bad documentation\nsl4a - I found no way to embed it directly into my app. I cant let the user download the sl4a app. I don't know whether I can get the result of a script and pass paramaters to it.\nandroid-python27 - bad documentation, same as sl4a\nrhino - does not provide built-ins to access popular Android SDK methods\nandrolua - bad documentation, I don't know whether it provides built-in access to the Android SDK\n\nIs there really no language available that suits my needs? Wouldn't we need a language like it which is easy to embed?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":511,"Q_Id":44230567,"Users Score":1,"Answer":"I finally found a project which fits to my needs: BeanShell (beanshell.org) .\nIt is Java-like but more easy. It has direct access to Java libraries and sharing variables between the host app and the script is very easy. It is lightweight. It is quiet popular and has a good documentation (even for android purposes)","Q_Score":1,"Tags":"android,python,scripting,embed","A_Id":44276418,"CreationDate":"2017-05-28T18:22:00.000","Title":"Embeddable Easy Lightweight Scripting Language with direct bindings to java for Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've just started learning python few days ago and I'd like to know how to simulate mouse movements inside games that have forced mouse coordinates.\ndirectx environments?\nI've currently tested pyautogui, ctypes, wxpython. I've also tried using directpython11 but I've had trouble installing it, ton of dll errors.\nCan't find any topics helping with this in google, lots of pages on how to click or write in these kinds of cases but nothing about moving the mouse.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1950,"Q_Id":44233219,"Users Score":1,"Answer":"Found a perfect solution, it will require some extra stuff to run but its the shortest way. \nHaven't found anyone who actually knows how to simulate mouse but decided to ask Sentdex for help and he recommended using vJoy to simulate controller.\nSo you need to simulate a controller instead of mouse by using a combination of vJoy(controller driver) and FreePIE(Input emulator). \nAfter doing some research, for my purpose the best solution for moving on the axis(x,y) is to bind controller (x,y) axis movements to keyboard shortcuts(E.g. W.A.S.D) and make the main script to press these shortcuts, if I'm looking in the wrong direction. \ntl;dr Simulate controller. NEED: vJoy, FreePie","Q_Score":1,"Tags":"python,directx,mouseevent,mouse,mousemove","A_Id":44331240,"CreationDate":"2017-05-29T00:21:00.000","Title":"How to simulate mouseMovement in-game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to lay a grid on top of a pack? I ask this because I am trying to make an interactive map. I want a background image to take up the entire window and then place buttons on top of it in specific locations. The grid makes it is easy to place the buttons where they need to go, but I cannot get the background image to work properly unless I use a pack. Then I cannot easily place the buttons where I would like for them to go (they need to go over the top of specific places on a map i.e. buildings)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":355,"Q_Id":44271088,"Users Score":0,"Answer":"\"overlay a grid on top of pack\" makes no sense. Tkinter has neither a grid nor a pack object. grid and pack are functions. \nAs functions, you can not use them both to manage widgets that have a common parent. \nSince your goal is to have a background image, the simplest solution is to use a label rather than a frame. You can call grid to arrange widgets inside a label in exactly the same way that you arrange widgets inside a frame. The benefit of using a label is that you can give it an image. \nAnother option would be to continue to use your frame, and then use place to add your background image to the frame. place does not share the same limitation as grid and pack since it doesn't affect the geometry of the parent widget.","Q_Score":0,"Tags":"python,tkinter","A_Id":44272087,"CreationDate":"2017-05-30T20:12:00.000","Title":"overlay grid on top of pack","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I get a ximgproc_DisparityWLSFilter from cv2.ximgproc.createDisparityWLSFilter(left_matcher),\nbut I cannot get ximgproc_DisparityWLSFilter.filter() to work.\nThe error I get is \n\nOpenCV Error: Assertion failed (!disparity_map_right.empty() && (disparity_map_right.depth() == CV_16S) && (disparity_map_right.channels() == 1)) in cv::ximgproc::DisparityWLSFilterImpl::filter, file ......\\opencv_contrib\\modules\\ximgproc\\src\\disparity_filters.cpp, line 262\n\nIn general, how do I figure out how to use this, when there isn't a single google result for \"ximgproc_DisparityWLSFilter\"?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2604,"Q_Id":44276962,"Users Score":0,"Answer":"Unlike c++, Python doesn't work well with pointers. So the arguments are \nFiltered_disp = ximgproc_DisparityWLSFilter.filter(left_disp,left, None,right_disp)\nNote that it's no longer a void function in Python!\nI figured this out through trial and error though.","Q_Score":2,"Tags":"python,opencv,disparity-mapping","A_Id":44306111,"CreationDate":"2017-05-31T06:10:00.000","Title":"What are the ximgproc_DisparityWLSFilter.filter() Arguments?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to to extract text from a screenshot taken from a game window in python. So far, I have been using tesseract (pytesseract) but while the recognigion itself is great, the performance is not optimal.\nAs I have read that tesseract is best used for high resolution images, I'm wondering if there is a better (faster) way?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":2713,"Q_Id":44308060,"Users Score":-1,"Answer":"Usually pytesseract is effective only for high resolution images. Certain morphological operations such as dilation, erosion, OTSU binarization can help increase in pytesseract performance.","Q_Score":2,"Tags":"python,ocr,tesseract,python-tesseract","A_Id":50696761,"CreationDate":"2017-06-01T12:50:00.000","Title":"Is there an alternative to (py)tesseract for extracting text from game screenshots?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I run any script in QPython, it runs in a console then I get prompted \"Press enter to exit\", but I want to interact with my just-run script instead of exiting. Is there any configuration option to control this behavior?\nDoes it have anything to do with the <&& exit> option displayed at the top of the console?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1007,"Q_Id":44335053,"Users Score":0,"Answer":"try the following code\nImport os\nos.system(\"sh\")","Q_Score":1,"Tags":"qpython3","A_Id":45024399,"CreationDate":"2017-06-02T18:10:00.000","Title":"QPython prompts \"Press enter to exit\" after running script. How to interact with console instead?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I run any script in QPython, it runs in a console then I get prompted \"Press enter to exit\", but I want to interact with my just-run script instead of exiting. Is there any configuration option to control this behavior?\nDoes it have anything to do with the <&& exit> option displayed at the top of the console?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1007,"Q_Id":44335053,"Users Score":0,"Answer":"I know it is a very old post, but I had the same problem:\nYou need to switch your keyboard to word based instead of character based.\n(Enter the three points- preferences-input method-word based) Then you receive a keyboard with an enter-sign. \nPress enter and it exits.","Q_Score":1,"Tags":"qpython3","A_Id":51234532,"CreationDate":"2017-06-02T18:10:00.000","Title":"QPython prompts \"Press enter to exit\" after running script. How to interact with console instead?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I run any script in QPython, it runs in a console then I get prompted \"Press enter to exit\", but I want to interact with my just-run script instead of exiting. Is there any configuration option to control this behavior?\nDoes it have anything to do with the <&& exit> option displayed at the top of the console?","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":1007,"Q_Id":44335053,"Users Score":0,"Answer":"If you want to access the console, you could try to raise an exception.","Q_Score":1,"Tags":"qpython3","A_Id":46437687,"CreationDate":"2017-06-02T18:10:00.000","Title":"QPython prompts \"Press enter to exit\" after running script. How to interact with console instead?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I understand that a few others have asked similar questions although i cant find any that match my specific issue so please be gentle.\nMy issue is every display i use results in my Tkinter display completely changing and im having to reposition and resize everything again through trial and error which is massively time consuming. Is there an easy way around this? I've used place and pixel sizes in the script so i think its everytime the resolution changes im having to start over.\nAnyway I thought i set the resolution to the Rpi touchscreen and built the GUI to that. However, now i've bought the touchscreen the GUI isn't even close to fitting it. \nI'm not that keen on having to resize and reposition everything again so if there is an easy way to achieve what i'm after i'd be grateful if someone could share it. If not, i'll just have to get on with it.\nCheers\nchris","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":383,"Q_Id":44356350,"Users Score":1,"Answer":"The problem is that you are using place. place should be avoided for exactly this reason. If you learn to use grid and pack properly, and do not call pack_propagate(0) or grid_propagate(0) unless you are certain it is the only solution to your problem, tkinter will do a fantastic job of adapting to different screen resolutions, font sizes, and user preferences.\nIn other words, the answer to \"[is there] an easy way to achieve what I'm after\" is \"use grid and pack, and avoid place\".","Q_Score":0,"Tags":"python,python-3.x,user-interface,tkinter,raspberry-pi2","A_Id":44356705,"CreationDate":"2017-06-04T16:37:00.000","Title":"Tkinter Screen Change as Altered Display - Easy way to rectify?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I understand that a few others have asked similar questions although i cant find any that match my specific issue so please be gentle.\nMy issue is every display i use results in my Tkinter display completely changing and im having to reposition and resize everything again through trial and error which is massively time consuming. Is there an easy way around this? I've used place and pixel sizes in the script so i think its everytime the resolution changes im having to start over.\nAnyway I thought i set the resolution to the Rpi touchscreen and built the GUI to that. However, now i've bought the touchscreen the GUI isn't even close to fitting it. \nI'm not that keen on having to resize and reposition everything again so if there is an easy way to achieve what i'm after i'd be grateful if someone could share it. If not, i'll just have to get on with it.\nCheers\nchris","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":383,"Q_Id":44356350,"Users Score":0,"Answer":"You probably want to utilize the width and height aspects of your screen, and make your program relative to those instead of making everything fixed\/static.\nYou can do this by calling winfo_width() or winfo_height() on your widget to get it's size. After you have this, instead of making an oval at 200 pixels if your screen is 400 pixels in width, you can make it relative, i.e. at width\/2 (if you declare winfo_width()as a variable).","Q_Score":0,"Tags":"python,python-3.x,user-interface,tkinter,raspberry-pi2","A_Id":44356396,"CreationDate":"2017-06-04T16:37:00.000","Title":"Tkinter Screen Change as Altered Display - Easy way to rectify?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to step through some code using Spyder (Python 3.6) but I keep getting the below error: \n\nModuleNotFoundError: No module named 'PyQt4'\n\nI have googled it and looked through Stack Overflow, but none of the possibilities seem to work.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1265,"Q_Id":44376527,"Users Score":0,"Answer":"Qt4 is no longer supported in Anaconda, so no new packages were created for Python 3.6.\nYou could use a community channel called conda-forge to install PyQt4 for Python 3.6. However, that channel is not supported nor associated with Continuum (the company behind Anacoda).","Q_Score":0,"Tags":"python,pyqt4,spyder","A_Id":44401170,"CreationDate":"2017-06-05T19:44:00.000","Title":"How to get PyQt4 working with Spyder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying figure out whats wrong with my PyQt5 install, I've looked at all the documentation and I should be able to use placeHolderText and setPlaceHolderText() but it doesn't look like it does. The QtWidgets.QLineEdit() works and shows up on my gui but can get it to setPlaceHolderText. Also QLayout.setFixedSize also returns the same error. Importing PyQt5 doesn't return any errors so these should work too.\nI installed PyQt5 through pip3 on python 3.5.2, has anyone had this issue before, I'm not sure what I've done wrong.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":847,"Q_Id":44406663,"Users Score":0,"Answer":"so umm... sightly embarrassing, \nsetPlaceHolderText() is suppose to have a lowercase h -> setPlaceholderText()\nand QLayout.setFixedSize is suppose to have uppercase S -> SetFixedSize()","Q_Score":0,"Tags":"python,qt,pyqt5,qlineedit,qtwidgets","A_Id":44407346,"CreationDate":"2017-06-07T07:50:00.000","Title":"PyQt5 5.8.2 QLineEdit has no attribute 'setPlaceHolderText'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"C++ part\nI have a class a with a public variable 2d int array b that I want to print out in python.(The way I want to access it is a.b)\nI have been able to wrap the most part of the code and I can call most of the functions in class a in python now.\nSo how can I read b in python? How to read it into an numpy array with numpy.i(I find some solution on how to work with a function not variable)? Is there a way I can read any array in the c++ library? Or I have to deal with each of the variables in the interface file.\nfor now b is when I try to use it in python\nps:\n1. If possible I don't want to modify the cpp part.\n\nI'm trying to access a variable, not a function. \n\nSo don't refer me to links that doesn't really answer my question, thanks.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":569,"Q_Id":44424308,"Users Score":0,"Answer":"You'll find that passing things back and forth between languages is much easier if you use a one-dimensional array in which you access elements using, e.g. arr[y*WIDTH+x].\nSince you are operating in C++ you can even wrap these arrays in classes with nice operator()(int x, int y) methods for use on the C++ side.\nIn fact, this is the internal representation which Numpy uses for arrays: they are all one-dimensional.","Q_Score":0,"Tags":"python,c++,arrays,numpy,swig","A_Id":44424756,"CreationDate":"2017-06-07T23:26:00.000","Title":"Reading c++ 2d array in python swig","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to write a Python script to automatically unzip lots of apk files and then do static analysis. However, when I unzip some apk files, unzip prompted that \"Press 'Q' to quit, or any other key to continue\". \nBecause it's a script and I haven't press any key then the script hangs. Any command option can solve this problem? Or do I have to handle it in Python? Thanks in advance :D","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":292,"Q_Id":44479568,"Users Score":0,"Answer":"I just ran into the same thing and figured out what's causing it. Turns out, if a zip file has a zip comment attached, it will be shown, along with a prompt that hangs your script.\nPassing -q to unzip will avoid showing the comment and any hangs, though you will lose the list of files being unzipped too. I haven't figured out how to just prevent the comment from showing up and not the rest of the stuff unzip prints.","Q_Score":1,"Tags":"python,unzip","A_Id":52304543,"CreationDate":"2017-06-11T01:25:00.000","Title":"Unzip prompted \"Press 'Q' to quit, or any other key to continue\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"In Python Tkinter, I have successfully made a keybind but it only\n works when I am clicked into the tkinter window.\n\nI want to be able to use the keybinds even when I am interacting with other programs even when they are full screen. (I am making an auto clicker and it is not possible to open the tkinter window and then click the key when you are mid game.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":125,"Q_Id":44533383,"Users Score":2,"Answer":"You cannot do what you want with tkinter. Tkinter bindings only work within windows created by tkinter.","Q_Score":1,"Tags":"python,python-3.x,tkinter,key-bindings","A_Id":44533510,"CreationDate":"2017-06-14T00:07:00.000","Title":"In Python Tkinter, I have successfully made a keybind but it only works when I am clicked into the tkinter window.","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On Mac, all widgets and canvas items appear of high quality on Retina display. However, on Windows 4K display, Tkinter has poor quality, and renders unnecessarily badly (pixelated) as if from 2009.\nHow do I fix the quality of Tkinter on Windows 10?\nI have tried using scaling, but this just makes all sorts of elements all sorts of different sizes.","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":1352,"Q_Id":44548176,"Users Score":4,"Answer":"What I usually do is that I import this module ctypes and type in ctypes.windll.shcore.SetProcessDpiAwareness(True). This will make the window of a higher quality.\nHope it works for you!","Q_Score":4,"Tags":"python,user-interface,tkinter,screen-resolution","A_Id":65176022,"CreationDate":"2017-06-14T14:53:00.000","Title":"how to fix the low quality of tkinter render","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to detect changes in files modified by another tcl\/python application.\nI used QFileSystemWatcher addPath for the files.\nIt does not emit fileChanged(QString) signal for changes in files.\nHowever, when I manually edit these files, fileChanged signal gets emitted and slot is executed.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":352,"Q_Id":44599119,"Users Score":0,"Answer":"Check that in your tcl\\python program you actually flush the data to the file using f.close() \\ f.flush() \\ using the 'with' statement.\nP.s.\nSometimes python waits until end of execution to actually write the data to the files. If this is what's happening here, the files won't be changed until the tcl\\python program ends its execution and thus the signal won't be emitted until then aswell.","Q_Score":1,"Tags":"python,c++,qt,user-interface,tcl","A_Id":44599173,"CreationDate":"2017-06-16T23:07:00.000","Title":"QFileSystemWatcher not emitting fileChanged signal for changes done by another application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Apologies for the long title. What I want to do is to be able to spawn a bullet to the left or right of the centre of an object, the player, which can turn in a full 360 degrees to the left and right. At the moment I am using x = hypotenuse * cos(player angle) and y = hypotenuse * sin(player angle). This works very strangely with it working while pointing upwards, with the bullet spawning on the right as intended, but as soon as it is angled downwards it starts spawning on the left.\nI have some teacher and we have done some playing around, however they have not been able to help too much as of yet.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":44621236,"Users Score":0,"Answer":"Ok guys, I am sorry, it turns out that I was giving the math.cosfunction degrees as opposed to radians. I did try giving it radians earlier, however for some reason it didn't work.","Q_Score":0,"Tags":"python,python-3.x,pygame,trigonometry","A_Id":44689124,"CreationDate":"2017-06-19T01:52:00.000","Title":"Making an object spawn to the left or right relative to another angled object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I noticed that the Text widget from tkinter is not present in the ttk widgets.\nI'm using the ttk instead of tkinter because its interface suits better.\nAnd I need Text widget because it has multiple lines unlikely the Entry widget.\nDoes anyone have a solution for my problem?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3708,"Q_Id":44658952,"Users Score":2,"Answer":"The solution is to use the tkinter text widget. tkinter and ttk are designed to work together.","Q_Score":1,"Tags":"python,tkinter,ttk","A_Id":44659737,"CreationDate":"2017-06-20T16:53:00.000","Title":"Python - Text widget from tkinter in ttk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a listbox, and I would like to have a progress bar inside each line of this listbox. Is there a simple way to do that, or do I have to rewrite the listbox class, or maybe override it ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":202,"Q_Id":44663086,"Users Score":1,"Answer":"There is no simple way. A listbox can only contain text. \nYou can fake it fairly easily with a text widget, since a text widget allows you to embed widgets. For each row you could insert the text, insert a progress bar, and then insert a newline.","Q_Score":0,"Tags":"python,tkinter,listbox","A_Id":44663142,"CreationDate":"2017-06-20T21:13:00.000","Title":"Customize tkinter listbox by adding progress bars","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a bot developer but I'm new to Python. I've been reading for hours now, planning the design of a new bot.\nI'd like your opinion on performance issues with running a GUI and a very fast core loop to keep a modest array of game entities updated.\nThe bot consists of a main array in an infinite loop which continually updates and also runs calculations. I know from my past bots that GUIs provide a problem with performance as they need to wait to detect events.\nI've looked at the possibility of a second thread, but I read that tkinter doesn't like more than one thread.\nI've checked out the idea of using .after to run the core array loop from the tkinter mainloop but my gut tells me that this would be bad practice.\nRight now I feel all I can do is try to contain the GUI and the core array all in one loop but this has never been good for performance.\nAre there better ways of designing the structure of this bot that I have not discovered?\nEdit\nI decided on removing the mainloop from tinker and simply using .update() to update any gui components I have, right now, this only consists of some labels which overlay the game screen.\nBoth the labels and the bot's functions run great so far.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":128,"Q_Id":44663094,"Users Score":1,"Answer":"Using tkinter and .after, I wrote a little single-threaded program that displays 1000 ovals that move randomly across the screen, updating every 50ms, and I don't see any lag. At 10ms I think I maybe see a tiny bit of lag. \nThese are simple objects with very little math to calculate the new positions, and there's no collision detection except against the edges of the window.\nThe GUI seems responsive. I am able to type into a text window in the same GUI as fast as I can. \nI don't know how that compares to what you want to do.","Q_Score":0,"Tags":"python,multithreading,python-3.x,user-interface,mmo","A_Id":44664163,"CreationDate":"2017-06-20T21:14:00.000","Title":"Python - Updating core array loop < 100ms and keeping the tkinter GUI responsive","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running Tkinter on a machine that has 3 monitors. Is there a way to specify which monitor (& the location on that monitor) to display my GUI?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":26,"Q_Id":44664221,"Users Score":3,"Answer":"The .geometry() method of the root (or any Toplevel) window is your interface to its size and position. Call it with no parameters to get a geometry string; you can then call the method with that string to set the window to the same place on the screen. For example, I get '200x200+5+28' for a small window on my main monitor, '200x200+2592+414' after moving it to the monitor on the right. (This is on Mac OS X, conceivably it works differently on other platforms.)","Q_Score":1,"Tags":"python,user-interface,tkinter","A_Id":44664589,"CreationDate":"2017-06-20T22:52:00.000","Title":"Tkinter: Issue with Multiple Montiors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to run a python script that uses a custom module written by someone else. I created that module by running CMake according to the creator's instructions. Running my python script, I get the error: ImportError: libopencv_imgproc.so.3.1: cannot open shared object file: No such file or directory. This error is caused by the module I created earlier.\nThere is no file of that name since I have OpenCV 3.2.0 installed, so in usr\/local\/lib there's libopencv_imgproc.so.3.2.0. I don't know how to fix this or where to start looking. The CMakeLists.txt of the module has a line \nfind_package(OpenCV 3 COMPONENTS core highgui imgproc REQUIRED).\nI tried changing it to \nfind_package(OpenCV 3.2.0 COMPONENTS core highgui imgproc REQUIRED), \nwithout success.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":430,"Q_Id":44705077,"Users Score":0,"Answer":"The problem was an old version of the module lurking an a different folder where the python script was actually looking. This must have been created in the past with an OpenCV 3.1 environment.","Q_Score":0,"Tags":"python,opencv,cmake","A_Id":44717895,"CreationDate":"2017-06-22T16:39:00.000","Title":"How can I force CMake to use the correct OpenCV version?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I was wondering if someone would be able to help shed a little light for me on something I am working on in Python.\nI am creating a program with a Tkinter GUI interface that interacts with a Serial device, and an ADC chip to measure voltage. I want to make sure I properly understand how I'm building the main program loop to keep everything running smoothly. I'm going to lay out how I think the program should run, if anyone has any corrections please throw them at me.\n\nProgram is run, GUI Interface initializes\nUser presses a button\nsend signal of button through serial\nmeasure\/display voltage levels\nperiodically update voltage display\nif button is pressed, return to step 3\n\nNow I know to run my Tkinter GUI I set up mainloop() as the last line of code. Now my question is simply, is that all I will need? Will mainloop() continually update while it waits for another button press, or will I essentially have to creatre an update method that cycles through everything until another button is pressed?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":60,"Q_Id":44706353,"Users Score":3,"Answer":"Will mainloop() continually update while it waits for another button press, or will I essentially have to creatre an update method that cycles through everything until another button is pressed?\n\nNot all. That's why you are using tk.Tk().mainloop(). tkinter does this for you. All you are expected to do is implement the functionality that should happen when your button is pressed. tkinter will listen for the button press.","Q_Score":2,"Tags":"python,tkinter,main","A_Id":44706671,"CreationDate":"2017-06-22T17:55:00.000","Title":"Want Clarification for Program Loop (Python)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program with some Label() widgets, some Button() widgets, some Text() widgets, and a few Entry() widgets. A couple of revisions ago, I didn't have the labels, and I had less Entry() widgets, and I mixed .pack() and .grid() as was convenient and I was fine. I had to do some refactoring, and added the extra widgets in the process - all the new things added used .grid(). Nothing about the other widgets changed. Now, I get an error along the lines of \"unable to use grid in .\", etc. (I can post the full error message if necessary). Why, and how can I fix this? (I can post code if necessary as well.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1773,"Q_Id":44711267,"Users Score":3,"Answer":"You can't mix grid and pack with widgets that share the same parent. \nWhy? Because grid will try to lay widgets out, possibly growing or shrinking widgets according to various options. Next, pack will try to do the same according to its rules. This may require that it change widget widths or heights. \ngrid will see that widgets have changed size so it will try to rearrange the widgets accirding to its rules. pack will then notice that some widgets have changed size so it will rearrange the widgets according to its rules. grid will see that widgets have changed size so it will try to rearrange the widgets according to their rules. pack will then notice that some widgets have changed size so it will rearrange the widgets according to its rules. grid will see that ...","Q_Score":2,"Tags":"python,user-interface,tkinter,widget","A_Id":44711332,"CreationDate":"2017-06-23T00:27:00.000","Title":"Using .pack() and .grid() at the same time with tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a relatively simple layout in Kivy, and want to display a series of buttons which get populated top to bottom of the screen, then when they reach the bottom, a new column is started from the top.\nGridLayout appears to do what I want, but it always seems to go from left to right first, rather than top to bottom. I've check the official documentation and Google and can't seem to find a solution.\nStackLayout does what I want with the \"orientation: \"tb-lr\" command, however the button widths don't get fully scaled to fit the container when there's only one column which GridLayout does do and is required for this application.\nThanks for any help.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1475,"Q_Id":44736279,"Users Score":0,"Answer":"Use GridLayout but populate it with BoxLayouts instead of buttons. Orient each of these BoxLayouts vertically and populate the buttons inside.","Q_Score":1,"Tags":"python,kivy,kivy-language","A_Id":44750212,"CreationDate":"2017-06-24T12:16:00.000","Title":"Kivy: GridLayout always goes left to right then down, can you go top to bottom then left to right?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have imported sys\nI have tried using sys.quit, again works when I run it as a python script but not as an app.\nI have also tried calling root.destroy() inside the app_exit function\n\ncontext: I have a button called exit which calls an app_exit function which just calls the quit function.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":79,"Q_Id":44765124,"Users Score":1,"Answer":"The python quit() and exit() functions are meant to be used in the REPL only. You need to use sys.exit() or raise SystemExit.","Q_Score":0,"Tags":"python-2.7,tkinter,py2app","A_Id":44765155,"CreationDate":"2017-06-26T17:17:00.000","Title":"quit() using Tkinter not working while executing as an app using py2app. However it works when I run it a python script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Exactly how do I utilize the various event methods that widgets have? Say I have a comboBox(drop down list) and I want to initiate a function every time someone changes the choice. There is the changeEvent() method in the documentation but It would be great if someone explains to me with a piece of code.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":102,"Q_Id":44771725,"Users Score":0,"Answer":"This is a pretty broad question. I recommend checking out the many tutorials on Youtube.com. \nHowever, in your init method, put something like this:\nself.ui.charge_codes_combo.currentIndexChanged.connect(self.setup_payments)\n\nIn my example, the combo box was placed on a form in Qt Designer. Self.setup_payment is a method triggered by the change in the combo box.\nI hope this helps!","Q_Score":0,"Tags":"python,python-3.x,pyqt,pyqt4","A_Id":44775948,"CreationDate":"2017-06-27T03:13:00.000","Title":"How to use pyqt widget event() method?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My employer currently has a lot of python code currently written and he wants me to create an application that interacts with this code and controls a Basler Ace Camera. The Basler Ace Cameras only support C, C#, C++ coding languages. What is the easiest way to integrate his Python code with the camera code which I am currently writing in C# because of the .NET framework?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":925,"Q_Id":44789188,"Users Score":0,"Answer":"Actually, there is a python interface availabe for working with and access the features of Basler camera namely pypylon","Q_Score":1,"Tags":"c#,python,camera,integration","A_Id":54589317,"CreationDate":"2017-06-27T20:20:00.000","Title":"Basler Ace Camera Integration with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"BACKGROUND: \nIt's important to consider memory usage of applications on ARM computers like the Raspberry Pi. When programming with Python, there are several GUI choices. A couple of the most popular are QT and TK. The Raspberry Pi 2 and 3 are limited by 1-Gbyte RAM, and 32-Gbyte max USB memory storage, per stick. They also have a much slower RISC (ARM) processor compared to popular desktop or laptop computers. Still, it's \"enough\" to run applications, even many GUI applications at a time if they use conservative programming techniques. I'm figuring that if a user stuck to TK based applications (Python-Tkinter-GUI) with the Raspberry Pi, then there wouldn't be nearly the number of difficulties.\nQ: Does anyone have any statistics on this ... by using Tkinter instead of PyQT for GUI program development with the intended user being on a Raspberry Pi version 2 or 3 ...\nPerformance ratios, programming with Tkinter vs PyQT:\n\nSize of Program in storage \nSize of Program executed in RAM\nSpeed of Application","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1089,"Q_Id":44811520,"Users Score":1,"Answer":"tkinter based GUI should be smaller on the disk and RAM but has less capabilities and may not suite your needs depending on what you need. tkinter is best for a small, simple gui. it will have no problems running a fair sized document.","Q_Score":7,"Tags":"python-3.x,qt,tkinter,tk","A_Id":62209717,"CreationDate":"2017-06-28T19:58:00.000","Title":"Memory savings of Python Tkinter GUI vs PyQT","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering the interaction that wxPython has with running things on separate cores and if wxPython releases the GIL when running. \nI've assumed that when I kick off some command which takes a while that wxPython starts up the wxWidgets c++ code which runs on multiple cores and somehow releases the GIL until the task is finished and then comes back. However I have nothing to base this on. Does this ever happen? \nWhat is actually going on under the hood?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":59,"Q_Id":44913520,"Users Score":1,"Answer":"The GIL is automatically released and reacquired whenever a call is made to a wx C++ function or method. This is probably a bit of overkill as there are a number of things that are quick and won't ever block and it might be more efficient to not release\/reacquire the GIL, but this approach ensures that we don't miss doing it for something that will block.\nIn addition, any time there is an event dispatched to a Python event handler, or when a virtual method overridden in Python is called, or etc. then the GIL is acquired before entry to that code and released again afterwards.","Q_Score":0,"Tags":"wxpython","A_Id":44931999,"CreationDate":"2017-07-04T20:17:00.000","Title":"Does wxpython run on separate process and release the GIL (Global Interpreter Lock)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently at a crossroads. I'm somewhat versed in Python (2.7) and would really like to start getting into GUI to give my (although mini) projects some more depth and versibility.\nFor the most part, my scripts don't use anything graphical so this is the first time I'm dipping my toes in this water.\nThat said, I've tried using pygame and tkinter but seem to fail at every turn to get something up and running (although I had some slight success with pygame)\nAm I correct to understand that for both I need X started in order to generate any type of interface, and with that, so I need X to get any type of input (touchscreen presses)?\nThanks in advance!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":203,"Q_Id":44979339,"Users Score":0,"Answer":"In order to use tkinter, you must have a graphics system running. For Windows and OSX that simply means you need to be logged in (ie: can't run as a service). For linux and other unix-like systems that means that you must have X running. \nNeither tkinter nor any of the other common GUI toolkits will write directly to the screen.","Q_Score":0,"Tags":"python,linux,user-interface,tkinter,debian","A_Id":44979879,"CreationDate":"2017-07-07T20:45:00.000","Title":"Python GUI without 'video system'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Studying Tkinter and I've only found tutorials on Tkinter without OOP, but looking at the Python.org documentation it looks like it's all in OOP. What's the benefit of using classes? It seems like more work and the syntax looks night and day from what I've learned so far.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":916,"Q_Id":44992913,"Users Score":2,"Answer":"This is going to be a really generic answer and most of the answers to this will be opinionated anyways. Speaking of which,the answer will likely be downvoted and closed because of this.\nAnyways... Let's say you have a big GUI with a bunch of complicated logic sure you could write one huge file with hundreds, if not thousands of lines, and proxy a bunch of stuff through different functions and make it work. But, the logic is messy.\nWhat if you could compartmentalize different sections of the GUI and all the logic surrounding them. Then, takes those components and aggregate them into the sum which makes the GUI?\nThis is exactly what you can use classes for in Tkinter. More generally, this is essentially what you use classes for - abstracting things into (reusable - instances) objects which provide a useful utility.\nExample:\nAn app I built ages ago with Tkinter when I first learned it was a file moving program. The file moving program let you select the source \/ destination directory, had logging capabilities, search functions, monitoring processes for when downloads complete, and regex renaming options, unzipping archives, etcetera. Basically, everything I could think of for moving files.\nSo, what I did was I split the app up like this (at a high level)\n1) Have a main which is the aggregate of the components forming the main GUI\nAggregates were essentially a sidebar, buttons \/ labels for selection various options split into their own sections as needed, and a scrolled text area for operation logging + search.\nSo, the main components were split like this:\n2) A sidebar which had the following components \n\nSection which contained the options for monitoring processes\nSection which contained options for custom regular expressions or premade ones for renaming files\nSection for various flag such as unpacking\n\n3) A logging \/ text area section with search functionality build in + the options to dump (save) log files or view them.\nThat's a high level description of the \"big\" components which were comprised from the smaller components which were their own classes. So, by using classes I was able to wrap the complicated logic up into small pieces that were self contained. \nGranted, you can do the same thing with functions, but you have \"pieces\" of a GUI which you can consider objects (classes) which fit together. So, it just makes for cleaner code \/ logic.","Q_Score":2,"Tags":"python,tkinter","A_Id":44992975,"CreationDate":"2017-07-09T04:14:00.000","Title":"Tkinter with or without OOP","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a GUI that starts off with a video written in Kivy. That GUI is supposed to then begin loading the whole program in the background while the clip is playing, and after the clip, a window for login is supposed to come up. How do I load the whole program and at the same time load the video to play at the start of the program?\nI used event dispatcher but it didn't work.\nAdditionally, how do I tell the window to open from the video to the login to the first page of the GUI without being separate GUIs to load from?\nThank you very much.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":45041154,"Users Score":0,"Answer":"i think you should first try and convert the video to an image format (gif) and then load it in the Image class in the kv file and then use clock to schedule it to load a new screen(login) after some seconds depending on the duration of the gif","Q_Score":0,"Tags":"python,python-2.7,python-3.x,user-interface,kivy","A_Id":45068664,"CreationDate":"2017-07-11T17:31:00.000","Title":"Placing a Video at Start of GUI to Transition to Main Code Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have developed an application with pyqt5 and it is working fine on windows but when i run this app on mac osx it's graphics are not working fine like the layout of the buttons, labels and other stuff are not showing perfectly. \nI have created app in PyQt5 and using Cx_freeze i made executable for windows as well as mac osx. \nI tried py2app also still on mac side my application is not working.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1149,"Q_Id":45096004,"Users Score":0,"Answer":"Most of the default styling of qt widgets are derived from the OS or the interface that you are using, try changing some style sheet properties to get the desired layout and since there are no code, I can't pinpoint to what can be done to change.","Q_Score":0,"Tags":"macos,python-3.x,pyqt5,cx-freeze,py2app","A_Id":45117297,"CreationDate":"2017-07-14T06:20:00.000","Title":"my pyqt5 application is working fine on windows but when i run this on Mac the graphics are not as it is","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Someone know how can I send string by socket qpython3 android (client) to python2.7 linux (server)?\nFor python2.7 linux (server) ok, I know, but I dont know how create the client with qpython3 android.\nSomeone Know?\nTKS","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":217,"Q_Id":45111731,"Users Score":0,"Answer":"It's your loopback address this wont work\nHOST = '127.0.0.1'\nInstead that use true ip address on network for your host and make sure port of 5000 on server is open already","Q_Score":0,"Tags":"python-2.7,sockets,qpython3","A_Id":69265192,"CreationDate":"2017-07-14T21:17:00.000","Title":"Sending string via socket qpython3 android (client) to python2.7 linux (server)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i try to run my android test script by \"monkeyrunner cameraTest.py\"\nbut it can't work, the cmd show me this \nSWT folder '..\\framework\\x86' does not exist.\nPlease set ANDROID_SWT to point to the folder containing swt.jar for your platform.\nanyone know how to deal with this\uff1fthanks","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2025,"Q_Id":45163450,"Users Score":0,"Answer":"In addition to @ohbo's solution, copying AdbWinApi.dll, AdbWinUsbApi.dll into framework folder solved my problem.","Q_Score":2,"Tags":"java,android,python,testing,monkeyrunner","A_Id":49088774,"CreationDate":"2017-07-18T10:00:00.000","Title":"SWT folder '..\\framework\\x86' does not exist. Please set ANDROID_SWT to point to the folder containing swt.jar for your platform","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am trying to configure Pydev in Eclipse. Even PYTHONPATH with python.exe file and downloaded wxpython package as well to interact with GUI environment \nBut, getting an error when i am starting python console in the \"console\" environment in Eclipse \nAm wandering about \"Thread_IsMain\" error \nAttributeError: module 'wx' has no attribute 'Thread_IsMain' Traceback (most recent call last): File \"D:\\Software\\eclipse\\plugins\\org.python.pydev_5.8.0.201706061859\\pysrc\\pydevconsole.py\", line 194, in process_exec_queue inputhook() File \"D:\\Software\\eclipse\\plugins\\org.python.pydev_5.8.0.201706061859\\pysrc\\pydev_ipython\\inputhookwx.py\", line 117, in inputhook_wx3 assert wx.Thread_IsMain() # @UndefinedVariable","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":92,"Q_Id":45190226,"Users Score":0,"Answer":"It seems to be an issue in PyDev itself when dealing with wx... maybe wx broke that API. \nYou can try just commenting out that line and checking if other things work -- as that code in the debugger is pure python, you can tweak it in place ;)","Q_Score":0,"Tags":"python,eclipse,user-interface,pydev","A_Id":45400633,"CreationDate":"2017-07-19T12:12:00.000","Title":"Error While Configuring pydev in eclipse","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to create a web interface to display some data that is being extracted live from a piece of hardware.\nI have already written a program using pyQt that extracts data every second. I was wondering if it is possible to simultaneously push this data to a web interface with Python.\nI want the webpage to not continuously refresh as data is coming in every second. Charts are essential, I have to have the ability to plot the data that is being pushed.\nCan anyone suggest me how I would go about doing this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":183,"Q_Id":45205559,"Users Score":0,"Answer":"Probably the most conventional way to go about this would be to write some server-side code to communicate with the device, and save responses (all of them? the most recent n?) to a database. You'd expose this to a REST API, which you'd then call at a specified interval using AJAX from the browser.","Q_Score":0,"Tags":"python","A_Id":45205670,"CreationDate":"2017-07-20T05:02:00.000","Title":"creating a web interface that displays live data from hardware","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have 3 points: A, B, C in 3D space. AC = BC in length. They represent a triangle object called T. Each point is a tuple of floats representing it's coordinates.\nT is placed such as median point from A and B is in axes origin already.\nIn my API, I can rotate T globally, that is with respect to any one global axis at a time, for rotation.\nPseudocode for this API is like:\nT.rotate('x', angle) for rotating T around global x axis of angle value, with right hand rule.\nMy question is for the code to rotate T such as: \n\nA and B are on x axis\nC is on y axis\n\nI suppose I will need 3 calls in succession, for rotating around each of the axes. But I have troubles figuring the angles by initial points coordinates.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1165,"Q_Id":45241469,"Users Score":0,"Answer":"EDITED to include angle calculations.\nSince you do not provide any real code in your question, I'll just provide an algorithm and angles. If you improve your question with code I can add some code of my own.\nTo clarify, we must have length AC equal to length BC, and the midpoint of side AB must be the origin. That latter means that the coordinates of points A and B are negatives of each other. (Actually, the real requirements are that the vector OC where O is the origin is perpendicular to the vector AB and that origin is in line AB. Your conditions are more strict than this.)\nLet's say that at any point the coordinates of A are (Ax, Ay, Az) and similarly for B and C.\nFirst, move point A to the xy plane. Do this with a rotation of all three points around the x-axis. Due to the conditions, point B will also be in the xy plane. One possible angle of the rotation is -atan2(Az, Ay) though others are also possible. Check that the resulting values of Az and Bz are zero or close to it in floating-point precision.\nSecond, do a rotation around the z-axis to move point A to the x-axis (and the other points appropriately). Point B will now also be on the x-axis. One angle of rotation for this is -atan2(Ay, Ax). Check the resulting Ay and By.\nThird and last, do a rotation around the x-axis to move point C to the y-axis. Points A and B will not be affected by this last rotation. One angle of rotation for this is -atan2(Cz, Cy). Check the resulting Cx (which should have been zero before this last rotation) and Cz.\nYour triangle is now in the desired position, provided your original triangle actually met the conditions. Note that this algorithm did not use any rotation around the y-axis: it was not needed, though you could replace my initial rotation around x with one around y if you want.","Q_Score":0,"Tags":"python,3d,rotation","A_Id":45242163,"CreationDate":"2017-07-21T15:30:00.000","Title":"Triangle rotation with Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a snake game with Python. I am following Sentdex's Pygame tutorials, but I wanted to try to make obstacles, so I went off and tinkered with the code a bit.\nHow do I make the apple stop spawning inside other foreign obstacles?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":258,"Q_Id":45251198,"Users Score":1,"Answer":"To generate random coordinates, you can use a while loop and random.randrange to get new x and y coords, check if the coords are blocked, if yes, continue to generate new coords and check again if the area is blocked, if it's not blocked return the coords. Of course if the whole map is filled, this loop will run infinitely, so you'd need a way to break out of it in this special case or quit the game. \nAlternatively you could create a list of the non-blocked coords and then use random.choice to pick one coord pair.","Q_Score":1,"Tags":"python,pygame","A_Id":45264734,"CreationDate":"2017-07-22T05:53:00.000","Title":"Python Pygame Snake Apple Spawning Inside obstacles","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just purchased a \"Kano\" (raspberry pi) for my daughter, and we're trying to create a python script using the terminal. I've been using the nano text editor, and so far it's been going well, but I know that there are better code editors for python.\nDoes anyone have a recommendation for a code editor for python that I can launch from the LXTerminal? For example, in a manner similar to how the nano editor is launched to edit a python script (\"nano mygame.py\")\nIdeally, I want something that comes re-installed with kano\/Debian that I can use out of the box, which is very user-friendly. I feel like always having to resort to ^O and ^X etc. to save and exit is really not user-friendly. Also, nano doesn't seem to have good syntax highlighting and indentation, etc. which would be nice for coding.\nI have the Pi 3 with all the latest software updates (as of the writing of this post)\nthanks, \nDarren","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":455,"Q_Id":45259272,"Users Score":1,"Answer":"For editing text using the terminal vim is an excellent choice (vim mygame.py). Initially it is going to be confusing, because it has two different modes and it is easy to forget which one you are in. But in the long term learning it will pay off, because it can do some incredible things for you. Once you get used to it, it will make nano look like a bad joke. And this is probably the best time for your daughter to learn it: later on it is only going to get more difficult to learn a more abstract, and more powerful editor.\nThe first thing to remember is that initially, after starting vim, you are in command mode so you cannot type text like you would expect. To change into editing mode, just press i (without a colon), then you can type text like in any other editor, until you press Esc, which goes back to command mode. Commands start with a colon. For example you can quit vim by typing :q (with the colon) and then pressing Enter. You write the file (i.e. save your changes) using :w. You can give it a filename too, which works exactly like \"Save as...\". To open another file for editing you can use :e otherfile.py.\nThese were the most essential things I could think of, but there are other modes for selecting lines, characters, rectangular blocks. For copy & pasting, and other things I would recommend going through a tutorial, or just searching for vim copy paste or whatever is needed. I cannot emphasize enough that it is worth learning these, because of the advanced features of the editor, especially if you are planning to use the editor for coding! As a quick example, you can completely reindent your whole code by typing gg=G in command mode.\nThe default settings of vim will give you a very basic look and feel, but you can download (and later customize) a .vimrc file which simply goes into your home directory, and from then on this will be used at every start. If you just Google vimrc, you will find a lots of good examples to start with, which will turn on syntax highlighting with pretty colours, and give you some more sensible settings in general. I would recommend downloading one or two versions of the .vimrc file early on, and trying out the difference it can make.\nAnother option would be emacs, which is equally powerful, and equally confusing for a beginner. If you want an editor that is intuitive using the terminal, nano is probably your best bet, from those that are installed by default. Yes, nano counts as intuitive. Anything else will be somewhat more difficult, and far more powerful.","Q_Score":0,"Tags":"python,raspberry-pi,debian,raspberry-pi3","A_Id":45259716,"CreationDate":"2017-07-22T21:11:00.000","Title":"user-friendly python code editor in debian (raspberry pi)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just purchased a \"Kano\" (raspberry pi) for my daughter, and we're trying to create a python script using the terminal. I've been using the nano text editor, and so far it's been going well, but I know that there are better code editors for python.\nDoes anyone have a recommendation for a code editor for python that I can launch from the LXTerminal? For example, in a manner similar to how the nano editor is launched to edit a python script (\"nano mygame.py\")\nIdeally, I want something that comes re-installed with kano\/Debian that I can use out of the box, which is very user-friendly. I feel like always having to resort to ^O and ^X etc. to save and exit is really not user-friendly. Also, nano doesn't seem to have good syntax highlighting and indentation, etc. which would be nice for coding.\nI have the Pi 3 with all the latest software updates (as of the writing of this post)\nthanks, \nDarren","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":455,"Q_Id":45259272,"Users Score":0,"Answer":"Geany is a nice little GUI editor in Raspbian. I use it over nano every time. No frills. but familiar menu commands and easy interface.","Q_Score":0,"Tags":"python,raspberry-pi,debian,raspberry-pi3","A_Id":45260780,"CreationDate":"2017-07-22T21:11:00.000","Title":"user-friendly python code editor in debian (raspberry pi)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a program using PyQt5 and pyqtgraph, however, I keep running into this error:\n\nImportError: cannot import name 'QGraphWidget'\n\nI used QtDesigner to make a form and promoted a QGraphicsWidget. I know I did it correctly (I've done it at least 10 times to try and resolve the issue), but the error persists.\nI'm using Windows 7, Anaconda, and PyCharm, but I tried running the code in other environments and still got the error.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":644,"Q_Id":45282330,"Users Score":1,"Answer":"In the documentation it implies that the promoted name can be anything, however, this seems to be untrue (at least at the moment).\n\nUnder \u201cPromoted class name\u201d, enter the class name you wish to use (\u201cPlotWidget\u201d, \u201cGraphicsLayoutWidget\u201d, etc).\n\nAfter re-doing my QGraphicsWidget for the 6th time, I decided to name it one of the example names in the tutorial, which seems to have solved the problem.\nIn other words name your widget and promoted widget \"PlotWidget\", \"ImageView\", \"GraphicsLayoutView\", or \"GraphicsView\". (Please keep in mind I have only tested \"PlotWidget\".)","Q_Score":0,"Tags":"python,import,pyqt5,pyqtgraph","A_Id":45329119,"CreationDate":"2017-07-24T13:46:00.000","Title":"pyqtgraph QGraphicsWidget import error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I built a py2app and Tkinter based application, and sent it to a friend, it does not seem to be working on the friends laptop that runs OSX sierra. Is there anything I can do?\nWhen I try to open the application on my friends computer it just says Hook Error (name of the application is hook).","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":181,"Q_Id":45283914,"Users Score":0,"Answer":"So if some one else is facing the same issue, the best way to figure out what is wrong is to run the console version of the app by going to the MacOS folder. In this specific case, sierra was not letting my app create a log file, siting lack of permissions, which was wierd, it seems like sierra has some extra security feature that doesnt let 3rd party apps create new files (just a guess, could be some other reason too), so when I opened the app from terminal with 'sudo', the problem was fixed. I had to do this only once though, even after restarts double clicking the icon opened up the application and updated the log file too. Hope this helps if you came in search of answers here.","Q_Score":0,"Tags":"python,python-2.7,user-interface,tkinter,py2app","A_Id":45290904,"CreationDate":"2017-07-24T15:01:00.000","Title":"py2app tkinter application built on El capitan not working on a sierra","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python script which runs perfectly on my work computer (1600 x 900 resolution). It is on this computer that I took all the screenshot images used by pyautogui.locateOnScreen. I tried to run this program on my home laptop with a different resolution (1340 x 640) and the script does not seem to find the image location. I am guessing that it is because of the different resolution. (I have copied the script folder from my work computer to the home computer, so the path to the image file is exactly the same). Is there anything I can change in my script so that pyautogui.locateOnScreen would identify the image on any computer resolution?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":4334,"Q_Id":45302681,"Users Score":2,"Answer":"I'm the creator of PyAutoGUI. The problem you have isn't with the screen resolution, but the screen scaling. Your program will work fine on monitors at different resolutions. But at high resolutions, the text and buttons of your programs become too small and so Windows and macOS fix this with \"screen scaling\", which can increase the size of UI elements like text and buttons by 150% or 200%. If you have multiple monitors, each monitor can have it's own screen scaling setting; for example one monitor at 100% and another at 150%.\nIf you take a screenshot while a monitor is at, for example, 100% and then try to use it on a monitor that is scaled at 200%, the image won't match because the screenshot is literally half the width and length of what it would have been on the 200% monitor.\nSo far, there is no work around for this. Resizing the screenshot might not work because there could be subtle differences and the screenshot mechanism currently needs a pixel-perfect match. You just need to retake the screenshots on the monitor with the different screen scaling setting.","Q_Score":1,"Tags":"python-3.4,screen-resolution,pyautogui","A_Id":69426639,"CreationDate":"2017-07-25T12:01:00.000","Title":"Running Pyautogui on a different computer with different resolution","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to bring sprites to the foreground so that they are on the top layer of an image. This is the line i am using to assign the value of the image\nball = pyglet.sprite.Sprite(ball_image, 50, 50) \nIs there a property that i can add to this line that will draw the image on the foreground ? \nedit: I am trying to keep the first image stay in the foreground regardless if its drawn before or after the second image.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":766,"Q_Id":45351555,"Users Score":2,"Answer":"Drawing the sprite you want to be on the top later than the bottom sprites should accomplish what you want.","Q_Score":2,"Tags":"python,python-3.x,pyglet","A_Id":45351754,"CreationDate":"2017-07-27T12:59:00.000","Title":"In Pyglet is there way to bring sprites to foreground","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a GUI that I would like to put at the disposal for my colleagues to use under the form of .exe , after some researchs i found pyinstaller as \"freezer\" which work great after downloading the github version , but my issue is even if the .exe is created when i run it , it show up for less than a second on the screen and it disapears\nI would like to know how to keep it on the screen (most important part) and getting it closed when the user close it himself..\nThanks in advance for the help!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":177,"Q_Id":45368358,"Users Score":0,"Answer":"Another option would be to manually open a CMD window, navigate to, and then execute your exe, rather than letting the packaged application spawn the instance.","Q_Score":1,"Tags":"python-3.x,user-interface,tkinter,pyinstaller,tkinter-canvas","A_Id":51119738,"CreationDate":"2017-07-28T08:18:00.000","Title":"avoiding a pyinstaller .exe disapear of the screen without closing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've encountered a problem while attempting to create a Tkinter window using root = tk.Tk() . Every time I get to that point, the program crashes, and \"Python quit unexpectedly\" message is displayed.\nI get no tracebacks at all, so I assume that is the ActiveTcl bug. However, I have the new distribution from ActiveTcl Website installed, which is supposed to take care of the problem (obviously, it doesn't).\nInterestingly enough, it only crashes when it is executed in Python 2.7. It works fine in Python 3.6. However, I need to use 2.7.\nMy MacOS version is 10.12.5.\nAny ideas \/ suggestions about fixing the issue are welcome.\nP.S. I have read a good dozen of similar posts before posting this, and not any of the proposed solutions worked for me. Please consider this before marking this post as a duplicate.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1652,"Q_Id":45468503,"Users Score":1,"Answer":"I don't know what is meant by \"new distribution\" for ActiveTcl is but if you're using 8.6, it needs to be downgraded to 8.5. \nAlso, if you run IDLE which uses Tkinter, do you see any messages warning of \"instability\"? If you see that then, it means you need to downgrade Tcl to 8.5.","Q_Score":2,"Tags":"python,macos,python-2.7,tkinter,activetcl","A_Id":45489621,"CreationDate":"2017-08-02T18:33:00.000","Title":"Tkinter keeps crashing on Tk() on Mac","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed termux on my android device (Pixel C), and successfully installed python 3.6.2 there, and after downloaded (with pip) some libraries like pillow (there were some problems, but with online forums I solved it), vk, etc.\nTkinter should be preinstalled on python, but it wasn't (like some other modules like time, random etc.).\nAll this modules - tkinter, that should be preinstalled, are not there - and it is not possible to install them.\npip install tkinter\n->Could not find a version that satisfies the requirement time (from versions: )\nNo matching distribution found for tkinter.\nif I try with:\napt-get install python3-tk\nStill nothing - error placing file.\napt-get update and apt upgrade didn't help...","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":8845,"Q_Id":45477805,"Users Score":0,"Answer":"You can't install tkinter or any graphical library or framework on termux because termux doesn't have a GUI and relevant graphical headers.","Q_Score":0,"Tags":"android,python,tkinter,termux","A_Id":54987146,"CreationDate":"2017-08-03T07:39:00.000","Title":"I can't install tkinter on termux","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So i am writing a python3 app with kivy and i want to have some data stored in a database using sqlite.\nThe user needs to have access to that data from the first time he opens the app\nIs there a way to possibly make it so that when i launch the app, the user that downloads it, will already have the data i stored, like distribute the database along with the app? so that i don't have to create it for every user.\nI have searched here and there but haven't found an answer yet\nThank you in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":310,"Q_Id":45483128,"Users Score":1,"Answer":"Just include the database file in the apk, as you would any other file.","Q_Score":1,"Tags":"android,python-3.x,sqlite,kivy","A_Id":45489681,"CreationDate":"2017-08-03T11:39:00.000","Title":"Android-How can i attach SQLite database in python app","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on GUI application with tkinter. When I click in the corner on Button [X] GUI application is closed, but console application is still running. \nHow to make when I closed GUI application in same time is closed console application.\nI am trying with sys.exit() but this not worked.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":112,"Q_Id":45510704,"Users Score":1,"Answer":"If you rename the file to *filename*.pyw then the program will launch with no console.","Q_Score":1,"Tags":"python,python-3.x,tkinter","A_Id":45510841,"CreationDate":"2017-08-04T15:36:00.000","Title":"tkinter gui is closed but console is not closed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using wxPython DirDialog and it seems to have a bug.\nWhen launching the dialog I specify a default path (defaultPath).\nThat path is being selected by the dialog but the dialog is not scrolled to the selected path.\nInstead the dialog is scrolled to the top of the dialog.\nThis leaves the user to scroll A LOT down to reach the default path.\nVery inconvenient.\nAny way to correct this?\nUsing:\nPython 2.6.5\nwxPython 2.8.12.1\nWindows 8.1","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":114,"Q_Id":45546490,"Users Score":0,"Answer":"Well apparently if I exclude the style \"wx.DD_DEFAULT_STYLE\" then it works just fine.\nSo this works:\nstyle = wx.DD_DIR_MUST_EXIST \nBut this doesn't focus the dialog properly on the defaultPath:\nstyle = wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST\nI guess it must be a bug somewhere","Q_Score":0,"Tags":"python,windows,wxpython","A_Id":45688399,"CreationDate":"2017-08-07T12:05:00.000","Title":"wxPython DirDialog does not scroll to selected folder","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have 3 identical (I thought) servers that are running 2012 R2. I built the app using python 3.4 and PySide 1.2.4 on a Windows 7 machine. Running the setup file gives me the executable as well as 3 dll files: QtCore4.dll, QtGui4.dll, and QtNetwork4,dll. I copied all these files to the 3 servers. I can run the exe from 2 of the servers just fine, but the third one is giving me trouble. At first it was giving me an error saying that MSVCR100.dll was not installed. So, I copied msvcr100.dll from one of the other servers where the exe runs fine. Now when I try to run the exe I get the following error:\nTraceback (most recent call last):\n File \"Ninja_Lite.py\", line 3, in \n File \"C:\\Python34\\lib\\site-packages\\zipextimporter.py\", line 109, in load_module\nImportError: MemoryLoadLibrary failed loading PySide\\QtGui.pyd: The specified module could not be found. (126)\nDoes anyone have any idea what could be causing this error to only happen on one of the 3 servers?","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":477,"Q_Id":45616787,"Users Score":-1,"Answer":"I fixed the issue. There were some differences in the MSVCP and MSVCR dll files between the 2 machines. I copied all the missing dll files from the machine that was working to the one that wasn't both in the System32 and SysWOW64 directories and now the program is working.\nThe files were:\nmsvcp60.dll\nmsvcp100.dll\nmscvp120.dll\nmsvcr60.dll\nmsvcr100.dll\nmsvcr120.dll\nHope this helps anyone in the future!","Q_Score":0,"Tags":"python,windows,pyside,py2exe","A_Id":45617193,"CreationDate":"2017-08-10T14:39:00.000","Title":"Issue with py2exe executable on Windows Server 2012 R2","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Say I have a Frame in tkinter with a set width and height (placed using the place method), and I add a child Frame to that parent Frame (using the pack method). In that child Frame, I add an arbitrary amount of widgets, so that the child Frame's width is dynamically set depending on its children.\nMy question is how do I get the width of the child Frame if it's width is greater than its parent?\nI know there's a winfo_width method to get the width of a widget, but it only returns the width of the parent Frame if its width is greater than its parent. In other words, how do I get the actual width of a widget, not just the width of the part of the widget that is displayed?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":174,"Q_Id":45625918,"Users Score":2,"Answer":"The width will never be bigger than the parent frame. \nYou can call winfo_reqwidth to get the requested width of the widget. I'm not sure if that will give you the answer you are looking for. I'm not entirely what the real problem is that you are trying to solve.","Q_Score":2,"Tags":"python,python-3.x,tkinter,width","A_Id":45626120,"CreationDate":"2017-08-11T02:12:00.000","Title":"Get width of child in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a music player in Python using Pygame and Pydub(I used Pygame for actually playing the music, while Pydub is probably unrelated to the issue).\nThe music works fine even when windows are switched unless I switch to another Pygame window. I thought this effect would go away if I compiled it(cx_freeze), but that didn't work.\nSo I was wondering if there is any way to let the music keep playing when the window is switched to another Pygame window.\nI used pygame.mixer.music instead of Sound objects if that might somehow be related.\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":115,"Q_Id":45645884,"Users Score":0,"Answer":"Not exactly a fix, but it seems that if I disable the mixer(pygame.mixer.quit()) it doesn't cancel out the audio. Unfortunately, I haven't found a way to use audio in two pygame windows at once.\nFeel free to post another answer if anyone figures out a full fix.","Q_Score":0,"Tags":"python,audio,pygame","A_Id":45657002,"CreationDate":"2017-08-12T02:13:00.000","Title":"Pygame Audio Stops When Window Switches?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python 2.7 program with Pygame 2.7 which I wanted to embed into a website. How would you do this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":75,"Q_Id":45672853,"Users Score":1,"Answer":"You wouldn't. Pygame isn't a web based technology for games. If that's one of your main platforms, look into HTML5 based frameworks instead (or a platform that can export its runtime and content to HTML5).","Q_Score":0,"Tags":"python,python-2.7,pygame","A_Id":45672890,"CreationDate":"2017-08-14T10:48:00.000","Title":"How do you embed a Python 2.7 game requiring pygame into a website?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The title basically says it. Right now I have the two panedWindows attached to the root window. I would like the windows to either lift() or lower() one panedWindow on top of the other when a button is pressed rather than the panedWindows being stacked on top of each other in the same window.\nI also understand there may be a better way of implementing this sort of menu feature. If you know a better way, that would be great too.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":44,"Q_Id":45682899,"Users Score":0,"Answer":"I used .grid(row = 0) on both panedWindows. Then I called lift on the window I wanted to raise up and it worked.","Q_Score":0,"Tags":"python,python-3.x,tkinter","A_Id":45700714,"CreationDate":"2017-08-14T20:54:00.000","Title":"How to place a panedWindow behind another panedWindow tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Does Kivy offer any of the functions for disabling windows hotkey (ALT+F4) to your app?\nOr can I do this through python 3.5+ ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":303,"Q_Id":45729077,"Users Score":0,"Answer":"You can redefine stop in your app-class and you only call super(MyApp, self).stop() if you want to quit. However you need an overlayed widget wich overloads on_close, that you can quit with [escape] in which you write super(MyApp, app).stop().","Q_Score":1,"Tags":"python,windows,kivy,kivy-language","A_Id":45732412,"CreationDate":"2017-08-17T07:31:00.000","Title":"How to disable windows hotkey ALT+F4 in Kivy app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to visualize data computed by my program (neural network), by showing images while the program is working, creating a video that shows the progress in real time.\nIt should be pretty basic, but I'm new to Python, and I'm struggling to find the good framework to do this. It seems that with most libraries (Tkinter, graphics, matplotlib, etc), displaying a video stops the computation, and the user has to interact with the GUI (like close the window) to go back to the program. For now I use PIL.show() to display a single image without stopping the program, but it does not seem suited to video, because I cannot replace the displayed image by another, as the window is not handled by the program anymore.\nI'm using Linux Mint and Python 2.7.6\nSo what is the simplest way to do that ? Is there a library that is well-suited ? Or where can I find an example code doing that ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":436,"Q_Id":45735688,"Users Score":0,"Answer":"Write a multithreading script that runs both, your computation script and a script for the images(where each of them can act as one frame for the video). Keep closing the image window each time the next image is computed. \nThis solution is makeshift but will work","Q_Score":0,"Tags":"python,matplotlib,graphics,real-time","A_Id":45740933,"CreationDate":"2017-08-17T12:53:00.000","Title":"Real-time animation in Python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've disabled the subscription manager and registered a few repos, epel and remi, but am unable to install tkinter. Keep getting the error no package available. The only package available is for python 3.4. Was wondering whether anyone else had run into this issue. Not sure how to resolve it there's not a lot of documentation on the RHEL website.\nI've also tried installing tcl\/tk and yum can't seem to find these packages either. The one package with tcl in it it fails because of dependency problems. No luck with yum groupinstall -y \"development tools\" either. I'm mostly just trying to install pyautogui which requires tkinter be installed already.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1205,"Q_Id":45803704,"Users Score":0,"Answer":"The tkinter package is in the rhel-7-server-optional-rpms repo, though I don't see pyautogui available in RHEL.\nYour mileage may vary on whether tkinter is at the right version needed.","Q_Score":0,"Tags":"python-2.7,tkinter,yum,rhel7","A_Id":45806096,"CreationDate":"2017-08-21T18:40:00.000","Title":"RHEL 7 installing tkinter with python 2.7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to do some applications with python, but I haven't found any way of getting a tool-box of buttons, check box, etc.\nCan some explain me please how can I do that with:\n1. Pycharm.\n2. If it is problem with Pycharm, visual studio community is also okay.\nThanks,\nAyal","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":795,"Q_Id":45817703,"Users Score":0,"Answer":"This is what I have found:\nThere is a designer from QT, to build a ui file. There is a tool for translating the ui into python. Then you can edit the logic, with any python tool. You only need PyQt the current version is PyQt5.","Q_Score":0,"Tags":"python-3.x","A_Id":45877103,"CreationDate":"2017-08-22T12:30:00.000","Title":"Python windows forms application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"if I put \"import tkinter\" in my Python (3.6) file the mac app I get with py2app does not work. \npy2app works just fine with other Python files importing other packages (math, time, random etc) only importing tkinter raises this problem","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":558,"Q_Id":45856131,"Users Score":0,"Answer":"Solved but I'm not sure it should have to work like this. \nI think the problem is that Mac works with Python 2.7 (system Python) which raises an error when it gets \"import tkinter\". \nSo I installed with Homebrew Python 2.7, redesigned my modules written in P 3.6 (\"import Tkinter\" etc.) py2app-ed it and everything went fine.","Q_Score":1,"Tags":"python,tkinter,py2app","A_Id":45869121,"CreationDate":"2017-08-24T08:02:00.000","Title":"py2app does not work with tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I encounter some annoying behavior with modal frames in WxPython.\nAs we all know, when a modal window shows up, it appears on foreground (on top of the main window) and the main window should become inaccessible (no response to click for example).\nThis is working as expected with nested WxFrames until using the Windows start (status)bar.\nIf user clicks on main frame on Windows bar, it appears on top of the second frame, which is totally inaccurate as user does not understand what's happening and why the window is inaccessible.\nThe first solution coming on my mind is to bind activation event of the first frame, and set programmatically (& systematically) the second frame to foreground. However it appears to me weird that this behavior is not already done naturally by WxPython.\nDoes anyone have any idea or any native \/ generic solution for that?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":89,"Q_Id":45856240,"Users Score":0,"Answer":"It is much better to use wx.Dialog when you need a modal window, as it is designed from the start to behave that way. In fact, because of the inconsistencies the MakeModal method has been removed for frames, although if you really need to do it that way there is a workaround.","Q_Score":0,"Tags":"python-2.7,wxpython","A_Id":45899941,"CreationDate":"2017-08-24T08:08:00.000","Title":"WxPython - Inaccurate modal windows behavior","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to clear a tkinter window completely. However, I need a way to clear every widget on the window all at once without using pack.forget().","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":28747,"Q_Id":45905665,"Users Score":1,"Answer":"You can use destroy method for each widget for example if it's a button you write btn1.destroy() and do it for all widgets. The forget method isn't recommended for it only remove the widgets from appearance.","Q_Score":3,"Tags":"python,tkinter","A_Id":52132169,"CreationDate":"2017-08-27T13:50:00.000","Title":"Is there a way to clear all widgets from a tkinter window in one go without referencing them all directly?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know that the only way to build for cross platform in Python is Kivy but I recently heard of the Beeware project and this tool called Toga. As much as I know its still in its early stage and a lot of people aren't familiar with it as well but there are a couple of basic tutorials on the website. It looks very promising but I don't know about its future and the issues I might face if I start working on it as it might have a lot of bugs as of now. I read on the docs that Toga lets you build Native cross platform apps, are Kivy apps not native? Are they like Hybrid apps, like the ones you build on Phonegap? Thanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3705,"Q_Id":45945387,"Users Score":12,"Answer":"Toga achieves its gui by mapping the Toga api to native platform widgets on different systems. This means that the apps will automatically look and behave like other 'native' apps from that system. In contrast, Kivy uses opengl for drawing, using its own widget toolkit. This means that by default it looks and behaves exactly the same on all different platforms. You can customise it, but in practice it's very hard to get something that really acts just like another framework.\nBoth methods have advantages and disadvantages. Kivy is quite flexible and portable, since you can use opengl just about anywhere, and the harder part is probably compiling Kivy and Python itself. On the other hand, Toga's method is the only way to get something that really acts like a native app, and also possibly sidesteps some Kivy problems like relatively slow startup on Android. That said, I'm not sure if the need to wrap different widgets explicitly means it may be less flexible, compared to Kivy's drawing API that can achieve basically anything without special platform support.","Q_Score":8,"Tags":"python,kivy,beeware","A_Id":45948867,"CreationDate":"2017-08-29T17:48:00.000","Title":"Difference between Kivy and Toga (Beeware project) for Cross platform in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've built a very simple assistant app in python which can do very basic tasks like taking notes, reminding you, stopwatch, timer, web scrape for news feeds etc. tkinter seems confusing and looks oldish to me. On the other hand, css js seems much easier to design gui side and way more elegant looking. Is it possible to design a desktop gui app (may be with electron?) using HTML+CSS+JavaScript but it will run my old python codes?\nI've been coding for only two months and i suck at it. Please excuse my newbiness.\nTLDR: Simply, i want to make the gui side using HTML+CSS+JavaScript to take user input but then it will run python scripts and shows output in the gui app. Is it possible?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2102,"Q_Id":45986266,"Users Score":0,"Answer":"The popular form of Javascript or ES6 (which you are talking about) is designed to run in browser, so, the limitations are that it can only make calls via browser, i.e. it cannot directly interact with the OS like python's OS module. This means you will need a web-service in your computer that would run a specific python code and return you the responses, this requires a web-service\/web-framework, preferably python's like Django, Flask which will run the python script for you because they can make OS calls on the server machine. I do think other non-python web-services are cacpable to do so, but of course, the natural preference would be 'Python-based services'. \n Sidenote: \nIf the case was with Node.js(i.e. the server-side js) and not ES6(client-side browser-run) you would have an upperhand i.e. you could invoke python scripts on your server because node.js like the python-based web-servers do support os calls.","Q_Score":0,"Tags":"javascript,python,html,css,user-interface","A_Id":45986589,"CreationDate":"2017-08-31T16:32:00.000","Title":"Is it possible to design GUI with HTML+CSS+JavaScript but it will actually run python script?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I've built a very simple assistant app in python which can do very basic tasks like taking notes, reminding you, stopwatch, timer, web scrape for news feeds etc. tkinter seems confusing and looks oldish to me. On the other hand, css js seems much easier to design gui side and way more elegant looking. Is it possible to design a desktop gui app (may be with electron?) using HTML+CSS+JavaScript but it will run my old python codes?\nI've been coding for only two months and i suck at it. Please excuse my newbiness.\nTLDR: Simply, i want to make the gui side using HTML+CSS+JavaScript to take user input but then it will run python scripts and shows output in the gui app. Is it possible?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2102,"Q_Id":45986266,"Users Score":0,"Answer":"It can't be done, you'd have to make it like a web app (although with local webserver serving python responses)\nEDIT:\nif you don't mind running it in webbrowser, you can make quite easily webserver, that will evaluate your queries...","Q_Score":0,"Tags":"javascript,python,html,css,user-interface","A_Id":45986381,"CreationDate":"2017-08-31T16:32:00.000","Title":"Is it possible to design GUI with HTML+CSS+JavaScript but it will actually run python script?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Recently I was trying to package all the files from a pygame program into an Android package (apk) using PGS4A, but it says that I need python 2.7.\nHow to create an apk from pygame with python 3.5?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2183,"Q_Id":46023310,"Users Score":1,"Answer":"I am also building an apk from pygame. But the tool -pgs4a actually is designed for python2 only. No tool has been developed to enable to use python3. So only option is python2. Till now it is not possible to use python3 for this purpose.","Q_Score":1,"Tags":"android,python-3.x,pygame,apk","A_Id":55198484,"CreationDate":"2017-09-03T12:09:00.000","Title":"How to create an APK from Pygame using PGS4A?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a Python code which imports libraries like numpy, scipy, keras (deep learning). \nIs it possible to convert it to mobile .apk using say kivy?\nI couldn't find any documentation specifying it is possible or not possible. Kindly help.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":12122,"Q_Id":46063595,"Users Score":2,"Answer":"While there is a numpy recipe, i believe there is no scipy or keras one, and it's certainly going to be quite some work to do them, so while theorically yes, python-for-android would do the job, in practice, you'll have to get your hands dirty to get that going.","Q_Score":3,"Tags":"python,apk,kivy","A_Id":46064362,"CreationDate":"2017-09-05T21:27:00.000","Title":"Converting Python Code to apk for Android?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create an GUI application, that would communicate with Asterisk server and provide functions, such as call forwarding, originating calls, etc. \nI wanted to use Kivy (Python GUI framework), but there here is so many different tools (AGI, AMI, FastAGI) and libraries (Pyst2, StarPy, etc.) to manage asterisk, that i don't even know where to start. \nI have already written some code (using Pyst2 asterisk manager) but I have a feeling, that this is not the best solution, as said application should be able to have multiple instances open simultaneously and AMI would be too messy for that purpose. \nCould someone give me some advice or suggestions what tools would be best to use in this case?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":168,"Q_Id":46071484,"Users Score":0,"Answer":"You can start from nice book, like ORelly \"The future of telephony\".\nThere is no way do something really valuable without know of asterisk dialplan. All that technology used for different things.","Q_Score":1,"Tags":"python,asterisk,voip,asteriskami","A_Id":46072812,"CreationDate":"2017-09-06T09:25:00.000","Title":"Creating touch GUI application for communication with Asterisk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying an application to write an application on which I have used a client\/server architecture. The client side is developed using .NET\\C# and the server side is developed on python. To communicate the both sides, I used first tcp\/ip socket; so i put my python's methods on a loop then I ask each time from my c# application to run an method. This idea is very bad as it require to cover all use cases that can be happening on network or something like that. After a work of search, I have found three technologies that can answer a client\/server architecture which are RPC, RMI and WCF. RMI a java oriented solution so it is rejected. So, my question here is: does RPC and WCF support multi programming languages (interoperability) especially betwenn C# and python?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":525,"Q_Id":46080092,"Users Score":1,"Answer":"I'm not sure I completely understand your use case, but I would suggest having a look at a REST API approach if you need to have .Net talk to Python, or vice versa.","Q_Score":0,"Tags":"c#,python,wcf,client-server,rpc","A_Id":46080832,"CreationDate":"2017-09-06T16:20:00.000","Title":"Client Server architecture using python and C#","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am a new to python. I am have installed Python27 and Vpython on my windows 64-bit W8.1 laptop.\nThe python version was Py27 32-bits and Vpython 32-bits. After installation I thought I could directly run an example program from the VIDLE (File -> Open -> bounce). But I realized there is lot more to install to get this working.\nSo I googled the errors and found that I has to install Numpy and WxPython which I was able to complete successfully. But now I have this error shown below\n\"The Polygon module is not installed,\n so the text and extrusion objects are unavailable.\nThe ttfquery and\/or FontTools modules are not installed,\n so the text object is unavailable.\" \nI googled for this but was not able to arrive at anything. \nShould I install Polygon module, FontTools and ttfquery module?\nI was not able to fond a proper link to do any of the above. Kindly help me out. I have a hit a wall.\nThanks!!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":347,"Q_Id":46110613,"Users Score":0,"Answer":"Hopefully was able to solve the issue.\nThe problem was with the way how I installed Vpython. I should have accidentally selected \"custom installation\" instead of \"full installation\".\nAlso the version of numpy that comes with default set-up did not support for me. Hence I used the pip to update the version and now everything is up and running.\nI am able to get the example programs to work.\nAlso the 64-bit version is not working still. So its always safe to stick on to 32-bit version even if your machine is 64-bit","Q_Score":0,"Tags":"python-2.7,vpython","A_Id":46111204,"CreationDate":"2017-09-08T07:09:00.000","Title":"Cannot get started with Vpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a new to python. I am have installed Python27 and Vpython on my windows 64-bit W8.1 laptop.\nThe python version was Py27 32-bits and Vpython 32-bits. After installation I thought I could directly run an example program from the VIDLE (File -> Open -> bounce). But I realized there is lot more to install to get this working.\nSo I googled the errors and found that I has to install Numpy and WxPython which I was able to complete successfully. But now I have this error shown below\n\"The Polygon module is not installed,\n so the text and extrusion objects are unavailable.\nThe ttfquery and\/or FontTools modules are not installed,\n so the text object is unavailable.\" \nI googled for this but was not able to arrive at anything. \nShould I install Polygon module, FontTools and ttfquery module?\nI was not able to fond a proper link to do any of the above. Kindly help me out. I have a hit a wall.\nThanks!!","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":347,"Q_Id":46110613,"Users Score":0,"Answer":"You're working with an older version of VPython that is no longer supported. See the first page of vpython.org.","Q_Score":0,"Tags":"python-2.7,vpython","A_Id":47043208,"CreationDate":"2017-09-08T07:09:00.000","Title":"Cannot get started with Vpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Having a horrible time learning Tkinter, and it seems to me as though when you make a button execute a function ...command=do_this), that command cannot have any parameters, it can only execute a function.\nI would like to pass a parameter to do_this() to give it functionality depending on the input, like do_this(parameter). However the command functionality of a button does not use the brackets at the end of the function name and doesn't seem to support parameters.\nHow do I get around this? The intended use of the program is to generate a frequency histogram based on different groups of data from a csv file, where the groups are selected via a listbox, then the histogram is generated by pressing a button.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":340,"Q_Id":46130703,"Users Score":0,"Answer":"In the call of your widget, insert\ncommand=lambda parameter1=value,parameter2=value,etc:name(parameters)\nFor example, if u want a button to execute a function do_this(a)\nwith paramter a set to 5 it's\ncommand=lambda a=5:do_this(a)","Q_Score":0,"Tags":"python,tkinter,listbox","A_Id":46130765,"CreationDate":"2017-09-09T12:27:00.000","Title":"Pass a parameter from a listbox\/button to a function in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Thanks in advance. \nHow can I list all the components like the buttons labels textboxs everything. I dont know if this is possible with pywin32. I am using python 3.5, windows 10 x64.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":702,"Q_Id":46142910,"Users Score":0,"Answer":"I don't know what items might be included in that class. If you have PythonWin, which is a good REPL for working with Python on Windows, you can get extensive lists of GUI components from its help files. For instance, you could select 'Python for Win32 Extensions Help' then 'Objects' under 'Pythonwin and win32ui' to see the list of available GUI objects in this category. By right-clicking within the list you'd get the HTML which you could process for a list.\nI hope somebody has a better way!","Q_Score":0,"Tags":"python,pywin32","A_Id":46145842,"CreationDate":"2017-09-10T16:25:00.000","Title":"List windows gui components using pywin32","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a study assignment due that requires me to convert a *.ui file from Qt into a *.py file using the command prompt.\nHowever I have been struggling because I can not find the Pyuic5\/4 module used to convert a *.ui file into a *.py file.\n{I have literally dug through and searched for it in my drive and can not find it}\nI have the mots recent Qt and Python download and running well.\nAny help or alternative method to converting *.ui to *.py would really be appreciated!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":184,"Q_Id":46150511,"Users Score":2,"Answer":"Try to run pip install pyuic5-tool in your terminal.","Q_Score":0,"Tags":"python,qt,user-interface,pyqt,pyuic","A_Id":66570292,"CreationDate":"2017-09-11T07:38:00.000","Title":"PyQt5 file missing (PyQt noob)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to set up a gameshow type system where I have 5 stations each having a monitor and a button. The monitor will show a countdown timer and various animations. My plan is to program the timer, animations, and button control through pygame and put a pi at each station each running it's own pygame script, waiting for the start signal (can be keypress or gpio).\nI'm having trouble figuring out how to send that signal simultaneously to all stations. Additionally I need to be able to send a 'self destruct' signal to each station to stop the timer. I can ssh into each station but I don't know how to send keypress\/gpio signals through the command line to a running pygame script..\nI was thinking of putting a rf receiver on each pi, all at the same wavelength and using a common transmitter, but that seems very hacky and not necessarily so simultaneous.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":114,"Q_Id":46246197,"Users Score":0,"Answer":"This ought to work ... but it's purely hypothetical:\nUse a parallel circuit to set a pin \"high\" and \"low\" - \"high\" means start the timer; \"low\" means stop the timer. The next \"high\" resets and restarts the timer.\nYou could use two circuits. One for start\/stop and one for \"reset\". You'd probably need some code to not reset while running.\nThe parallel circuit can be controlled manually (for testing) or automatically (perhaps with a master program?).","Q_Score":0,"Tags":"python,raspberry-pi,pygame","A_Id":46246348,"CreationDate":"2017-09-15T19:17:00.000","Title":"Control Multiple Raspberry Pis Remotely \/ Gameshow Type System","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a program using C#, but I just figured out that what I am going to program is very very difficult in C# yet easy in Python. So what I want to do is make a .PYD file and use it in C# program, but I don't know how. I've been searching about it but I couldn't find anything. \nSo these are my questions: How do I use .PYD file in C#? I know that .PYD files are similar to .DLL files, so are .PYD files still usable in computers that have no Python installed?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2953,"Q_Id":46317830,"Users Score":2,"Answer":"A .pyd file IS a DLL but with function init*() where * is the name of your .pyd file. For example, spam.pyd has a function named initspam(). They are not just similar, but the same! They are usable on PCs without Python.\n\nDo not forget: builtins will NOT be available. Search for them in C, add them as an extern in your Cython code and compile!","Q_Score":3,"Tags":"c#,python,pyd","A_Id":46322006,"CreationDate":"2017-09-20T09:09:00.000","Title":"Using .PYD file in C#?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to convert a .ui file generated in Qt4 into python executable file.\nI've tried installing pyqt4 dev tools by the following command:\npip install pyqt4-dev-tools\nBut found an exception as follows:\nCould not find a version that satisfies the requirement pyqt4-dev-tools (from versions: )\nNo matching distribution found for pyqt4-dev-tools.\nWill be pleased if anyone provides a solution.Thank you.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":436,"Q_Id":46326595,"Users Score":0,"Answer":"For Windows, if you installed PyQt4 package already, you should have the pyuic tool available. You can call it with usingpython C:\\Python\\Python2.7\\Lib\\site-packages\\PyQt4\\uic\\pyuic.py UIFileName.ui -o PythonFileName.py -x","Q_Score":0,"Tags":"python,pyqt4","A_Id":46413682,"CreationDate":"2017-09-20T15:51:00.000","Title":"Python27 - PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"In a perspective: \nThe user interface features in kivy is easier to handle, compared to pygame. But, in pygame, it is convenient to manipulate graphics with blit : do blit, then clear all graphics on the surface after finishing an event, then blit again, etc. \nIt is also more flexible (based on my limited exp. on this), because the pygame activity can be controlled using while and can get info of the events with one line of code. \nIs it possible to package a kivy app, that uses pygame module, for Android?\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4711,"Q_Id":46335246,"Users Score":3,"Answer":"It is also more flexible (based on my limited exp. on this), because the pygame activity can be controlled using while and can get info of the events with one line of code. \n\nIt isn't more flexible, just a different API. Kivy's drawing API is much more modern and closer to how drawing with opengl actually works.\n\nIs it possible to package a kivy app, that uses pygame module, for Android?\n\nKivy used to use a modified pygame backend on Android, which is still available using --bootstrap=pygame when using python-for-android. I think at least some pygame commands worked when this was used, including drawing commands. However, use of the pygame api was never really supported, and the pygame bootstrap is nowadays deprecated in favour of SDL2 - we won't deliberately break it, but it has issues that will probably never be fixed.","Q_Score":4,"Tags":"android,python-3.x,pygame,kivy","A_Id":46348642,"CreationDate":"2017-09-21T03:59:00.000","Title":"Use Pygame in Kivy to be packaged to an Android app, is this Ok?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd designed a python software that required to start right after boot into system. I'd use sudo nano \/home\/pi\/.config\/lxsession\/LXDE-pi\/autostart to add in @python3 \/home\/pi\/X\/exe.py\nBefore I'd include serial communication into the apps, everything works fine.\nBut after I'd add in serial, the autostart had failed.\nSo, how to autostart on boot a PyQt5 based serial comn.-able apps in Raspbian Jessie?\nI'd been suspecting that this weird behavior is due to serial communication that I'd added, that will be used before Pi logon.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":61,"Q_Id":46345699,"Users Score":0,"Answer":"I'd decided to reflash the image and my problem is solved.","Q_Score":1,"Tags":"python-3.x,serial-port,pyqt5,raspbian","A_Id":46519334,"CreationDate":"2017-09-21T13:47:00.000","Title":"Raspbian autostarting a PyQT5 UI that has Serial communication","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've created with python and kivy an android app that works offline, app shows landscape photos, how can i open my app only when wifi is enabled? to let my app upload ads,have patience with me im new Thank You.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":127,"Q_Id":46347262,"Users Score":0,"Answer":"There's a dirty method though.. try requesting google.com or any other reliable website in the background with urllib or requests or socket, if its not getting any reply it must mean that system is not connected to internet","Q_Score":0,"Tags":"python,kivy","A_Id":63662212,"CreationDate":"2017-09-21T14:59:00.000","Title":"How can i open my app only when wifi is enabled for upload Ads?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So, I'm programming in Python 3.2 on android (the app I'm using is QPython3) and I wonder if I could make a game\/app with a graphic interface for android, using only a smartphone. Is it possible? If yes, how do I do that?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3395,"Q_Id":46376713,"Users Score":0,"Answer":"Look at using Linux (a different Kernal) distro on your phone. Many will basically act as a pc, just lacking power. I'm sure there is one you can run regular Python with. Then you may also look at renpy for porting it to android, or even kivy but i'm thinking kivy would be very different than anything you have, and require learning a new language basically.\nSadly changing the OS on your phone is the only option I can think of, and probably the best. I cannot imagine any frameworks for android to be as vast as those that have been developed for PC. You may be able to find some hacked, port version of something that may help, a tool something idk.","Q_Score":2,"Tags":"android,python-3.x,kivy,2d-games,qpython3","A_Id":61050929,"CreationDate":"2017-09-23T06:22:00.000","Title":"Pygame\/Kivy on Android?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm searching for a tkinter custom widget collection that I can include in a application designer I'm writing in 100% Python but haven't had much luck yet. I figured out a way to do a table for instance, but would like to save myself the work if there's a good implementation out there.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":277,"Q_Id":46387431,"Users Score":0,"Answer":"I found a couple of packages for pure Python custom widget creation with a little more searching online. One is Python megawidgets, at pmw.sourceforge.net, which, according to their documentation:\n\"is a toolkit for building high-level compound widgets in Python using the Tkinter module. It consists of a set of base classes and a library of flexible and extensible megawidgets built on this foundation. These megawidgets include notebooks, comboboxes, selection widgets, panes widgets, scrollable widgets, and dialog windows.\"\nA different approach is writing custom widgets yourself using the Widget Construction Kit, at effbot.org\/zone\/wck.htm. This provides a base Widget class with primitive drawing methods, such as for borders, text, and colors, along with a basic but complete set of event definitions for binding your event handlers to your custom widgets. It has some good advice on doing animated widgets, such as drag and drop. \nIf anybody knows of any other packages of widgets or construction toolkit APIs, feel free to post it here. Developers will appreciate having a larger selection in a single location.","Q_Score":0,"Tags":"python,tkinter,collections,widget","A_Id":46395861,"CreationDate":"2017-09-24T06:55:00.000","Title":"tkinter custom widget collecting","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a client application with python. GUI is created with PyQt.\nBasically, the application connects to the server via ssh and retrieves information thereby reading files generated by the server software. I am using paramko module.\nMy question is:\nShould I open an ssh connectivity right when the client application is started and keep until it quits? Or I should create a new ssh connectivity whenever a button in client app triggers information retrieval?\nHow would it affect the performance?\nAny suggestion and reference would be highly appreciated.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":64,"Q_Id":46398738,"Users Score":-1,"Answer":"Whenever you have ssh to server 1 port is block from both the side, if you have connection when client starts then it will block that port and no one could communicate to server , also you increasing server load just keeping the connection open. \nSo, my advice is to start ssh whenever the need is and stop once task is completed.","Q_Score":1,"Tags":"python,ssh,paramiko","A_Id":46398816,"CreationDate":"2017-09-25T06:19:00.000","Title":"Client application's connectivity with server","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to write output files containing tabular datas (float values in lines and columns) from a C++ program.\nI need to open those files later on with other languages\/softwares (here python and paraview, but might change).\nWhat would be the most efficient output format for tabular files (efficient for files memory sizes efficiency) that would be compatible with other languages ?\nE.g., txt files, csv, xml, binarized or not ?\nThanks for advices","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":408,"Q_Id":46468549,"Users Score":0,"Answer":"First of all the efficiency of i\/o operations is limited by the buffer size. So if you want to achieve higher throughput you might have to play with the input output buffers. And regarding your doubt of what way to output into the files is dependent on your data and what delimiters you want to use to separate the data in the files.","Q_Score":1,"Tags":"python,c++,io","A_Id":46468692,"CreationDate":"2017-09-28T11:57:00.000","Title":"Which data files output format from C++ to be read in python (or other) is more size efficient?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to write output files containing tabular datas (float values in lines and columns) from a C++ program.\nI need to open those files later on with other languages\/softwares (here python and paraview, but might change).\nWhat would be the most efficient output format for tabular files (efficient for files memory sizes efficiency) that would be compatible with other languages ?\nE.g., txt files, csv, xml, binarized or not ?\nThanks for advices","AnswerCount":3,"Available Count":2,"Score":0.1325487884,"is_accepted":false,"ViewCount":408,"Q_Id":46468549,"Users Score":2,"Answer":"1- Your output files contain tabular data (float values in lines and columns), in other words, a kind of matrix.\n2- You need to open those files later on with other languages\/softwares\n3- You want to have files memory sizes efficiency\nThat's said, you have to consider one of the two formats below:\n\nCSV: if your data are very simple (a matrix of float without particualr structure)\nJSON if you need a minimum structure for your files\n\nThese two formats are standard, supported by almost all the known languages and maintained softwares.\nLast, if your data have a great complexity structure, prefer to look at a format like XML but the price to pay is then in the size of your files!\nHope this helps!","Q_Score":1,"Tags":"python,c++,io","A_Id":46473158,"CreationDate":"2017-09-28T11:57:00.000","Title":"Which data files output format from C++ to be read in python (or other) is more size efficient?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to update my canvas but tkinter.update() says tkinter has no attribute \"update\". What might be the possible solution. My thanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4656,"Q_Id":46478672,"Users Score":3,"Answer":"You need to call update on your canvas object instead of tkinter, i.e. canvas.update().","Q_Score":2,"Tags":"python,tkinter,tkinter-canvas","A_Id":46478717,"CreationDate":"2017-09-28T21:34:00.000","Title":"How to update the canvas in python using tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to install kivy, but my computer doesn't recognise me as having installed pip so I run get-pip.py through my cmd and this is what happens:\nWhen I type: cd \\Users\\jmcco\\Desktop\\python-3.6.2-embed-amd64\\ and then type: python get-pip.py I get an error message that reads: TypeError: expected str, bytes or os.PathLike object, not NoneType\n\nThe whole cmd output reads:\nFile \"get-pip.py\", line 20061, in \n main()\nFile \"get-pip.py\", line 194, in main\n bootstrap(tmpdir=tmpdir)\nFile \"get-pip.py\", line 82, in bootstrap\n import pip\nFile \"\", line 961, in _find_and_load\nFile \"\", line 950, in _find_and_load_unlocked\nFile \"\", line 646, in _load_unlocked\nFile \"\", line 616, in _load_backward_compatible\nFile \"C:\\Users\\jmcco\\AppData\\Local\\Temp\\tmp8xsq68ol\\pip.zip\\pip__init__.py\", line 26, in \nFile \"\", line 961, in _find_and_load\nFile \"\", line 950, in _find_and_load_unlocked\nFile \"\", line 646, in _load_unlocked\nFile \"\", line 616, in _load_backward_compatible\nFile \"C:\\Users\\jmcco\\AppData\\Local\\Temp\\tmp8xsq68ol\\pip.zip\\pip\\utils__init__.py\", line 23, in \nFile \"\", line 961, in _find_and_load\nFile \"\", line 950, in _find_and_load_unlocked\nFile \"\", line 646, in _load_unlocked\nFile \"\", line 616, in _load_backward_compatible\nFile \"C:\\Users\\jmcco\\AppData\\Local\\Temp\\tmp8xsq68ol\\pip.zip\\pip\\locations.py\", line 88, in \nFile \"ntpath.py\", line 75, in join\nTypeError: expected str, bytes or os.PathLike object, not NoneType\nC:\\Users\\jmcco\\Desktop\\python-3.6.2-embed-amd64>","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":627,"Q_Id":46487500,"Users Score":0,"Answer":"So, if Windows doesn't recognize something as a script (for example, if you're using .py extension), then it will try to open the file in whatever it has as a default editor. In your case, it's Atom. In my case (when I used Windows) it was Notepad++.\nRegardless, you need to use the command prompt to get this working:\n\nPress Windows-r A prompt will show up.\nType cmd in the prompt.\nPress enter This will drop you into the command prompt.\nType python then hit enter If you have an error, then you don't have Python.\nPaste\/type cd \\Users\\jmcco\\Desktop\\python-3.6.2-embed-amd64\\\nType python get-pip.py\n\nAlternatively, you could use Anaconda, which should allow you to use a GUI to install.","Q_Score":1,"Tags":"python-3.x,cmd,path,pip","A_Id":46490397,"CreationDate":"2017-09-29T11:03:00.000","Title":"Python 3.6.2 - Trying to install pip through cmd, get the following TypeError:","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Buildozer to convert a python file to android APK (using Kivy) and it gets quite far through the process but then errors.\nAny ideas what is causing this error at the end?\n\ntoolchain.py: error: unrecognized arguments: --sdk 19 Could\n not find hostpython, will not compile to .pyo (this is normal with\n python3)\nCommand failed: \/usr\/bin\/python -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name KivyTest --name KivyApp --version 0.1 --package doublejgames.com.kivytest --android_api 19 --sdk 19 --minsdk 9 --private \/home\/kivy\/Desktop\/.buildozer\/android\/app --orientation landscape --copy-libs --arch armeabi-v7a --color=always --storage-dir=\/home\/kivy\/Desktop\/.buildozer\/android\/platform\/build\n\nThis seems to be the main error:\n\ntoolchain.py: error: unrecognized arguments: --sdk 19 Could\n not find hostpython, will not compile to .pyo (this is normal with\n python3)\n\nIn my buildozer.spec file, I'm using the requirements:\n\nrequirements = kivy, python3crystax==3.6 \n\nI also tried just\n\nrequirements = kivy, python3crystax\n\nAny help would be appreciated! Thanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":750,"Q_Id":46545454,"Users Score":0,"Answer":"The error is the 'error: unrecognized arguments: --sdk 19' part, the rest is not important. The problem arises from a regression in python-for-android, as this argument was removed but is still passed by buildozer. I've re-added the argument (with a deprecation warning) and created a PR to stop buildozer calling it anyway. This means that if you clean everything and try again, the error should no longer occur.","Q_Score":0,"Tags":"python,kivy,buildozer","A_Id":46575561,"CreationDate":"2017-10-03T13:12:00.000","Title":"Could not find hostpython, will not compile to .pyo (Buildozer python-to-android)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"is there a way of placing character onto another character in python tkinter Label? If not is it possible with Text widget?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":57,"Q_Id":46565209,"Users Score":1,"Answer":"No, it is not possible with either the Label orText widget. You can do it with the Canvas widget, however.","Q_Score":0,"Tags":"python,tkinter,label,character","A_Id":46565877,"CreationDate":"2017-10-04T12:44:00.000","Title":"Place char on another char in tkinter Label widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am attempting to get PyQt4 running on a windows 10 device with python 3.6.3. I have sips installed and built already in my python directory. However, when I run the configure.py\/configure-ng.py file in the PyQt4 folder I get the following error: Error: Make sure you have a working Qt qmake on your PATH. \nI'm not sure how to fix this problem or what qmake is. I apprectiate any answers on how to fix this!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":13360,"Q_Id":46570466,"Users Score":4,"Answer":"qmake is the name of Qt's build tool, which generates Makefiles or other files needed to compile code on any platform that Qt supports. To fix this, you need to find out where the qmake executable lives on your system.\nIf you know where the executable installed, just add that directory to your path. If you don't know, you'll have to find it somehow, by searching your computer.","Q_Score":5,"Tags":"python,qt,qmake","A_Id":46570647,"CreationDate":"2017-10-04T17:08:00.000","Title":"PyQt4 Error: Make sure you have a working Qt qmake on your PATH","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I tried the following program in Win10, it works\nBut I want to use it in linux mint and it display nothing (it display a window with a button on my win10)\nfrom tkinter import *\ntk=Tk()\nbtn= Button(tk,text=\"ttk\")\nbtn.pack()\nI want it display a window with a button on my linux mint","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":395,"Q_Id":46598682,"Users Score":1,"Answer":"You need to invoke Tk's mainloop. Add tk.mainloop() at the end of your code. Besides that, I suggest you use import tkinter as tk (in which case you would have to rename your variable to something else (suggestion: root is kind of idiomatic)) instead of from tkinter import *, since you don't know what names that imports. It can replace names you imported earlier, and it makes it very difficult to see where names in your program are supposed to come from.","Q_Score":0,"Tags":"linux,windows,python-3.x,tkinter","A_Id":46601511,"CreationDate":"2017-10-06T05:16:00.000","Title":"How can I use python 3 tkinter in Linux?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was thinking about creating minesweeper in python\/pygame. However, I was stumped when I was trying to figure out a way to guarantee a large swath of empty space on the first move (such as in minesweeper on Windows XP). Does anyone have a method for doing this? I don't want code, just words.\nThank you in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":50,"Q_Id":46637916,"Users Score":1,"Answer":"Firstly, that doesn't happen on Windows XP (or any common minesweeper implementation) every time. It's very likely to if you are playing on a low difficulty though.\nThere are some ideas though;\n\nGenerate the map after the first click. This allows you to avoid the area the user clicked, giving you the large swath you desire - simply by tweaking your mine placement algorithm to avoid the area around where the user clicked.\nGenerate the map - but change it if insufficient space would be exposed. This will (probably) result in a faster reaction on the first click as the map will likely be already generated.\nDon't do this. As mentioned previously - this is not how windows XP worked. But there was a high likelihood of this just happening naturally on easier difficulties. It might be worth recalculating the map if the user clicks on a mine on the first move, but otherwise leave it to your random distribution. Remember that (except some custom modes) there are going to be many more empty squares than ones with mines.\n\nHopefully that will get you started.","Q_Score":0,"Tags":"python","A_Id":46638373,"CreationDate":"2017-10-09T02:06:00.000","Title":"Exposing a Large Swath of Tiles in Minesweeper","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to discuss an issue.\n\nWhat can be put to the requirements=... in the buildozer.spec?\nIs it necessary to put sdl2 and python2 so that the app works fine on the phone?\nShould it better be built using android_new or android? \n\nI have the main.py code that depends on kivy modules and some of its widgets, and also numpy, and some built-in Python2 modules. The app works fine in Windows using Python2 (and also Python3), the app uses three .py files for storing functions and objects. When I deploy the app using buildozer to the phone, the app does not crash..but the touch for button does not work and the Image widget does not show. This is built using buildozer android debug. \nThanks.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1585,"Q_Id":46661848,"Users Score":0,"Answer":"The fact that it runs means your requirements are probably ok. As mentioned previously, I would update as \"android_new\" is now \"android\". That might fix the touch, but the missing image is probably a path issue. I would suggest posting on the kivy forums if you still have issues.\n\"kivy\" should be enough for requirements, but also \"python2\" or \"python3crystax\" would be good to add to explicitly state which python version you want to use.","Q_Score":0,"Tags":"android,python-2.7,python-3.x,kivy","A_Id":52576484,"CreationDate":"2017-10-10T08:21:00.000","Title":"List of buildozer requirements to build an apk for Kivy-Python app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to discuss an issue.\n\nWhat can be put to the requirements=... in the buildozer.spec?\nIs it necessary to put sdl2 and python2 so that the app works fine on the phone?\nShould it better be built using android_new or android? \n\nI have the main.py code that depends on kivy modules and some of its widgets, and also numpy, and some built-in Python2 modules. The app works fine in Windows using Python2 (and also Python3), the app uses three .py files for storing functions and objects. When I deploy the app using buildozer to the phone, the app does not crash..but the touch for button does not work and the Image widget does not show. This is built using buildozer android debug. \nThanks.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1585,"Q_Id":46661848,"Users Score":0,"Answer":"As said in my last comment on your other post, the default buildozer.spec produced by \"buildozer init\" should be enough to compile a working apk, including image and clickable button.\nSo it's not necessary to add sdl2 or python2 in your requirements. \n\"android_new\" or \"android\"? Now it's called \"android\" and \"android_old\", so you might update your buildozer installation so it may resolves your others problems, but when I was using your version, I used \"android_new\".","Q_Score":0,"Tags":"android,python-2.7,python-3.x,kivy","A_Id":46662406,"CreationDate":"2017-10-10T08:21:00.000","Title":"List of buildozer requirements to build an apk for Kivy-Python app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning a lot about the uses of Machine Learning and Google's Tensorflow. Mostly, developers use Python when developing with Tensorflow. I do realize that other languages can be used with Tensorflow as well, i.e. Java and C++. I see that Google s about to launch Tensorflow Lite that is supposed to be a game changer for mobile devices. My question; can I be safe by learning Tensorflow using Python and still be able to develop mobile apps using this service?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":249,"Q_Id":46676738,"Users Score":0,"Answer":"Short answer is : yes. You will be safe with python since it\u2019s the main front end language for tensorflow. Also I agree with BHawk\u2019s answer above.","Q_Score":0,"Tags":"java,android,python,mobile,tensorflow","A_Id":46680237,"CreationDate":"2017-10-10T22:02:00.000","Title":"Using Tensorflow on smartphones","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been learning a lot about the uses of Machine Learning and Google's Tensorflow. Mostly, developers use Python when developing with Tensorflow. I do realize that other languages can be used with Tensorflow as well, i.e. Java and C++. I see that Google s about to launch Tensorflow Lite that is supposed to be a game changer for mobile devices. My question; can I be safe by learning Tensorflow using Python and still be able to develop mobile apps using this service?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":249,"Q_Id":46676738,"Users Score":0,"Answer":"In short, yes. It would be safe to learn implementing TensorFlow using python and still comfortably develop machine learning enabled mobile apps.\nLet me elaborate. Even with TensorFlow Lite, training the data can only happen on the server side; only the prediction, or the inference happens on the mobile device. So typically, you would create your models on TensorFlow, often using python, and then leverage TensorFlow Lite to package that model into your app.","Q_Score":0,"Tags":"java,android,python,mobile,tensorflow","A_Id":46817475,"CreationDate":"2017-10-10T22:02:00.000","Title":"Using Tensorflow on smartphones","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've installed, uninstalled, reinstalled FontTools and Fontmake via pip. \nHowever, whenever I try to call Fontmake in terminal I get the following error. Py23 appears to be a Fonttools dependency, which is also installed.\nThanks in advance for any help!\nTraceback (most recent call last):\n File \"\/usr\/local\/bin\/fontmake\", line 9, in \n load_entry_point('fontmake==1.3.1.dev0', 'console_scripts', 'fontmake')()\n File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/Extras\/lib\/python\/pkg_resources.py\", line 357, in load_entry_point\n return get_distribution(dist).load_entry_point(group, name)\n File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/Extras\/lib\/python\/pkg_resources.py\", line 2394, in load_entry_point\n return ep.load()\n File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/Extras\/lib\/python\/pkg_resources.py\", line 2108, in load\n entry = import(self.module_name, globals(),globals(), ['name'])\n File \"\/Library\/Python\/2.7\/site-packages\/fontmake\/main.py\", line 18, in \n from fontmake.font_project import FontProject\n File \"\/Library\/Python\/2.7\/site-packages\/fontmake\/font_project.py\", line 37, in \n from defcon import Font\n File \"\/Library\/Python\/2.7\/site-packages\/defcon\/init.py\", line 10, in \n from defcon.objects.font import Font\n File \"\/Library\/Python\/2.7\/site-packages\/defcon\/objects\/font.py\", line 6, in \n from ufoLib import UFOReader, UFOWriter\n File \"\/Library\/Python\/2.7\/site-packages\/ufoLib\/init.py\", line 6, in \n from fontTools.misc.py23 import basestring, unicode\nImportError: No module named py23","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":264,"Q_Id":46761139,"Users Score":0,"Answer":"I fixed this by installing Fonttools from the source files, instead of installing with pip.","Q_Score":0,"Tags":"python-2.7,module,ttx-fonttools","A_Id":46761612,"CreationDate":"2017-10-15T23:42:00.000","Title":"Error message after installing fontmake: \"No module named py23\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I start up my PyQt GUI, the focus immediately goes to the text box.\nI want there to be no focus on any of the buttons at the start of the program, especially not the text box.\nIs there a way to remove the focus entirely or at least move the focus to a button or something?\nThanks","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1856,"Q_Id":46780773,"Users Score":1,"Answer":"Create a button with dimensions 0 wide by 0 high.\nSet it as the default button and also early in the tab order before the other controlls that except focus; but note that it will be triggered if the user presses ENTER in some edit controls.\nCall self.ui.yourbutton.setFocus() if desired for example after restore from minimized","Q_Score":3,"Tags":"python-3.x,user-interface,focus,pyqt5,startup","A_Id":56467458,"CreationDate":"2017-10-17T00:27:00.000","Title":"PyQt: How do you clear focus on startup?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I start up my PyQt GUI, the focus immediately goes to the text box.\nI want there to be no focus on any of the buttons at the start of the program, especially not the text box.\nIs there a way to remove the focus entirely or at least move the focus to a button or something?\nThanks","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1856,"Q_Id":46780773,"Users Score":1,"Answer":"clearFocus() seems to work after a certain amount of delay after the window is visible. I also used setFocus() on the QMainWindow and then the textedit field lost focus.","Q_Score":3,"Tags":"python-3.x,user-interface,focus,pyqt5,startup","A_Id":51915780,"CreationDate":"2017-10-17T00:27:00.000","Title":"PyQt: How do you clear focus on startup?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a really simple app in Python for a school project. It is for a skillsharing community that our club is trying to start up. Imagine Venmo, but without any money involved. It's essentially a record of favors done for those in the community.\nThe users' info is stored as a dictionary within a dictionary of all users. The dictionary is pickled and the .pkl is updated automatically whenever user info is changed. I want the users to be able to access the information online, by logging in via username and password. It will be used regularly by people and security isn't really a concern since it doesn't store personal info and the users are a small group that are in our club.\nAnyhow, my issue is that I only know how to do backend stuff and basic tkinter GUIs (which, AFAIK can't be used for my needs). I'm a self-taught and uncommitted novice programmer, so I don't even know how to search for what I'm trying to do. I imagine what I need to do is put the program and the .pkl on the server that will host my website. (I have a domain name, but never figured out how to actually make it a website...) From there, I imagine I have to write some code that will create a login screen and allow users to login and view the attributes associated with their profile as well as send \"payment\" (as favors) to other users.\nHow do I do any\/all of this? I'm looking for online resources or explanations from the community that will help me get this project off the ground. Also, telling me what it is called that I am trying to do would be greatly appreciated. Thanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":60,"Q_Id":46783732,"Users Score":1,"Answer":"If I got your idea right then you just want to create python web application.\nFirst, you should check out python WebFrameworks and choose right one for you.\nThen you should check how to work with it on your existing web server.\nAnd last but not least (if I didn't forget anything) you should check some info on front-end programming.\nSorry, if I gor your idea wrong or misguiding you at somwe point.","Q_Score":0,"Tags":"python,web-applications","A_Id":46784214,"CreationDate":"2017-10-17T06:23:00.000","Title":"How do I make an app available online? [Python]","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just made an app using python and tkinter widgets. \n There are Labels, Frames, Buttons, etc in the Tk and Toplevel widgets.\nHowever, it includes thousands of codes and its really annoying to resize every widgets when I support multiple resolutions.\nIs there any way to expand the resolution ratio for existing Tkinter Tk() and Toplevel() widget and their child widgets? (zooming-in)\n If not, what would be the best approach to support multiple resolutions of a python app with the same ratio?\n Any help would be much appreciated, sorry for bad English.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":421,"Q_Id":46784260,"Users Score":0,"Answer":"Can't comment so I add a short tip to the detailed Ethan answer. You can design most of the GUIs in tkinter with either pack, grid or a combination of both (by placing frames on a window with one of them, and using either grid or pack inside of each frame, to \"place\" the widgets). You can tune the configurations for proper location and size when the window resizes. Keep placer use for special cases (like overlaying some widget on the top of others)","Q_Score":0,"Tags":"python,tkinter","A_Id":46797450,"CreationDate":"2017-10-17T07:01:00.000","Title":"Python - is there any way to expand the resolution ratio for existing Tkinter Tk() and Toplevel() widget? (zooming-in)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python script that I execute from the command line, and I pass to it some parameters from there as well. \nNow I'm designing the GUI to execute that script, so I want to execute the script after clicking a button, and passing the arguments from a Listbox. \nI have seen some suggestions that used lambda functions. However, I couldn't find any example of executing a whole different script that takes arguments from command line basically. \nI also tried ecevfile, but it executes the script without taking any parameters. \nHow can I execute the script by a button press and passing the arguments as well?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":273,"Q_Id":46844090,"Users Score":0,"Answer":"Just an idea but you could write a function to make a batch file and use os.startfile(\"batch.bat\")","Q_Score":0,"Tags":"python,button,lambda,tkinter","A_Id":46853395,"CreationDate":"2017-10-20T07:15:00.000","Title":"Tkinter: Passing parameters to a python script executed by button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been playing around with tkinter a lot at my school using pycharm, but when i go home and use the pycharm on my pc, the module is not installed for tkinter. I can't seem to find how to install it. I am running python 3.6. I do not have python running on cmd.exe. All help is appreciated, thanks.","AnswerCount":6,"Available Count":4,"Score":0.0333209931,"is_accepted":false,"ViewCount":15283,"Q_Id":46894762,"Users Score":1,"Answer":"install Packages : 'future' import tkinter","Q_Score":2,"Tags":"python,tkinter,pycharm,tk,python-3.6","A_Id":51811625,"CreationDate":"2017-10-23T17:02:00.000","Title":"How to install tkinter onto pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been playing around with tkinter a lot at my school using pycharm, but when i go home and use the pycharm on my pc, the module is not installed for tkinter. I can't seem to find how to install it. I am running python 3.6. I do not have python running on cmd.exe. All help is appreciated, thanks.","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":15283,"Q_Id":46894762,"Users Score":0,"Answer":"Depending on your setup, you may need to uninstall and reinstall Pycharm. I had this problem on Linux Mint 20, and the issue was I was using the Flathub version of Pycharm. I uninstalled, and downloaded pycharm from the website, installed through terminal and suddenly everything works.","Q_Score":2,"Tags":"python,tkinter,pycharm,tk,python-3.6","A_Id":65334470,"CreationDate":"2017-10-23T17:02:00.000","Title":"How to install tkinter onto pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been playing around with tkinter a lot at my school using pycharm, but when i go home and use the pycharm on my pc, the module is not installed for tkinter. I can't seem to find how to install it. I am running python 3.6. I do not have python running on cmd.exe. All help is appreciated, thanks.","AnswerCount":6,"Available Count":4,"Score":-0.0996679946,"is_accepted":false,"ViewCount":15283,"Q_Id":46894762,"Users Score":-3,"Answer":"In pycharm project interpreter you need to install future package\nthen restart pycharm, after that use import tkinter.\nRemember to use lower case.","Q_Score":2,"Tags":"python,tkinter,pycharm,tk,python-3.6","A_Id":58871000,"CreationDate":"2017-10-23T17:02:00.000","Title":"How to install tkinter onto pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been playing around with tkinter a lot at my school using pycharm, but when i go home and use the pycharm on my pc, the module is not installed for tkinter. I can't seem to find how to install it. I am running python 3.6. I do not have python running on cmd.exe. All help is appreciated, thanks.","AnswerCount":6,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":15283,"Q_Id":46894762,"Users Score":0,"Answer":"Just import Tkinter with lowercase t: import tkinter as tk","Q_Score":2,"Tags":"python,tkinter,pycharm,tk,python-3.6","A_Id":50565829,"CreationDate":"2017-10-23T17:02:00.000","Title":"How to install tkinter onto pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to build a gambling dice game for fun using Python's Tkinter in Python 3. The error I am having is after the money is taken away from your bank account (it does this in a different function) I want it to go back to the mainloop. So basically I want to exit a function to get back into the main code (which isn't in a function). Any ideas on how?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":84,"Q_Id":46898992,"Users Score":0,"Answer":"The function should automatically stop when it is finished running. Using return, though, will immediately exit the current function, perhaps before it gets through all of its code, if that's what you mean.","Q_Score":0,"Tags":"python,tkinter","A_Id":46899067,"CreationDate":"2017-10-23T21:42:00.000","Title":"Exit Function Into Main Code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I create a tkinter.Label with parameter fg = PRIMARY_COLOR and than .pack() it, if I change the value of PRIMARY_COLOR variable, call the .update() method of the widget, foreground color will not change. I know, why this is happening, but can I somehow do, that the widget will change foreground color with the PRIMARY_COLOR variable change? Can I make some kind of \"pointer\"?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":380,"Q_Id":46916293,"Users Score":1,"Answer":"No, you cannot do what you want. You will need to call the configure method of every widget that uses that color.","Q_Score":1,"Tags":"python,pointers,variables,tkinter,parameters","A_Id":46916546,"CreationDate":"2017-10-24T17:10:00.000","Title":"Update tkinter widget parameters with \"pointer\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Let's say I have a button widget of arbitrary size,\n\nis there a conventional way to make its text to fit or let's say\nresize in proportion of the button's new size?\n\nIf so what is it?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":170,"Q_Id":46966692,"Users Score":1,"Answer":"No, there is nothing built-in. You can probably make it work, but tkinter is designed to work the other way around: you specify the text and the widget will automatically resize to fit.","Q_Score":0,"Tags":"python,tkinter","A_Id":46967037,"CreationDate":"2017-10-27T02:39:00.000","Title":"Is there a conventional, simple way to make the fontsize of text option in a widget to fit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a kivy file with several widgets, one of them is a switch.\nThe problem is that wherever I press on the screen, it flips the switch.\nI have 2 other widgets - one of them is a check-box and another is radio-buttons, which also have some problems and I think they are occuring because of the switch.\nThe problem is that in order to press them I need to press on a different part of the screen and not on the widget itself.\nAny help would be appreciated.\nUPDATE\nI am using Windows only for development.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":109,"Q_Id":46988123,"Users Score":0,"Answer":"You probably have a switch that is larger than you expect. From the documentation of the switch: \"The entire widget is active, not just the part with graphics. As long as you swipe over the widget\u2019s bounding box, it will work.\" I would try changing the background of the switch to see how big it really is.","Q_Score":0,"Tags":"python,widget,kivy","A_Id":47026950,"CreationDate":"2017-10-28T09:20:00.000","Title":"Kivy module switch widget pressed anywhere","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a small project in VPython 7; Python 3.6, where textures need to be applied to my 3D objects. However, when I try loading the texture in, the object does not appear, until I place the texture in the Lib\\site packages\\vpython\\vpython_data folder, where it is loaded perfectly with no problems.\n\nHowever, for my project, I need it to be in my chosen directory for easy organisation.\n\nLet's call the directory C:\\Project with my texture Tex \/Tex.jpg\ntextures.customTex= {'file':\":Tex.jpg\"}\nself.3DObject= sphere(pos=vector(0,0,0),radius = 1, texture=textures.Tex)\nThe above will work if the texture is the the \/vpython_data directory.\nHowever, when I try to load the same texture but in my directory:\ntextures.customTex= {'file':\":C:\\Project\\Tex.jpg\"}\nself.3DObject= sphere(pos=vector(0,0,0),radius = 1, texture=textures.Tex)\n\nThe above will not work.\n\nMy question is whether there if I am loading it in wrong, or whether there is simply no workaround this problem.\nThank you in advance","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":433,"Q_Id":47022486,"Users Score":0,"Answer":"If you are running this in a Jupyter Notebook and the directory where the image exists is a subdirectory of the directory where the notebook is located then it will work. For instance if there is an images directory in the same directory as the notebook which contains Tex.jpg file then this will work.\nself.3DObject= sphere(pos=vector(0,0,0),radius = 1, texture=\"images\\Tex.jpg\")","Q_Score":1,"Tags":"python,python-3.x,directory,vpython","A_Id":47043754,"CreationDate":"2017-10-30T19:02:00.000","Title":"VPython 7 Texture not loading from custom directory","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to all of this and I am trying to install PyQt5, I entered \"pip install pyqt5\" and this is what happened - ( its cached because of previous download attempt)\nC:\\Users\\Liam>pip install pyqt5\nCollecting pyqt5\n Using cached PyQt5-5.9.1-5.9.2-cp35.cp36.cp37-none-win_amd64.whl\nCollecting sip<4.20,>=4.19.4 (from pyqt5)\n Could not find a version that satisfies the requirement sip<4.20,>=4.19.4 (from pyqt5) (from versions: )\nNo matching distribution found for sip<4.20,>=4.19.4 (from pyqt5)\nCan anyone give me some pointers I am completely lost.\nThank you for any help that you can give me\nLiam","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":3282,"Q_Id":47085598,"Users Score":0,"Answer":"That is not a valid version number. You have to use a final version of python (as stated in Klaus D.'s comment).","Q_Score":0,"Tags":"python,pyqt5,python-sip","A_Id":47085913,"CreationDate":"2017-11-02T22:28:00.000","Title":"How do i install PyQt5 with python 3.7.0a2 on windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to all of this and I am trying to install PyQt5, I entered \"pip install pyqt5\" and this is what happened - ( its cached because of previous download attempt)\nC:\\Users\\Liam>pip install pyqt5\nCollecting pyqt5\n Using cached PyQt5-5.9.1-5.9.2-cp35.cp36.cp37-none-win_amd64.whl\nCollecting sip<4.20,>=4.19.4 (from pyqt5)\n Could not find a version that satisfies the requirement sip<4.20,>=4.19.4 (from pyqt5) (from versions: )\nNo matching distribution found for sip<4.20,>=4.19.4 (from pyqt5)\nCan anyone give me some pointers I am completely lost.\nThank you for any help that you can give me\nLiam","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":3282,"Q_Id":47085598,"Users Score":1,"Answer":"Use Python 3.4 Pyqt 5 works with it","Q_Score":0,"Tags":"python,pyqt5,python-sip","A_Id":57754547,"CreationDate":"2017-11-02T22:28:00.000","Title":"How do i install PyQt5 with python 3.7.0a2 on windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to provide a specific graphics window title in turtle graphics, similar to how title KJR works in cmd.exe.\nI am currently in the process of creating a game, and would like it to display the name, KJR, rather than turtle graphics.\nIs there a way this can be done?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3295,"Q_Id":47116006,"Users Score":0,"Answer":"Use the title(\"Custom title\") function","Q_Score":1,"Tags":"python,turtle-graphics","A_Id":70328375,"CreationDate":"2017-11-04T21:55:00.000","Title":"How to rename the graphics window when using turtle graphics?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I already know tkinter.Tk().attributes(\"-topmost\", True) which makes the window stay on top all the time. But is there some way to make the window stay at the bottom all the time? I mean something like tkinter.Tk().attributes(\"-bottommost\", True) or something like that.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":703,"Q_Id":47122453,"Users Score":0,"Answer":"No, there is no method in tkinter that forces the window to be below all other windows on the desktop.","Q_Score":1,"Tags":"python,tkinter,window,desktop,topmost","A_Id":47123502,"CreationDate":"2017-11-05T14:04:00.000","Title":"Tkinter window at the bottom all the time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"how can I install Qt Designer for PyQt5.\nI installed SIP from PyPi by running: \n pip3 install SIP\nand I installed PyQt5 also from PyPi by running: \n pip3 install PyQt5\nbut I didn't find QT Designer","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4343,"Q_Id":47127649,"Users Score":0,"Answer":"Qt designer doesn't come bundled with PyQt5. You can install it separately using pip install pyqt5-tools (or pip3 install pyqt5-tools).\nYou will find designer.exe at:\n...\\Lib\\site-packages\\pyqt5_tools\\Qt\\bin","Q_Score":1,"Tags":"python,pyqt5,qt-designer,pypi","A_Id":63687408,"CreationDate":"2017-11-05T23:14:00.000","Title":"how can I install Qt Designer for PyQt5 for WINDOWS 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to port some algorithms written on Python to Android. The algorithms don't use any OS specific staff, only several CPython modules for data processing. And I don't want to use some heavy frameworks like kivy. Are there any easy way to build cpython for Android?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":389,"Q_Id":47211305,"Users Score":2,"Answer":"I didn't find how to build it. But I downloaded Crystax NDK and found out python libraries already compiled and just copied them to my project.","Q_Score":1,"Tags":"android,python,cpython","A_Id":47213499,"CreationDate":"2017-11-09T20:51:00.000","Title":"How to build CPython for Android?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a python GUI application, using tkinter, which displays text in Hebrew. \nOn Windows (10, python 3.6, tkinter 8.6) Hebrew strings are displayed fine. \nOn Linux (Ubuntu 14, both python 3.4 and 3.6, tkinter 8.6) Hebrew strings are displayed incorrectly - with no BiDi awareness - am I missing something? \nI installed pybidi, and via bidi.algorithm.get_display(hebrew_string) - the strings are displayed correctly.\nBut then, on Windows, get_display(hebrew_string) is displayed incorrectly. \nIs BiDi not supported on python-tkinter-Linux?\nMust I wrap each string with get_display(string)?\nMust I wrap get_display(string) with a only_on_linux(...) function?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":877,"Q_Id":47249474,"Users Score":0,"Answer":"As on of the main authors of FriBidi and a contributor to the bidi text support in Gtk, I strongly suggest that you don't use TkInter for anything Hebrew or any other text other than Latin, Greek, or Cyrillic scripts. In theory you can rearrange the text ordering with the stand alone fribidi executable on on Linux, or use the fribidi binding, but bidi and complex language support goes well beyond that. You might need to support text inserting, cut and paste, shaping, just to mention a few of the pitfalls. You are much better off using the excellent gtk or Qt bindings to python.","Q_Score":3,"Tags":"python-3.x,tkinter,hebrew,bidi","A_Id":49477501,"CreationDate":"2017-11-12T13:39:00.000","Title":"Hebrew with tkinter - BiDi","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to use VSCode as my main IDE for Anaconda Custom Python 2.7.13 on MacOS High Sierra. I'm trying to make a file open dialogue box appear using PyQt5. In Spider the following works fine, but not in VS Code:\n\nfrom PyQt5 import QtWidgets\nfiles = QtWidgets.QFileDialog.getOpenFileNames()\nThe error I get in the VSC console is simply Not Available whereas in the context of a larger program I get\nE1101:Module 'PyQt5.QtWidgets' has no 'QFileDialog' member.\nI was wondering whether anyone had any idea where this issue is arising from?\nOli","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":664,"Q_Id":47263281,"Users Score":0,"Answer":"I ran another QT5 program I was working on that I already knew worked in VSC and added a dialog box. This worked fine, so I created a UI using QT Designer to add it to. It seems that QFileDialog needs an instance of class Ui_Frame() to instantiate. The fact that it worked in Spyder and not VSC may be related to the fact that the UI of Spyder is built on QT.","Q_Score":0,"Tags":"python-2.7,visual-studio-code,pyqt5,qtwidgets","A_Id":47269525,"CreationDate":"2017-11-13T11:29:00.000","Title":"Anaconda Python in Visual Studio Code PyQt5 import error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to develop a native gear VR application in android studio using oculus native mobile SDK version 1.9.0. On running the VR samples enclosed within the SDK, I ran into the error mentioned below and the build failed. \n\nTraceback (most recent call last):\nFile \"C:\\ovr_sdk_mobile_1.9.0\\bin\\scripts\\build\\ovrbuild_keystore.py\", line 86, in \n genDebugKeystore()\nFile \"C:\\ovr_sdk_mobile_1.9.0\\bin\\scripts\\build\\ovrbuild_keystore.py\", line 84, in genDebugKeystore\n debug_props['storepass'], debug_props['keypass'], replace=False)\nFile \"C:\\ovr_sdk_mobile_1.9.0\\bin\\scripts\\build\\ovrbuild_keystore.py\", line 71, in create_keystore\n return execfn(cmd)\nFile \"C:\\ovr_sdk_mobile_1.9.0\\bin\\scripts\\build\\ovrbuild_keystore.py\", line 82, in \n create_keystore(lambda x: ovrbuild.call(x),\nFile \"ovrbuild.py\", line 169, in call\n gradleTask = \"clean\" if command_options.should_clean else \"assembleDebug\" if command_options.is_debug_build else \"assembleRelease\"\n NameError: global name 'command_options' is not defined\n:VrSamples:Native:VrTemplate:Projects:Android:genDebugKeystore FAILED\nFAILURE: Build failed with an exception.\n*Where:\n Script 'C:\\ovr_sdk_mobile_1.9.0\\VrApp.gradle' line: 314\n*What went wrong:\n Execution failed for task ':VrSamples:Native:VrTemplate:Projects:Android:genDebugKeystore'.\n Process 'command 'C:\\ovr_sdk_mobile_1.9.0\/bin\/scripts\/build\/ovrbuild_keystore.py.bat'' finished with non-zero exit value 1\n\nCould anyone of you help me to solve this error?\nThis error is also present in oculus SDK version 1.7.0.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":330,"Q_Id":47321964,"Users Score":1,"Answer":"I was having the exact same problem. Same output and everything.\nAfter tracing the issue down for hours, I finally found my problem to be that my PATH did not include the java bin directory. The error was being caused because the keytool.exe program could not be reached.\nOn Windows 10, right click on This PC, select Advanced System Settings, select Environment Variables. In the System variables window on the lower half of the screen, find the Path variable. Ensure the java bin directory is in the list.\nIn my case I had to add:\nC:\\Program Files\\Java\\jdk1.8.0_112\\bin\nThe problem was not immediately corrected. I still had Android Studio open. I shut down the program and restarted the computer. After reboot and opening Android Studio again, everything started to build!\nHope this helps somebody else.","Q_Score":0,"Tags":"python,build,sdk,oculus","A_Id":48023152,"CreationDate":"2017-11-16T05:01:00.000","Title":"Build error in oculus native mobile sdk version 1.9.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm writing a graphics program in Python and I would like to know how to make a Canvas update only on-demand; that is, stop a canvas from updating every run of the event loop and instead update only when I tell it to.\nI want to do this because in my program I have a separate thread that reads graphics data from standard input to prevent blocking the event loop (given that there's no reliable, portable way to poll standard input in Python, and polling sucks anyway), but I want the screen to be updated only at intervals of a certain amount of time, not whenever the separate thread starts reading input.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":467,"Q_Id":47337197,"Users Score":3,"Answer":"You can't pause the update of the canvas without pausing the entire GUI.\nA simple solution would be for you to not draw to the canvas until you're ready for the update. Instead of calling canvas commands, push those commands onto a queue. When you're ready to refresh the display, iterate over the commands and run them. \nYou could also do your own double-buffering, where you have two canvases. The one you are actively drawing would be behind the visible one. When you are ready to display the results, swap the stacking order of the canvases.","Q_Score":0,"Tags":"python-3.x,tkinter,tkinter-canvas","A_Id":47337880,"CreationDate":"2017-11-16T18:57:00.000","Title":"How to make tkinter Canvas update only on-demand?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i use python3crystax to build plyer apk but when i run apk on android it show error message \"Accessing org.renpy.android.PythonActivity is deprecated and will be removed in a future version.\" i try to use old version of python-for-android it get other error !\nif i just change plyer init Activity it can run but still can see any notify!\nFile \"main.py\", line 9, in \n11-07 00:58:08.840 7082-7112\/youer.com.school I\/python: from kivy.app import App\n11-07 00:58:08.841 7082-7112\/youer.com.school I\/python: File \"\/data\/user\/0\/youer.com.school\/files\/app\/crystax_python\/site-packages\/kivy\/app.py\", line 319, in \n11-07 00:58:08.843 7082-7112\/youer.com.school I\/python: from kivy.base import runTouchApp, stopTouchApp\n11-07 00:58:08.843 7082-7112\/youer.com.school I\/python: File \"\/data\/user\/0\/youer.com.school\/files\/app\/crystax_python\/site-packages\/kivy\/base.py\", line 26, in \n11-07 00:58:08.845 7082-7112\/youer.com.school I\/python: from kivy.clock import Clock\n11-07 00:58:08.845 7082-7112\/youer.com.school I\/python: File \"\/data\/user\/0\/youer.com.school\/files\/app\/crystax_python\/site-packages\/kivy\/clock.py\", line 362, in \n11-07 00:58:08.847 7082-7112\/youer.com.school I\/python: from kivy._clock import CyClockBase, ClockEvent, FreeClockEvent, \\\n11-07 00:58:08.848 7082-7112\/youer.com.school I\/python: ImportError: dlopen failed: cannot locate symbol \"_Py_NoneStruct\" referenced by \"\/data\/data\/youer.com.school\/files\/app\/crystax_python\/site-packages\/kivy\/_clock.so\"...","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":56,"Q_Id":47396382,"Users Score":0,"Answer":"change org.renpy.android.PythonActivity to org.kivy.android.PythonActivity","Q_Score":0,"Tags":"android,python,python-3.x","A_Id":47451587,"CreationDate":"2017-11-20T16:13:00.000","Title":"some error come from plyer on android and python3crystax","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a laser pointer that I'm using along with my webcam as a drawing tablet, but I'd like to use the extra buttons on it too. They seem to be bound to Page Up, Page Down, Escape, and Period. I can't seem to figure out a way to get the input(which is handled like it's a keyboard) without any windows being selected.\nI've tried serial and pyusb, but I've had issues with both of those. I got it to work with Pygame, but as far as I know, you can't receive input without the window it creates being selected. Any ideas?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1423,"Q_Id":47398738,"Users Score":0,"Answer":"You could try making a python key-logger. However, it would be much easier to just use Pygame.","Q_Score":2,"Tags":"python,input","A_Id":47398877,"CreationDate":"2017-11-20T18:26:00.000","Title":"Live Keyboard Input in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a laser pointer that I'm using along with my webcam as a drawing tablet, but I'd like to use the extra buttons on it too. They seem to be bound to Page Up, Page Down, Escape, and Period. I can't seem to figure out a way to get the input(which is handled like it's a keyboard) without any windows being selected.\nI've tried serial and pyusb, but I've had issues with both of those. I got it to work with Pygame, but as far as I know, you can't receive input without the window it creates being selected. Any ideas?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1423,"Q_Id":47398738,"Users Score":0,"Answer":"CodeSurgeon answered me in a comment.\n\nLooks like there are a lot of youtube tutorials on the subject, surprisingly. This one shows a cross-platform approach using the pynput module, while this one looks to be using a windows-specific approach (pyhook and pythoncom). Can't vouch for either of these as I just found them through some searching, and I am sure there are others as well.\n\nI found that pynput works for me. (Windows 10\/Python 3.4)","Q_Score":2,"Tags":"python,input","A_Id":47518662,"CreationDate":"2017-11-20T18:26:00.000","Title":"Live Keyboard Input in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Currently, we are developing with Kivy 1.10.0 and Python 3.4.4 on Windows.\nAt the time of Build, I plan to build it through Linux in the virtual environment.\nIn order to run on both iOS and Android, what version do I need for both Kivy and Python in Linux?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":47411725,"Users Score":0,"Answer":"It doesn't matter what Kivy version you have installed locally (a new one will be built for Android), and both python2.7 or python3.5+ should work.","Q_Score":0,"Tags":"python,kivy","A_Id":47487305,"CreationDate":"2017-11-21T11:14:00.000","Title":"What version running in iOS and Android in Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am wondering what options I have to speed up kivy after I package it. \nI was looking into cython and pypy because those should speed up python. Also, I was reading that kivy can be a little slower and bigger than most android applications because it includes python and the interpreter. I usually just search around forever until i find an answer but it can be hard to find things about kivy. \nCan anyone with experience recommend something to get better speeds out of this framework? I'm dealing with a lot of code so it could be cumbersome testing a lot of this stuff out. \nedit: 132137\nasked Nov 24 '17 at 19:13\nI have a lot of this application packaged now. I wouldn't so much worry about cython until you are packaging it. I would also try to package the application incrementally to make sure everything works. More than anything, I was just really worried about how things would go when I started packaging it. I should have started earlier. The size hasn't been too much of an issue. I would try and write it on ubuntu or a linux distribution(buildozer doesn't work with windows) and not everything will run the same cross all platforms(I had some issues with some of the modules I was working with). I love kivy this is like an eli5 thing I wish I'd known at the time. \nAfter messing around with it some I got it down to 16mb. So I'm really happy with the framework. I guess i didn't need to include the buildozer folder in the build. I'm new to programming but I'm pretty happy with how everything turned out.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1947,"Q_Id":47478918,"Users Score":2,"Answer":"When it comes to responsiveness, make sure your python code is optimised. That means doing things like not loading Screens or other widgets until you need them (or even doing it in the background as much as possible).\nFor speeding up python itself, the main supported method is cython. python-for-android does not support pypy.\n\nkivy can be a little slower and bigger than most android applications because it includes python and the interpreter.\n\nA basic Kivy-using APK is about 7MB. And the delay from starting the interpreter manifests largely during the startup of the application, which can take a few seconds, especially on older devices.","Q_Score":1,"Tags":"python,kivy,cython,pypy","A_Id":47487341,"CreationDate":"2017-11-24T19:13:00.000","Title":"What are my options to speed up and reduce the size of my kivy android application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an issue with StaticText, and I do not know how to make it accept only the following data = '0123456789.' . Of course, when you type any letter, the letter is automatically deleted. Can you help me please","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":35,"Q_Id":47491757,"Users Score":0,"Answer":"You probably mean TextCtrl, don't you? You can use a validator, there is an example in the wxPython demo, which is a part of the Docs and Demo package.","Q_Score":0,"Tags":"wxpython","A_Id":47568957,"CreationDate":"2017-11-26T00:07:00.000","Title":"wxpython make StaticText limit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I define for example tkinter.Button widget with parameters (width=10, height=1)(in characters) and then I want to retrieve it's size in pixels, how do I do it?\nEDIT:\nI tried widget.winfo_height() and widget.geometry(), but all these functions return height defined in number of characters. I think it would be possible to create the same widget in a frame and then write frame.winfo_height() which would return size in pixels, but this is not so elegant solution.","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":5427,"Q_Id":47495285,"Users Score":9,"Answer":"Ok, I figured it out. We must call widget.update() first before calling widget.winfo_height().","Q_Score":1,"Tags":"python,tkinter,size,pixels","A_Id":47622396,"CreationDate":"2017-11-26T10:48:00.000","Title":"Get tkinter widget size in pixels","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found that kivy is very nice framework to build cross platform application and I am very interested in kivy just to do android application as I think is easy and comfortable in kivy.\nAfter trying few examples, I am interested to know how should handle android run time permission for the kivy app.\nActually I had searched on google, but no single working example out there. Should I go back to android \/ java or it possible with kivy and some other python libs.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":7102,"Q_Id":47510030,"Users Score":1,"Answer":"i know this answer is a little late, but to get permissions you have to specify them before the build. E.g buildozer uses a buildozer.spec. In this file you can specify the permissions you need.","Q_Score":4,"Tags":"android,python,kivy,android-permissions,pyjnius","A_Id":63417403,"CreationDate":"2017-11-27T11:34:00.000","Title":"How to handle android runtime permission with kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found that kivy is very nice framework to build cross platform application and I am very interested in kivy just to do android application as I think is easy and comfortable in kivy.\nAfter trying few examples, I am interested to know how should handle android run time permission for the kivy app.\nActually I had searched on google, but no single working example out there. Should I go back to android \/ java or it possible with kivy and some other python libs.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":7102,"Q_Id":47510030,"Users Score":1,"Answer":"python-for-android doesn't have any code for handling runtime permissions. I expect to look at it sooner rather than later, but there's no ETA for it.\nYou can probably add the code for it yourself if you're interested and know how. If you'd like to try it, such contributions would be very welcome.","Q_Score":4,"Tags":"android,python,kivy,android-permissions,pyjnius","A_Id":47522452,"CreationDate":"2017-11-27T11:34:00.000","Title":"How to handle android runtime permission with kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently have a scrollbar and a canvas on the same hierarchical level. In the canvas, there is a frame created using the canvas' create_window method. \nI have a binding that is called when the canvas is configured that will resize the scrollregion to fit bbox(\"all\"). It works, but ONLY when the entire window is resized (e.g. If I add more widgets to the canvas that are now not in its visible region, I have to resize the window to be able to change the canvas' scrollregion). \nIdeally, the scrollregion should change as soon as the new widget is added to a nonvisible location of the canvas (e.g. it's off the screen). What am I currently doing incorrectly? Any advice is appreciated!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":423,"Q_Id":47522534,"Users Score":0,"Answer":"You need to put a binding on the inner frame's event to also reset the scrollregion.","Q_Score":2,"Tags":"python,tkinter,scrollbar","A_Id":47523573,"CreationDate":"2017-11-28T01:29:00.000","Title":"Tkinter: Resizing scrollbar without adjusting window size","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created an app in Kivy.\nIt uses two modules: requests and geocoder.\nHow can I run this app by using Kivy Launcher?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":446,"Q_Id":47590717,"Users Score":0,"Answer":"You can install them manually into your project directory.\nSo if you need Requests for example, you can package it with the application.\nYou can download the source, copy the requests directory into your application\u2019s codebase, and import requests in your python files as you normally would.","Q_Score":0,"Tags":"python,kivy","A_Id":47592299,"CreationDate":"2017-12-01T09:52:00.000","Title":"How to run apps in Kivy Launcher if the application uses additional modules?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a game using Pygame where there are random obstacles on the screen (like boxes). The boxes can be removed by the player when they place a bomb next to it. I have some items that I would like to have randomly appear in place of the box if it is removed. I'm not sure how to go about this logically. Does anyone have any tips? No code is necessary (but helpful), I just want some steps logic-wise to get me started.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":47604678,"Users Score":1,"Answer":"In order to have the box removed you need to call a ~destructor function on it, which would remove the image of the box and so on correct?\nTake advantage of that and create a function that chooses which item to spawn (could be random, up to you) in the position where the box used to be. \nThen call this function at the end of the destructor. That's how imagine it working.","Q_Score":0,"Tags":"python,pygame","A_Id":47604704,"CreationDate":"2017-12-02T04:44:00.000","Title":"Making items appear from obstacles in game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On Android, when you do a long touch on a TextInput widget, a 'Select All Paste' popup shows up. Is there a way to disable this feature ?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":273,"Q_Id":47610826,"Users Score":1,"Answer":"I found the answer in the source code of TextInput. Simply set the TextInput use_bubble to False to disable the selection paste popup.","Q_Score":0,"Tags":"android,python-3.x,kivy,kivy-language","A_Id":47613212,"CreationDate":"2017-12-02T17:56:00.000","Title":"Is there a way to get rid of the TextInput 'Select all' popup?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On Android, when you do a long touch on a TextInput widget, a 'Select All Paste' popup shows up. Is there a way to disable this feature ?","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":273,"Q_Id":47610826,"Users Score":0,"Answer":"yes the kivy text input has a property use_bubble, change it to False if you don't want this behaviour","Q_Score":0,"Tags":"android,python-3.x,kivy,kivy-language","A_Id":47611045,"CreationDate":"2017-12-02T17:56:00.000","Title":"Is there a way to get rid of the TextInput 'Select all' popup?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create text editor that have coloring feature, Bold,Italic, ... and too many basically Office Program feature for users of my program. but creating this will take too much of my time. so is there a module, package or code for this ?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":87,"Q_Id":47657995,"Users Score":0,"Answer":"Gtk3 already has Gtk.TextView and Gtk.TextBuffer which has the requirements you mention (though might be missing some of the more sophisticated ones of a real Office suite). It can also insert images, and do many other tricks. Of course, you have to provide the commands to do steer the widget into executing each of them. \nAnother possibility is using a web-based editor, and include webkit in your project.","Q_Score":0,"Tags":"python,gtk3","A_Id":47842208,"CreationDate":"2017-12-05T16:11:00.000","Title":"Python GTK3 Basic Text Editor Like MS Office, LibreOffice","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a list of bitmap buttons in a vertical sizer on the right.\nI want to move the button and resize it when I click on it.\nHow can I proceed?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":174,"Q_Id":47700585,"Users Score":0,"Answer":"Try like this\n\n\nself.toolbar.SetToolDisabledBitmap(self.recoveryBtn.Id,wx.Bitmap(RECOVERY_BTN_BMP))","Q_Score":0,"Tags":"wxpython","A_Id":49250297,"CreationDate":"2017-12-07T17:29:00.000","Title":"Resizing a BitmapButton image in wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The command line of an application built with cx_Freeze can be hidden with Win32GUI.\nWhy does cx_Freeze choose to reference Win32GUI rather than Win64GUI?\nThis suggests that cx_Freeze has either not been updated to include this feature, or is calling a 32 bit command and yet almost all Windows computers are now 64 bit. \nIs there a reason why the inplamenters chose to call it this?\nI have researched for a long time but have not found any answer, any thoughts would be appreciated. Thank you.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1399,"Q_Id":47703965,"Users Score":1,"Answer":"It is simply because that is how it started. Even now it is called the \"Win32\" subsystem, even though it is 64-bit!","Q_Score":0,"Tags":"python,cx-freeze","A_Id":47725348,"CreationDate":"2017-12-07T21:18:00.000","Title":"Why does cx_Freeze use Win32GUI rather than Win64GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Is there any difference between window.listen(), screen.listen(), and turtle.listen()? \nI see them used differently in various programs but assume they can be called interchangeably.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3369,"Q_Id":47724417,"Users Score":0,"Answer":"turtle and screen have separate inputs.\nFor example:\nturtle.onclick() and screen.onclick() may seem the same but screen.onclick() is referring to the general window while turtle.onclick() is referring to the turtle module itself.\nTurtle\nWhen calling turtle.onclick() you are activating the (onclick) function, to call your argument function whenever the user clicks specifically on the turtle object.\nScreen\nWhen calling screen.onclick() you are activating the (onclick) function, to call your argument function whenever the user clicks anywhere on the window.\nThis is equivalent to turtle.onscreenclick() because onscreenclick() refers to the entire screen. Hence the name screenclick rather than just click which refers to the turtle object.\nListen\nSo because turtle and screen have separate input functions, you'll need separate listening functions.\nSo\nturtle.listen() listens for overall the entire turtle module's inputs, whilst screen.listen() listens for screen \/ window inputs.","Q_Score":0,"Tags":"python,turtle-graphics,listen","A_Id":67288344,"CreationDate":"2017-12-09T01:28:00.000","Title":"Difference between turtle.listen() and screen.listen()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I change the default kivy icon logo? I tried in buildozer spec but nothing happens - when I convert my app in the apk the icon does not change.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2472,"Q_Id":47729340,"Users Score":0,"Answer":"Change the icon.filename setting in the buildozer.spec file.","Q_Score":0,"Tags":"python-2.7,kivy,ubuntu-16.04,buildozer","A_Id":47729379,"CreationDate":"2017-12-09T14:01:00.000","Title":"How to change default kivy logo with another image logo?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just started to study OpenCV with Python and was trying to build my first game bot. My thought is: capture the game window frame by frame and analyze the pixels in some specific locations, if the color of those pixels has changed, then press a key to do some automatic operations.\nThis game needs quick reactions so the FPS is quite important, I have tried the mss and PIL, but the fps in both methods are not enough (30+ with mss and 10+ with PIL's ImageGrab), so I'm wondering if there is any better way to deal with pixels in real-time. Thanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1166,"Q_Id":47740206,"Users Score":0,"Answer":"Want to continue Jakubs great answer:\nUsing C++ or something might be a good idea in some cases.\nI created a csgo aimbot with opencv, pil, pyautogui and numpy and few other modules, watching sentdex's videos on this subject might give u some idea(link above).\nThere might be a custom module for GPU cv2\ntips for py:\n1) lower imagegrab resolution.\n2) in imagegrab.grab bbox you can give coordinates on which the grabs will happen instead of full screen.\n3) grayscale is 0-255 so it will speed up the process, if u know which colors are in this reaction thingy just pass them to grayscale so u know in which colors to respond to.","Q_Score":0,"Tags":"python","A_Id":47741851,"CreationDate":"2017-12-10T15:16:00.000","Title":"Dealing with pixels in real-time using OpenCV","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I tell a turtle to face a direction in turtle graphics?\nI would like the turtle to turn and face a direction no matter its original position, how can I achieve this?","AnswerCount":7,"Available Count":1,"Score":0.0285636566,"is_accepted":false,"ViewCount":9625,"Q_Id":47841384,"Users Score":1,"Answer":"You can use:\nturtle.right(angle)\nor:\nturtle.left(angle).\nHope this helps!","Q_Score":4,"Tags":"python,turtle-graphics,python-turtle","A_Id":62399262,"CreationDate":"2017-12-16T00:14:00.000","Title":"Turtle direction in turtle graphics?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a GUI that uses the Tkinter Canvas widget to allow a user to draw a line over an image. I would like to convert that line object to a list of points that make up that line. I'm able to get the coordinates and bounding box and other things described under the documentation, but I wasn't able to find the answer to this.\nAs an example, if I had a line that started at point (0,0) and ended at (3,3), I would like a list that includes points [(0,0), (1,1), (2,2), (3,3)] \nAny help is greatly appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":668,"Q_Id":47858956,"Users Score":0,"Answer":"There is no way to get this information from tkinter.","Q_Score":1,"Tags":"python,tkinter","A_Id":47860104,"CreationDate":"2017-12-17T20:04:00.000","Title":"How to convert Tkinter line object to list of points","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a menu with a few RadioMenuItems.\nAfter the user selects an option, my program reloads the menu and therefore also resets the pointer to the selected item.\nI need to programmatically set it back but without activating the function connected to it. RadioMenuItem.set_active(True) will activate the function. In fact, it seems that my function is called even when I do not call set_active, even just when the menu is drawn.\nHow do?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":217,"Q_Id":47937244,"Users Score":0,"Answer":"Turns out active was the wrong signal to connect to a RadioMenuItem, even though it works perfectly fine for a regular MenuItem.\nInstead, connecting the toggled signal, and then checking in the callback function whether the widget's get_active() function returns True, results in the desired behaviour.","Q_Score":0,"Tags":"python,gtk","A_Id":48007102,"CreationDate":"2017-12-22T07:08:00.000","Title":"how to set a Gtk RadioMenuItem as 'selected' without activating it","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am collecting some data from my android application. How to run a python script in my android application that uses the collected data as input and generates some output?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":4957,"Q_Id":47968040,"Users Score":2,"Answer":"Consider Jython, Jython is an implementation of the high-level, dynamic, object-oriented language Python seamlessly integrated with the Java platform. The predecessor to Jython, JPython, is certified as 100% Pure Java.\n\nmbedded scripting - Java programmers can add the Jython libraries to\ntheir system to allow end users to write simple or complicated\nscripts that add functionality to the application.\nInteractive experimentation - Jython provides an interactive\ninterpreter that can be used to interact with Java packages or with\nrunning Java applications. This allows programmers to experiment and\ndebug any Java system using Jython.\nRapid application development - Python programs are typically 2-10X\nshorter than the equivalent Java program. This translates directly\nto increased programmer productivity. The seamless interaction\nbetween Python and Java allows developers to freely mix the two\nlanguages both during development and in shipping products.\n\n\nThe awesome features of Jython are as follows,\n\n\nDynamic compilation to Java bytecodes - leads to highest possible\nperformance without sacrificing interactivity.\nAbility to extend existing Java classes in Jython - allows effective\nuse of abstract classes.\n\nJython doesn't compile to \"pure java\", it compiles to java bytecode subsequently to class files. To develop for Android, one compile java bytecode to Dalvik bytecode. To be honest, this path of development is not official , thus you will run into lots of problem with compatibility of course.","Q_Score":16,"Tags":"android,python,android-activity","A_Id":48065914,"CreationDate":"2017-12-25T11:09:00.000","Title":"Running Python Script from Android Activity","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Python project (a game) I would like to sell eventually. Would it be considered, by Python standards, acceptable to use a .pyc file instead of a regular .py source file to distribute the game, for security reasons? Would this even be effective? Or, on the other hand, is that just not what .pyc files are for?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1752,"Q_Id":47972613,"Users Score":0,"Answer":"Is is 'alright? Yes, the license allows you to distribute .pyc files.\nIs is 'effective'? It will most likely be unnecessary, as there will be no commercial reason to copy your work. If it is super good, people will de-compile or write similar games in another language. See jonrsharpe's link.\nIs is intended? The main purpose of .pyc files is to avoid unnecessarily re-compiling Python code by caching the result.","Q_Score":2,"Tags":"python,pygame,pyc","A_Id":47972705,"CreationDate":"2017-12-25T23:10:00.000","Title":"Is it proper to use .pyc files?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to bundle a PyQt project using Pyinstaller. I tried creating package using command pyinstaller --onedir Hello.py.\nThis creates dist folder and has Hello.exe. On running it gets the error: This application failed to start because it could not find or load the Qt platform plugin \"windows\"in \"\".\nReinstalling the application may fix this problem.\nI solved the issue in my PC by\n\nsetting environment variable QT_QPA_PLATFORM_PLUGIN_PATH\n\nor by \n\nCopying dist\\Hello\\PyQt5\\Qt\\plugins\\platform folder to where Hello.exe exists.\n\nBut this issue exists when I bundle to a single file using command --onefile, and run on any other machine, where QT_QPA_PLATFORM_PLUGIN_PATH is not set.\nCan someone help to figure out the issue.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2889,"Q_Id":48007100,"Users Score":0,"Answer":"If you using python 3.4 and pip refuses to install pyqt5\n\nDownload and install\nPyqt5 manually to %your python 3.4 dir%\nCreate directory\nGo to %your python 3.4 dir%\\Lib\\site-packages\\PyQt5 create directory Qt and then move plugins folder there.\nAdd plugins\nThen you can add ('C:\/Python34-32\/Lib\/site-packages\/PyQt5\/Qt\/plugins', 'PyQt5\/Qt\/plugins') to data in your spec file.\n\nbe sure to download PyQt 5.4.1 or other version that supports python 3.4\n\nAt least that solved my problem. I hope this will help somebody","Q_Score":10,"Tags":"python,pyqt5,pyinstaller","A_Id":57068272,"CreationDate":"2017-12-28T11:58:00.000","Title":"Error: Could not find or load the Qt platform plugin \"windows\" - PyQt + Pyinstaller","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a GLADE file, a main window of type \"GtkNotebook\" and there are several pages in it (Window1 = Page1, Page2, Page3, Page4). \na) Is it possible, like a web-browser, to take one of this page and separate it from the main windows? Example Page4 taken away with the cursor would create a Windows2\nb) If not (I could not achieve it till now), I will have probably to create 2 windows which open automatically when I start my application (one will be Window1 = Page1, Page2, Page3, the second one will be Window2 with Page4). I will search how to do this after I have a feedback from here if a) could be done in any way.\nThanks (this is my first post here)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":96,"Q_Id":48021783,"Users Score":0,"Answer":"I think that is not posible to do dinamically.\nAs you know on Pygtk we load the glade file by this way wTree = gtk.glade.XML(\"localize.glade\") only once time, and after that we have on scope the access to all tree of controls and componets.\nIf you have a window loaded, you can load another window, but not pull apart a tab that belong to a window loaded already, is something that not insted on pygtk, is not supported. Each window run on a singular process, i can not figure out how to pull apart it from the root proccess.\nI hope its helps you out.","Q_Score":3,"Tags":"python-3.x,pygtk,glade","A_Id":48027204,"CreationDate":"2017-12-29T11:18:00.000","Title":"GLADE & Pygtk: how to split dynamically windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I get the following error when trying to import gtk in Python 2.7 :\n>>> import gtk\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"gtk\/__init__.py\", line 40, in \n from gtk import _gtk\n File \"\/usr\/lib\/python2.7\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python2.7\/site-packages\/cairo\/_cairo.so: undefined symbol: cairo_tee_surface_index\nAnd I get the following error when trying to import cairo from Python 3.6:\n>>> import cairo\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"\/usr\/lib\/python3.6\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python3.6\/site-packages\/cairo\/_cairo.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index\n\nI compiled and built the modules in the order as given in the BLFS book.\nI also installed cairo as given in the book with tee enabled.\nMy system is an LFS, with 4.14.4 Kernel Version, with Python 2.7.14 and Python 3.6.4.\nEDIT: Downloaded the source and did 'make uninstall' and then reinstalled it. Now I can import cairo without any errors.","AnswerCount":8,"Available Count":5,"Score":0.0748596907,"is_accepted":false,"ViewCount":7143,"Q_Id":48049253,"Users Score":3,"Answer":"install cairocffi, and\nreplace import cairocffi with import cairocffi as cairo.","Q_Score":9,"Tags":"linux,python-2.7,pygtk,python-3.6,pycairo","A_Id":49293259,"CreationDate":"2018-01-01T11:26:00.000","Title":"Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I get the following error when trying to import gtk in Python 2.7 :\n>>> import gtk\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"gtk\/__init__.py\", line 40, in \n from gtk import _gtk\n File \"\/usr\/lib\/python2.7\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python2.7\/site-packages\/cairo\/_cairo.so: undefined symbol: cairo_tee_surface_index\nAnd I get the following error when trying to import cairo from Python 3.6:\n>>> import cairo\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"\/usr\/lib\/python3.6\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python3.6\/site-packages\/cairo\/_cairo.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index\n\nI compiled and built the modules in the order as given in the BLFS book.\nI also installed cairo as given in the book with tee enabled.\nMy system is an LFS, with 4.14.4 Kernel Version, with Python 2.7.14 and Python 3.6.4.\nEDIT: Downloaded the source and did 'make uninstall' and then reinstalled it. Now I can import cairo without any errors.","AnswerCount":8,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":7143,"Q_Id":48049253,"Users Score":0,"Answer":"For me,\nldd \/usr\/lib64\/python3.6\/site-packages\/cairo\/_cairo.cpython-36m-x86_64-linux-gnu.so\nshowed:\nlibcairo.so.2 => \/usr\/local\/lib\/libcairo.so.2 \nI had a stale self-compiled cairo installation. If you still have the original compile tree, you can run make uninstall within it. Otherwise, simply move the offending cairo files in \/usr\/local\/lib manually to another location, and delete once you are sure the files are unnecessary.","Q_Score":9,"Tags":"linux,python-2.7,pygtk,python-3.6,pycairo","A_Id":50362423,"CreationDate":"2018-01-01T11:26:00.000","Title":"Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I get the following error when trying to import gtk in Python 2.7 :\n>>> import gtk\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"gtk\/__init__.py\", line 40, in \n from gtk import _gtk\n File \"\/usr\/lib\/python2.7\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python2.7\/site-packages\/cairo\/_cairo.so: undefined symbol: cairo_tee_surface_index\nAnd I get the following error when trying to import cairo from Python 3.6:\n>>> import cairo\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"\/usr\/lib\/python3.6\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python3.6\/site-packages\/cairo\/_cairo.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index\n\nI compiled and built the modules in the order as given in the BLFS book.\nI also installed cairo as given in the book with tee enabled.\nMy system is an LFS, with 4.14.4 Kernel Version, with Python 2.7.14 and Python 3.6.4.\nEDIT: Downloaded the source and did 'make uninstall' and then reinstalled it. Now I can import cairo without any errors.","AnswerCount":8,"Available Count":5,"Score":0.1243530018,"is_accepted":false,"ViewCount":7143,"Q_Id":48049253,"Users Score":5,"Answer":"I just shifted on older version of pycairo. Try downloading version 1.11.0.\npip uninstall pycairo pip install pycairo==1.11.0\nYou can do shift on other versions available too.\nAt this time; they are:-\n1.11.0, 1.11.1, 1.12.0, 1.13.0, 1.13.1, 1.13.2, 1.13.3, 1.13.4, 1.14.0, 1.14.1, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 1.15.6, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.17.0, 1.17.1, 1.18.0\nI don't know much about its internals, i just used brute force to get a solution.\nHope it helps.","Q_Score":9,"Tags":"linux,python-2.7,pygtk,python-3.6,pycairo","A_Id":55534650,"CreationDate":"2018-01-01T11:26:00.000","Title":"Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I get the following error when trying to import gtk in Python 2.7 :\n>>> import gtk\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"gtk\/__init__.py\", line 40, in \n from gtk import _gtk\n File \"\/usr\/lib\/python2.7\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python2.7\/site-packages\/cairo\/_cairo.so: undefined symbol: cairo_tee_surface_index\nAnd I get the following error when trying to import cairo from Python 3.6:\n>>> import cairo\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"\/usr\/lib\/python3.6\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python3.6\/site-packages\/cairo\/_cairo.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index\n\nI compiled and built the modules in the order as given in the BLFS book.\nI also installed cairo as given in the book with tee enabled.\nMy system is an LFS, with 4.14.4 Kernel Version, with Python 2.7.14 and Python 3.6.4.\nEDIT: Downloaded the source and did 'make uninstall' and then reinstalled it. Now I can import cairo without any errors.","AnswerCount":8,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":7143,"Q_Id":48049253,"Users Score":0,"Answer":"I find that the root error is not finding the py3cairo.h\njust locate py3cairo.h, and ln -s \/usr\/include\/pycairo\/py3cairo.h \/usr\/include\/py3cairo.h\nthen the compilation works without error.","Q_Score":9,"Tags":"linux,python-2.7,pygtk,python-3.6,pycairo","A_Id":58881631,"CreationDate":"2018-01-01T11:26:00.000","Title":"Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I get the following error when trying to import gtk in Python 2.7 :\n>>> import gtk\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"gtk\/__init__.py\", line 40, in \n from gtk import _gtk\n File \"\/usr\/lib\/python2.7\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python2.7\/site-packages\/cairo\/_cairo.so: undefined symbol: cairo_tee_surface_index\nAnd I get the following error when trying to import cairo from Python 3.6:\n>>> import cairo\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"\/usr\/lib\/python3.6\/site-packages\/cairo\/__init__.py\", line 1, in \n from ._cairo import * # noqa: F401,F403\nImportError: \/usr\/lib\/python3.6\/site-packages\/cairo\/_cairo.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index\n\nI compiled and built the modules in the order as given in the BLFS book.\nI also installed cairo as given in the book with tee enabled.\nMy system is an LFS, with 4.14.4 Kernel Version, with Python 2.7.14 and Python 3.6.4.\nEDIT: Downloaded the source and did 'make uninstall' and then reinstalled it. Now I can import cairo without any errors.","AnswerCount":8,"Available Count":5,"Score":0.049958375,"is_accepted":false,"ViewCount":7143,"Q_Id":48049253,"Users Score":2,"Answer":"I'm using conda and I have same issue, but path are little bit different due to conda env:\nImportError: \/home\/juro\/anaconda3\/envs\/py37\/lib\/python3.7\/site-packages\/cairo\/_cairo.cpython-37m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index\n$ ldd \/home\/juro\/anaconda3\/envs\/py37\/lib\/python3.7\/site-packages\/cairo\/_cairo.cpython-37m-x86_64-linux-gnu.so\n$ outputs:\n...\nlibcairo.so.2 => \/home\/juro\/anaconda3\/envs\/py37\/lib\/libcairo.so.2 (0x00007ff6d8ad9000)\n...\nIt seems that conda (anaconda) package cairo is broken or pip pycairo package is broken (I don't know who's fault it is ;)). It's missing symbol cairo_tee_surface_index in \"libcairo.so.2\" library. That symbol is required by pycairo package (pip install pycairo), so when you do \"import cairo\" you get that failure.\nYou have these options:\n\nI found out that my system (debian) libcairo.2 has that missing symbol:\n$ strings \/usr\/lib\/x86_64-linux-gnu\/libcairo.so.2.11400.8 | grep cairo_tee_surface_index. So I just downgraded my conda's cairo to the same version as on my system conda install cairo=version and copied my system libcairo over my conda libcairo:cp \/usr\/lib\/x86_64-linux-gnu\/libcairo.so.2.11400.8 ~\/anaconda3\/lib\/libcairo.so.2.11400.8. You can backup the original one, but don't use move command (mv) because those libraries are hardlinks (those libraries can be shared among multiple conda environments). Use just cp for backup.\nYou can change RPATH inside \"_cairo.cpython-36m-x86_64-linux-gnu.so\" libary file using chrpath command (man chrpath) to point to folder where is correct libcairo.so.2. With correct one I mean the library build with cairo_tee_surface_index symbol.\nbuild your own cairo library (same version as in your conda '$ conda list cairo') and copy it over ~\/anaconda3\/lib\/libcairo.so.2.{additional_version_characters}.\n\nWhere is your system's libcairo?\n\/sbin\/ldconfig -p | grep libcairo","Q_Score":9,"Tags":"linux,python-2.7,pygtk,python-3.6,pycairo","A_Id":53972647,"CreationDate":"2018-01-01T11:26:00.000","Title":"Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently using PyCUDD, which is a SWIG-generated Python wrapper for the C package CUDD. I'm currently trying to get CUDD to print some debug information from inside the C code, but any printfs inside the C code don't seem to be producing any output - putting them in the .i files for SWIG produces output, putting them in the C code does not. I'm not sure if this is some property of SWIG specifically or of compiling the C code to a shared object library.\n(Particularly frustrating is that I know that I have had this problem and gotten it working before, but I can't seem to find anything searching for the problem now, and I apparently forgot to leave notes on that one thing.)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":861,"Q_Id":48064686,"Users Score":0,"Answer":"I still forget what my problem was before. However, I have found that what was causing my problem here was a linker issue - the linker was looking at an old version of the library, which did not have my changes.","Q_Score":0,"Tags":"python,c,swig,cudd","A_Id":48671922,"CreationDate":"2018-01-02T16:41:00.000","Title":"Make printf appear in stdout from shared object library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can't seem to set the volume of a channel to 0 in one ear. (I initiated the mixer with stereo). I did pygame.mixer.Channel(channel).set_volume(0,volume) and it seems to play at about half-ish volume on the left and full volume on the right. Any clue what I'm doing wrong?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":158,"Q_Id":48064949,"Users Score":0,"Answer":"Are you on windows?\nThe problem is not in Python or Pygame itself, but rather in Windows. It seems sound enhancements are somehow fiddling with the way the sound my script is playing (or any other Pygame script for that matter).\nI'm on Windows 10 and this is how I did it:\n1.Right click on the speaker icon in the taskbar\n2.Select Playback Devices\n3.Select Speakers and Properties\n4.Go to Enhancements tab and uncheck Equalizer and Loudness Equalization\nThat's it.","Q_Score":0,"Tags":"python,pygame","A_Id":48065090,"CreationDate":"2018-01-02T17:00:00.000","Title":"Pygame Can't Set Volume to 0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am kind a stuck. I have tried to make Tetris game with music to .exe, but I really don't know how to do it. Can someone give some tips, how to make .py to .exe?\n I have tried Pyinstaller, cx_Freeze and none of them work.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":88,"Q_Id":48092110,"Users Score":1,"Answer":"They should all work. Py2exe and Py2app are the ones that don't. If they don't work they you haven't used them properly. Particularly cx_Freeze that requires you to \"tune things manually\".\nHere are some debug steps that will help you resolve your error:\n\nWhen freezing for the first time don't hide the console. This will hide any errors that occur. You need to see those.\nWhen building look for any errors that appear at the end. These may give you a clue as to how to solve the problem.\nIf you have errors the terminal will appear shortly then close. Run the executable through the terminal and the terminal will stay open allowing you to read the messages. This can be done in the following way:\n\n\n C:\\Location>cd \\Of\\App \n C:\\Location\\Of\\App>NameOfExecutable\ncd is a command that stands for change dictionary and assuming your .exe is called NameOfExecutable.\nUnder PowerShell you would use the same but .\/NmeOfExecutable to execute instead.\n\nSee what errors that appear. If you get an error that says a package is missing includes often does the trick (remember to include the top level package as well as the exact one missing.\nIf you use external files or images remember to use include_files to add them along as well. Note that you can add runtimes (or DLLs) in this way too\nAttempt a build folder before going for an msi. Get the build folder working first then go for the msi.","Q_Score":1,"Tags":"python,python-3.x,exe,executable","A_Id":48123001,"CreationDate":"2018-01-04T09:20:00.000","Title":"Converting Python 3.6.1 Tetris game with music, to exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"for a project i have to make a GUI for python. It should show some variables (temp etc). But I don't know how I can pass variables trough GTK to the window. Any answers appreciated :)\nsome info: I am using a RPi3, but that's nothing which is important, or is it? I have a 7\" display attached, on which the program should be seen in full screen. In the end, there should stand sth like temp, humidity, water etc\nI don't exactly know which GTK i use, but it's in python. So I think it's pygtk\nThanks for reading,\nFabian","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":104,"Q_Id":48092543,"Users Score":1,"Answer":"Done. I've used Flask, Socket.io and gtk to make an app, showing a html file in full screen, with python variables in it.","Q_Score":0,"Tags":"python,html,python-2.7,gtk,webkitgtk","A_Id":48123502,"CreationDate":"2018-01-04T09:45:00.000","Title":"Give python variables to GTK+ with an html file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to set empty value to datetimeedit widget (01.01.00 0:00 is not really what I want to see). Using dtwidget.setDateTime(QDateTime()) or dtwidget.clear() is not affected. How can I do this?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":1423,"Q_Id":48139087,"Users Score":-1,"Answer":"Short answer is No you cannot.\nHere's the long answer.\nYou cannot set the date to 00.00.0000 00:00. Because it makes no damn sense. By default, it shows an unknwon date-time as 12:00 AM of the first day of the first month of year 0000.\nIf you really badly want to show \"00.00.00 0:00\", then do this: dt.setDisplayFormat( \"00.00.00 0:00\" ). What's the problem with this? Yeah, it shows 00.00.00 0:00 for any date-time you set. You'll have to set a sensible format once the user starts interacting with your widget or you want to set a valid date-time.\nSo you want some crappy behaviour from standard Qt widgets, subclass them and implement your own code.","Q_Score":1,"Tags":"python,qt,datetime,pyqt,pyqt5","A_Id":48147393,"CreationDate":"2018-01-07T16:17:00.000","Title":"How to clear value in QDateTimeEdit?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"everyone!\nI want to implement the Turtle into my application just for the purpose of coordinate generation. The problem is that I need to get the coordinates of turtle move (etc.) without any \"pop-up window\" containing the graphics or even worse animation. Is it possible somehow to disable initialization of turtle graphics?\nThanks a lot!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":60,"Q_Id":48189504,"Users Score":0,"Answer":"OK, I have solved the situation by using: speed(0); turtle.tracer(False); turtle.bye(). The graphics window is intialized but suddenly closed.","Q_Score":0,"Tags":"python,turtle-graphics","A_Id":48210844,"CreationDate":"2018-01-10T14:22:00.000","Title":"How to disable initializing of graphics window of Python Turtle","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using tkinter and specifically the ttk.treeview widget to display tuples. I do a lot of inserting and was wondering if the iid (item identifier) can overflow or how it is handled. I hypothesize that the maximum iid is 0xFFF which is equivalent to 4095 base 10 given that they are formatted as string like \"I001.\" If they do overflow how can I reuse\/delete an iid?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":159,"Q_Id":48195505,"Users Score":1,"Answer":"After some testing I discovered iids are not just three digit hexadecimals but can be up to five. I say up to five because in my testing I hit a memory error before I could exhaust the amount of unique iids. I was getting iids like \"IEA600\" before I hit memory issues.\nOne memory error was \"unable to realloc 3145736 bytes\" when deleting just under a million children from the treeview.","Q_Score":1,"Tags":"python,tkinter,treeview,ttk","A_Id":48207480,"CreationDate":"2018-01-10T20:25:00.000","Title":"Can Tkinter ttk.treeview iid overflow?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My path is cd ~\/.buildozer\/android\/platform\/android-sdk-21\/build-tools\/19.1.0\/\nthe name of my apk is MyApplication-0.1-release-unsigned.apk \nthe path of apk is \/home\/kivy\/Desktop\/provaAPP\/bin","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":457,"Q_Id":48222898,"Users Score":1,"Answer":"Something like ~\/.buildozer\/android\/platform\/android-sdk-21\/build-tools\/19.1.0\/zipalign -v 4 \/home\/kivy\/Desktop\/provaAPP\/bin\/yourapkname.apk youroutputapkname.apk, I think.","Q_Score":1,"Tags":"android,python,linux,kivy,buildozer","A_Id":48235557,"CreationDate":"2018-01-12T09:12:00.000","Title":"How to zipalign a Apk with kivy buildozer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use the command pyautogui.press('enter') in a for loop that runs for many times and for a long time.\nThe problem is that if I run the code and I want to do something else, happens that enter is pressed in the window I'm working on and not only on the terminal as I would like.\nIs there a way to run pyautogui.press('enter') only on the terminal and, in the meantime, work on other windows?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":227,"Q_Id":48228084,"Users Score":1,"Answer":"It's not possible, pyautogui manually moves the mouse so you can't be doing something else...","Q_Score":0,"Tags":"python,python-2.7,pyautogui","A_Id":51386256,"CreationDate":"2018-01-12T14:17:00.000","Title":"pyautogui in the same window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to use named arguments in C function?\nSomething like function with prototype void foo(int a, int b, int c);\nand I want to call it with foo(a=2, c=3, b=1); [replaced the order of b & c and used their names to distinguish]\nMotivation: I want a more Pythonic C, where I can easily manipulate my function arguments without mixing them by mistake","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":339,"Q_Id":48264698,"Users Score":4,"Answer":"Named arguments are not supported in C.\nAll arguments must be passed in the correct order.","Q_Score":4,"Tags":"python,c","A_Id":48264739,"CreationDate":"2018-01-15T14:09:00.000","Title":"A way to emulate named arguments in C","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to develop a game for Android using pygame.\nIt would be a platformer. To move the main charachter, I would make the game to wait for mouse events (like pygame.MOUSEBUTTONDOWN).\nIn order to do that on mobile, I'd like to create a graphic representation of a joypad with arrow keys to be shown on the bottom left corner of the screen.\nNow, when the user touches one of the arrows, a MOUSEBUTTONDOWN event should be triggered and the charachter should move accordingly.\nMy question is: since the \"joypad\" object is a mere draw, how can I link it to the event with pygame?\nIs there a way to do so? Should I use the pixel coordinates of the arrow keys of the joypad or is there a better choice?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":70,"Q_Id":48371137,"Users Score":1,"Answer":"As far as I know this is not possible.\nWhen handling input, mouse input and touch input are to be handled separately.\nSo to answer the 2 questions you listed at the end: \n\nAs far as I know there is no way to implement this functionality.\nYou could use the pixel coordinates of the arrows. However you can use Rects for that and test if the place of mouse input\/touch input is inside the arrow button Rect with the collidepoint method\n\nYou can achieve that as follows:\narrow_left.collidepoint(mouse_x, mouse_y)\nI hope this answer helped you!","Q_Score":1,"Tags":"android,python,pygame,mouseevent,mouse","A_Id":48371785,"CreationDate":"2018-01-21T20:01:00.000","Title":"pygame - link an object to mouse event","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"All tutorials simply import tkinter,\nI am wondering, though, why not import _tkinter? If my understanding is correct, _tkinter is the actual library in cpython and tkinter is the interface or API.\nI am simply trying to grasp the paradigm as I read through some of the tkinter source code. It seems there is some python black magic afoot.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3762,"Q_Id":48385116,"Users Score":9,"Answer":"_tkinter is a C-based module that wraps an internal tcl\/tk interpreter. When you import it, and it only, you get access to this interpreter but you do not get access to any of the python classes. \nYou certainly can import _tkinter, but then you would have to recreate all of the python interfaces to the tcl\/tk functions.","Q_Score":5,"Tags":"python,tkinter","A_Id":48385739,"CreationDate":"2018-01-22T15:34:00.000","Title":"Import _tkinter or tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've a made a selenium test using python3 and selenium library.\nI've also used Tkinter to make a GUI to put some input on (account, password..).\nI've managed to hide the console window for python by saving to the .pyw extension; and when I make an executable with my code, the console doesn't show up even if it's saved with .py extension.\nHowever, everytime the chromedriver starts, it also starts a console window, and when the driver exists, this window does not.\nso in a loop, i'm left with many webdriver consoles.\nIs there a work around this to prevent the driver from launching a console everytime it runs ?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":617,"Q_Id":48414156,"Users Score":0,"Answer":"driver.close() and driver.quit() are two different methods for closing the browser session in Selenium WebDriver.\ndriver.close() - It closes the the browser window on which the focus is set.\ndriver.quit() \u2013 It basically calls driver.dispose method which in turn closes all the browser windows and ends the WebDriver session gracefully.\nYou should use driver.quit whenever you want to end the program. It will close all opened browser window and terminates the WebDriver session. If you do not use driver.quit at the end of program, WebDriver session will not close properly and files would not be cleared off memory. This may result in memory leak errors.","Q_Score":0,"Tags":"python,selenium,webdriver,selenium-chromedriver","A_Id":48414334,"CreationDate":"2018-01-24T03:01:00.000","Title":"Python3, Selenium, Chromedriver console window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a string like this (\"Theres loads of adventures to be had here;\\nYou'll get your own Kob\u00e9mon\\nand get to catch more!\") in my .JSON file and when I read from it into the python file and into a Tkinter textbox I get \"\u00c3\u00a9\" instead of \u00e9. Is there a way to stop this. Im reading the .JSON using this :(self.Lines = json.load(open(\"Data\/Lines.json\")))","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2107,"Q_Id":48448863,"Users Score":7,"Answer":"Try This:\n(self.Lines = json.load(open(\"Data\/Lines.json\",\"rb\"), encoding=\"utf-8\"))\nThe difference is loading the file in bytes and reading it in utf-8 format (assuming that's the file format).","Q_Score":3,"Tags":"python,json,decoding,diacritics","A_Id":48449404,"CreationDate":"2018-01-25T17:37:00.000","Title":"Python Reading from JSON accented characters coming out wrong","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a pipe connection game in Pygame where you rotate a set of given pipe pieces to connect the start to the end, and am having trouble making a way for the game to actually be completed. I need to find if any path of white pixels (from the pipe piece sprites) connects any red pixel to any blue pixel (the colours of the start and end pieces). How could I go about doing this? The background colour is black, if that helps.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":69,"Q_Id":48477179,"Users Score":0,"Answer":"I would make a scraper-like tool:\n1 From each red pixel check for connecting white\/blue pixels, put these in a list\n2 From each white pixel in the list, check if a blue pixel can be reached, if so , return True\n3 add any white pixels that connect to white pixels already in the list (but don't add any that already are in the list)\n4 if no new white pixels where added and no blue pixels where found, return False. else, go back to step 2","Q_Score":0,"Tags":"python,pygame,sprite","A_Id":48477360,"CreationDate":"2018-01-27T15:16:00.000","Title":"How can I find if there is a white path connecting pixels of two different colours in Python \/ Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've made a desktop app using Python 3 and PyQt 5 and it works except for the playback of the MP4 video files (compiled by pyrcc5). They are visible and play on the video widget but there is a green line down the right side. I tried to put a green frame (using a Style Sheet) around the QVideoWidget but with no success.\nDoes anyone have any advice on how to resolve this issue?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":273,"Q_Id":48478792,"Users Score":1,"Answer":"Okay, so I couldn't find anything on \"MP4 and green line\" so I looked at how to modify the PyQt5 interface as a way of hiding the issue.\nThe option I chose was QGroupBox and changing the padding in the stylesheet to -9 (in my particular case - you may find another value works better but it depends on the UI).\nI did attempt to use QFrame, as my other option, but this didn't personally work for me.","Q_Score":0,"Tags":"python-3.x,video,pyqt5","A_Id":49198231,"CreationDate":"2018-01-27T17:57:00.000","Title":"Python 3, PyQt 5 - MP4 as resource file issue","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using pip install to install kivy on windows 10. I keep getting an error in the command prompt that states:\n\n(could not find a version that satisfies the requirement pywin32 (from\n versions: ) no matching distribution found for pywin32 (from\n pypiwin32)\n\nDo you have any ideas?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1882,"Q_Id":48491623,"Users Score":0,"Answer":"i got the same issue (error)\nit couldn't find any version that satisfies the python interpreter , any version of python that Pywin32 doesn't support\ntype in the console (cmd) : pip install pypiwin32==219 \nthis version 219 nearly supports all the versions of python (not all of them !)\nand if still not worked do this : choose on of these versions of python and install it then it will work ! \n2.7.X\n3.1.X\n3.2.X\n3.3.X\n3.4.X\n3.5.X\nnotice that this version doesn't support 3.6 , anyway good luck with your programming see you again boys !","Q_Score":1,"Tags":"python,kivy","A_Id":50039603,"CreationDate":"2018-01-28T21:41:00.000","Title":"Error installing kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently using Qpython and Sl4A to run python scripts on my Droid device.\nDoes anybody know of a way to use something like PyAutoGUI on mobile to automate tapping sequences (which would be mouse clicks on a desktop or laptop)?\nI feel like it wouldn't be too hard, but I'm not quite sure how to get the coordinates for positions on the mobile device.","AnswerCount":2,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":8687,"Q_Id":48558151,"Users Score":7,"Answer":"Something like PyAutoGui for Android is AutoInput. It's a part of the main app Tasker. If you've heard about Tasker, then you know what I'm taking about. \nIf not, them Tasker is an app built to automate your Android Device. If you need specific taps and scrolls, then you can install the plug-in Auto Input for Tasker. It's precisely allows you to tap a point in your screen. \nOr, if you have a rooted device, then you can directly run shell commands from Tasker without the need of any Plug-in.\nNow, you can get the precise location of your x,y coordinate easily. \nGo to settings, About Phone, and Tap on\nBuild Number until it says, \"You've unlocked developer options.\"\nNow, in the settings app, you will have a new developer options. Click on that, then scroll down till you find \"Show Pointer Location\" and turn that on. Now wherever you tap and hold the screen, the top part of your screen will give you the x,y coordinate of that spot.\nI hope this helps. Please comment if you have any queries.","Q_Score":3,"Tags":"user-interface,automation,sl4a,pyautogui,qpython3","A_Id":48928935,"CreationDate":"2018-02-01T08:18:00.000","Title":"Way to use something like PyAutoGUI on Mobile?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently using Qpython and Sl4A to run python scripts on my Droid device.\nDoes anybody know of a way to use something like PyAutoGUI on mobile to automate tapping sequences (which would be mouse clicks on a desktop or laptop)?\nI feel like it wouldn't be too hard, but I'm not quite sure how to get the coordinates for positions on the mobile device.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":8687,"Q_Id":48558151,"Users Score":2,"Answer":"Unfortunately no. PyAutoGUI only runs on Windows, macOS, and Linux","Q_Score":3,"Tags":"user-interface,automation,sl4a,pyautogui,qpython3","A_Id":66658332,"CreationDate":"2018-02-01T08:18:00.000","Title":"Way to use something like PyAutoGUI on Mobile?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am facing issue to get python working on Android Board.\nI cross compiled python 2.7.14 successfully and copied binaries and lib onto the board and getting following error.\nCANNOT LINK EXECUTABLE \"python2.7\": cannot locate symbol \"nl_langinfo\" referenced by \"\/system\/bin\/python2.7\"...\nAborted \nI used ndk version16b for cross compilation.\nany help and idea shall be greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":352,"Q_Id":48558440,"Users Score":0,"Answer":"nl_langinfo() was introduced to Android at API 26. If your board runs an older version of Android, you should recompile python, setting the ANDROID_API to match your version.","Q_Score":2,"Tags":"python-2.7,android-ndk","A_Id":48559783,"CreationDate":"2018-02-01T08:37:00.000","Title":"Android NDK Cross compilation issue in python2.7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there an environment that supports virtual Android devices for Python app testing?\nI'm using Kivy to develop a simple Python app and cannot find an environment to test application deployments that run\/handle Python. The Android Studio is designed to handle Java but provides the functionality I am looking for by opening a virtual android device.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":513,"Q_Id":48593596,"Users Score":0,"Answer":"I am not familiar with Kivy, but you can create and launch a virtual device from android studio or the command line once you have the android sdk installed. If Kivy builds and APK then you can deploy that apk to the virtual device using ADB or by dragging the APK into the virtual device window.","Q_Score":0,"Tags":"android,python,virtual-machine","A_Id":48593697,"CreationDate":"2018-02-03T03:18:00.000","Title":"Virtual android device for Kivy application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Spyder through the WinPython-64bit-3.6.3.0Qt5 distribution on my Windows 7 Laptop. To add a third screen to my Laptop I started using a USB 3.0 Docking Station. After Installing the drivers Spyder won't launch, neither will the WinPython Control Panel. \nThese are the drivers I installed:\nDisplayLink Graphics Driver Version: 8.0.762.0\nDisplayLink Ethernet Driver Version: 8.0.403.0\nDisplayLink Audio Driver Version: 8.0.745.0\nUninstalling the drivers fixes the problem, but my question is if this is a known issue and if there is a way to use both Spyder and the Docking Station.\nSo far I have tried updating PyQt5, which had no effect.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":99,"Q_Id":48620524,"Users Score":0,"Answer":"This is not really a solution to the problem, but it's how I am able to use Spyder again.\nI downloaded and installed the latest Anaconda (Version 5.0.1) distribution. I am able to launch Spyder, which is included in that distribution, even with the docking station drivers still installed.","Q_Score":1,"Tags":"python,driver,pyqt5,spyder","A_Id":48680952,"CreationDate":"2018-02-05T10:32:00.000","Title":"Issues with WinPython after installing Docking Station Driver","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Spyder through the WinPython-64bit-3.6.3.0Qt5 distribution on my Windows 7 Laptop. To add a third screen to my Laptop I started using a USB 3.0 Docking Station. After Installing the drivers Spyder won't launch, neither will the WinPython Control Panel. \nThese are the drivers I installed:\nDisplayLink Graphics Driver Version: 8.0.762.0\nDisplayLink Ethernet Driver Version: 8.0.403.0\nDisplayLink Audio Driver Version: 8.0.745.0\nUninstalling the drivers fixes the problem, but my question is if this is a known issue and if there is a way to use both Spyder and the Docking Station.\nSo far I have tried updating PyQt5, which had no effect.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":99,"Q_Id":48620524,"Users Score":0,"Answer":"I fixed mine. The issue was the way DisplayLink and Microsoft work together. Microsoft has admitted to there being an issue with the Windows kernel mode graphics driver. This is only an issue for machines with two+ graphics cards and the use of DisplayLink. DisplayLink uses the graphics card that Windows registers in the kernel, which by default is the primary monitor. On my HP laptop, the Intel graphics card is only used on the laptop screen (the primary) and is registered in the kernel, the NVIDIA card I have is used for all external screens, not registered. When you move an application, such as Spyder\/Python, to the external monitors, the program's graphics will not work properly as you will be using DisplayLink, which is set to use the Intel graphics card, but you are now on the NVIDIA card. This does not happen to all apps, just those that rely heavily on the DisplayLink driver, these programs typically include GPU heavy programs such as emulators. To fix this, I disabled the Intel Graphics card, forcing the laptop to use the NVIDIA card and for the NVIDIA card to register with the kernel. This is not an ideal solution, but until Microsoft finds a fix for this, we are forced to use this method.","Q_Score":1,"Tags":"python,driver,pyqt5,spyder","A_Id":48666300,"CreationDate":"2018-02-05T10:32:00.000","Title":"Issues with WinPython after installing Docking Station Driver","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I oftentimes see classes containing def execute(self) and def run()\nDoes python automatically pick this up like int main() in C++?","AnswerCount":6,"Available Count":2,"Score":0.0333209931,"is_accepted":false,"ViewCount":10001,"Q_Id":48654148,"Users Score":1,"Answer":"No. Not unless your script is loaded inside some wrapper code that in turn executes your file's run or execute function.","Q_Score":1,"Tags":"python","A_Id":48654163,"CreationDate":"2018-02-07T00:28:00.000","Title":"Why do classes have Def Run() and Def Execute()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I oftentimes see classes containing def execute(self) and def run()\nDoes python automatically pick this up like int main() in C++?","AnswerCount":6,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":10001,"Q_Id":48654148,"Users Score":0,"Answer":"The run() method is used by the Thread and Process classes (in the threading and multiprocessing modules) and is the entry point to the object when you call the it's .start() method.\nIf you've seen it outside of that usage then I would think that it's probably either contextual or coincidental.\nI'm not aware of any canonical execute() method.","Q_Score":1,"Tags":"python","A_Id":68869922,"CreationDate":"2018-02-07T00:28:00.000","Title":"Why do classes have Def Run() and Def Execute()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Squish 6.3 Qt. The application i am testing contains a QLabel whose content changes dynamically.\nIs it possible to wait for the label to be set to a particular value?\nI can't use waitForObject as the object always exists and only its text value keeps changing.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2137,"Q_Id":48766455,"Users Score":0,"Answer":"Adding TimeoutMilliseconds did not work, so I added time.sleep(Seconds) and this worked for me better.","Q_Score":1,"Tags":"python,pyqt,squish","A_Id":52899603,"CreationDate":"2018-02-13T12:05:00.000","Title":"Wait for an object property to be set in squish","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I do not understand what the difference is between pygame.display.update() and pygame.display.flip().\nI have tried both and it seems that update() is slower than flip()...\nEDIT:\nMy question is why update() with no parameters is much slower than flip().\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1482,"Q_Id":48769882,"Users Score":6,"Answer":"You must first understand how pygame.display.flip and pygame.display.update work.\nWhen the screen mode pygame.DOUBLEBUF is set, Pygame actually maintains two screens: the active screen which is presently displayed and a buffer which you (the programmer) can update behind the scenes (without the user seeing anything).\nOnce you are done with your edits on the buffer, you can use pygame.display.flip to switch the active screen with the buffer. The entire screen is updated. This is the recommended way to update the entire screen. Also, this is the only way to update non-software screens (OPENGL and Hardware accelerated screens for example).\npygame.display.update on the other hand treats the screen as a group of pixels (that's called a software screen). This allows a Pygame program to update only a portion of the screen. This is faster as only a portion of the screen needs to be modified.\nNow, if the entire screen is to be updated (pygame.display.flip and pygame.display.update without any arguments) pygame.display.flip is faster.\nRemember, I said OpenGL and HW-accelerated screens (SOFT-screens too) maintain a buffer. Drawing to this buffer is slow, but flipping is very fast (in HW-screens and OpenGL). Updating the entire screen using pygame.display.update is even slower as it does things pixel by pixel and without HW-acceleration.","Q_Score":0,"Tags":"python,pygame","A_Id":48770582,"CreationDate":"2018-02-13T15:10:00.000","Title":"Why is pygame.display.update() slower than pygame.display.flip()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"And if so, how would one add a tooltip to a checkbox object? It appears that the control inherits from wxWindow which has tooltips, so can it be added to a wxCheckBox?\nThanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":438,"Q_Id":48779478,"Users Score":0,"Answer":"Try this:\nself.YourCheckboxObject.SetToolTip(wx.ToolTip(\"Paste your tooltip text here\"))","Q_Score":0,"Tags":"python-3.x,wxwidgets","A_Id":48779658,"CreationDate":"2018-02-14T04:04:00.000","Title":"Python - can you add a tooltip on a wx.CheckBox object?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a program where I have a group() with sprites in them. I start by adding each sprite to the group and passing an image for each sprite. Is it possible loop through each sprite in the group and changing the image of a sprite if a certain criteria is met (if statement), or would you need to remove the whole group and create a new one?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2080,"Q_Id":48835136,"Users Score":0,"Answer":"I just realised that you can run pygame.image.load() again to change the image.","Q_Score":1,"Tags":"python,pygame,sprite","A_Id":49012486,"CreationDate":"2018-02-16T21:30:00.000","Title":"Change sprite's image in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've already added the code for drag and drop to the iconview widget, but I haven't found any method for dragging two or more items: every time an item is selected, the previous selection is cleaned.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":109,"Q_Id":48836650,"Users Score":0,"Answer":"A lot later I had the same problem.\nIconView at least now supports that by default (if Ctrl is held).\nNote that your application must have keyboard focus.","Q_Score":1,"Tags":"python-3.x,gtk3","A_Id":65550746,"CreationDate":"2018-02-17T00:14:00.000","Title":"Python3-Gtk3. Iconview. Drag multiple items","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use pyautogui to search an image on Desktop window for click automation.\n\npyautogui.locateOnScreen(image)\n\nIf the image is captured on the same screen as screenshot, it can be matched. However, if the image is a bit different, it cannot. e.g. captured as the low resolution image.\nCan I set some likelihood in pyautogui or use other library?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":330,"Q_Id":48837086,"Users Score":0,"Answer":"Use confidence, default value is 0.999. Reason is pyscreeze is actually used by pyautogui which has the confidence value which most likely represents a percentage from 0% - 100% for a similarity match. Looking through the code with my amateur eyes reveals that OpenCV and NumPy are required for confidence to work otherwise a different function would be used that doesn't have the confidence value.\nfor example:\npyautogui.locateCenterOnScreen('foo.png', confidence=0.5)\nwill set your confidence to 0.5, which means 50%.","Q_Score":3,"Tags":"python,automation,pyautogui","A_Id":70868419,"CreationDate":"2018-02-17T01:35:00.000","Title":"How to search not same images but similar images by pyautogui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"ttk.treeview.focus() returns the iid of a single line. The treeview box allows you to select multiple lines. How do I get a list of iids for the selected lines?","AnswerCount":2,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":6125,"Q_Id":48867800,"Users Score":9,"Answer":"ttk.treeview.focus() returns the current focus item. That means the item that was last selected. The function you are looking for is ttk.treeview.selection(). This returns a tuple of the selected items.","Q_Score":3,"Tags":"python,tkinter,treeview,focus,ttk","A_Id":48867937,"CreationDate":"2018-02-19T13:58:00.000","Title":"Tk Treeview Focus(). How do I Get Multiple Selected Lines?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to detect camera tampering (lens being blocked, resulting in a black frame). The approach I have taken so far is to apply background subtraction and then finding contours post thresholding the foreground mask. Next, I find the area of each contour and if the contour area is higher than a threshold value (say, larger than 3\/4th of the camera frame area), then the camera is said to be tampered.\nAlthough upon trying this approach, there is a false tamper alert, even when the camera captures full view.\nNot sure, how to go about this detection.\nAny help shall be highly appreciated","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1009,"Q_Id":48890390,"Users Score":0,"Answer":"A possible cause for this error could be mild jitters in the frame that occur due to mild shaking of the camera\nIf your background subtraction algorithm isn't tolerant enough to low-value colour changes, then a tamper alert will be triggered even if you shake the camera a bit.\nI would suggest using MOG2 for background subtraction","Q_Score":0,"Tags":"python,opencv,camera,background-subtraction,opencv-contour","A_Id":50014778,"CreationDate":"2018-02-20T16:56:00.000","Title":"detecting when the camera view is blocked (black frame)","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to create a simple scene in 3d (in python) where you have a cube in front of you, and you are able to rotate it around with the mouse. \nI understand that you should rotate the complete scene to mimic camera movement but i can't figure out how you should do this.\nJust to clarify I want the camera (or scene) to move a bit like blender (the program).\nThanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":553,"Q_Id":48911436,"Users Score":0,"Answer":"Ok I think i have found what you should do\njust for the people that have trouble with this like I did this is the way you should do it:\nto rotate around a cube with the camera in opengl:\nyour x mouse value has to be added to the z rotator of your scene\nand the cosinus of your y mouse value has to be added to the x rotator\nand then the sinus of your y mouse value has to be subtracted of your y rotator\nthat should do it","Q_Score":0,"Tags":"python,pygame,blender,pyopengl","A_Id":48952393,"CreationDate":"2018-02-21T16:58:00.000","Title":"PyOpenGL how to rotate a scene with the mouse","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I noticed you need 2 steps to draw something in Pygame, first use surface.blit(), and then use display.update(). Why doesn't surface.blit() draw the object directly?\nThank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":72,"Q_Id":48969180,"Users Score":3,"Answer":"It is useful because it allows you to further modify the window before actually \nchanging it. \nImagine you want to use more than just surface.blit() but potentially dozens of functions.\nUpdating a window takes a memory space and time.\nYou would want to keep these two things to a minimum. If you wanted to apply multiple things to your window rather than keep updating everything as soon as it is called it waits until you have applied all changes then you can tell it to update the window once.\nWhy use it when you use only one function? Simply because it cannot \"guess\" that you only want one function. It is more efficient for you to tell it when to update the window.","Q_Score":2,"Tags":"python,pygame","A_Id":48969232,"CreationDate":"2018-02-25T00:48:00.000","Title":"Why do we need to display.update() after surface.blit() something?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to get column number or value in wx.ListControl wxPython? I want to sort the item by column when I click it. I'm using BoaConstructor IDE. Please help me :)","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":416,"Q_Id":48974839,"Users Score":0,"Answer":"Thank you for all of your answers. I've found the way to do it. When the column is clicked, it will return the value of the column header. This is what I want. \nnoCol = event.m_col \nn = self.lc.GetColumn(noCol).GetText() \nprint(n)","Q_Score":1,"Tags":"python,wxpython,boa-constructor","A_Id":48990057,"CreationDate":"2018-02-25T14:57:00.000","Title":"Get column number or value in wx.ListControl wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using PyQt5 and Python 3.6.4 to design a ui for a program. It was made on a 720p monitor however now using the same code on a 4k monitor, everything is tiny apart from the text. How would I go about resizing the whole app to look the same on all monitors: (720p, 1080p, 4k, etc.)\nThe program is to be run on windows through an executable created through compiling the python code.\nCheers","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":4389,"Q_Id":49048294,"Users Score":4,"Answer":"Simple 1 line fix for any who need \nos.environ[\"QT_AUTO_SCREEN_SCALE_FACTOR\"] = \"1\"","Q_Score":1,"Tags":"python,resize,pyqt5,qapplication","A_Id":49049245,"CreationDate":"2018-03-01T11:04:00.000","Title":"PyQt5 Resize app for different displays","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This may be a basic question, but I'm still learning Kivy and I'm not sure how to do this.\nThe program that I'm writing with Python 2.7 and Kivy reads a folder full of images, and then will display them one at a time as the user clicks through. \nRight now, I'm calling a function that reads the next image on the click of a button. This means that I have a bit of lag between each image.\nI'd like to load all the images in the beginning, or at least some of them, so that there isn't a lag as I click through the images. \nI'm not sure if this is done on the Python side or the Kivy side, but I appreciate any help!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":485,"Q_Id":49083639,"Users Score":0,"Answer":"Loading all your images in memory will be a problem when you have a lot of images in the folder, but you could have a hidden image with the next image as source (it's not even needed to add the Image to the widget tree, you could just keep it in an attribute of your app), so everytime the user load the next image, it's displayed instantly, since it's cached already, and while the user is looking at this image, the second image widget, which stays invisible, would start loading the next image.\nOf course, if you want to load more than 1 image, you'll have to do something more clever, you could have a list of Image widgets in memory, and always replace the currently displayed source with the next in line for pre-fetching).","Q_Score":0,"Tags":"python,python-2.7,kivy","A_Id":49100661,"CreationDate":"2018-03-03T11:28:00.000","Title":"How can I pre-load or cache images with Python 2.7 and Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to show\/hide a QLineEdit (or some other widget) using QCheckBox or QComboBox.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1223,"Q_Id":49087309,"Users Score":0,"Answer":"You need to connect the stateChanged signal (for QCheckBox; emitted every time you check\/uncheck the box) or currentIndexChanged signal (for QComboBox; emitted every time you select a different item in the combo box) to a slot (you can also use a lambda here). In that slot all you need to do is call the QLineEdit's show() or hide() method to toggle the visibility of the line edit.","Q_Score":0,"Tags":"python,pyqt","A_Id":49087417,"CreationDate":"2018-03-03T17:51:00.000","Title":"Change widget visibility using QCheckBox or QComboBox in PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to modify a python program to be able to communicate with a C++ program using shared memory. The main responsibility of the python program is to read some video frames from an input queue located in shared memory, do something on the video frame and write it back to the output queue in shared memory.\nI believe there are few things I need to achieve and it would be great if someone can shed some light on it:\n\nShared memory: In C\/C++, you can use functions like shmget and shmat to get the pointer to the shared memory. What is the equivalent way to handle this in python so both python and C++ program can use the same piece of shared memory?\nSynchronization: Because this involves multi-processing, we need some sort of locking mechanism for the shared memory in both C++ and python programs. How can I do this in python?\n\nMany thanks!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":7802,"Q_Id":49103709,"Users Score":6,"Answer":"Perhaps shmget and shmat are not necessarily the most appropriate interfaces for you to be using. In a project I work on, we provide access to a daemon via a C and Python API using memory mapped files, which gives us a very fast way of accessing data\nThe order of operations goes somewhat like this:\n\nthe client makes a door_call() to tell the daemon to create a shared memory region\nthe daemon securely creates a temporary file\nthe daemon open()s and then mmap()s that file\nthe daemon passes the file descriptor back to the client via door_return()\nthe client mmap()s the file descriptor and associates consecutively-placed variables in a structure with that fd\nthe client does whatever operations it needs on those variables - when it needs to do so.\nthe daemon reads from the shared region and does its own updates (in our case, writes values from that shared region to a log file).\n\nOur clients make use of a library to handle the first 5 steps above; the library comes with Python wrappers using ctypes to expose exactly which functions and data types are needed.\nFor your problem space, if it's just the python app which writes to your output queue then you can track which frames have been processed just in the python app. If both your python and c++ apps are writing to the output queue then that increases your level of difficulty and perhaps refactoring the overall application architecture would be a good investment.","Q_Score":12,"Tags":"python,c++,synchronization,multiprocessing","A_Id":49118076,"CreationDate":"2018-03-05T04:57:00.000","Title":"How to use shared memory in python and C\/C++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Tkinter GUI I've been working on for some time that has a live-plotting feature currently built in matplotlib. However, I'm finding matplotlib to be too slow (it seems to build up a lag over time, as if filling up a buffer of frames of incoming data), so I'm thinking of switching my plotting to PyQtGraph. Can I put this into my Tkinter app?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1645,"Q_Id":49224477,"Users Score":3,"Answer":"No, you cannot embed a PyQtGraph Object inside a tkinter application.","Q_Score":3,"Tags":"python,tkinter,pyqtgraph","A_Id":49224491,"CreationDate":"2018-03-11T19:59:00.000","Title":"Embedding a PyQtGraph into a Tkinter GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Am having a problem in getting the libraries such as kivy which i have installed through QPYPI. How can i get them since when i navigate to \/ qpython\/ lib\/ python2.7\/ site-packages\/ the folder is empty","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":393,"Q_Id":49235442,"Users Score":0,"Answer":"All your site packages aren't stored in the qpython folder especially if you are not using an external sdcard\nOn my phone all libraries are stored in \n\"\/data\/data\/org.qpython.qpy\/files\/lib\/python2.7\/site-packages\" path\nIf you cant access this path on your phone ,then you need to root your phone","Q_Score":0,"Tags":"python,qpython","A_Id":49477242,"CreationDate":"2018-03-12T12:37:00.000","Title":"How to get libraries which i have installed using QPYPI in the file manager of Android","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to remove the actual Close, minimize and maximize buttons of a window and create my own custom buttons, just like in chrome. I therefore want to add corner widgets to my tabwidget. Is there a way so that I can add three buttons as corner widgets of a QTabWidget?\nIs it somehow possible to achieve using the QHBoxLayout ?\nThe setCornerWidget function just takes one widget as its input.","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":545,"Q_Id":49254062,"Users Score":4,"Answer":"Add a generic QWidget as the corner widget.\nGive it a QHBoxLayout.\nAdd your buttons to the layout.\n\nI use this frequently, often by subclassing QTabWidget and creating accessor functions that return the individual buttons. Adding signals like buttonClicked(int) with the index and buttonClicked(QAbstractButton) with the button itself are helpful, too.","Q_Score":1,"Tags":"python,qt,pyqt,pyqt5,qtabwidget","A_Id":49256651,"CreationDate":"2018-03-13T10:42:00.000","Title":"PyQt QTabWidget Multiple Corner WIdgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Appium\nPython\niOS\nel.text and get_attribute('label') etc. all seem to pulling accessibility information. Is there a way to pull the actual text that is displayed on screen using Appium? I need to be able to pull for a given element.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2239,"Q_Id":49265166,"Users Score":0,"Answer":"It does not return visible text if you use .text\nYou need to ask the developer to add a new attribute in the iOS code with the actual mention of the original url text. Then you will be able to see the new attribute in the Appium element locator table. If this is not done there is no value in the appium element locator table to give you the visible text","Q_Score":1,"Tags":"appium,appium-ios,python-appium","A_Id":51236016,"CreationDate":"2018-03-13T20:17:00.000","Title":"Appium - Get actual, visible text that is displayed on screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This may sound dumb, but I am unable to figure out how to update my main.py code using buildozer. I once created a file main.py and ran buildozer init . Afterwards I executed some android commands like buildozer android run. Now I would like to change the code of my main.py . But whenever I try to re-compile using buildozer android run the same not edited code is used. I found out that the file PROJECT\/.buildozer\/android\/app\/main.py is used. But I don't want to update this file because that seems unclean to me.\nEdit: I already tried buildozer android clean and buildozer android update and I already searched on the internet but I could not find anything.\nWhat is the solution to update the buildozer codebase?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":587,"Q_Id":49284459,"Users Score":1,"Answer":"Well, a very stupid solution. After 45 minutes of trial-and-error I found out that I just have to invoke buildozer android debug to compile the application. buildozer android run is independent and just runs the compiled application. As a user of the gradle build system I did not think about this case, because I was familar with the target-based build system.\nThe final solution to compile and run on the target device is therefore: buildozer android debug deploy run\nI hope this answer will help someone who expects the same problem.","Q_Score":0,"Tags":"android,python,kivy,buildozer","A_Id":49284548,"CreationDate":"2018-03-14T17:43:00.000","Title":"Buildozer update python code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"In python distribution .h files are included in the include folder (C:\\Users\\x_user\\AppData\\Local\\Programs\\Python\\Python36-32\\include). I can not find the use of these .h files. How and where are these .h files are used (if in any python file)? I am running python 3.6.4 on Windows 8.1","AnswerCount":1,"Available Count":1,"Score":1.0,"is_accepted":false,"ViewCount":166,"Q_Id":49340894,"Users Score":8,"Answer":"They are provided so that C extensions can be built against the Python installation. It is all about support for third-party tools.\nIn general, day-to-day user has no need for those files. It mainly affects them when they are installing an external tool that needs to be recompiled.","Q_Score":2,"Tags":"python,c,python-3.x,header-files","A_Id":49340937,"CreationDate":"2018-03-17T19:14:00.000","Title":"Why \"include\" folder contains .h files in python disribution (python 3.6.4)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a project written in Python that should perform some actions in an opened application window. For example I run application window with 3 buttons at 3 different positions. I write a script using auto-gui lib for python 3 and set x, y coordinates to click on 3 button positions. But my problem is: If I minimize this window, clicker clicks at the given position within another currently open window. \nMy main question: is there a way (with help of a lib or by any other means) to trigger or bind this script to work only with this opened (or specified) application. And if I minimize this window, clicker continues to work in this minimized window, not in the currently active one. Please suggest.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1023,"Q_Id":49445954,"Users Score":0,"Answer":"You should have a look at win32gui module, more specifically to SetActiveWindows, SetForegroundWindow, SetActiveWindows also EnumWindows to find your application.\nWith these you can detect a certain application by it's title using EnumWindows you can then maximize it and set it as active so it will be fullscreen and the first one you see on the monitor. This way you can now use the (x,y) coordinates for clicks because the windows will always be maximized therefore the buttons in the same position everytime.","Q_Score":0,"Tags":"python,python-3.x,python-2.7,mouseclick-event","A_Id":52735508,"CreationDate":"2018-03-23T09:11:00.000","Title":"python: windows GUI automation working with a specific window regardless of its state","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"From PyQt4.QtGui Cannot import module uic\nI cannot seem to find this uic module to download or install it. I think it's suppose to come with the qt4 and qt designer packages.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":49460431,"Users Score":0,"Answer":"uic would be a c++ rather than a python command.\nI\u2019m guessing you want to convert qt file to a python compatible file if that is the case simply open a terminal and navigate to the directory where your Qt file is and the enter the following:\n$ pyuic your_file.ui -o your_file.py\nyou should now have in the same directory a .py file which you can incorporate in your project","Q_Score":0,"Tags":"python,qt,pyqt","A_Id":49516795,"CreationDate":"2018-03-24T01:50:00.000","Title":"Difficulty with running PyQt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So this is a bit of a tricky situation. Using Three.js\/ReactJS and canvas. \nScenario: When I click and drag a sphere beyond its boundaries a tooltip will show a warning message over the mouse pointer. When I release the mouse the tooltip will disappear. When I click and drag the sphere back to a position inside the boundaries, the tooltip will not be displayed once inside the boundaries.\nBear in mind this is tied into the state of the app handled by react, and in this instance the tooltip is being updated when the conditions are met and updated in the state. \nThe tooltip element is present however, the attributes and content gets updated on a click and hold when the sphere is out of bounds...\nusing\nActionChains(page.driver).move_to_element_with_offset(sphere_order_panel, -1047, 398).click_and_hold().move_to_element_with_offset(sphere_order_panel, -1633, 265).click_and_hold().perform()\nclicks on the element and drags it to the position outside of its boundaries, but the tooltip is NOT updated... i've put a breakpoint on the page once i manually click into the page, my sphere gets snapped to my mouse location (meaning click_and_hold is indeed working... but i check the html and verify that the tooltip is not updated. however if i manually use my mouse and click on the sphere the tooltip will update! is selenium automation not executing the click_and_hold correctly? I don't think this is the case. \nIs there a way to add the mouse pointer to the page using selenium?\nOr is there a way to use execute_script() to use javascript on the page to satisfy my conditions to get the tooltip to be updated?\nI'm really stuck on this.. and this is a tricky situation (for me at least)\nAny help greatly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":198,"Q_Id":49539286,"Users Score":0,"Answer":"to get around my issue, I had to do this \nchain = ActionChains(page.driver).move_to_element_with_offset(sphere_order_panel, -1047, 398).click_and_hold()\nchain = chain.move_to_element_with_offset(sphere_order_panel, -1047, 398) \nchain.perform()","Q_Score":0,"Tags":"python,reactjs,selenium,canvas,three.js","A_Id":49634904,"CreationDate":"2018-03-28T16:04:00.000","Title":"Python Selenium: Show Tooltip on Mouse Pointer (Three.js\/React\/Canvas)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have recently developed a python based UI script using tkinter and python 2.7 on Windows 10 OS. To distribute it to the users I converted the script into an single file exe using pyinstaller.\nThe script is working fine on all Windows 10 systems but creating issue on Windows 7 as:\n\"Fatal Error: Can not run ... script\"\nI cannot wrap my head around it.\nAny help is appreciated.\nThanx in advance..:)","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1879,"Q_Id":49551660,"Users Score":1,"Answer":"When you use pyinstaller to compile your script to executable in windows 10 and want to use it in window 7 it won't work.\nBut you can compile it with pyinstaller in windows 7 and use the executable in windows 7, 8, and 10\nAlso take note of this, take into consideration 32-bit and 64-bit version of the operating systems when use windows 7 32-bit to compile your executable and want to use it in windows 7 64-bit operating system version it won't work and vice versa.\nSo when you compile in windows7 32-bit version it will work on only 32-bit version of operating systems and not on 64-bit version of windows operating system and vice versa","Q_Score":0,"Tags":"python,python-2.7,tkinter,exe,pyinstaller","A_Id":49554853,"CreationDate":"2018-03-29T08:47:00.000","Title":"Tkinter python script converted to exe using pyinstaller on Windows 10 not working on Windows7","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"The pygame.movie package is deprecated and I haven't found an alternative to blit a video on a surface (background for example) and blit other objects on the foreground? That's not possible with moviepy etc. Thank you so much!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":79,"Q_Id":49608065,"Users Score":0,"Answer":"There is no such thing, unless if you want to upload every frame of the video as an image and play them frame by frame.","Q_Score":0,"Tags":"python,windows,python-3.x,pygame,pygame-surface","A_Id":49618130,"CreationDate":"2018-04-02T08:46:00.000","Title":"Is there still a possibility to blit a video on a PyGame surface?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been wanting to know how to make a GUI without using a module on Python, I have looked into GUI's in Python but everything leads to Tkinter or other Python GUI modules. The reason I do not want to use Tkinter is because I want to understand how to do it myself. I have looked at the Tkinter modules files but it imports like 4 other Modules.\nI don't mind the modules like system, os or math just not modules which I will use and not understand. If you do decide to answer my question please include as much detail and information on the matter. Thanks -- Darrian Penman","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1223,"Q_Id":49658301,"Users Score":1,"Answer":"For the same reason that you can't write to a database without using a database module, you can't create GUIs without a GUI module. There simply is no way to draw directly on the screen in a cross-platform way without a module.\nWriting GUIs is very complex. These modules exist to reduce the complexity.","Q_Score":0,"Tags":"python,python-3.x,user-interface,tkinter","A_Id":49658628,"CreationDate":"2018-04-04T18:48:00.000","Title":"Python - How do I make a window along with widgets without using modules like Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been wanting to know how to make a GUI without using a module on Python, I have looked into GUI's in Python but everything leads to Tkinter or other Python GUI modules. The reason I do not want to use Tkinter is because I want to understand how to do it myself. I have looked at the Tkinter modules files but it imports like 4 other Modules.\nI don't mind the modules like system, os or math just not modules which I will use and not understand. If you do decide to answer my question please include as much detail and information on the matter. Thanks -- Darrian Penman","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":1223,"Q_Id":49658301,"Users Score":1,"Answer":"You cannot write a GUI in Python without importing either a GUI module or importing ctypes. The latter would require calling OS-specific graphics primitives, and would be far worse than doing the same thing in C. (EDIT: see Roland comment below for X11 systems.)\nThe python-coded tkinter mainly imports the C-coded _tkinter, which interfaces to the tcl- and C- coded tk GUI package. There are separate versions of tcl\/tk for Windows, *nix, and MacOS.","Q_Score":0,"Tags":"python,python-3.x,user-interface,tkinter","A_Id":49658596,"CreationDate":"2018-04-04T18:48:00.000","Title":"Python - How do I make a window along with widgets without using modules like Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I am trying to mimic human typing best as possible. Right now I am using pyautogui.typewrite(\"what i want to type\") to type and it is basically pasting it, is there anyway i can get it to maybe type the letters one by one but in a quick manner?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":334,"Q_Id":49828473,"Users Score":1,"Answer":"In order to mimic human typing as best as possible you need to study human (for example your own) typing first creating a database of \"time distances\" between the strokes of single keys within different words and use this database for setting the time.sleep(timeDistance) in the for e in text: loop (see the answer by \u1d21\u029c\u1d00\u1d04\u1d0b\u1d00\u1d0d\u1d00\u1d05\u1d0f\u1d0f\u1d05\u029f\u1d073000). \nAnother approach to understand how to mimic human typing as best as possible is to try to write an own detector of automated typing. Humans tend to repeat given patterns of own typing behavior with \"time distances\" between given combinations of keystrokes that don't vary by chance (hence the need for a database depending on the keystroke sequences).","Q_Score":1,"Tags":"python,web,automation,pyautogui","A_Id":49836015,"CreationDate":"2018-04-14T06:05:00.000","Title":"Python Automating Typing On Webpage","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I was watching a video about installing pygame, and it told me to download the link from pygame the most recent one. So I downloaded that and kept pressing the 'next' in wizard setup in order to install it. However, then when I did 'import pygame' it didn't work. Then on the pygame website it gave me this command to type into cmd promt - 'py -m pip install -U pygame --user'. Then when I did that and did import pygame, it didn't come up with an error. But I'm confused because the pygame I downloaded is in downloads, so I deleted it and removed it completely of computer, but import pygame still works. Why is this so? Sorry, I'm very much a noob at downloading\/installing stuff and I get concerned about small things like this, but if anyone could tell me why 'import pygame' still works, and if I even needed to download pygame in the first place, I'd very much appreciate it. Thank you.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":49,"Q_Id":49831264,"Users Score":0,"Answer":"When you downloaded pygame, then it just get downloaded as a setup in your computer. For now, it isn't installed in your computer. So, importing it will not work, because python can't find that file installed in python root folder\nBut as soon as you execute this command py -m pip install -U pygame --user, then pip looks for a package named pygame in your computer, and install it then the installed file of pygame moves somewhere in python root folder. So, Now importing pygame will work. \nAnd you said that you deleted the downloaded file. So, Python will not be affected anyways, because that was only a setup. Main stuff, which is the installed file get moved in python root folder. As a result it is still in your computer. So, importing pygame would definitely work, because python can still find pygame in its root folder.\nSo, this is how all this works!","Q_Score":0,"Tags":"python,pygame","A_Id":49831350,"CreationDate":"2018-04-14T12:07:00.000","Title":"New PC pygame concerns","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm translating a Python program which uses OpenCV to C# with Java bindings. I tested both Python and C# programs using the same image, and I realized the findContours method returns different contours between the 2 programs.\nPython: _, contours, hierarchy = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)\nC#: Imgproc.FindContours(edges, contours, hierarchy, Imgproc.RetrTree, Imgproc.ChainApproxSimple);\nFor Python, I checked using len(contours), for C# contours.Count, and they return the values 94 and 106 respectively. I think this may be the cause to many discrepancies in my translated program, and I'm not sure why. What am I doing wrong here?\n\nAdd-on: The Canny method below is called before calling findContours. Anything before is just reading the image, and converting the image into a gray one, thus the grayImg variable.\n\nC#: Imgproc.Canny(grayImg, edges, 100, 200, 3, false);\nPython: edges = cv2.Canny(gray, 100, 200, apertureSize = 3)\nI previously thought it was because of differing OpenCV versions, but I realized both are using OpenCV 3. Unless the FindContours method is different in 3.1 than 3.4, I'm back to square one again as I don't know the cause of the problem.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":194,"Q_Id":49890287,"Users Score":0,"Answer":"I've finally found the answer to this phenomenon. The python program is using OpenCV 3.4, while the Java bindings of my C# program is using the older OpenCV 3.1 . The FindContours method may be found in both versions, but apparently returns different values.","Q_Score":0,"Tags":"c#,python,opencv,opencv-contour","A_Id":49896647,"CreationDate":"2018-04-18T02:37:00.000","Title":"Different return from Java and Python cv2.findContours","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating an image detection module, and I do a lot of math calculations around arrays.\nI know that C\/C++\u2019s array iterates faster than Python\u2019s\nI can't move my project to C\/C++, so I wanted to create an array module in C\/C++ and call it in Python.\nWhat I want to know:\n1) Is this viable? Or calling a module from another interpreter will slow down my program more than it will speed it up?\n2) Is there some Python package that does what I want?\nI feel like I haven\u2019t written enough info, but I can't think of anything else important.\n[EDIT] So I just went with numpy and it has everything I need :p, thanks everyone","AnswerCount":4,"Available Count":2,"Score":0.1488850336,"is_accepted":false,"ViewCount":111,"Q_Id":49984220,"Users Score":3,"Answer":"Both the array and the low level operations on it would have to be in C++; switching on a per element basis will have little benefit.\nThere are many python modules that have internal C\/C++ implementations. Simply wrapping a C or C++ style array would be pointless, as the built in python data types can basically be that.","Q_Score":0,"Tags":"python,c++,c,arrays","A_Id":49984333,"CreationDate":"2018-04-23T15:01:00.000","Title":"C++ Vector in Python for Perfomance","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating an image detection module, and I do a lot of math calculations around arrays.\nI know that C\/C++\u2019s array iterates faster than Python\u2019s\nI can't move my project to C\/C++, so I wanted to create an array module in C\/C++ and call it in Python.\nWhat I want to know:\n1) Is this viable? Or calling a module from another interpreter will slow down my program more than it will speed it up?\n2) Is there some Python package that does what I want?\nI feel like I haven\u2019t written enough info, but I can't think of anything else important.\n[EDIT] So I just went with numpy and it has everything I need :p, thanks everyone","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":111,"Q_Id":49984220,"Users Score":0,"Answer":"Try boost.python.\nIf you can port all the computational heavy stuff to C++, it'll be quite fast but if you need to switch continuously between C++ and python, you won't get much improvement.","Q_Score":0,"Tags":"python,c++,c,arrays","A_Id":49984679,"CreationDate":"2018-04-23T15:01:00.000","Title":"C++ Vector in Python for Perfomance","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As the title suggests, is it possible to check whether a tkinter window is withdrawn or not?\nI am aware of the fact, that I can have a variable toggled True\/False whenever I withdraw\/deiconify a window, but in my case, that will simply be too messy.","AnswerCount":1,"Available Count":1,"Score":0.761594156,"is_accepted":false,"ViewCount":600,"Q_Id":49989727,"Users Score":5,"Answer":"You can call the method winfo_viewable which returns whether or not the widget is visible. \nFrom the official tcl\/tk documentation:\n\nReturns 1 if window and all of its ancestors up through the nearest toplevel window are mapped. Returns 0 if any of these windows are not mapped.","Q_Score":3,"Tags":"python,tkinter","A_Id":49990093,"CreationDate":"2018-04-23T20:49:00.000","Title":"Check if tkinter window is withdrawn?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to check the appearance of my GUI while coding, for several OS where it should be distributed.\nHow can I do ?\nThe problem is that the \u2018previsualisation\u2019 proposed by QT Designer is very different from the appearance of the distributed release. I even have spots in tabs that appear with same font and size in \u2018previsualisation\u2019 but have different sizes on Windows... I work with: python 3.5, a GUI designed with QT Designer, developed on mac OS 10.11 and shared with Windows 7 and Windows 10 systems (installed with a recent pyinstaller)","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":50048117,"Users Score":0,"Answer":"ok. For the moment, I developed a ui file for each OS and test the appearance \"for real\". That's awkward and, moreover, in a given ui file, some strings that have exactly the same apparent properties in Qt Designer may appear differently in the final release","Q_Score":0,"Tags":"python,windows,pyinstaller,qt-designer","A_Id":51113469,"CreationDate":"2018-04-26T16:40:00.000","Title":"appearance of my GUI in several OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to check the appearance of my GUI while coding, for several OS where it should be distributed.\nHow can I do ?\nThe problem is that the \u2018previsualisation\u2019 proposed by QT Designer is very different from the appearance of the distributed release. I even have spots in tabs that appear with same font and size in \u2018previsualisation\u2019 but have different sizes on Windows... I work with: python 3.5, a GUI designed with QT Designer, developed on mac OS 10.11 and shared with Windows 7 and Windows 10 systems (installed with a recent pyinstaller)","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":45,"Q_Id":50048117,"Users Score":2,"Answer":"The preview uses some approximation of the final style drawn completely by Qt, but the style used \"for real\" in most platform plug-ins either employs real, native widgets, or emulates them asking for theme parts straight from the machine where it's running. So, it's not possible to have a completely faithful preview unless you use a style that is always drawn completely by Qt (such as Fusion).\nLong story short: to see how your application will really look on different platforms you'll have to test it \"for real\".","Q_Score":0,"Tags":"python,windows,pyinstaller,qt-designer","A_Id":50048245,"CreationDate":"2018-04-26T16:40:00.000","Title":"appearance of my GUI in several OS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What's the difference between tkinter's Entry() and Text() functions?\nCouldn't find anything online, so after figuring it out, wanted to make it available online for others.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":6118,"Q_Id":50194711,"Users Score":1,"Answer":"The Entry widget has validation commands (ie, possibility to have only lowercase, only digits etc). This needs some workaround to make work in Text widgets.","Q_Score":3,"Tags":"python,python-3.x,user-interface,tkinter","A_Id":56186574,"CreationDate":"2018-05-05T22:54:00.000","Title":"What's the difference between Entry() and Text()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a question about PyQt4 in motionbuilder 2016\nI have successfully installed Pyqt4 from pip\nand it show up \"have Requirement already satisfied: PyQt4 in c:\\python27\\lib\\site-packages (4.11.4) \"\nbut when import the module in motionbuilder by using import PyQt4\nis have the error : \"ImportError: No module named PyQt4\"\nAny suggestions would be appreciated.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":496,"Q_Id":50218411,"Users Score":0,"Answer":"I have found out the problem and solved\nUninstall the Python2.7 and reinstall again, getting the new version of Pip, install the whl file by using pip\nit solved, i think is my sys.path mass up!","Q_Score":0,"Tags":"python,python-2.7,pyqt4,motionbuilder","A_Id":50251538,"CreationDate":"2018-05-07T16:11:00.000","Title":"motionbuilder 2016 PyQt4","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there any way to fill a Tkinter canvas polygon with an image using PIL or another libraries? I need to transform an image or draw it by pixel.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":442,"Q_Id":50222253,"Users Score":0,"Answer":"You can draw a polygon around an image, but you can't fill a polygon with an image. You would have to calculate the space of a polygon, and then use an external library or program to change the size of the image. Tkinter can only double or halve the size of images.","Q_Score":0,"Tags":"python,tkinter","A_Id":50222299,"CreationDate":"2018-05-07T20:50:00.000","Title":"Filling a Tkinter Canvas Polygon with an Image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am doing a mini project, where I need to create labels using tkinter library of python. I need to attach a link to each of the label, so that whenever I will click on a particular label, it should stream its online video. Videos can be YouTube videos. So I was wondering is there any way to do this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":185,"Q_Id":50226886,"Users Score":1,"Answer":"You cannot easily do what you want. Tkinter has no way to render html. You would have to parse the HTML and CSS and Javascript yourself, and translate the information for display on a canvas or text widget.","Q_Score":0,"Tags":"python,tkinter","A_Id":50226992,"CreationDate":"2018-05-08T06:04:00.000","Title":"Is there any way to stream online videos in python tkinter window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I try to collect data for a database inside my tool. At the moment I have only a few variables so I have some entry widgets where the user puts the data in.\nSo now if I think a bit further I may have 25 or more variables. But I don't want to overflow my GUI with 25 or more entry widgets.\nI hope its okay to not include any code, I think entry widgets are well known.\nSo my question is:\nIs there a better widget to collect many inputs? I tried it with a treeview but I cant find a way to make the cells editable or anything similar.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":33,"Q_Id":50230581,"Users Score":1,"Answer":"You could have one entry field and next to it a dropdown menu with which the user specifies which data he is entering. \nIf you can categorize the inputs, you could look into notebooks\/tabs for tkinter to seperate them nicely.","Q_Score":0,"Tags":"python,tkinter","A_Id":50230612,"CreationDate":"2018-05-08T09:41:00.000","Title":"Tkinter GUI many entry widgets, is there a better way?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently working on a project that would allow me to serve a web page to multiple local devices and use each client as controls for Pygame input. I am having trouble finding out if I can even pass data in-between the two (Pygame and flask) let alone having them run side by side using something like async. (Please note i am just getting started digging into python programming). I was thinking of two ways that this could happen if it is possible to have them communicate.. \n1) Use flask to pass the data to Pygame.\n2) Use something like Brython to run python localy on the device via browser and connect them using sockets.\nIs it possible or is this just a pipe dream?\nThanks,","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":154,"Q_Id":50299695,"Users Score":0,"Answer":"This is not possible.\nPyGame is intended for rendering graphics on the computer running the Python binary, while Flask is intended to generate HTML to be sent to a remote computer. The only way to interact with a remote user through a browser is through HTML and JavaScript.\nMoreover, this there is no way to interface PyGame with HTML\/JS because PyGame's method of accessing the local screen, keyboard and mouse is very different from HTML's method of interacting with the user. To give just one major obstacle, PyGame's fundamental mode of operation is to block the UI thread until an event (such as a mouse click) occurs, using the function pygame.event.wait(). In HTML, by contrast, this is not allowed, and you are expected instead to register handlers for events such as mouse clicks.","Q_Score":1,"Tags":"python,html,asynchronous,flask,pygame","A_Id":64150040,"CreationDate":"2018-05-11T20:18:00.000","Title":"Using python generated web page as input for Pygame controls","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have looked at a few python GUI frameworks like PyQt, wxPython and Kivy, but have noticed there aren\u2019t many popular (used widely) python applications, from what I can find, that use them.\nBlender, which is pretty popular, doesn\u2019t seem to use them. How would one go about doing what they did\/what did they do and what are the potential benefits over using the previously mentioned frameworks?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":469,"Q_Id":50346411,"Users Score":1,"Answer":"I would say that python isn't a popular choice when it comes to making a GUI application, which is why you don't find many examples of using the GUI frameworks. tkinter, which is part of the python development is another option for GUI's.\nBlender isn't really a good example as it isn't a GUI framework, it is a 3D application that integrates python as a means for users to manipulate it's data. It was started over 25 years ago when the choice of cross platform frameworks was limited, so making their own was an easier choice to make. Python support was added to blender about 13 years ago. One of the factors in blender's choice was to make each platform look identical. That goes against most frameworks that aim to implement a native look and feel for each target platform.\nSo you make your own framework when the work of starting your own framework seems easier than adjusting an existing framework to your needs, or the existing frameworks all fail to meet your needs, one of those needs may be licensing with Qt and wxWidgets both available under (L)GPL, while Qt also sells non-GPL licensing.\nThe benefit to using an existing framework is the amount of work that is already done, you will find there is more than you first think in a GUI framework, especially when you start supporting multiple operating systems.","Q_Score":0,"Tags":"python,python-3.x,user-interface,blender","A_Id":50404266,"CreationDate":"2018-05-15T09:13:00.000","Title":"Why and how would you not use a python GUI framework and make one yourself like many applications including Blender do?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I don't have any struggle with any code or similar, but I wonder, why don't we always have to import everything we use (like for example BoxLayout or GridLayout)? I can use a BoxLayout even without importing it, so my question is: When is it mandatory to import a module and when isn't it really necessary? I couldn't find anything about it on the internet so I thought I could get some information here.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":99,"Q_Id":50397890,"Users Score":1,"Answer":"The reason you could use classes like BoxLayout and GridLayout even without explicitly importing them is because they are parts of the library anyway.\nAs for your question on when is it necessary to explicitly import libraries, I think it's a good programming practice to always do so. This way, you'll be able to avoid confusion in referring to classes or functions.","Q_Score":0,"Tags":"python,import,module,kivy,boxlayout","A_Id":50398080,"CreationDate":"2018-05-17T18:04:00.000","Title":"Why are not all modules imported, but can still be used?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What happens to slave widgets when the parent widget is destroyed?\nHow can we faster remove all references on objects related with GUI after calling my_gui.destroy() in python tkinter?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":30,"Q_Id":50420219,"Users Score":1,"Answer":"The references stay around according to the normal python rules. The underlying widget objects are all destroyed when the root window is destroyed.","Q_Score":0,"Tags":"python,python-3.x,tkinter","A_Id":50420419,"CreationDate":"2018-05-18T22:58:00.000","Title":"what happen with references on gui objects when the root is destroyed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Just a general question. Instead of having a popup window appear when I use imshow, is it possible to have this window open up in a GUI application (could be any GUI framework, I am just wondering if this is possible) view instead?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":366,"Q_Id":50458452,"Users Score":0,"Answer":"It is possible to design a Window-based application using highgui, the same api that you use for displaying pop-up windows. But I am not sure how powerful it is, when it comes to designing a fully fledged application.\nIf you are using python, pyqt is generally easy to work with. For c++, you have choices like Qt (multiplatform), Quartz (Mac, with Objective C or Swift), etc.","Q_Score":3,"Tags":"python,c++,opencv,graphics,computer-vision","A_Id":50459232,"CreationDate":"2018-05-22T01:12:00.000","Title":"Is there anyway to take an opencv display window and save it to a GUI window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I create a python GUI by PyQt4, and now I'm trying to save this program into Google Cloud Platform(Compute engine) so that I can remotely execute it. But after I execute my python program, there's a problem showed up, the console showed the message :\"cannot connect to X server\". I also try to run with \"xvfb-run python GUI.py\", although it started to run but the graphical user interface didn't showed up, is there any suggestion? Thanks in advance!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":769,"Q_Id":50526152,"Users Score":1,"Answer":"In order to run a GUI application remotely on a Linux\/Unix box, you need to have a X server running on your local machine and ready to accept a connection. Easiest way to do this is to SSH in and enable X11Forwarding either in your client config, your personal version of the client config, or on the command line (ie, the -X or -Y options).\nUs Linux folks already have an X server, as do them BSD folks. Mac users can install it and it integrates quite nicely on OS X. Windows users need to either pay some $ and buy a license for a commercial product, or use cygwin-x.","Q_Score":1,"Tags":"python-2.7,user-interface,google-cloud-platform,xserver","A_Id":50558432,"CreationDate":"2018-05-25T09:41:00.000","Title":"cannot connect to X server error showed up in GCP","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Skip the first two paragraphs if your not interested in why I'm asking this question.\nHere is the situation: I'm using a Moto Z Play with the Projector Modification, the mod is really cool and allows me to literally project my phone screen onto the wall. I've been writing a personal assistant program that helps me with my daily life I.E. Sorting gmails, reminding me of calendar events, keeping track of anything I want it to remember and reminding me of those things when I've asked it to, and much more. Its basically a personal secretary.\nOne new feature I just added was a habit tracker. I created a small graphical interface on my phone using Tasker that would email my \"assistant\" who would then record the habit and create a really cool graph that shows my past habit record as well as using a neural network to predict the next days habit. Only problem is, the graph got really intricate really fast. I want to show a months worth of habits (16 total habits), creating what can be up to a 16 x 31 floating point graph with labels. My laptop screen is just not big enough to display all of that without it just being a mess! I really want to display the graph from my projector mod, the entire wall will definitely be big enough to show all that data.\nOk, now my question (thanks for hanging in there I know that was a lot):\nIs there any way that I can display an image on my phone from a Python program without creating a standalone app? Even if my phone needs to be plugged into my computer to stream the data through a cable.\nI would use a service like Kivy to create a standalone app, but then it wouldn't be hooked up to my assistant, completely defeating the purpose.\nI'm not looking for anything similar to a notification, I really want to draw over the entire screen of my phone. This is something I did with Processing (Java library) a while back, but now I'm using Python because it's more machine learning friendly.\nI've looked into a lot of services but nothing seems to be able to do this. Remember that I dont need to send anything back from my phone, simply display an image on the screen until the desktop side program tells it to stop.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":397,"Q_Id":50536582,"Users Score":0,"Answer":"Not my expertise but if I would need to do something like that I would make a web-service of the python app using django and go to the url with my phone. Don't know if it help....","Q_Score":0,"Tags":"android,python,image,cross-platform","A_Id":50536668,"CreationDate":"2018-05-25T20:41:00.000","Title":"Python: Displaying Graphics on Android Screen from Desktop Script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Skip the first two paragraphs if your not interested in why I'm asking this question.\nHere is the situation: I'm using a Moto Z Play with the Projector Modification, the mod is really cool and allows me to literally project my phone screen onto the wall. I've been writing a personal assistant program that helps me with my daily life I.E. Sorting gmails, reminding me of calendar events, keeping track of anything I want it to remember and reminding me of those things when I've asked it to, and much more. Its basically a personal secretary.\nOne new feature I just added was a habit tracker. I created a small graphical interface on my phone using Tasker that would email my \"assistant\" who would then record the habit and create a really cool graph that shows my past habit record as well as using a neural network to predict the next days habit. Only problem is, the graph got really intricate really fast. I want to show a months worth of habits (16 total habits), creating what can be up to a 16 x 31 floating point graph with labels. My laptop screen is just not big enough to display all of that without it just being a mess! I really want to display the graph from my projector mod, the entire wall will definitely be big enough to show all that data.\nOk, now my question (thanks for hanging in there I know that was a lot):\nIs there any way that I can display an image on my phone from a Python program without creating a standalone app? Even if my phone needs to be plugged into my computer to stream the data through a cable.\nI would use a service like Kivy to create a standalone app, but then it wouldn't be hooked up to my assistant, completely defeating the purpose.\nI'm not looking for anything similar to a notification, I really want to draw over the entire screen of my phone. This is something I did with Processing (Java library) a while back, but now I'm using Python because it's more machine learning friendly.\nI've looked into a lot of services but nothing seems to be able to do this. Remember that I dont need to send anything back from my phone, simply display an image on the screen until the desktop side program tells it to stop.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":397,"Q_Id":50536582,"Users Score":0,"Answer":"Regardless of \"how\" or \"what\", the answer is, you will always need some software running on the Android to capture the stream of data (images) and display it in the screen.\nThe point is, you don't have to write this software yourself. The obvious example that come to mind is use any DLNA compatible software, VLC for example, and have your python to generate a h264 stream and point VLC to it. Another way would be use some http service from your python and simply load it in the browser.\nhope it helps.","Q_Score":0,"Tags":"android,python,image,cross-platform","A_Id":50537235,"CreationDate":"2018-05-25T20:41:00.000","Title":"Python: Displaying Graphics on Android Screen from Desktop Script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know if there is a command that will put the image in the foreground, set it to transparent and block it, that is, the picture will look like a background for a text editor","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":48,"Q_Id":50592183,"Users Score":0,"Answer":"No, there is not. You can't use a picture for the background of a text widget.","Q_Score":0,"Tags":"python,tkinter,python-imaging-library","A_Id":50592323,"CreationDate":"2018-05-29T20:07:00.000","Title":"Add background Image on widget Text using PIL","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a beginner in learning pyqt5. when I run the command from Section3.Dialog import Ui_Dialog as the tutorial taught, It gave me the Error: ModuleNotFoundError: No module named 'Section3'.\n Any guidance will be appreciated as I have already searched the error in net but have no idea yet.\nI watched the tutorial PYQT5 video namely \"Packtpub Python GUI Programming Recipes using PyQt5 [Video]_git.ir\" while in the third folder named \"3. Enhancing the Qt5 GUI Functionality\" in the file namely \"11.Calling Dialogs from the Main Window.mp4\" at the time :\"05:52\" teacher writes this command from Section3.Dialog import Ui_Dialog but when I run it it gave me the error :from Section3.Dialog import Ui_Dialog.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":268,"Q_Id":50610214,"Users Score":1,"Answer":"The python interpreter is looking for a folder called \"Section3\" located in the same directory as your python script. Inside the 'Section3' folder there needs to be a python script called 'Dialog' which has a class or function called 'Ui_Dialog'. Make sure that the folder 'Section3' exists and is located in the same folder as your script, and it should import just fine.","Q_Score":0,"Tags":"python,module,pyqt5","A_Id":50610976,"CreationDate":"2018-05-30T17:13:00.000","Title":"How to solve the Error: No module named 'Section3' while using Pyqt5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm completly stuck on this. I keep getting error message \n\nProcess finished with exit code -1073741819 (0xC0000005)\n\nI'm using pycharm with pyqt5.6 and qt5.6.2 and the problem started when I upgraded to these versions.\nI've tried searching as much as I can, but have not been able to find an answer. Can anyone help please?","AnswerCount":8,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":46053,"Q_Id":50620954,"Users Score":0,"Answer":"Same problem, this resolved in my case:\n\ntry run from command line (no pycharm), it works ( exception only in debug )\nclosed pycharm\ndeleted \".idea\" folder inside project path\nopened pycharm\nreconfigure python runtime version and command line parameter\ndebug works","Q_Score":23,"Tags":"python,pycharm,pyqt5","A_Id":71405983,"CreationDate":"2018-05-31T09:26:00.000","Title":"Process finished with exit code -1073741819 (0xC0000005) Pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm completly stuck on this. I keep getting error message \n\nProcess finished with exit code -1073741819 (0xC0000005)\n\nI'm using pycharm with pyqt5.6 and qt5.6.2 and the problem started when I upgraded to these versions.\nI've tried searching as much as I can, but have not been able to find an answer. Can anyone help please?","AnswerCount":8,"Available Count":5,"Score":-0.024994793,"is_accepted":false,"ViewCount":46053,"Q_Id":50620954,"Users Score":-1,"Answer":"I had the same problem today when plotting a simple matrix. For me just changing the Python interpreter helped. I am not sure why, but I could imagine it has something to do with the installed libraries.","Q_Score":23,"Tags":"python,pycharm,pyqt5","A_Id":69899161,"CreationDate":"2018-05-31T09:26:00.000","Title":"Process finished with exit code -1073741819 (0xC0000005) Pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm completly stuck on this. I keep getting error message \n\nProcess finished with exit code -1073741819 (0xC0000005)\n\nI'm using pycharm with pyqt5.6 and qt5.6.2 and the problem started when I upgraded to these versions.\nI've tried searching as much as I can, but have not been able to find an answer. Can anyone help please?","AnswerCount":8,"Available Count":5,"Score":0.049958375,"is_accepted":false,"ViewCount":46053,"Q_Id":50620954,"Users Score":2,"Answer":"I just ran into this error, and found it was caused by using a method from a newer version of Python than my venv was configured (match\/case in 3.10.0 with 3.8 as the interpreter)","Q_Score":23,"Tags":"python,pycharm,pyqt5","A_Id":69586586,"CreationDate":"2018-05-31T09:26:00.000","Title":"Process finished with exit code -1073741819 (0xC0000005) Pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm completly stuck on this. I keep getting error message \n\nProcess finished with exit code -1073741819 (0xC0000005)\n\nI'm using pycharm with pyqt5.6 and qt5.6.2 and the problem started when I upgraded to these versions.\nI've tried searching as much as I can, but have not been able to find an answer. Can anyone help please?","AnswerCount":8,"Available Count":5,"Score":0.0748596907,"is_accepted":false,"ViewCount":46053,"Q_Id":50620954,"Users Score":3,"Answer":"Not sure if this is the 'right' way to do it but I ended up completely uninstalling anaconda and rebuilding it. When I then made a new virtual environment the problem resolved. If others have the same issue this might work too. By the way the problem first occurred with an update to pyqt5.","Q_Score":23,"Tags":"python,pycharm,pyqt5","A_Id":50642745,"CreationDate":"2018-05-31T09:26:00.000","Title":"Process finished with exit code -1073741819 (0xC0000005) Pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm completly stuck on this. I keep getting error message \n\nProcess finished with exit code -1073741819 (0xC0000005)\n\nI'm using pycharm with pyqt5.6 and qt5.6.2 and the problem started when I upgraded to these versions.\nI've tried searching as much as I can, but have not been able to find an answer. Can anyone help please?","AnswerCount":8,"Available Count":5,"Score":0.0,"is_accepted":false,"ViewCount":46053,"Q_Id":50620954,"Users Score":0,"Answer":"I had the same problem solve it by updating my tensorflow. There is probably some kind of compatibility problem. I realize the problem was from my \"import tensorflow\" because i was not getting an obvious error right after the import line.","Q_Score":23,"Tags":"python,pycharm,pyqt5","A_Id":53706693,"CreationDate":"2018-05-31T09:26:00.000","Title":"Process finished with exit code -1073741819 (0xC0000005) Pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have developed a Tkinter GUI and need to add a button in the GUI window top panel, next to the minimise, maximise and close buttons. The button then calls a function. How can this be done?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":132,"Q_Id":50624741,"Users Score":1,"Answer":"Tkinter doesn't have any support to do what you want. You'll have to find some sort of platform-specific library to alter what is shown in the window border. \nYour only other option is to turn off the window border provided by your OS with overrideredirect, and then create your own border with whatever controls you want. This requires a lot of work because you also have to write the code for moving and resizing the window, but it's possible.","Q_Score":1,"Tags":"python,tkinter,tkinter-canvas,tkinter-menu","A_Id":50625498,"CreationDate":"2018-05-31T12:48:00.000","Title":"Add button to Tkinter Window panel before minimise, maximise buttons","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Wrote a game and compiled it with pyinstaller. An EXE file was created but when I go to run it, it thinks for 3-4 seconds and then it returns to command prompt.\nClicking from the folder in Windows does nothing.\nNo errors, nothing! Do I need something in my code to allow this to run? The only imports are tkinter and random.\nEdit 1: tested a \"hello world\" script to see if there were issues with pyinstaller, it ran fine.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":594,"Q_Id":50633440,"Users Score":0,"Answer":"I understand that the post is older, but it may be useful for other member who may come across the similar problem.\nI had created a script using Jupiter notebook and it creates ipynb file.\nWhen I create an exe file using pyinstaller, the exe was doing nothing.\nI resolved it by first converting ipynb file to py file using below command:\npyinstaller my_script.py\nIt will create the py file under same location.\nNow, execute below command to create exe file:\npyinstaller my_script.py\nIt will create exe file under dist folder.\nAnd it works.","Q_Score":0,"Tags":"python,tkinter,compilation,pyinstaller","A_Id":56474512,"CreationDate":"2018-05-31T22:05:00.000","Title":"pyinstaller compiled .exe does nothing","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I accidentally installed a wrong version of wxPython (3.0.2.0).\nWhen I try to install the latest wxPython-4.0.1, I get the following error:\n\nFound existing installation: wxPython 3.0.2.0\n Cannot uninstall 'wxPython'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.\n\nSo, I searched around a bit and apparently you have to use the uninstaller found within your original wxPython-3.0.2.0 dmg file in order to uninstall it. I did not have the file anymore it seemed, and went through my history to get the exact download and version from Sourceforge (I think!), but when I use the uninstaller, I get the following:\n\n* No wxPython installations found! *\n\nHow am I able to remove this old version of wxPython?\nI am very new to this, so sorry if this sounds stupid.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1068,"Q_Id":50688630,"Users Score":1,"Answer":"As you've discovered wxPython Classic and wxPython Phoenix use different installation strategies. In fact, Classic's approach is quite messy compared to Phoenix's, the uninstallation script was created to help to undo some of that (especially the things left behind by the OSX Installer tool.)\nThe good news however is that you can manually clean up the parts that pip is complaining about. I don't have it installed here any longer to be able to give you exact instructions, but from memory it should be something like this.\n\nIn your Python's site-package folder, (something like \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages) remove folders and files starting with wx.\nIn \/usr\/local\/lib remove any folders starting with wxPython\n\nAdditionally, wxPython Phoenix is not required to be installed globally like Classic was. If you use virtualenvs or Python3's venvs then you can install the wheel in them instead of your global Python environment if you prefer.","Q_Score":1,"Tags":"wxpython,uninstallation","A_Id":50733198,"CreationDate":"2018-06-04T20:54:00.000","Title":"Cannot uninstall wxPython 3.0.2.0 (macOS)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm trying to create a game in Python tkinter that involves a rocket ship and some asteroids. The problem is, the rocket ship is made up of multiple shapes. I don't need advice on how to simplify the rocket's shape, but if I could get pointers on using images in a canvas, that might be better.\nAnyway, I was researching methods on how to combine multiple shapes into a single shape, or moving multiple shapes at once. This involved the use of IDs and tags, and I'm unclear on which I should use and why.\nWhy do I need to move multiple shapes at once? The rocket ship is made up of multiple shapes, and it needs to move from side to side. I really don't want a bunch of self.canvas.move() methods cluttering up my code, so if anyone could help me, I would greatly appreciate it. Thanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1022,"Q_Id":50732085,"Users Score":7,"Answer":"Overview\nYou're speaking of canvas objects. Every canvas object has a unique integer id. No two objects can have the same id. The id is assigned by tkinter and returned to your code when you create the object. This id is necessary to later be able to refer to each individual object. \nTags on the other hand are completely arbitrary (except they can't be a sequence of digits) and assigned by you. You can assign one or more tags to an object (or no tags to an object), and multiple objects can share the same tags.\nUsage\nBoth tags and ids can be used by many of the canvas methods such as move, bbox, coords, etc. \nThe most common use of tags are to group multiple objects into a single logical object. A ship might have a body, some wings, maybe some other parts. Each of those parts may have a unique id, but you can assign the same tag to all of the parts so that you can move all parts together in unison. \nFor a concrete example, let's say you make a ship out of a rectangle for the body and a two triangles for wings. Each will have a unique id. If you want to move those three together as if they were one, you might give each of them the tag \"ship-1\". If you call `canvas.move(\"ship-1\", 10, 0), all three of those objects will be moved ten pixels to the right.\nIf you create a second ship, you might give the pieces of that ship the tag \"ship-2\". In that way you can move just \"ship-1\" or just \"ship-2\". Further, if you also give each of those objects the tag \"Ship\" in addition to their unique \"ship-\" tag, then you can move all ships at once.\nTaking it another step further, lets say you are simulating a space battle. Half the ships are the good guys and half are the bad guys. So now, in addition to giving each piece of a ship the tag \"ship-1\", and also giving each piece of a ship the tag \"Ship\", you can also give each piece of the ship the tag \"good\" or \"bad\"\nUse-case\nWith all of the above in place, you can now do the following:\n\nmove one individual piece of one ship by using the id\nmove all pieces for the first ship with \"ship-1\"\nmove all pieces for the second ship with \"ship-2\"\nmove all of the \"good\" ships together in formation with \"good\"\nmove all of the \"bad\" ships together in formation with \"bad\"\nmove all ships using \"Ship\"\nmove everything with the special tag \"all\" which automatically refers to everything on the canvas.\n\nAnd, of course, instead of moving you can also change the color of any of those, or delete all of the objects for any of those, move an object or objects on top of or underneath other objects (z-index), etc.","Q_Score":0,"Tags":"python,python-3.x,tkinter,tkinter-canvas","A_Id":50732333,"CreationDate":"2018-06-07T02:16:00.000","Title":"Difference Between 'ID' and 'tag' with Tkinter objects","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've built PyQt5 5.10.1 against Qt 5.5 with the --qml-debug flag.\nWhen I import QtQml I get the message \"QML debugging is enabled. Only use this in a safe environment.\"\nbut whenever I try to run my application, passing arguments to the QApplication constructor, there's no indication that running my app with the -qmljsdebugger=port:1234,block option does anything. I'm expecting a message like \"QML Debugger: Waiting for connection on port 1234\", or \"QML Debugger: Ignoring \"qmljsdebugger=port:1234\". Debugging has not been enabled.\", but neither of these messages are displayed.\nI've tried printing QApplication.arguments(), and the qmljsdebugger argument is not there, but the name of the program is.\nI've tried passing ['program.py', '-qmljsdebugger=port:1234,block'] directly to the QApplication() constructor, but the second argument is not visible from the call to QApplication.arguments(). Funny enough if i remove the leading '-' from the argument, it shows up in that list but doesn't do anything.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":537,"Q_Id":50778388,"Users Score":1,"Answer":"debugging was not being turned on because i was using QQmlEngine instead of QQmlApplicationEngine.","Q_Score":1,"Tags":"python,debugging,qml,pyqt5","A_Id":50801153,"CreationDate":"2018-06-09T20:45:00.000","Title":"PyQt5 QML Debugging enabled, qmljsdebugger option doesn't do anything","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to wrap the text in the cells of the wxpython dataviewctrl? I have some long strings which are making the grid cells very large.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":86,"Q_Id":50789881,"Users Score":0,"Answer":"OK I was able to get the cells to wrap by using textwrap in a function called from GetValueByRow(). It seems to work; but, does gives a somewhat strange string of text when editing the cell.","Q_Score":0,"Tags":"dataview,wxpython","A_Id":50867302,"CreationDate":"2018-06-11T02:43:00.000","Title":"wxpython DataViewIndexListModel Text Wrap","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote an app to plot a graph from an input file when you drag and drop the file onto a gui interface. However after the execution of plt.show() in the program, the gui interface becomes inactve. \nUsing plt.draw() instead of plt.show() or using plt.ion() solves this issue, but then the python graph stop updating, ie. resizing\/ closing the graph doesn't work until the next time a file is dragged and dropped.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":50932413,"Users Score":0,"Answer":"Try to make two different files and put the plt.show() in the other one, to see if it works.","Q_Score":0,"Tags":"python,matplotlib","A_Id":50932563,"CreationDate":"2018-06-19T15:51:00.000","Title":"plt.show() stops gui interface from updating","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program which uses multiple cores to process images before drawing to a canvas for a main view (using multiprocessing). I would like to know the best way to tackle this problem.\nIs it possible to have each core drawing to its own canvas which are layered on-top of each other in the same view? Is it possible to have this behavior?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":588,"Q_Id":51048950,"Users Score":2,"Answer":"No, it is not possible. GUI widgets cannot be shared between processes. On some platforms, it just isn't possible at all; on other platforms, it would be possible, but only by doing things very differently from the way Tk does; on others, it sort of works, but the event loops are all screwed up. So, the result may be that nothing shows up, that one or both processes freezes, that the GUI doesn't respond to events, that tkinter raises an exception in the child, that tkinter creates a whole separate independent GUI, or, if you're really unlucky, that things unpredictably work sometimes but do one of the other things other times.\n\nHowever, that doesn't mean there's no way to do what you want, just that you can't do it directly.\nThe simplest solution is to marshal your Canvas commands and pass them over a Pipe or Queue for the main process to execute.\nA fully general solution isn't that hard, but in your case, it should be even simpler: all you want the background process to do is process an image and then display it. So the only Canvas command you need is create_image.\nAnd, in fact, you can probably do with tasks on a Pool, which just return the image when they're done, with the main process doing the create_image with the results.\nMixing waiting on multiprocessing async results with a tkinter event loop is a bit of a pain, but if you use concurrent.futures, you can just attach the create_image as a callback on the Future returned by the task.\n\nA different option is to have the background processes create off-screen Canvas objects, draw to them, then capture the results as a BitmapImage or a postscript rendering, which you can then pass to the main process to blit onto a Canvas of its own. But this is a lot more complicated; I think the other solution will probably work a lot better for you.","Q_Score":0,"Tags":"python,tkinter,multiprocessing,tkinter-canvas","A_Id":51049107,"CreationDate":"2018-06-26T17:57:00.000","Title":"Python Multiprocessing Drawing to Tkinter Canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a 2D platformer using my own engine in Python\/Pygame and have made a good start. I've also made a level designer that exports the level tile map and the game imports it, but I need to associate different things, like switches that open specific doors (or to be more precise, pressure plates that hold a specific door open) but my tile map array currently only holds the tile image index number. What's the best way to include associated tiles (like which switch opens which door etc)?\nDo I make an extra file with that data? Or do I have 2 values for each tile? I've tried Googling, but it's not really covered anywhere. I'm sure there's someone with this kind of experience out there... I don't really want to hard-code it in as I want the game to be as versatile as possible.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":921,"Q_Id":51051198,"Users Score":1,"Answer":"I would change your file format from storing one tile index per 2D cell to storing some more complex data object. My first thought would be a dictionary per cell for maximum flexibility moving forward, but serializing that and storing it will be quite large. There's a trade-off here between flexibility and storage size.\nAnother option would be using NamedTuples to store a fixed number of parameters per cell, while preserving a concise serialization. NamedTuples are nice because they let you very concisely represent a data object in a way that both serializes well and can be queried into using named fields.\nThe questions you need to ask yourself are \"what metadata do I need to know about each cell on the map\" and \"how much do I care about concise file size to represent them\".","Q_Score":0,"Tags":"python,pygame,game-engine","A_Id":51051536,"CreationDate":"2018-06-26T20:51:00.000","Title":"Best way to save a 2D Pygame platformer level tile map with extra data","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For some reason, whenever I try incorporating the while loop into my tkinter program, the window I created freezes and says \"not responding\". Is this because while is not compatible with tkinter? If so, please let me know a way around this.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":88,"Q_Id":51102703,"Users Score":0,"Answer":"\"not compatible\" is not the right word. Tkinter programs can certainly use while loops. In fact, mainloop itself is a while loop. \nThe issue isn't compatibility, it's just that tkinter is single-threaded and can do only one thing at a time. If python is running your loop, it can't also be updating the screen and processing events at the same time unless you explicitly make that happen.\n\nIf so, please let me know a way around this.\n\nThat part of the question is too broad for stackoverflow. There are many ways around it, but it depends on what you're actually trying to do in that while loop. For example, you could run the loop in another thread. You could run it in a separate process. you could break it down to smaller chunks that run inbetween the moments when tkinter needs to update the screen, or you could explicitly ask tkinter to update the screen in the middle of the loop.","Q_Score":0,"Tags":"python,tkinter","A_Id":51103483,"CreationDate":"2018-06-29T13:18:00.000","Title":"Is the while loop not compatible with tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have multiple computers running python applications, each using the same MySQL server. Each of the applications contains a tkinter GUI that allows editing of a set of data (corresponding to data in a table in the MySQL server). Whenever the data is updated one machine (and in turn updated on the MySQL server), I would like the other machines to be prompted to update there displayed data by pulling from the server. I know I could simply have the applications self-update after a given interval, but I would prefer to only update when there is new data to pull.\nHow should I go about this?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":37,"Q_Id":51119912,"Users Score":2,"Answer":"This isn't something you can do with MySQL. \nThere is no provision in the client\/server protocol for the server to spontaneously emit messages to a client, so there is no mechanism in MySQL that allows connected clients to be notified of events via a push notification.","Q_Score":0,"Tags":"mysql,python-3.x,server","A_Id":51120353,"CreationDate":"2018-07-01T02:16:00.000","Title":"How can I communicate with other client connections on a MySQL server using python?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have multiple computers running python applications, each using the same MySQL server. Each of the applications contains a tkinter GUI that allows editing of a set of data (corresponding to data in a table in the MySQL server). Whenever the data is updated one machine (and in turn updated on the MySQL server), I would like the other machines to be prompted to update there displayed data by pulling from the server. I know I could simply have the applications self-update after a given interval, but I would prefer to only update when there is new data to pull.\nHow should I go about this?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":37,"Q_Id":51119912,"Users Score":2,"Answer":"I would suggest that your other client to do a long polling to your database and return a response if there are any feedback.","Q_Score":0,"Tags":"mysql,python-3.x,server","A_Id":51120370,"CreationDate":"2018-07-01T02:16:00.000","Title":"How can I communicate with other client connections on a MySQL server using python?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a simple game in Python 3 and I need to draw a rectangle rotated by a given angle and around a specific centre of rotation. \nIs there a simple way of doing this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":146,"Q_Id":51122198,"Users Score":0,"Answer":"As long as you are using the pygame library, the pygame.transform.rotate(*Surface*,*angle*) function may be worth a try. \nWithout a code sample it is hard to understand the context you are trying to apply this in.","Q_Score":1,"Tags":"python-3.x","A_Id":51145896,"CreationDate":"2018-07-01T09:47:00.000","Title":"Drawing a rotated rectangle in python 3, pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using pyperclip in Python 3.6\nIf i have a giant 2D array(640X480) how can I copy it in one program and paste it another program using pyperclip copy() and paste() functions.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":362,"Q_Id":51122730,"Users Score":0,"Answer":"You could convert the array to a JSON string or perhaps a pickle, copy the string, then paste it into the other program. The other program will need to be able to decode the JSON string or pickle.","Q_Score":2,"Tags":"python,arrays,pyperclip","A_Id":51122832,"CreationDate":"2018-07-01T11:08:00.000","Title":"Using Pyperclip to copy and paste a 2d array","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two custom-written C routines that I would like to use as a part of a large Python application. I would prefer not to rewrite the C code in pure Python (or Cython, etc.), especially to maintain speed.\nWhat is the cleanest, easiest way that I can use my C code from my Python code? Or, what is the cleanest, easiest way for me to wrap my C code for use in my Python source?\nI know \"cleanest\" and \"easiest\" will attract opinions, but I really just need some good options for using custom pre-written code, versus many of the other answers\/tutorials which describe how to use full-on C libraries as CPython extensions.\nEDIT:\nCython and ctypes have both been suggested. Which is a better choice in my case? Each of the two routines I mentioned originally are very computationally intensive. They are used for image calculations and reconstructions, so my plan is to build a Python application around their use (with other functionality in mind that I already have in Python) with the C code run as needed for processing.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":178,"Q_Id":51160830,"Users Score":1,"Answer":"Use cython to wrap your C code. In other words, create a CPython extension using Cython, that calls your C code.","Q_Score":0,"Tags":"python,c,python-3.x,python-3.5,python-c-api","A_Id":51160991,"CreationDate":"2018-07-03T18:21:00.000","Title":"Calling custom C subroutines in a Python application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I am using Pycharm IDE on Windows 10, but in Windows' most recent update they have added a new keyboard shortcut (Alt+Shift+F10) for changing the screen display to negative. The problem is this shortcut is the same as the \"Run\" shortcut in Pycharm which I use very frequently. As far as I'm aware there is no way to change the keyboard shortcuts in Windows 10, but perhaps there is a way to change shortcuts in Pycharm? Thanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":247,"Q_Id":51179120,"Users Score":3,"Answer":"In File -> Settings -> Keymap you can modify the shortcuts the way you want.","Q_Score":1,"Tags":"python,windows-10,pycharm","A_Id":51179193,"CreationDate":"2018-07-04T18:14:00.000","Title":"Pycharm\/Windows 10 keyboard shortcut clash","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am coding a tkinter program whereby a user can login. I want my entry box for the password to be able to show 'Password' and then when a user starts typing I want to use the 'show' option to make it so the characters are hidden. The issue is 'show' does not update like for example the textvariable option. Is there any workaround for this?","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":487,"Q_Id":51224905,"Users Score":4,"Answer":"I just figured it out, I can use entry.config(show=\"*\") to change the state of the option while the program is running.","Q_Score":2,"Tags":"python,tkinter","A_Id":51225078,"CreationDate":"2018-07-07T16:18:00.000","Title":"Tkinter entry widget 'show' option","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a weird problem! I made a client \/ server Python code with Bluetooth in series, to send and receive byte frames (for example: [0x73, 0x87, 0x02 ....] ) \nEverything works, the send reception works very well ! \nThe problem is the display of my frames, I noticed that the bytes from 0 to 127 are displayed, but from 128, it displays the byte but it adds a C2 (194) behind, for example: [0x73, 0x7F, 0x87, 0x02, 0x80 ....] == [115, 127, 135, 2, 128 ....] in hex display I would have 73 7F C2 87 2 C2 80 .. , we will notice that he adds a byte C2 from nowhere! \nI think that since it is from 128! that it is due to a problem of signed (-128 to 127) \/ unsigned (0 to 255).\nAnyone have any indication of this problem?\nThank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":72,"Q_Id":51242202,"Users Score":0,"Answer":"0xc2 and 0xc3 are byte values that appear when encoding character values between U+0080 and U+00FF as UTF-8. Something on the transmission side is trying to send text instead of bytes, and something in the middle is (properly) converting the text to UTF-8 bytes before sending. The fix is to send bytes instead of text in the first place.","Q_Score":1,"Tags":"python-3.x,bluetooth,byte,frames","A_Id":51245089,"CreationDate":"2018-07-09T09:26:00.000","Title":"Trouble displaying signed unsigned bytes with python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am Creating a python custom code to Visualise scientific\/medical data in 3D. \nThis code should be implemented in the GUI I am creating with TKInter, so as to visualise these data sets directly in the GUI. \nIf I already have the code written up is there a way I can run this code in my GUI and subsequently open and run the visualisation window directly in the TKInter GUI???\nIs it possible to create custom windows inside with TKInter which contain more complex code and allow the user to visualise the image output of the code??\nAdditional info: The visualisation code for the 3d data is created with VTK (Visualisation ToolKit) and opens a custom Visualisation window.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":560,"Q_Id":51268131,"Users Score":0,"Answer":"Unless the VTK binding for Python contains a dedicated library for interaction with TKInter, no, you can't.\nEvery GUI toolkit contains it's own set of widgets designed to interact with each other in exactly the ways defined by the toolkit, so you generally can't simply mix widgets from two libraries in one window.\nYou can, of course, write a Python program that imports both libraries and then opens two windows, one from TKInter and one from VTK. By making it handle events from both windows, you can also provide some very basic interaction between them. This might be the closest to what you want.","Q_Score":0,"Tags":"python-3.x,tkinter,3d,window,vtk","A_Id":51268647,"CreationDate":"2018-07-10T14:42:00.000","Title":"Python TkInter: Creating a Window which runs my custom code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python app that I'd like to call on some images, by something like this:\n\nright clicking on images in windows\nmenu pops up => shows the python application in the list of items\nwhen clicked, batch runs on the images\n\nCan this be done w\/o using Visual Studio?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":51274400,"Users Score":0,"Answer":"That \"list of items\" is called the context menu. That is controlled by \"The Registry\", which is only accessible by the computer's administrator.\nMANDATORY WARNING: THE REGISTRY IS NOT A TOY, AND WILL BREAK YOUR COMPUTER IF YOU DO NOT KNOW WHAT YOU ARE DOING. IF YOU ARE NOT AT LEAST 80% CONFIDENT, DON'T TOUCH IT. I TAKE NO RESPONSIBILITY IF YOU BREAK YOUR COMPUTER. \nThat's not to say you will though. If you still want to continue, you should definitely back it up: \n\nOpen the registry\n\n\nPress (Windows key) + R to open the run dialog\nType in \"regedit.exe\" and then enter\nEnter you Administrative approval when prompted\n\nOnce in the registry, look at the panel on the left and all the way at the top there should be a \"folder\" (called \"key\" in the registry) called \"HKEY_CLASSES_ROOT\". Click on it. (If you can't find it, it might be under \"Computer\". Just expand it.). You should now see a lot of keys.\nBackup the registry (optional but recommended)\n\nClick on \"File\" (top) => \"Export\". \nOn the bottom, choose \"Selected branch\". If you want though, you could export the whole registry by selecting \"All\" just to be safe (it's a HUGE file though, and probably not necessary)\nChoose a file to save it to and click \"Save\". Wait for the loading to finish.\n\nDecide which file type you want. You said: image. That could be: \".jpg\", \".png\", \".bmp\", etc. Just repeat the following steps for all desired file types.\nFind the \"file type association\"\n\n\nUnder your selected key, find the key with the file extension you want (eg. \".jpg\"). Click on it \nThere will be a couple of \"values\" on the side. Check the one called \"(Default)\". This has the name of the file. (eg: \"jpegfile\")\n\nNavigate to the file. Still in the same key as the extension (\".jpg\"), locate the key with the name from step 5. Open it.\nMake a new command.\n\n\nRight-Click the \"shell\" key, select \"New\" => \"key\"\nName this new key with a logical, one word name (eg \"process\").\nThis new key has a \"(Default\") value. Change it's value (not the name) to what you want to appear on the right click menu. \nUnder your new key, make a new key called \"command\".\nSet this key's default value to the full path of your Python installation, a space, then the script path, including any arguments. You can pass \"%L%\" as an argument to have the registry replace it with the path to the right-clicked file. (eg. \"path\/to\/python.exe path\/to\/script.py %L%\"). Just make sure your Python script can take arguments.\n\n\nDone!\nFeel free to comment with questions","Q_Score":2,"Tags":"python,windows,mouseevent","A_Id":51274809,"CreationDate":"2018-07-10T21:52:00.000","Title":"Is there a way to invoke python from Windows click?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a working application that successfully uses the python-can module to receive incoming messages on a kvaser CAN bus. When I used PyInstaller to convert this program to an executable file, the terminal logged that it \"loaded kvaser's CAN library.\" The outputted .exe GUI runs as normal, yet the program suddenly doesn't receive any more CAN messages like it had beforehand. In the terminal, I printed the error it catches: \n\"Cannot import module can.interfaces.kvaser for CAN interface 'kvaser': No module named 'can.interfaces.kvaser\". \nNote that in the .spec file that I used to create the executable, I added \"import can.interfaces.kvaser\" at the top. I am not sure if the error I am getting is because I am not using pyinstaller correctly or if it is because I am somehow importing the CAN dependencies incorrectly, yet I suspect it is likely due to the latter. Is there a different way to import the python-can kvaser module that may solve this discrepancy between CAN functionality of the program before and after it was converted to an executable?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":812,"Q_Id":51312059,"Users Score":2,"Answer":"Figured it out. It turns out that PyInstaller specifically installs the dependencies at the top of the main file you want to execute. Dependencies in other python files that you import into the main file aren't detected by PyInstaller. I added all the import calls I needed to the main file and it worked.","Q_Score":2,"Tags":"python,exe,pyinstaller,can-bus","A_Id":51326002,"CreationDate":"2018-07-12T18:12:00.000","Title":"Kvaser's CAN library has been loaded, but program executable outputs a \"No module named 'can.interfaces.kvaser'\" error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've set up a simple appJar UI, which has an \"execute\" button that calls a function containing code that takes a minute to run. I have injected my gui() variable, app, into this function.\nThere are 4 major steps, after each of which I would like a Statusbar to update to reflect that a step has been completed. However, what tends to happen is that as the function code runs, the GUI becomes unresponsive and it isn't until the code completes execution that ALL of the changes to the status bar are displayed at once.\nMy question is how should I be handling the UI such that the Statusbar is updated in real time?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":284,"Q_Id":51313880,"Users Score":1,"Answer":"appJar is just a wrapper around python tkinter module from standard library.\nWhile your code is running, the ui is not running, thus it becomes unresponsive. If you want the ui to remain responsible, you have to return control from your code to the ui library from time to time. \nThat can be done by calling gui.topLevel.update() in your code, or by using asynchronous programming and having the main async loop call it, or by using threads.\nWhich one of those is the best, depends on what your program is doing.","Q_Score":0,"Tags":"python,user-interface","A_Id":51313975,"CreationDate":"2018-07-12T20:23:00.000","Title":"appJar status bar doesn't update in real time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Converting python to C# is an option. Are there any ready-made converters to do this? Or are there any other ways to realize a uwp app from a python code? You help is very much appreciated.","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5628,"Q_Id":51335488,"Users Score":0,"Answer":"I think your best bet would be converting, and then learning a little. Based on the difficulty and how many different or new things you need to learn to alter the app, you should maybe just consider learning the language basics and then go from their creating it in C#, You'll gain some skills in another language. Who knows maybe like it more. \nYou could try one of many other converters, to another language that works or even convert to a language to convert. There is a C++ converter of some kind that may be a bit better, and then I guess perhaps you could convert from their with other tools, seriously may work better. More things are out their for C++ than C# and considering the commonalities, I bet a decent converter exists. Maybe convert to C or C++ or even Javascript because they have good conversion tools. With Java Script it would be kind easy to convert and learn a tiny bit to fix if you have a converter to C#.\nOtherwise converter between the two Python and C# isn't a main priority for many people, if anyone at all. Since they are so similar yet the Syantax is so different, it must be hard to create, and usually people stick with one or the other, or learn both because they do a lot of Object Oriented Code. I mean just Syntax needs to be learned. Also the modules mentioned or packages probably wont ever convet to C#. I'm pretty sure they would just need to build the packages from the ground up for C#, witch is possible.","Q_Score":4,"Tags":"c#,python,uwp,converter","A_Id":57502620,"CreationDate":"2018-07-14T05:16:00.000","Title":"How to use python code to create a universal windows platform application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm not too sure how I'd explain it in the title, but I want to bind a key in Tkinter and not have it work if the key is being held down.\nFor example, root.bind(\"\", doaction) I'm trying to run doaction only when the spacebar is clicked and not held down. Is there any way to do this? I've tried KeyRelease too.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":133,"Q_Id":51354333,"Users Score":0,"Answer":"There is not much you can do. With respect to keyboard keys, you can bind on and . If you want more, you'll have to set global variables and\/or timers that are set or reset on one of those, and then checked on the other.\nThe problem is that on some systems, keyboards may send a sequence of press\/release pairs while holding a key, while other systems may send just a single press and release. There's no good way to abstract that out since it may happen at the hardware level.","Q_Score":1,"Tags":"python,python-3.x,tkinter,bind","A_Id":51354371,"CreationDate":"2018-07-16T03:47:00.000","Title":"How to bind only keypresses and not when key is held down in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering what is the difference between ComboBox and OptionMenu widgets in python tkinter. It seems that they allow to do the same thing, but Combobox is only available in ttk. \nDoes anyone could explain the difference?\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2554,"Q_Id":51382099,"Users Score":8,"Answer":"The OptionMenu is a button with a menu attached. The menu typically grows in height until it reaches the edge of the screen. The choices are fixed, and the user can't type in their own value.\nA Combobox is in effect an Entry widget with a dropdown listbox. The user has the ability (if properly configured) to type into the combobox or pick from the dropdown list. The dropdown list is typically constrained to a handful of rows, with a scrollbar when the list gets to long to fit.\nThe Combobox is also a bit easier to add and remove items after the widget has been created. The OptionMenu was designed to have a static number of items that are set when the widget is created.","Q_Score":5,"Tags":"python,tkinter","A_Id":51382392,"CreationDate":"2018-07-17T13:02:00.000","Title":"Differences between OtpionMenu and ComboBox in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an ESP32 board, with Micropython installed properly, and connecting to local the internet.\nSince it have to do a scheduled jobs- its clock need to be synced. After boot it get a generic date 1\/1\/2000. \nHow can Micropython updates int clock using ntp.pool.org or other?\nGuy","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5775,"Q_Id":51435893,"Users Score":0,"Answer":"You can get a DS3231 RTC. I\u2019m currently using one and it works great.","Q_Score":1,"Tags":"micropython,esp32","A_Id":61282836,"CreationDate":"2018-07-20T05:55:00.000","Title":"ESP32 - using MicroPython: How to update clock after reboot?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This question was asked few times on stackoverflow. However, what I'm trying to do is a little bit different.\nI'm trying to port python to QNX. Compiling all the source files and statically linking it to a \"Hello World\" script using python c API works. \nI'm having problem with the struct module. I tried compiling struct into a shared library and placing it at the exec_prefix path specified by python. When I try to import it, It tries to load the module but it complains about unknown symbols.\nIt says something like \n\nUnknown symbol: _PyUnicode_FormatAdvancedWriter referenced by\n _struct.so\n\nI get a lot of unknown symbol errors like this. I included the header and source files of all these unknown symbols and it ends up throwing other unknown symbol errors. \nI might be doing something completely wrong. Any ideas on how I can link them?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":678,"Q_Id":51444888,"Users Score":1,"Answer":"I'm answering my own question since I figured out the fix. If anyone else is having the same problem, you have to export all the symbols to the dynamic symbol table at link time. To do this, you have to pass a flag -E to the linker i.e -Wl, -E. That should solve the problem. \nThis is a qcc specific flag so if you're experiencing this problem in gcc, you can try passing --whole-archive flag to the linker.","Q_Score":2,"Tags":"python,c,python-3.x,linker-errors,qnx-neutrino","A_Id":51655464,"CreationDate":"2018-07-20T14:32:00.000","Title":"How to statically link the python interpreter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made a small PyQt application containing 5-6 .py files. Now I want to build and compile them into a single main file, meaning it has to operate from one main window exe.\nMy .py files are connected with each other successfully. I have used pyinstaller to make the executable file, but the problem is I built each .py file into its own .exe file. But I want to make a single .exe file through which all the .py files can be used.\nHow to build all .py files into a single .exe file?","AnswerCount":5,"Available Count":2,"Score":0.0399786803,"is_accepted":false,"ViewCount":59064,"Q_Id":51455765,"Users Score":1,"Answer":"Use the Command pyinstaller --onefile yourprogramname.py. Pyinstaller will Automatically import and Compile the Dependency Files.","Q_Score":29,"Tags":"python,pyqt5,pyinstaller","A_Id":68895428,"CreationDate":"2018-07-21T11:49:00.000","Title":"How to build multiple .py files into a single executable file using pyinstaller?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have made a small PyQt application containing 5-6 .py files. Now I want to build and compile them into a single main file, meaning it has to operate from one main window exe.\nMy .py files are connected with each other successfully. I have used pyinstaller to make the executable file, but the problem is I built each .py file into its own .exe file. But I want to make a single .exe file through which all the .py files can be used.\nHow to build all .py files into a single .exe file?","AnswerCount":5,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":59064,"Q_Id":51455765,"Users Score":0,"Answer":"Finally i got the answer. check the below command\npyinstaller -F -w --onefile run_gui_server.py\ni am using this command it will tackcare about all .py files dependenses","Q_Score":29,"Tags":"python,pyqt5,pyinstaller","A_Id":71571440,"CreationDate":"2018-07-21T11:49:00.000","Title":"How to build multiple .py files into a single executable file using pyinstaller?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a calendarview in Android Studio, but i am unable to find a code that will allow me to display a text after clicking on a certain date. For example, the code will allow me to show \"3 people going\" after i click on a date in the textview. The code should also allow me to program each date to display a certain message. Thanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":876,"Q_Id":51456497,"Users Score":0,"Answer":"For this you have to make custom message view and show this on calendar date click. its not necessary you have to use library for this, but some calendar libraries have built=in message feature.","Q_Score":0,"Tags":"java,android,python","A_Id":51457683,"CreationDate":"2018-07-21T13:21:00.000","Title":"Display text in a textview with calendar","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I loaded a ducking png for my sprite, so when I press the down arrow, he ducks and when he ducks the rectangle gets smaller, which is good, but the rectangle seems like the sprite is floating instead of ducking at the place he is. It's like he sits on the air. How can I fix it?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":59,"Q_Id":51469366,"Users Score":1,"Answer":"Two options - \n\nYou could make the ducking graphic the same size as the regular standing graphic, and just place the sprite in the bottom part of the image (with the rest transparent)\nYou could reposition the box manually to move the y-position nearer to the ground when the ducking occurs\n\nOf these, the first is the easiest to implement, but the second would be necessary if you're also using the rectangle for e.g. hit-testing.","Q_Score":0,"Tags":"python,pygame","A_Id":51469391,"CreationDate":"2018-07-22T21:22:00.000","Title":"How can I make a sprite duck with a ducking png?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got quite a complicated GUI interface built by Tkinter library. It has several tabs and a lot of controls with possibility of dynamic adding and deleting them.\nAnd it seems that Tkinter has an internal maximum number of widgets, something about 10000 (including Frames). When it is exceeded new widgets are not created and even some strange graphical effects can appear outside the window (without any exceptions or messages). \nDid anyone face such problems? I wonder if there is a way to overcome this limitation.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":798,"Q_Id":51486281,"Users Score":0,"Answer":"From my experience, there is a way to have more than 10000 widgets, but not simultaneously.\nIf you destroy() the widgets you don't currently need, you can have more than 10000 during the lifetime of the application.\nApplication needs don't always allow it, but in your case, maybe you could destroy the unused tabs while they are not selected?","Q_Score":1,"Tags":"python,tkinter","A_Id":63578199,"CreationDate":"2018-07-23T19:50:00.000","Title":"Tkinter maximum number of widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got quite a complicated GUI interface built by Tkinter library. It has several tabs and a lot of controls with possibility of dynamic adding and deleting them.\nAnd it seems that Tkinter has an internal maximum number of widgets, something about 10000 (including Frames). When it is exceeded new widgets are not created and even some strange graphical effects can appear outside the window (without any exceptions or messages). \nDid anyone face such problems? I wonder if there is a way to overcome this limitation.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":798,"Q_Id":51486281,"Users Score":0,"Answer":"I have reached a similar problem. (migrating to QT is way too bothersome for me at the moment)\nMy solution is to \"paginate\" the data shown, so I can have a fixed number of widgets and just rewrite them based on the page I'm on.","Q_Score":1,"Tags":"python,tkinter","A_Id":65823399,"CreationDate":"2018-07-23T19:50:00.000","Title":"Tkinter maximum number of widgets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've created a kivy app that works perfectly as I desire. It's got a few files in a particular folder that it uses. For the life of me, I don't understand how to create an exe on mac. I know I can use pyinstaller but how do I create an exe from mac.\nPlease help!","AnswerCount":2,"Available Count":2,"Score":-0.1973753202,"is_accepted":false,"ViewCount":1152,"Q_Id":51515471,"Users Score":-2,"Answer":"This is easy with Pyinstaller. I've used it recently.\nInstall pyinstaller\n\npip install pyinstaller\n\nHit following command on terminal where file.py is path to your main file\n\npyinstaller -w -F file.py\n\nYour exe will be created inside a folder dist\nNOTE : verified on windowns, not on mac","Q_Score":1,"Tags":"python,kivy,pyinstaller,kivy-language","A_Id":51515669,"CreationDate":"2018-07-25T09:28:00.000","Title":"Creating an exe file for windows using mac for my Kivy app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've created a kivy app that works perfectly as I desire. It's got a few files in a particular folder that it uses. For the life of me, I don't understand how to create an exe on mac. I know I can use pyinstaller but how do I create an exe from mac.\nPlease help!","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1152,"Q_Id":51515471,"Users Score":1,"Answer":"For pyinstaller, they have stated that packaging Windows binaries while running under OS X is NOT supported, and recommended to use Wine for this.\n\n\nCan I package Windows binaries while running under Linux?\n\nNo, this is not supported. Please use Wine for this, PyInstaller runs\n fine in Wine. You may also want to have a look at this thread in the\n mailinglist. In version 1.4 we had build in some support for this, but\n it showed to work only half. It would require some Windows system on\n another partition and would only work for pure Python programs. As\n soon as you want a decent GUI (gtk, qt, wx), you would need to install\n Windows libraries anyhow. So it's much easier to just use Wine.\n\nCan I package Windows binaries while running under OS X?\n\nNo, this is not supported. Please try Wine for this.\n\nCan I package OS X binaries while running under Linux?\n\nThis is currently not possible at all. Sorry! If you want to help out,\n you are very welcome.","Q_Score":1,"Tags":"python,kivy,pyinstaller,kivy-language","A_Id":51515517,"CreationDate":"2018-07-25T09:28:00.000","Title":"Creating an exe file for windows using mac for my Kivy app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to write a custom AI API for a game which uses the Unreal engine 4. While I can read the process memory using Python just fine, I have confronted a bigger issue - reading the process memory only when relevant and sending in inputs only when possible - thus only once a frame is rendered. If I want to send inputs, they need to be sent on frames specifically (the game being a fighting game).\nTherefore, I need to update my own AI API with the same framerate as the game itself. My first idea was to look into the process memory and find out if there's any value that's updated each frame - while there're values updated all the time, they seem to be updated in memory after 8 frames occur. Unfortunately, 8 frames don't allow the AI to perform the inputs properly as the update loop would not update fast enough.\nI will be looking through the memory more but I was wondering if it's possible to attach a program to the running process to look at the window itself - and in case it has been updated (something new has been rendered), update the gamestate in the AI itself. Is there a way this can be achieved?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":677,"Q_Id":51527523,"Users Score":0,"Answer":"We are talking about a game built on Unreal Engine, and you cannot find an address being changed every frame.\nThis makes me concerned about where\/how you are trying to find the addresses being changed each frame. Perhaps try a memory scanning tool such as CheatEngine just in case.\nThere should be a few addresses changing each frame. One that comes to mind would be:\n\nOne of the addresses referenced when using this function: UGameplayStatics::GetRealTimeSeconds(GetWorld());\n\nIf you really cannot find a variable changing each frame, then I offer you a solution to hook into a function called in the process every frame by doing the following:\nThis is not a complete solution by any means as this covers a subjectively complex topic that you will likely need to learn about from other sources.\n[NOTE]\nIf this game uses an anti-cheat, you may be banned for this behaviour, I would suggest doing your research before attempting this. I take no responsibility for any issues or loss you may incur from the use of the following advice. \nBackup Option:\n\nUsing CheatEngine, open the target process.\nLook for a function that is being called every frame (like so):\n\n\nFind a variable you suspect is READ every frame (does not have to be changed)\nAdd it to your address list\nRight-click the entry from the address list and select: Find out what accesses this address\nAccept the prompt to attach a debugger to the process\nWatch the count, is it going up extremely fast? Great! this is likely being read every frame\nStop the tool and click on the Instruction entry in the list that has the high count\nClick the Show Disassembler button\nYou are now looking at the interpreted opcodes for the function that is accessing your address every frame\nSimply right click the highlighted row and click Select current function to find the start of the function\nI would personally toggle a breakpoint on this line (F5) with the game visible on the side to ensure it is being triggered each frame (continuing after each break with F9).\n\nYou now have the Base Address + Function Address in the Address column of the highlighted row.\nHere comes the hard part that will require further explanation and will be a learning exercise that you will need to undertake.\n\nRead up on patching a function by injecting code into the process or by modifying the process before you run it.\nThe injected code can communicate with your process via a Memory Mapped File or a Named Pipe, setting a flag every frame.\nYou will need to do this while retaining the original opcodes to ensure the program works as normal by either:\n\n\nrestoring after executing\nOR\njumping to a code cave and executing original opcodes before jumping back\nOR\nRedirecting the function altogether (not suitable for your current use but worth reading about)","Q_Score":2,"Tags":"python,artificial-intelligence,reverse-engineering,unreal-engine4","A_Id":51571965,"CreationDate":"2018-07-25T20:56:00.000","Title":"Hook a program to a running game, update each frame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Has tkinter opacity like HTML?if you do HTML you understand what I say.I searched a lot in google, but I didn't find my answer.If you know help me,please.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":755,"Q_Id":51571242,"Users Score":0,"Answer":"Has tkinter opacity like HTML\n\nNo, it does not. The only setting you have is the opacity of the window as a whole. You can't set the opacity of individual widgets.","Q_Score":0,"Tags":"python,python-3.x,tkinter","A_Id":51575735,"CreationDate":"2018-07-28T12:09:00.000","Title":"How to set widget opacity in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I might be sounding like a noob while asking this question but I really want to know how can I get the time from when my screen is on. Not the system up time but the screen up time. I want to use this time in a python app. So please tell me if there is any way to get that. Thanks in advance.\nEdit- I want to get the time from when the display is black due to no activity and we move mouse or press a key and screen comes up, the display is up, the user is able to read and\/or able to edit a document or play games. \nOS is windows .","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":51576081,"Users Score":0,"Answer":"In Mac OS ioreg might have the information you're looking for.\nioreg -n IODisplayWrangler -r IODisplayWrangler -w 0 | grep IOPowerManagement","Q_Score":1,"Tags":"python,windows,operating-system,kernel","A_Id":51576697,"CreationDate":"2018-07-28T23:43:00.000","Title":"Screen up time in desktop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have installed wxPython and am able to execute some scripts from Robin's great book. I am able to open pyCrust too. But if I try to wrap a wx script with pywrap, I get this -\n\nBlockquote\n PS C:\\Users\\jf7366\\Documents\\PythonScripts\\wxpython> pywrap Flintstonize.py\n pywrap : The term 'pywrap' is not recognized as the name of a cmdlet, function, script file, or operable program.\n Check the spelling of the name, or if a path was included, verify that the path is correct and try again.\n At line:1 char:1\n + pywrap Flintstonize.py\n\nI tried installing pywrap by itself, successful install, but to no avail... Why would I have a PATH issue with pywrap but not PyCrust? This makes no sense to me obviously.\nRegards,\nJack","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":57,"Q_Id":51576086,"Users Score":1,"Answer":"It's more likely that pywrap needs the PATH, but PyCrust most probably does not, so the best solution would be to add Python To PATH.","Q_Score":1,"Tags":"python","A_Id":51577186,"CreationDate":"2018-07-28T23:44:00.000","Title":"Trouble using pywrap","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"XLSXWRITER works on my Mac computer when I run my kivy app and successfully creates an XLSX file.\nUnfortunately once I compile the apk using buildozer the \"Export\" button I made doesn't create the XLSX. \nNo crash occurs, I just can't find the XLSX that should have been created. My theory is that the spreadsheet is created but 'lives' within the APK Package.\nPlease help me to create XLSX using Kivy on android!\n* Python 2.7.15\n* Kivy 1.9.1\n* Android Phone","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":154,"Q_Id":51603822,"Users Score":0,"Answer":"With an aid from @\"John Anderson\", the solution lies in the AndroidManifest.xml file, where one can simply \"comment out\" using the html comments \"\". At the bottom one can find the list of permissions that the app may or may not require, and can thereby comment out unnecessary permissions like \"WRITE_EXTERNAL_STORAGE\".","Q_Score":0,"Tags":"python,apk,kivy,xlsxwriter","A_Id":59485426,"CreationDate":"2018-07-31T00:12:00.000","Title":"Why doesn't XLSXWRITER create a file once my Kivy app is compliled into an APK?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to play a sound and display some information on the screen in my program.\nI'm currently using the following:\nwinsound.PlaySound('chaching.wav', winsound.SND_FILENAME)\n messagebox.showinfo(\n \"Info\", \"Assigned {} to {}, the password is {}\".format(\n id, acc_name, acc_pass))\nHowever that makes the stupid error noise when the message box is triggered.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2822,"Q_Id":51604921,"Users Score":1,"Answer":"I'm pretty sure there's no way to do this; calling bell() whenever a Message is displayed is part of Tcl\/Tk, not something Python\/Tkinter adds on top of it.1\nBut you can always use SimpleDialog to build a modal dialog that looks just like MessageBox but isn't one, and doesn't sound like one.2.\n\n1. Well, if you really wanted to reach down into the Tcl code\u2026 but you don't.\n2. IIRC, SimpleDialog does call bell() if you do things like press Esc or hit the close box on a dialog with no cancel button set. But I'm pretty sure that is done by Python\/Tkinter, not Tcl\/Tk, so you can just override the wm_delete_window or whichever method is responsible. Or just not create a window without a cancel button.","Q_Score":1,"Tags":"python,audio,tkinter,messagebox","A_Id":51605052,"CreationDate":"2018-07-31T03:08:00.000","Title":"How do I change or disable the default sound for tkinter message boxes in python 3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"qcow2 is an image for qemu and it's good to emulate.\nI know how to write data for qcow2 format, but I don't know how backing files in qcow2 work?\nI found nothing tutorial said this.\nCan anyone give me tips?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":398,"Q_Id":51631247,"Users Score":1,"Answer":"Backing file is external snapshot for qcow2 and the qemu will write COW data in the new image.\nFor example:\nYou have image A and B, and A is backing file of B.\nWhen you mount B to \/dev\/nbd and check its data, you'll find you can saw data of A.\nThat's because if there's no data in the range of B, qemu will read the same range of A.\nAn important notes: If qemu doesn't find A, you won't be able to mount B on \/dev\/nbd.","Q_Score":0,"Tags":"python,qemu","A_Id":51924013,"CreationDate":"2018-08-01T10:39:00.000","Title":"How backing file works in qcow2?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using wx.SearchCtrl and I need a red border around the search field. In the documentation, I could not find anything to do this easily. How can I do this?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":663,"Q_Id":51712663,"Users Score":2,"Answer":"You can't change the border colour directly, but you could use the usual trick with making this search control a child of wx.Panel with the background colour you want and make it just a few pixels smaller than its parent.","Q_Score":0,"Tags":"python,wxpython,wxwidgets,wxtextctrl","A_Id":51713327,"CreationDate":"2018-08-06T17:15:00.000","Title":"Wxpython: How to use different border color for Search box","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to upload my kivy application to Google Play store. For that i Need an .apk file , which has an api Level of 26 or higher. The .apk that I created had an apk Level of 19. So this was my way to set the Level to 26:\nI installed API 26,27,28 and the newest version of the building tool. \nIn buildozer.spec i set android.api = 26.\nAfter that I run \"buildozer android release deploy run\". And now I get this error:\n\"Check that aidl can be executed \nSearch for Aidl \nRun 'home\/dennis\/.buildozer\/android\/platform\/android-sdk-20\/build-tools\/28.0.2\/aidl' \nCWD None\nAidl cannot be executed\"\nWhat can i do to fix this? \nThank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1146,"Q_Id":51781916,"Users Score":0,"Answer":"Run ~\/.buildozer\/android\/platform\/android-sdk-20\/tools\/android\nSelect Android SDK Build-tools 26.x.x\nCheck aidl file in ~\/.buildozer\/android\/platform\/android-sdk-20\/build-tools\/26.x.x\/","Q_Score":0,"Tags":"android,python,kivy,apk,buildozer","A_Id":51831467,"CreationDate":"2018-08-10T08:10:00.000","Title":"Create kivy apk with buildozer ERROR: \"Aidl cannot be executed\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have python 3.7 with 32bit and after I did pip install pygame, I'm still getting\n\nModuleNotFoundError: No module named 'pygame'\n\nwhen running my code. I'm using pycharm.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":10270,"Q_Id":51786945,"Users Score":1,"Answer":"Probably you have several instances of Pythion on your computer. You may install pygame in one instance, but IDE uses another.","Q_Score":4,"Tags":"python-3.x,pygame","A_Id":66267946,"CreationDate":"2018-08-10T12:50:00.000","Title":"ModuleNotFoundError: No module named 'pygame'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have python 3.7 with 32bit and after I did pip install pygame, I'm still getting\n\nModuleNotFoundError: No module named 'pygame'\n\nwhen running my code. I'm using pycharm.","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":10270,"Q_Id":51786945,"Users Score":2,"Answer":"I would just like to add to what the first answer is saying:\nIf you are using pycharm, it still won't work until you go to file >> settings >> >> [your project name] >> python interpreter. You will see a list of packages there. If pygame is on it, then good, else, you must double click on the field where the packages are. It leads you to a little pop up box where you can type in things. If you type in pygame, you should be able to install the package.","Q_Score":4,"Tags":"python-3.x,pygame","A_Id":64087960,"CreationDate":"2018-08-10T12:50:00.000","Title":"ModuleNotFoundError: No module named 'pygame'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have python 3.7 with 32bit and after I did pip install pygame, I'm still getting\n\nModuleNotFoundError: No module named 'pygame'\n\nwhen running my code. I'm using pycharm.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":10270,"Q_Id":51786945,"Users Score":1,"Answer":"I ran into the same error a few days ago! Thankfully, I found the answer.\nYou see, the problem is that pygame comes in a .whl (wheel) file\/package. So, as a result, you have to pip install it.\nPip installing is a very tricky process, so please be careful. The steps are:-\nStep1. Go to C:\/Python (whatever version you are using)\/Scripts. Scroll down. If you see a file named pip.exe, then that means that you are in the right folder. Copy the path.\nStep2. In your computer, search for Environment Variables. You should see an option labeled 'Edit the System Environment Variables'. Click on it.\nStep3. There, you should see a dialogue box appear. Click 'Environment Variables'. Click on 'Path'. Then, click 'New'. Paste the path that you copied earlier.\nStep4. Click 'Ok'.\nStep5. Shift + Right Click wherever your pygame is installed. Select 'Open Command Window Here' from the dropdown menu. Type in 'pip install py' then click tab and the full file name should fill in. Then, press Enter, and you're ready to go! Now you shouldn't get the error again!!!","Q_Score":4,"Tags":"python-3.x,pygame","A_Id":52068216,"CreationDate":"2018-08-10T12:50:00.000","Title":"ModuleNotFoundError: No module named 'pygame'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to build create a script that does a few action inside an DirectX game.\nI've got everything working exept for moving the mouse.\nIs there any module avalable that can move the mouse, for windows (python 3)\nThanks!","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":1819,"Q_Id":51793103,"Users Score":-1,"Answer":"Use a freeware App called sikulix. It will do wonders for you","Q_Score":2,"Tags":"python,windows,python-3.x,directx","A_Id":51793147,"CreationDate":"2018-08-10T19:37:00.000","Title":"Python3 move mouse in DirectX games","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Since Text(Tk(), image=\"somepicture.png\") is not an option on text boxes, I was wondering how I could make bg= a .png image. Or any other method of allowing a text box to stay a text box, with an image in the background so it can blend into a its surroundings.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":325,"Q_Id":51794733,"Users Score":1,"Answer":"You cannot use an image as a background in a text widget.\nThe best you can do is to create a canvas, place an image on the canvas, and then create a text item on top of that. Text items are editable, but you would have to write a lot of bindings, and you wouldn't have nearly as many features as the text widget. In short, it would be a lot of work.","Q_Score":1,"Tags":"python,image,tkinter,textbox","A_Id":51795473,"CreationDate":"2018-08-10T22:27:00.000","Title":"Python\/Tkinter - Making The Background of a Textbox an Image?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"for some python programming I do for work I'd like to use pyqt4. I also use Anaconda and the Spyder IDE. \nTo downgrade pyqt from 5 to 4 I created a new environment within Anaconda. The problem is that everytime I install Spyder in this environment the pyqt version is being upgraded to 5 again.\nIs there any way to get around this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":817,"Q_Id":51818723,"Users Score":3,"Answer":"(Spyder maintainer here) You need to create your environment (called spy-pyqt4 in this case) with the following command\nconda create -n spy-pyqt4 spyder=3.2.8 pyqt=4\nSpyder 3.2.8 was our last version to support PyQt4.","Q_Score":2,"Tags":"python,pyqt,anaconda,spyder","A_Id":51832096,"CreationDate":"2018-08-13T09:02:00.000","Title":"How can I use pyqt4 with current python and spyder version?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Please tell me what wrong on kivy platform cannot be gotten expected behavior on macOS.\nFor example:\n1.UI acts different UI from (Mouse) pointer have indicated.\nFor example, three buttons was layouted on Boxlayout in a widget. the kivy widget launched action as other button was pushed, which button was different from right clicked by mouse. I felt that kivy repeat action in pushed:\n\n1st: when I pushed 1st button, launched action was as pushed 1st button.\n2nd: when I pushed 2nd button, launched action was as pushed 1st button was pushed. However I expected 2nd button act.\n3rd: when I pushed 2nd button, launched action was as pushed 2nd button was pushed. The action was I expected.\n\n2. I could not input to TextInput UI.\nIf I input character into UI of \"TextInput\" of my kivy application, the character was inputted into editor window of IDE which launched my kivy application\n3. Application icon did not appear.\nUsually, if python code launched, 'python launcher' icon appeared in dock bar of MacOS. However, if kivy code launched, neither 'python launcher' icon nor kivy icon appeared. The has problem if a kivy code was launched from IDE, the kivy windows hid behind IDE window.\nMy Environment:\n\nOS: macos 10.13.6\nHW: MacBookPro2016\nPython: miniconda + kivy was installed by command \"conda install kivy -c conda-forge\"\nOther: SDL, gstreamer etc. were installed and managed by homebrew.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":127,"Q_Id":51855310,"Users Score":0,"Answer":"This problem was solved to have installed kivy from anaconda.","Q_Score":0,"Tags":"python,kivy","A_Id":54009364,"CreationDate":"2018-08-15T08:26:00.000","Title":"What wrong that kivy platform cannot be gotten expected behavior on macOS?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I updated windows to the latest version yesteday, when pygame was working fine. After this update, pygame is very laggy compared to before, despite not adding any code to my project. I've tried restarting my computer, deleting and redownloading pygame, but it still doesn't work. Has anyone got any ideas? Python in general still is as fast as usual","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":92,"Q_Id":51878957,"Users Score":3,"Answer":"I would go to windows update history and remove the updates then try the game again this way you will know for sure if the windows update affected the game performance.","Q_Score":1,"Tags":"python,pygame","A_Id":51879156,"CreationDate":"2018-08-16T14:03:00.000","Title":"Pygame is slow after windows update","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been playing around with pythreejs, and, while it seems to be a good solution to the problem of visualizing 3D graphics in a jupyter notebook, I haven't been able to find any documentation about what jupyter is actually doing under the hood or what API exists for managing the widget. Currently, when I make a pythreejs plot (e.g., by calling display() on a pythreejs.Renderer object), I get a tiny little output window. How can I edit the size (and other properties) of this window? How can I see what the properties are?\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":274,"Q_Id":51967822,"Users Score":2,"Answer":"I discovered by experimentation that this can be controlled by passing the width and height parameters to the pythreejs.Renderer constructor. I would, however, appreciate any answer that points me toward better documentation for pythreejs or some philosophy regarding why\/how certain aspects of the three.js API were modified for Python's API.","Q_Score":1,"Tags":"python,three.js,widget,jupyter-notebook","A_Id":51971724,"CreationDate":"2018-08-22T13:17:00.000","Title":"How to make jupyter pythreejs plots larger?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Because of vision problems, I have to keep the font in my Python programs in pycharm larger than the default setting. When I execute any program, the run window comes up at the bottom and every time I have to start working on the Python code in the editor window, I have to close the run window using a mouse.\nIs there a way to close it using the keyboard shortcut? I could not find anything in the key map but there are so many settings that there is a chance that I may have missed it.\nI also tried with using the distraction free option and it works very well. However, when I tried to find something within the code, it does not bring up the in-line window that allows me to type the keyword is searched for.\nPlease suggest if there is any way to close the run window or if there is any workaround so that I can return to working in a larger editor window.\nThank you for any inputs","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":250,"Q_Id":51990919,"Users Score":2,"Answer":"shift+esc will hide the run window from within PyCharm. \nIf you want to access the run menu use: ctrl+shift+A\nYou can get a helpful cheatsheet of commands from within PyCharm by going to help -> Keymap Reference. This will provide the default key mapping for Windows and Linux","Q_Score":3,"Tags":"python,pycharm","A_Id":51991044,"CreationDate":"2018-08-23T17:03:00.000","Title":"Is there a way in pycharm to close the run window and just look at the editor window using a keyboard shortcut","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using the Geany IDE and I've wrote a python code that makes a GUI. Im new to python and i'm better with C. I've done research on the web and its too complicated because theres so much jargon involved. Behind each button I want C to be the backbone of it (So c to execute when clicked). So, how can i make a c file and link it to my code?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":51,"Q_Id":52075229,"Users Score":2,"Answer":"I too had a question like this and I found a website that described how to do it step by step but I can\u2019t seem to find it. If you think about it, all these \u2018import\u2019 files are just code thats been made separately and thats why you import them. So, in order to import your \u2018C File\u2019 do the following.\n\nCreate the file you want to put in c (e.g bloop.c)\nThen open the terminal and assuming you saved your file to the desktop, type \u2018cd Desktop\u2019. If you put it somewhere else other than the desktop, then type cd (insert the directory).\nNow, type in gcc -shared -Wl,-soname,adder -o adder.so -fPIC bloop.c into the terminal.\nAfter that, go into you python code and right at the very top of your code, type \u2018import ctypes\u2019 or \u2018from ctypes import *\u2019 to import the ctypes library.\nBelow that type adder = CDLL(\u2018.\/adder.so\u2019).\nif you want to add a instance for the class you need to type (letter or word)=adder.main(). For example, ctest = adder.main()\nNow lets say you have a method you want to use from your c program you can type your charater or word (dot) method you created in c. For example \u2018ctest.beans()\u2019 (assuming you have a method in your code called beans).","Q_Score":1,"Tags":"python","A_Id":52075312,"CreationDate":"2018-08-29T10:28:00.000","Title":"How to have cfiles in python code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've this question that has tangled my brain for so many days by now. It possible to connect a pyqt slider value onto a Maya\u00a0current time change? I have a slider that represents\u00a0the rotation value, if these values are keyframed and change over time the slider doesn't.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":184,"Q_Id":52082520,"Users Score":0,"Answer":"You can use the maya time slider change event ( from the cmds.scriptJob() ) \nIf you want to change time with the slider, you have to use PyQt.","Q_Score":1,"Tags":"python,pyqt5,maya,pyside2","A_Id":52085253,"CreationDate":"2018-08-29T16:50:00.000","Title":"Move a PyQt slider based on maya timeline","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using tkinter and the PIL to make a basic photo viewer (mostly for learning purposes). I have the bg color of all of my widgets set to the default which is \"systemfacebutton\", whatever that means.\nI am using the PIL.Image module to view and rotate my images. When an image is rotated you have to choose a fillcolor for the area behind the image. I want this fill color to be the same as the default system color but I have no idea how to get a the rgb value or a supported color name for this. It has to be calculated by python at run time so that it is consistent on anyone's OS.\nDoes anyone know how I can do this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":43,"Q_Id":52085525,"Users Score":2,"Answer":"You can use w.winfo_rgb(\"systembuttonface\") to turn any color name to a tuple of R, G, B. (w is any Tkinter widget, the root window perhaps. Note that you had the color name scrambled.) The values returned are 16-bit for some unknown reason, you'll likely need to shift them right by 8 bits to get the 0-255 values commonly used for specifying colors.","Q_Score":1,"Tags":"python,python-3.x,tkinter,python-imaging-library","A_Id":52085742,"CreationDate":"2018-08-29T20:22:00.000","Title":"Determining \"SystemFaceButton\" RBG Value At RunTime","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a python program which gets an input from user then runs a code and returns values, it is being saved as .py extension. \nI want to run it on different PC which doesn't have python. Is there a way to save it or compile it to .exe?\nNote: I am used to writing C programs which are directly compiled (code blocks) and gives .exe","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":111,"Q_Id":52123827,"Users Score":1,"Answer":"Pip install PyInstaller and then in the command prompt do PyInstaller yourscript.py > nameofprogramyouwant.exe","Q_Score":0,"Tags":"python,python-3.x,exe","A_Id":52124200,"CreationDate":"2018-08-31T23:59:00.000","Title":"Python program to run on PC","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a python program which gets an input from user then runs a code and returns values, it is being saved as .py extension. \nI want to run it on different PC which doesn't have python. Is there a way to save it or compile it to .exe?\nNote: I am used to writing C programs which are directly compiled (code blocks) and gives .exe","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":111,"Q_Id":52123827,"Users Score":0,"Answer":"The C code that you are used to writing compiles into .exe as you already know. However, not every PC can run .exe files, ie. those running on Mac, and other operating systems. So in short, the answer is no. However, there is a branch of Python known as Jython, which runs on the JVM (Java Virtual Machine) allowing it to work on any operating system with any PC. The ability to work on any machine in any environment is one of the most prized features of Java, and with Jython (which is compiled to Java code) you are able to emulate this key feature with python.","Q_Score":0,"Tags":"python,python-3.x,exe","A_Id":52132967,"CreationDate":"2018-08-31T23:59:00.000","Title":"Python program to run on PC","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a program that takes the picture from my webcam and also takes the screenshot of my screen and send them to my email. I used SimpleCV module to take the picture from webcam and pyautogui module to take the screenshot of my screen. I compiled my script using pyinstaller using command pyinstaller -w -i myicon.ico web_shot.py -F I ran the compiled exe file to my another computer but gave me fatal error failed to execute web_shot. Later I removed everything related with pyautogui (thinking that it is the thing that is throwing the error). I again compiled the rest of my script and again got the same error. Again I thought problem might be in SimpleCV module so I removed everything related with SimpleCV module and again compiled the rest of script using pyinstaller. This time I didn't get any error. It worked fine.\nI have written all my codes in python 2.7.15 (32-bit) because SimpleCV module doesn't support python 3+.\nI think pyinstaller is unable to recognize or compile the SimpleCV module. I tried other compiling script like py2exe, cx_Freeze but could not get success.\nHow can I compile my this script without getting fatal error?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":137,"Q_Id":52134367,"Users Score":1,"Answer":"The fatal error is caused due to missing of opencv_ffmpeg341.dll in your directory where you have .exe file is.\nSolve it by copying opencv_ffmpeg341.dll from C:\\\"your python installed path\"\\Lib\\site-packages\\cv2 to the same path where your executable (.exe) is.","Q_Score":0,"Tags":"python-2.7,simplecv","A_Id":54653393,"CreationDate":"2018-09-02T05:54:00.000","Title":"Getting fatal error after compiling python script containing SimpleCV module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on the following project and I am having really difficulties in finding the right way of doing that. I would like to build in Python (but I am open to other possibilities) a very basic interface that allows the user to draw with the mouse (or the pen if used on a surface laptop) something and then save the image. Ideally I would like this to work on a website or at least in a jupyter notebook (at least I imagine this to be utterly difficult).\nAnyone can point me in the right direction? The goal would be to use the images as input to a neural network model to demonstrate its result with real life examples.\nI am looking at tk but I don't seem to find much in terms of examples.\nThanks in advance, Umberto","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":1360,"Q_Id":52140339,"Users Score":1,"Answer":"I'd take a look at pyautogui to capture the mouse location then \"draw\" it in matplotlib -- should be able to do this in a loop. You'll want to watch the tkinter window size to sync the mouse coordinates with the relative location.\nWhy not just have your script open create a new blank img and automatically open it with paint - then read it on close? Seems easier than creating a drawing GUI.","Q_Score":1,"Tags":"python,image,user-interface,draw","A_Id":52140437,"CreationDate":"2018-09-02T19:25:00.000","Title":"Create a basic Python interface to save images drawn with a mouse","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a UI with ttk.Notebook tabs, and would like to display the same widget in multiple tabs. This requires the widget to simultaneously have multiple parent frames, which doesn't seem possible. Is there some other way it can be done?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1260,"Q_Id":52152364,"Users Score":1,"Answer":"No, you cannot have a single widget in multiple places. A widget can only be in one place at a time.","Q_Score":1,"Tags":"python,tkinter","A_Id":52152565,"CreationDate":"2018-09-03T15:12:00.000","Title":"In tkinter, is it possible to place the same widget into multiple frames?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When the value of a wx.TextCtrl is changed, the event wx.EVT_TEXT is emitted. Calling GetValue() in the event handler returns the new value. Calling GetInsertionPoint() in the event handler returns the new insertion point. Is it possible to get the old value and the old insertion point (before the text change is made)?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":269,"Q_Id":52163586,"Users Score":0,"Answer":"I don't believe so. However you could just save off the value and insertion point when the text control is created. These will be an empty string and zero (respectively), I believe.\nThen in the EVT_TEXT event handler, you would just update the saved values whenever something changes.","Q_Score":0,"Tags":"wxpython","A_Id":52167137,"CreationDate":"2018-09-04T09:55:00.000","Title":"wxPython: Get old value and insertion point in a wx.TextCtrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"On Windows 10, I'm trying to make a window stay always on bottom; that is, it is always shown behind other windows and can't be brought on top of them. I've seen around that the easiest solution is to make the window a child of the desktop; however, I've had mixed success in doing this. The undesirable side effects of making a window child of the desktop are not a problem in this case. I've tried making my window child of SysListView32, SHELLDLL_DefView and Progman.\nIn the first two cases, the window does correctly stay behind, though for some reason it is partially transparent and the desktop background can be seen behind it (but not whatever files\/folders may be on the desktop). In the last case the window can't be seen at all. Is there some way to take care of the transparency issue, or am I not making my window child of the right window? If it matters, I'm using Python 3.7 with Pygame (which is based on SDL) to create my window.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":313,"Q_Id":52175822,"Users Score":0,"Answer":"Instead of finding another solution, I've managed to fix the transparency issue by enabling the extended window style WS_EX_LAYERED on my window using SetWindowLong.","Q_Score":0,"Tags":"python,winapi","A_Id":52208210,"CreationDate":"2018-09-05T01:20:00.000","Title":"Making a window always stay behind","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to use the Qt Designer in PyCharm with all the most recent versions?\nI use Python 3.7.0 and PyQt5 (5.11.2) in PyCharm and have downloaded the PyQt5Designer package (using PyCharm), but there seems to be no usable designer.exe file in the PyQt5 directories, and I cannot find any PyCharm functionality to start the designer either. Also, pyqt5-tools seems to be incompatible with Python 3.7.0, so that folder does not exist either.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":9305,"Q_Id":52211135,"Users Score":2,"Answer":"I tried to use PyQt5 with 3.7, and realized the same issue. I downgraded Python to 3.6, and all was good.. I'd recommend downgrading until a new version of PyQt is released to support 3.7.\nInside of the pyqt5-tools, after installation will have the designer.exe you can use.","Q_Score":5,"Tags":"pycharm,pyqt5,qt-creator,qt-designer,python-3.7","A_Id":52286954,"CreationDate":"2018-09-06T19:42:00.000","Title":"Is it possible to use the Qt Designer in PyCharm with all the most recent versions?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to use the Qt Designer in PyCharm with all the most recent versions?\nI use Python 3.7.0 and PyQt5 (5.11.2) in PyCharm and have downloaded the PyQt5Designer package (using PyCharm), but there seems to be no usable designer.exe file in the PyQt5 directories, and I cannot find any PyCharm functionality to start the designer either. Also, pyqt5-tools seems to be incompatible with Python 3.7.0, so that folder does not exist either.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":9305,"Q_Id":52211135,"Users Score":0,"Answer":"Probably this is already resolved. However, as there is no update and I found something working fine for me:\nWith Pycharm 2019.2 (64x) and Python 3.7 after installing pyqt5-tools (v5.11.3.1.4) one can find the 'designer.exe' under ...\/site-packages\/pyqt5-tools\/Qt\/bin.\nNote: I think this pyqt5-tools (v5.11.3.1.4) downgrades the PyQt5 to v5.12.1 if any upgraded version is already installed. However, it works fine!\ncheers!","Q_Score":5,"Tags":"pycharm,pyqt5,qt-creator,qt-designer,python-3.7","A_Id":57378514,"CreationDate":"2018-09-06T19:42:00.000","Title":"Is it possible to use the Qt Designer in PyCharm with all the most recent versions?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using Windows\/Python 3.7 and Pygame 1.9.4 is already installed, except I exited out of the terminal and can't find the version name to finish the installation. \nAccording to the book I'm following, I need to finish by typing in:\n\"python -m pip install --user pygame-[version name].whl\"\nI can't find the version name anywhere online. I remember it started with \"pygame-18.0\"\nEdit: It works now! It was installed the whole time. Still not sure what the book wants me to do with the whl file thing, but if that raises problems, I'll just restart the whole process again. Thank you!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":333,"Q_Id":52261995,"Users Score":0,"Answer":"try pip3\/pip install pygame\nnow the latest version of pygame is \"pygame-1.9.4\"","Q_Score":0,"Tags":"python,pygame","A_Id":52262178,"CreationDate":"2018-09-10T16:29:00.000","Title":"Pygame 1.9.4. Installation Trouble","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning Python and I have a situation in which I am tempted to have an __init__() function in several of my different classes. Are there any problems that this could cause? If it makes any difference one of them is in a Tkinter main loop for the user interface.\nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":79,"Q_Id":52265615,"Users Score":2,"Answer":"What __init__() does is allowing you to set up the initial values inside your class, either as hard-coded default values or as values you pass the object as parameters. Imagine you having to have a class Employee and 10 Employee objects in your code. In theory you could do without having an init() and set the various fields (e.g., name, wage, and so on) from outside your class... But why would you, if you can have this handy little function that does all of that for you?","Q_Score":0,"Tags":"python,python-3.x,tkinter","A_Id":52265703,"CreationDate":"2018-09-10T21:18:00.000","Title":"Can each class have an __init__() function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a program with a Tkinter-based GUI, using Python 3.6.5.\nI have a temporary window with some Text widgets (and other things) in it. The whole window gets destroyed when the temporary window closes. However, I'd like to preserve undo\/redo history and any text that is in some particular Text widgets the next time it is opened (and re-built). Reprogramming this another way is certainly possible, but may be an unnecessary and large amount of work, considering how things are set up (although if you have ideas that you feel should work no matter the setup, feel free to let me know). Changing the setup could probably easily introduce bugs.\nTwo different windows with different widgets need to share data between some of the similar widgets (and I want to extend that to include undo-redo history). I believe the different parents is part of why the window is destroyed, but I could be wrong (there may be other reasons).\nAnyway, I was wondering, where is the undo\/redo history of a Text widget stored? If I could just somehow copy that just before the window closes and put it in the newly build widget (of whichever window it gets build on), that would be great.\nI'm adding the tk tag since I looked at the Python source code for tkinter and didn't find anything particularly useful (so maybe those who use TCL or such will know).\nI realize that it may not be possible to access the variable that stores the history, but I figured it was worth asking about, just in case.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":95,"Q_Id":52285402,"Users Score":1,"Answer":"No, you cannot save the undo\/redo history of the text widget, destroy the widget, then re-apply the history to a new widget. \nThe best solution will be to not destroy the widget. Just hide it and then reshow it instead of destroying it and recreating it.","Q_Score":1,"Tags":"python,python-3.x,tkinter,widget,tk","A_Id":52285516,"CreationDate":"2018-09-11T23:25:00.000","Title":"How to copy the undo\/redo history of a Tkinter Text widget into another","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a utility library in Python that works with the Qt framework. My code is pure Python and is compatible with both PyQt5 and PySide2. My main module could either be run on its own from the command line with python -m or it could be imported into another project. Is there a clean way to specify that the project needs either PyQt5 or PySide2 in its a wheel distribution?\nHere is what I have found in my research but I am asking in case there is a better way to package the project than these options:\nI could add logic to setup.py in a source distribution of the project to check for PyQt5 and PySide2. However, wheels are recommended way to distribute Python projects, and from what I can tell this kind of install-time logic is not possible with wheels. Alternatively, I could not specify either PySide2 or PyQt5 as dependencies and recommend in the install instructions that one of them be installed together with my project.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":316,"Q_Id":52286940,"Users Score":0,"Answer":"My particular case is somewhat niche (so I am not accepting this as the answer). I realized the package was really doing two things: acting as a library and as a command line tool. I decided to split it into two packages: package and package-cli. package does not explicitly depend on PyQt5 or PySide2 but specifies that one of them must be installed in the documentation. Since package is a library, it is intended to be integrated into another project where it is easy to list package and PyQt5 together in the requirements.txt. For package-cli, I just choose one of PyQt5 or PySide2 to be the explicit dependency. package-cli depends on package and PyQt5 and just adds a console_script to call the main module in package.","Q_Score":2,"Tags":"python,packaging,python-wheel","A_Id":52350571,"CreationDate":"2018-09-12T03:08:00.000","Title":"How to support alternate dependencies in a Python package?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to add InPadding to my LabelFrame i'm using AppJar GUI. I try this:\nself.app.setLabelFrameInPadding(self.name(\"_content\"), [20, 20])\nBut i get this error:\n\nappJar:WARNING [Line 12->3063\/configureWidget]: Error configuring _content: unknown option \"-ipadx\"\n\nAny ideas how to fix it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":112,"Q_Id":52289125,"Users Score":0,"Answer":"Because of the way containers are implemented in appJar, padding works slightly differently for labelFrames.\nTry calling: app.setLabelFramePadding('name', [20,20])","Q_Score":0,"Tags":"python-3.x,user-interface","A_Id":52907153,"CreationDate":"2018-09-12T06:55:00.000","Title":"Error configuring: unknown option \"-ipadx\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm trying to implement a keyword based personal assistant\nMy issue is my grammar is set up so that after I detect the keyword, I still need to use it in my grammar,but switching to jsfg mode discards that utterance \nTherefore I need to use Decoder.get_raw_data and Decoder.process_raw_data in but in Python there is no implementation for .get_raw_data method present in C\/C++ implementation\nIs there any way I could use it?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":92,"Q_Id":52295615,"Users Score":0,"Answer":"You have to implement Python part in swig unfortunately.","Q_Score":0,"Tags":"python,cmusphinx,pocketsphinx","A_Id":52938578,"CreationDate":"2018-09-12T12:48:00.000","Title":"Pocketsphinx Python get_raw_data","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How am I supposed to handle hidden files like .gitignore in my Eric project? Open Dialog does not seem to have an option to show hidden files; I couldn't find any such option anywhere in settings or configurations. Is there a solution?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":114,"Q_Id":52345919,"Users Score":1,"Answer":"With the Qt File Dialog, you can right click on the file list. Show Hidden Files checkbox is on the context menu.","Q_Score":0,"Tags":"python,qt,user-interface,eric-ide","A_Id":52354370,"CreationDate":"2018-09-15T15:00:00.000","Title":"Eric IDE, Qt File Dialog: show hidden files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a Python program with Qt5 GUI and compiled an .exe with PyInstaller. It works fine on most PCs, but on some the compiled .exe wont start at all. No error message, no process in taskmanager, no entry in system protocol. I uninstalled anti virus program and disabled windows defender, still the same. The funny thing is, that when I open a command prompt and start the .exe from within the command prompt it works as it should. But it does not when double clicking the .exe from within windows explorer. The Windows OS is Windows 10.\nAny suggestions or somebody had same\/similar issue?\nRegards\nDavid\nEDIT: Windows UAC was the problem: when turend completely off the application does not start.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":365,"Q_Id":52364789,"Users Score":0,"Answer":"Windows UAC was the problem: when turend completely off the application does not start.","Q_Score":0,"Tags":"python,windows,qt5,pyinstaller,pyside2","A_Id":52421758,"CreationDate":"2018-09-17T09:39:00.000","Title":"Pyinstaller Qt5 Application won't start in Windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Let's say I have a list of 887123, 123, 128821, 9, 233, 9190902. I want to put those strings on screen using pygame (line drawing), and I want to do so proportionally, so that they fit the screen. If the screen is 1280x720, how do I scale the numbers down so that they keep their proportions to each other but fit the screen? \nI did try with techniques such as dividing every number by two until they are all smaller than 720, but that is skewed. Is there an algorithm for this sort of mathematical scaling?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":29,"Q_Id":52465795,"Users Score":1,"Answer":"I used this algorithm: x = (x \/ (maximum value)) * (720 - 1)","Q_Score":0,"Tags":"python,math,pygame","A_Id":52466333,"CreationDate":"2018-09-23T11:46:00.000","Title":"How to put a list of arbitrary integers on screen (from lowest to highest) in pygame proportionally?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been experimenting with QT5 for Python, using pyqt5. I've noticed that most tutorials recommend using pyuic5 to convert the XML UI to Python code. I've also seen a couple of tutorials where instead they use uic.loadUi(\"myui.ui\") to dynamical load the XML UI. This seems like a cleaner, more modular solution to me, but it appears to be an unpopular option. Is there a reason converting your code with pyuic5 is a sounder solution?","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":8622,"Q_Id":52471705,"Users Score":2,"Answer":"The biggest reason to use pyuic5 is that IDEs (e.g. Visual Studio Code, PyCharm) do not understand .ui files, and therefore cannot provide code introspection (e.g. autocompletion of widget names) for your class unless you compile it to Python.","Q_Score":16,"Tags":"python,pyqt,pyqt5","A_Id":69406173,"CreationDate":"2018-09-24T01:28:00.000","Title":"Why in pyqt5 should I use pyuic5 and not uic.loadUi(\"my.ui\")?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program written in C++ (as a static library for now) with very abstract interface that uses operator overloading on my classes etc. I want to create a shared library out of it (DLL on Windows would be the first step, before trying other platforms) to use it in other more \"user friendly\" languages. I read that Python has some level of support for this with its ctypes.\nI just want to know, if it is possible to use some higher level abstractions from a C++ DLL in Python to choose the right option before I invest time in trying to do something, that's impossible. User should be able to initialize the classes provided by my program and use them with all their methods including overloaded operators (only those available in python of course). Or is Python only meant to support some simple function calls etc.?\nThe C++ code (even just the user accessible classes) is huge and I would like to avoid creating separate Python wrappers, as all of the needed functionality is already done in C++.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":910,"Q_Id":52495024,"Users Score":3,"Answer":"Since no one answered, I will provide everything I have gathered myself in the meantime. Hope it might be helpful for some.\nPython's ctypes are meant to support only C language features. So there is no way to directly access classes and other C++ objects from Python using ctypes. However, there are some ways to access them.\nThe tedious method\nCreate C style objects for the C++ classes, and then create Python wrappers for them.\nThe C style object would basically be a pointer to the C++ object allocated dynamically. It should have additional methods like for example the conventionally named ->Release() to destroy the object and free the allocated memory. Then you would need to create python wrappers manually that would resemble the original C++ object including the overloaded operators etc. (Sidenote: The only operator I came across, that could be needed in such situations and is not overloadable in Python is the assignment operator.)\nThis is probably the best solution when you want to have full control over what's happening and don't mind duplicating the interface in Python.\nThe quick method\nBoost provides a Boost::Python library to handle this. It lets you export practically anything you would need - classes, operators, even multiple overloaded methods.\nThe only problem is, that this library is quite large and it's one of the non-header-only Boost libraries, so you would need to figure out how to build it with your project and this might not be easy for people, who never worked with Boost (like myself).\nI don't know what exactly this library does, maybe it just automates the same thing described in the previous method. So I'm not sure whether it reduces levels of additional wrappers or just simply does all the hard wrapping work for you, but it does what I needed to be done.\nThe quicker method\nLuckily I came across an alternative - pybind11. It's a relatively small library, that does the same thing as Boost::Python and it's header-only. It has nice documentation and is easy to use. It's called pybind11 as it was originally meant to support C++11, but it currently supports C++14 and experimentally C++17, but I used it with a C++17 project and found no problems so far.\nI'm not yet sure which method would be the best for my project but for now, I use pybind11, just to make it easier while the project is under development.","Q_Score":1,"Tags":"python,c++,dll,dllexport","A_Id":52724620,"CreationDate":"2018-09-25T09:38:00.000","Title":"Export of C++ classes for Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two python files (Iron Python 2.7) and a .net dll file.\n\nabc.py\ndef.py\nghi.dll\n\nabc.py is the Main file that contains the code for Windows Forms application and def.py is a supporting file that has the functions. ghi.dll is a third party api file that has been modified to dll.\nI want to create this to an Windows Forms Application executable to distribute it to others in my team.\nUsed Visual Studio 2017 to write the code.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":721,"Q_Id":52501442,"Users Score":1,"Answer":"Create a folder and copy all the required .net dlls from the C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework.NETFramework\\v4.0 folder and copy all the required files from the C:\\Program Files (x86)\\IronPython 2.7\\Lib folder\nCopy the ipyc.exe from C:\\Program Files (x86)\\IronPython 2.7 folder and copy pyc.py from C:\\Program Files (x86)\\IronPython 2.7\\Tools\\Scripts folder\nOpen Command Prompt and navigate to the appropriate folder and use the following command\n ipyc def.py \/main:abc.py \/target:winexe","Q_Score":0,"Tags":".net,executable,ironpython","A_Id":52524477,"CreationDate":"2018-09-25T15:10:00.000","Title":"How to build a executable for ironpython files and a .Net dll file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a tkinter listbox, when I select a item it performs a few actions then returns the results, while that is happening the item I selected does not show as selected, is there a way to force it to show selected immediately so it's obvious to the user they selected the correct one while waiting on the returned results? I'm using python 3.4 and I'm on a windows 7 machine.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":79,"Q_Id":52540413,"Users Score":0,"Answer":"The item does show as selected right away because the time consuming actions are executed before updating the GUI. You can force the GUI to update before executing the actions by using window.update_idletasks().","Q_Score":0,"Tags":"python,tkinter,listbox","A_Id":52550908,"CreationDate":"2018-09-27T15:26:00.000","Title":"Force tkinter listbox to highlight item when selected before task is started","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem. In Tkinter there are two widgets: Text and Entry. The Text widget has a configuration wrap='word'. And the Entry widget has a method select_range. I need both the wrap configuration and the select_range method in order to select certain parts of a massive text (by select I mean like with the mouse).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":22,"Q_Id":52563605,"Users Score":1,"Answer":"There is no direct way to combine the features of two different widgets, but there's really no need to do that. All you're asking for is the ability to select a range of text, and the text widget supports that. \nThe method to select a range of characters is documented. All you need to do is add the tag \"sel\" to a range of characters.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":52563624,"CreationDate":"2018-09-28T23:03:00.000","Title":"Is there a way to create a widget with configuration wrap and select_range method?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a website for a university project where you can play some minigames I've programmed with Pygame (Python). How can I make the games executable online (like flashgames)? I'm using php","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":10710,"Q_Id":52588601,"Users Score":0,"Answer":"Do you have the executable? If not, check out cx-Freeze. If you do have the executable, I would suggest somehow implementing the executable into the html code to play. Check out Chrome's dino runner (chrome:\/\/dino) the source is free.","Q_Score":5,"Tags":"php,python,pygame","A_Id":52591088,"CreationDate":"2018-10-01T09:55:00.000","Title":"How can I make a Pygame game executable online?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I built a small GUI using Tkinter. The GUI features, among some other elements, three buttons. These buttons serve to open a dystem dialog and select certain data-files etc. One of the three buttons is a 'Go' button that runs the underlying data-processing.\nWhen running the .py script the GUI works fine. However, after creating a developer app in alias mode using Py2App the buttons have become invisible! They're still there and usable, but invisible until interacted with.\nHow can I prevent this from happening?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":198,"Q_Id":52688867,"Users Score":1,"Answer":"I was stuck in your exact situation for quite some time. When I ran my tkinter script, it worked perfectly and all the buttons showed up, but once I packaged it, the buttons stopped showing up (They were still there but you couldn't see them). After a long time of trying random things, I found out how to make the buttons and their text show up again. Simply resize the window. Even a difference of 1 or 2 pixels does the trick. I have not yet found a way to PREVENT this issue, but at least this makes the app look right. \nPlease reply if you figure out a solution to prevent this!\nGood Luck!","Q_Score":2,"Tags":"python,tkinter,py2app","A_Id":53104834,"CreationDate":"2018-10-07T13:16:00.000","Title":"Tkinter GUI buttons become invisible after creating app using Py2App","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have the issue of a PyQt-based GUI application occasionally crashing at exit with either a segmentation fault or an error message that indicates an unhandled C++ exception was encountered.\nWhile running, there are no such issues, this problem is most likely caused by some step in the application shutdown.\nHow can I best debug such a \"mixed\" scenario of Python and C++, except for actually wrapping the application launch command with gdb, or explicitly enabling core dumps and trying a \"post-mortem\" analysis on the resulting core file?\nThank you very much!\nFabian Aichele","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":131,"Q_Id":52701748,"Users Score":0,"Answer":"A real-world approach is to keep a registry of active objects. Add each object in its ctor, remove in the dtor. In members that you've seen crash, check if this appears in the registry. If that doesn't help, add these checks also to related methods\nIt's formally Undefined Behavior already to call that method, but you already have UB. However, this method won't work too well on virtual calls. In that case, it's a good moment to introduce the public non-virtual\/protected virtual pattern: Replace a virtual public method X with a pair public: auto X() { checkAlive(this); return doX(); } protected: virtual Foo doX();\nThis pattern is also good for various other assertions,logging and similar non-functionals.","Q_Score":0,"Tags":"python,c++,debugging","A_Id":52702690,"CreationDate":"2018-10-08T11:57:00.000","Title":"How to debug non-deterministic segmentation faults in a mixed Python-C++ library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use a QSortFilterProxyModel to filter a QSqlTableModel's data, and want to get the filtered rowCount.\nBut when I call the QSortFilterProxyModel.rowCount method, the QSqlTableModel's rowCount was returned.\nSo how can I get the filtered rowcount?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":993,"Q_Id":52779569,"Users Score":0,"Answer":"You should after set QSortFilterProxyModel filter to call proxymodel.rowCount\u3002","Q_Score":1,"Tags":"python,pyqt,pyqt5,qsortfilterproxymodel","A_Id":62380679,"CreationDate":"2018-10-12T12:28:00.000","Title":"How to get filtered rowCount in a QSortFilterProxyModel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Idle3 (of python3) regularly crashes when in a window and using the middle mousewheel.\nThere is always the same error left in Terminal:\n\nTraceback (most recent call last): File \"\/usr\/local\/bin\/idle3\", line 5, in main() File\n \"\/usr\/local\/Cellar\/python\/3.7.0\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python3.7\/idlelib\/pyshell.py\",\n line 1548, in main\n root.mainloop() File\n \"\/usr\/local\/Cellar\/python\/3.7.0\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python3.7\/tkinter\/init.py\", line 1280, in mainloop self.tk.mainloop(n)\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xFF in position 0: invalid continuation byte\n `","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":852,"Q_Id":52818660,"Users Score":1,"Answer":"The problem seems to be that brew installed python without tcl-tk, thus using the old tcl-tk from mac-os. This one has a problem interpreting some mousewheel commands.\nThe solution : \nbrew reinstall python --with-tcl-tk","Q_Score":1,"Tags":"python,python-3.x,macos","A_Id":52818661,"CreationDate":"2018-10-15T14:10:00.000","Title":"My Idle (idle3) from python installed with homebrew on a mac crashes","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"How can I select a single column in treeview tkinter, when I try to use the tree.get_children() it only let me chose a item.\nCan somebody help me out ?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":828,"Q_Id":52875351,"Users Score":0,"Answer":"The treeview widget doesn't support selecting data by column. You can only select by row.","Q_Score":0,"Tags":"python,tkinter,treeview","A_Id":52876524,"CreationDate":"2018-10-18T13:37:00.000","Title":"Selecting a single column in treeview tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My pyglet application fails to run, only giving the error ImportError: Library \"GLU\" not found. I have installed PyOpenGL and libgl1 across the system, in the virtualenv, and tried reinstalling everything multiple times. Nothing seems to help. Similiar questions mention it may be related to my graphics card, which is Intel Corporation HD Graphics 5500 (rev 09). Anyone have any ideas?\nFurther details\n\nPython version: 3.7\nIDE: Pycharm Community\nOS: elementaryOS v5.0 Juno\nInstallation method: Flatpak\nGraphics Driver: Intel Corporation Broadwell-U Integrated Graphics","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1370,"Q_Id":52885954,"Users Score":1,"Answer":"Don't install pycharm through flatpak, for whatever reason that doesn't work. Install it through the pycharm website.","Q_Score":0,"Tags":"python,opengl,pycharm,pyglet","A_Id":52909744,"CreationDate":"2018-10-19T04:34:00.000","Title":"Pyglet fails to load GLU library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm confused on how the PyOpenGL camera works or how to implement it. Am I meant to rotate and move the whole world around the camera or is there a different way?\nI couldn't find anything that can help me and I don't know how to translate C to python.\nI just need a way to transform the camera that can help me understand how it works.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":362,"Q_Id":52907020,"Users Score":3,"Answer":"To say it bluntly: There is no such thing as a \"camera\" in OpenGL (neither there is in DirectX, or Vulkan, or in any of the legacy 3D graphics APIs). The effects of a camera is understood as some parameter that contributes to the ultimate placement of geometry inside the viewport volume.\nThe sooner you understand that all that current GPUs do is offering massively accelerated computational resources to set the values of pixels in a 2D grid, where the region of the pixels changed are mere points, lines or triangles on a 2D plane onto which they are projected from an arbitrarily dimensioned, abstract space, the better.\nYou're not even moving around the world around the camera. Setting up transformations is actually errecting the stage in which \"the world\" will appear in the first place. Any notion of a \"camera\" is an abstraction created by a higher level framework, like a third party 3D engine or your own creation.\nSo instead of thinking in terms of a camera, which constrains your thinking, you should think about it this way:\nWhat kind of transformations do I have to chain up, to give a tuple of numbers that are called \"position\" an actual meaning, by letting this position turn up at a certain place on the visible screen?\nYou really ought to think that way, because that is what's actually happening.","Q_Score":0,"Tags":"python,opengl,pyopengl","A_Id":52907433,"CreationDate":"2018-10-20T15:04:00.000","Title":"PyOpenGL camera system","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know complex math and the necessary operations (either \"native\" Python, or through NumPy). My question has to do with how to display complex numbers in a UI using wxPython. All the questions I found dealing with Python and complex numbers have to do with manipulating complex data.\nMy original thought was to subclass wx.TextCtrl and override the set and get methods to apply and strip some formatting as needed, and concatenating an i (or j) to the imaginary part.\nAm I going down the wrong path? I feel like displaying complex numbers is something that should already be done somewhere.\nWhat would be the recommended pattern for this even when using another UI toolkit, as the problem is similar. Also read my comment below on why I would like to do this.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":52975402,"Users Score":0,"Answer":"As Brian considered my first comment good advice, and he got no more answers, I am posting it as an answer. Please refer also to the other question comments discussing the issue.\n\nIn any UI you display strings and you read strings from the user. Why\n would you mix the type to string or string to type translation with\n widgets functionality? Get them, convert and use, or \"print\" them to\n string and show the string in the ui.","Q_Score":1,"Tags":"python,user-interface,tkinter,wxpython","A_Id":55748532,"CreationDate":"2018-10-24T18:05:00.000","Title":"Display complex numbers in UI when using wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to convert Qt .ui files made using Qt Designer with pyside2-uic but the output starts with 2 garbage bytes then every other byte is a null. \nHere's the start of the output:\n\nFF FE 23 00 20 00 2D 00 2A 00 2D 00 20 00 63 00 6F 00 64 00 69 00 6E 00 67 00 3A 00 20 00 75 00 74 00 66 00 2D 00 38 00 20 00 2D 00 2A 00 2D 00 0D 00 0A 00 0D 00 0A 00 23 00 20 00 46 00 6F 00\n\nIf I remove the first 2 bytes and all the nulls the it works as expected. \nI'm using Python 3.7 and the newest version of pyside2, is there any way to get pyside2-uic to output a valid file without having to run it through another script to pull out all the garbage?","AnswerCount":3,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":832,"Q_Id":53035340,"Users Score":0,"Answer":"This bug(?) only occurs when pyside2-uic is run in powershell and the output is redirected to a file. \nIf using powershell use the -o option to specify an output file. Both methods work fine from a normal command prompt.","Q_Score":0,"Tags":"python,python-3.7,pyside2","A_Id":53051998,"CreationDate":"2018-10-28T19:30:00.000","Title":"pyside2-uic null bytes in output","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to convert Qt .ui files made using Qt Designer with pyside2-uic but the output starts with 2 garbage bytes then every other byte is a null. \nHere's the start of the output:\n\nFF FE 23 00 20 00 2D 00 2A 00 2D 00 20 00 63 00 6F 00 64 00 69 00 6E 00 67 00 3A 00 20 00 75 00 74 00 66 00 2D 00 38 00 20 00 2D 00 2A 00 2D 00 0D 00 0A 00 0D 00 0A 00 23 00 20 00 46 00 6F 00\n\nIf I remove the first 2 bytes and all the nulls the it works as expected. \nI'm using Python 3.7 and the newest version of pyside2, is there any way to get pyside2-uic to output a valid file without having to run it through another script to pull out all the garbage?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":832,"Q_Id":53035340,"Users Score":0,"Answer":"In pyside2-uic mainwindow.ui -o MainWindow.py\nUse -o instead of >","Q_Score":0,"Tags":"python,python-3.7,pyside2","A_Id":63013213,"CreationDate":"2018-10-28T19:30:00.000","Title":"pyside2-uic null bytes in output","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to convert Qt .ui files made using Qt Designer with pyside2-uic but the output starts with 2 garbage bytes then every other byte is a null. \nHere's the start of the output:\n\nFF FE 23 00 20 00 2D 00 2A 00 2D 00 20 00 63 00 6F 00 64 00 69 00 6E 00 67 00 3A 00 20 00 75 00 74 00 66 00 2D 00 38 00 20 00 2D 00 2A 00 2D 00 0D 00 0A 00 0D 00 0A 00 23 00 20 00 46 00 6F 00\n\nIf I remove the first 2 bytes and all the nulls the it works as expected. \nI'm using Python 3.7 and the newest version of pyside2, is there any way to get pyside2-uic to output a valid file without having to run it through another script to pull out all the garbage?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":832,"Q_Id":53035340,"Users Score":0,"Answer":"FYI, issue seems to be UTF-8 encoding (when using -o), vs. UTF-16 LE (output redirect in PowerShell).\nThis also matches to above ... every byte has a 00 with it (16 bit vs. 8 bit).","Q_Score":0,"Tags":"python,python-3.7,pyside2","A_Id":71505669,"CreationDate":"2018-10-28T19:30:00.000","Title":"pyside2-uic null bytes in output","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a functioning code that will not show text on the buttons unless I click and hold the button. When releasing the button's text becomes blank again. I have tried solving this on other forums and \n\nplease note: THERE IS NOTHING WRONG WITH THE CODE ITSELF.\n\nThere is some sort of issue with how my laptop is running the code. I've tried reinstalling python3.7 as well as tcl-tk. I really don't know what else to do.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":4342,"Q_Id":53052576,"Users Score":0,"Answer":"Updating doesn't work for everyone, I've read several posts of those for whom it didn't, and it didn't for me.\nBut since resizing the window works, there must be something that the tk instance does when resizing that makes everything appear again. \nSo you might check what happens there, and use that if your program detects if the OS is Mojave. Obviously this is not production worthy and only a fix for your own local projects or maybe some course project, but at least it's something.","Q_Score":3,"Tags":"python,python-3.x,tkinter,tkinter-layout","A_Id":53835116,"CreationDate":"2018-10-29T19:33:00.000","Title":"Tkinter buttons not showing text on my mac, although code works on others computers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to use Tkinter with AWS Lambda,I copied the tkinter folder from the lib folder: C:\\Users\\AGOJSO\\AppData\\Local\\Programs\\Python\\Python36\\lib\\tkinter\nAnd then made a zip file containing the tkinter folder and lambda_function.py, I made a ZIP file and uploaded it to AWS Lambda.\nThen on top of the code i wrote:\nfrom \/tkinter import *\ntk = Tk()\ngetting this error:\n\nSyntax error in module 'lambda_function': invalid syntax (lambda_function.py, line 4)\n\nHelp please.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":649,"Q_Id":53070290,"Users Score":0,"Answer":"You aren't going to be able to run tkinter on AWS lambda. Tkinter requires a display.","Q_Score":1,"Tags":"python,amazon-web-services,tkinter,dependencies,aws-lambda","A_Id":53070425,"CreationDate":"2018-10-30T18:01:00.000","Title":"Add Tkinter to AWS Lambda","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I install pygame for python 3.7.0 on windows 7(64-bit)? I tried using the pip install, and it always shows 'pip' is not recognized as an internal or external command, operable program, or batch file. I watched many videos and they all show that in order to install pygame you need to use pip install. \nWhat should I do? How should I download pip or is there another way to install pygame?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":2587,"Q_Id":53101523,"Users Score":0,"Answer":"Re-install python and click the choose to add to PATH at the bottom of the first install screen.","Q_Score":0,"Tags":"python,windows,pygame","A_Id":53102857,"CreationDate":"2018-11-01T12:43:00.000","Title":"How to install pygame for python 3.7.0 on windows 7(64-bit)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I install pygame for python 3.7.0 on windows 7(64-bit)? I tried using the pip install, and it always shows 'pip' is not recognized as an internal or external command, operable program, or batch file. I watched many videos and they all show that in order to install pygame you need to use pip install. \nWhat should I do? How should I download pip or is there another way to install pygame?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":2587,"Q_Id":53101523,"Users Score":1,"Answer":"When you installed python you were able to choose to add it to the PATH system variable, if you have not done this, pip will not work unless you navigate to its' location and run the command prompt from there.\nYou can search for pip.exe in windows to find it and then right click it and open the containing folder. Once in the containing folder right click anywhere and open command window here.\nAlternatively you can just type 'cmd' in the path bar and hit enter, and this will open a command window in place.","Q_Score":0,"Tags":"python,windows,pygame","A_Id":53101644,"CreationDate":"2018-11-01T12:43:00.000","Title":"How to install pygame for python 3.7.0 on windows 7(64-bit)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to have a multi-line text entry field with drop down options?\nI currently have a GUI with a multi-line Text widget where the user writes some comments, but I would like to have some pre-set options for these comments that the user can hit a drop-down button to select from.\nAs far as I can tell, the Combobox widget does not allow changing the height of the text-entry field, so it is effectively limited to one line (expanding the width arbitrarily is not an option). Therefore, what I think I need to do is sub-class the Text widget and somehow add functionality for a drop down to show these (potentially truncated) pre-set options. \nI foresee a number of challenges with this route, and wanted to make sure I'm not missing anything obvious with the existing built-in widgets that could do what I need.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":900,"Q_Id":53132987,"Users Score":1,"Answer":"I don't think you are missing anything. Note that ttk.Combobox is a composite widget. It subclasses ttk.Entry and has ttk.Listbox attached.\nTo make multiline equivalent, subclass Text. as you suggested. Perhaps call it ComboText. Attach either a frame with multiple read-only Texts, or a Text with multiple entries, each with a separate tag. Pick a method to open the combotext and methods to close it, with or without copying a selection into the main text. Write up an initial doc describing how to operate the thing.","Q_Score":1,"Tags":"python,tkinter","A_Id":53133245,"CreationDate":"2018-11-03T15:56:00.000","Title":"Multi-Line Combobox in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I built a GUI in python using wxpython, and I want to be able to restart it when I click on a button. I want the app to close, then open up again. Is this possible?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":143,"Q_Id":53135445,"Users Score":0,"Answer":"It really depends on what you mean by \"restart\". Do you want everything to be reinitialized? If not, you can just call Hide on the main window of your application. Put in an artificial sleep and then Show it again.\nAlternatively, you would need to basically launch a script on shutdown that would then relaunch your application.","Q_Score":0,"Tags":"python,python-3.x,user-interface,wxpython,restart","A_Id":53157307,"CreationDate":"2018-11-03T20:55:00.000","Title":"Restart Python 3.6 GUI - wxpython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Just started programming in python and pygames.\nWhenever I try running a py file with pygames, the pygames window will appear, but there will be absolutely nothing in it. No errors in the log, but nothing shows, it's just a gray screen.\nI tried running it on IDLE, and through the command line (I'm on a mac so I use the terminal)\nAnd it's not just my programs that aren't showing anything, I've tried to run one of pygames examples, and it will still not display anything. For example, if I run the pygames alien example, the window will appear with a blank gray background. I'll hear the audio for the program, but no display.\nAnything would help, I'm at a loss especially since no errors are showing in the log.\nEDIT1:\nI'm using Python 3 (and I really need to keep using Python 3)\nEDIT2:\nI'm using python 3.7. pygames version 1.9.4. The examples are with the pygames, they were downloaded together, so I assume it's for that version.\nEDIT3:\nok, my OS is Mojave 10.14. I've tried starting the application by: opening the file, running it on IDLE, and running it through the command line, none have worked. python2 is installed, but when I run the pygame it's a python3 file","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":3391,"Q_Id":53182886,"Users Score":2,"Answer":"You can also install new pygame using pip install pygame=2.0.0.dev6. This\nworked in my case.","Q_Score":9,"Tags":"python,pygame","A_Id":61076368,"CreationDate":"2018-11-07T02:36:00.000","Title":"Pygame not showing anything in the window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python GUI made with tkinter and I want to define a callback method to be called when the items in a listbox change:\n\nItem added to the listbox\nItem deleted from the listbox\n\nI think that should be possible with bindings but I am not sure what is the exact binding name.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":84,"Q_Id":53198575,"Users Score":0,"Answer":"There are no built-in events when data is added to or removed from a listbox. However, since it's your code that adds and removes the data, you can generate your own events with event_generate whenever you update the listbox.","Q_Score":0,"Tags":"python,tkinter","A_Id":53198841,"CreationDate":"2018-11-07T22:04:00.000","Title":"python tkinter Listbox bind with items updated","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently building a python application which uses sockets to communicate with other computers. I am almost finished with the backend (the frontend still looks atrocious), and I began thinking about expanding. Currently, my app is only intended to support Windows PC; however, I would like to expand to ios which would necessitate the use of Swift. I am writing this question to ask if python sockets can be shared across different types of devices (i.e. PC and iPhone) and different programming languages (i.e. Python and Swift). I am pretty sure that they can be shared across different types of devices, but I am unsure as to whether or not they can be shared with other programming languages. Thank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":35,"Q_Id":53243061,"Users Score":0,"Answer":"A socket in Python provides the same abstraction as a socket in C, C++, Perl, ruby, Java ... . This means application written in various languages can all communicate using sockets with each other. What is different are WebSockets in Javascript in the browser though - these need another WebSockets implementation as the peer but these can also be found for various programming languages.","Q_Score":0,"Tags":"python,swift,sockets,cross-platform","A_Id":53243418,"CreationDate":"2018-11-10T20:19:00.000","Title":"Cross Platforming and Cross Languaging Sockets","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an entry widget and a button that calls askdirectory. I would like the initial value for the entry widget to be the default initialdir parameter for askdirectory. How do I get that value from the askdirectory function? (the reason I want to do this and not set an initial parameter is that I suspect that the function saves a recent directory and I would like to help the user save some time looking for the directory)","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":2169,"Q_Id":53287843,"Users Score":1,"Answer":"The default is the current working directory.\nFrom the canonical tk documentation about the initialdir option:\n\nSpecifies that the directories in directory should be displayed when the dialog pops up. If this parameter is not specified, then the directories in the current working directory are displayed. If the parameter specifies a relative path, the return value will convert the relative path to an absolute path.\n\nThat being said, the dialogs on OSX and Windows are native dialogs, and there might be platform-specific behavior to pick your home directory or last used directory or most recently used directory. Unfortunately, I don't think there's any way to get that information.","Q_Score":1,"Tags":"python-3.x,tkinter","A_Id":53288122,"CreationDate":"2018-11-13T19:01:00.000","Title":"What is tkinter askdirectory default value for initialdir parameter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created a kivy application that allows plotting some graphics by using matplotlib lib. it worked well, and than i converted it to .exe with cx_freeze, it displayed this error :\n\nIntel MKL FATAL ERROR : Cannot load mkl_intel_thread.dll.\n\nAfter hours in forums, i putted all the mkl .dll files that exists in the Anaconda3-Windows-x86_64\\\\Library\\bin in Anaconda3-Windows-x86_64\\Lib\\site-packages\\numpy\\core folder because matplotlib needs numpy. with this action, the executable works perfectly on my laptop but not for the other users's laptops, it displayed this error :\n\nSystem Error\nThe program can't start because mkl_core.dll is missing from your computer. Try reinstalling the\nprogram to fix this problem.\n\nAnd then i putted the dll files in some folders in the executable's lib folder and now it displays this error :\n\nSystem Error\nThe program can't start because libiomp5md.dll is missing from your computer. Try reinstalling the\nprogram to fix this problem\n\nI don't understand whey these errors and how to solve this issue. I know that there is no error in my scripts (myapp.py and setup.py ) because it works well in my laptop.\nHave you any idea please ?\nThank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":195,"Q_Id":53302170,"Users Score":0,"Answer":"I am wondering if you properly assigned access permissions to the files. If you put them manually they may get your user's permissions and hence appear to be missing (inaccessible) for any other user.","Q_Score":0,"Tags":"python,matplotlib,kivy","A_Id":53302478,"CreationDate":"2018-11-14T14:10:00.000","Title":"Missing .dll files in an executable kivy application (matplotlib)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have wrote an Android library and build an aar file. And I want to write a python program to use the aar library. Is it possible to do that? If so, how to do that? Thanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":305,"Q_Id":53347795,"Users Score":0,"Answer":"There is no way to include all dependencies to your aar file. So According to the open source licenses you can add their sources to your project.","Q_Score":3,"Tags":"android,python,aar","A_Id":53348357,"CreationDate":"2018-11-17T02:57:00.000","Title":"Import aar of Android library in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So basically I have this main window with just a bunch of buttons on it. I am hiding the default header by using self.set_decorated(False). I want to be able to drag the window around my screen by clicking anywhere that's not a button. Is this possible? I haven't been able to find anything on this except for self.begin_move_drag(self.button_drag, event.x_root, event.y_root, event.time) which I don't really understand.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":192,"Q_Id":53356660,"Users Score":1,"Answer":"hb.props.custom_title = Gtk.Label(label=\" \")","Q_Score":0,"Tags":"python-3.x,gtk3,pygtk","A_Id":53508835,"CreationDate":"2018-11-17T23:48:00.000","Title":"How do I make a window draggable without a header?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have created a Tkinter window in a python script. The script runs perfectly in the python IDLE and generates the GUI. However, when I run this file outside of the IDLE by clicking on it on my Desktop, the terminal responds with ImportError: No module named tkinter. Even though tkinter is installed as its a default module when python is installed. Any help is much appreciated. Im working on python 3.7","AnswerCount":1,"Available Count":1,"Score":-0.3799489623,"is_accepted":false,"ViewCount":9913,"Q_Id":53365915,"Users Score":-2,"Answer":"Make sure your default python , the one that the terminal calls has tkinter installed. \nSo run 'python --version' in the terminal and if that yields 3.7 then your default python is 3.7. \nNow try to import tkinter using that same python version. \nopen the terminal and run python then run import tkinter as tk\nIf that does not yield an error saying that the module was not found then most probably you are running the executable with the wrong permissions.","Q_Score":3,"Tags":"python-3.x,macos,tkinter,module,terminal","A_Id":53365973,"CreationDate":"2018-11-18T22:04:00.000","Title":"ImportError: No module named tkinter. Mac OS Terminal","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am seeing following issue:\nIn [5]: img = open_image(\"2018-09-21_005.hdr\")\nIn [6]: view_cube(img, bands=[29, 19, 9])\nModuleNotFoundError Traceback (most recent call last)\n\/Library\/Frameworks\/Python.framework\/Versions\/3.6\/lib\/python3.6\/site-packages\/spectral\/graphics\/hypercube.py in \n 69 try:\n---> 70 import wx\n 71 from wx import glcanvas\nModuleNotFoundError: No module named 'wx'\nDuring handling of the above exception, another exception occurred:\nImportError Traceback (most recent call last)\n in \n----> 1 view_cube(img, bands=[29, 19, 9])\n\/Library\/Frameworks\/Python.framework\/Versions\/3.6\/lib\/python3.6\/site-packages\/spectral\/graphics\/graphics.py in view_cube(data, *args, **kwargs)\n 176 to accept keyboard input.\n 177 '''\n--> 178 from spectral.graphics.hypercube import HypercubeWindow\n 179\n 180 if not running_ipython():\n\/Library\/Frameworks\/Python.framework\/Versions\/3.6\/lib\/python3.6\/site-packages\/spectral\/graphics\/hypercube.py in \n 71 from wx import glcanvas\n 72 except ImportError:\n---> 73 raise ImportError(\"Required dependency wx.glcanvas not present\")\n 74\n 75 DEFAULT_WIN_SIZE = (500, 500) # Default dimensions of image frame\nImportError: Required dependency wx.glcanvas not present\nI used following command to install wx: \"brew install wxpython\"","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":928,"Q_Id":53369484,"Users Score":0,"Answer":"The problem was related to installation of python package\nUse following command to install by pip :\npip install wxpython\nAnd Use following command to install by conda environment :\nconda install wxpython","Q_Score":4,"Tags":"python,image,hypercube","A_Id":56294778,"CreationDate":"2018-11-19T06:38:00.000","Title":"Unable to use view_cube command due to issue with wx","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I work with Anaconda 5.3.0 and Python 3.7.\nAn application was made and I want to create an executable file with Pyinstaller, the case is that I miss the following error:\n\nException: Cannot find existing PyQt5 plugin directories Paths\n checked:\n C:\/Miniconda3\/conda-bld\/qt_1535195524645\/_h_env\/Library\/plugins","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3148,"Q_Id":53370225,"Users Score":0,"Answer":"In the anaconda command prompt try pip install PyQt5. It solved the issue for me.","Q_Score":1,"Tags":"python,pyqt5,pyinstaller","A_Id":54295293,"CreationDate":"2018-11-19T07:39:00.000","Title":"Error with Pyinstaller & PyQt5 \"Cannot find existing PyQt5 plugin directories\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"After going through quite a pain getting my python setup.py to work with setuptools and the dedicated microsoft VC (Microsoft Visual C++ Compiler Package for Python 2.7) and succesfully compiling my extension on windows 10 it turns out the Maya 2017 included python executable (mayapy) is compiled with a different version, see below.\nc:>python\nPython 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32\nc:>\"Program Files\\Autodesk\\Maya2017\\bin\\mayapy.exe\"\nPython 2.7.11 (default, Dec 21 2015, 22:48:54) [MSC v.1700 64 bit (AMD64)] on win32\nI have Visual Studio 12 installed as well and that seems to be the right compiler version.\nBut how can I tell setuptools to use that version?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":338,"Q_Id":53382295,"Users Score":0,"Answer":"The quick and dirty way is to use to compile the required DLL on the command line using the Command Prompt for the VS2012 x64 Native Tools. The version that matches the mayapy.exe in Maya 2017.\nTo compile your c code use cl. You may need to point to the Python 2.7 include files using \/I.\n\ncl \/DL \/I ..\\include \/I C:\\Python27\\include \n\nBecause the linker might have trouble finding the 'python27.lib' you can link manually as well using \/LIBPATH to point to the Python 2.7 libs directory.\n\nlink \/DLL \/LIBPATH:C:\\Python27\\libs *.obj\n\nThis will give you a DLL and intermediate files matching the compiler for mayapy.exe.\nThe dirty part.\nBuild the extension using python setup.py build. This will give you a module that will import in the regular python interpreter. Remove the 'lib*' directory in the 'build' folder. Copy the '.obj', '.exp' and the dll to the temp folder in your build folder, something like 'temp.win-amd64-2.7\\Release\\\\src'.\nThen run python setup.py build again.\nDirty yes, Quick, once you know what to do...","Q_Score":0,"Tags":"python,c,windows,maya","A_Id":53439019,"CreationDate":"2018-11-19T20:39:00.000","Title":"How can I compile python c extension for the Window 10 Maya 2017 python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I try to add to combobox list of units with superscripts. One of these is cm^-1. How can I put it as text?\nself.cbUnit.addItems([\"unit 1\", \"unit 2\", \"cm-1\"])","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":83,"Q_Id":53435304,"Users Score":1,"Answer":"Found solution. \nself.cbUnit.addItems([\"unit 1\", \"unit 2\", \"cm\\u207B\\u00B9\"])","Q_Score":1,"Tags":"python,pyqt5","A_Id":53435768,"CreationDate":"2018-11-22T16:46:00.000","Title":"How to add superscript in PyQt5 combobox?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Tkinter in python 2.7, and I noticed that sometimes the root window doesn't open until I start the mainloop method.\nI addition, in those cases, when close the window, the program is ending (the root.mainloop is the last line in the code), and in the other cases it's not happening.\nWhy is it happening?","AnswerCount":1,"Available Count":1,"Score":0.6640367703,"is_accepted":false,"ViewCount":541,"Q_Id":53452075,"Users Score":4,"Answer":"The short answer is that it's happening because that is how it was designed to happen.\nNothing happens in tkinter except through the event loop. Even something as simple as the window appearing is the event loop responding to an event. For example, when you create the window (and assuming you don't withdraw it), a \"redraw yourself\" event in effect gets added to the event queue. When you start the event loop, that's one of the first events it processes and the window appears.\nWhen you call mainloop(), that causes the event loop to start processing events. It is designed to start processing events and not return until the root window has been destroyed. That is why the call to mainloop is typically the last line of code in the file, since there's usually nothing else to do once the user has closed the window.\nThe other way to process events is to call update or update_idletasks. update will start the event loop, and return once all pending events have been processed (ie: it doesn't wait for the window to be destroyed). update_idletasks is similar, but only updates \"idle\" events: things scheduled with after, events related to redrawing windows, and a few others. It doesn't process user-generated events like mouse and button clicks.","Q_Score":1,"Tags":"python,tkinter","A_Id":53452166,"CreationDate":"2018-11-23T19:30:00.000","Title":"Why doesn't Tkinter.Tk() open the window right away?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"For a certain game I'm making, I think it would look a lot better if each letter came one by one, rather than all at once. What can I do to do this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":616,"Q_Id":53462742,"Users Score":0,"Answer":"First thought:\nYou could create an animation function:\nThis could be a loop that goes through each of the characters and displays them. The only real problem with this is the interrupt time in the main thread--pygame's--slowing down the rest of the game's logic.\nBetter allternative\nAn alternative would be rendering letters as though they were sprites and moving them on one by one--by setting their motion, this removes the delay.","Q_Score":0,"Tags":"python,pygame","A_Id":53462809,"CreationDate":"2018-11-24T22:01:00.000","Title":"How can I make text in pygame pan letter by letter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have recently installed PyQt4. The installation was successful. Is it good practice to now delete the PyQt4-4.11.4-cp37-cp37m-win_amd64.whl file? Will this prevent me from using pip uninstall PyQt4in the future?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1248,"Q_Id":53528729,"Users Score":2,"Answer":"You could delete the wheel package. It won't prevent you from uninstalling the package. \nIf, however, you need to reinstall the same package again, you will have to acquire the wheel package again, obviously.","Q_Score":2,"Tags":"python,pip,pyqt4","A_Id":53529036,"CreationDate":"2018-11-28T21:56:00.000","Title":"Should I delete .whl installers after packages have successfully been installed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a save function in a program im doing for bubbling\/ballooning drawings. The only thing I can't get to work is save a \"work copy\". As if a drawing gets revision changes, you don't need to redo all the work. Just load the work copy, and add\/remove\/re-arrage bubbles.\nI'm using tkinter and canvas. And creates ovals and text for bubbles. But I can't figure out any good way to save the info from the oval\/text objects.\nI tried to pickle the whole canvas, but that seems like it won't work after some googeling.\nAnd pickle every object when created seems to only save the object id. 1, 2 etc. And that also won't work since some bubbles will be moved and receive new coordinates. They might also have a different color, size etc.\nIn my next approach I'm thinking of saving the whole \"can.create_oval( x1, y1, x2, y2, fill = fillC, outli....\" as a string to a txt and make the function to recreate a with eval()\nAny one have any good suggestion on how to approach this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":597,"Q_Id":53571619,"Users Score":1,"Answer":"There is no built-in way to save and restore the canvas. However, the canvas has methods you can use to get all of the information about the items on the canvas. You can use these methods to save this information to a file and then read this file back and recreate the objects. \n\nfind_all - will return an ordered list of object ids for all objects on the canvas\ntype - will return the type of the object as a string (\"rectangle\", \"circle\", \"text\", etc)\nitemconfig - returns a dictionary with all of the configuration values for the object. The values in the dictionary are a list of values which includes the default value of the option at index 3 and the current value at index 4. You can use this to save only the option values that have been explicitly changed from the default.\ngettags - returns a list of tags associated with the object","Q_Score":1,"Tags":"python,python-3.x,canvas,tkinter,pickle","A_Id":53572078,"CreationDate":"2018-12-01T14:09:00.000","Title":"Saving objects from tk canvas","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"What tools should be used to create GUI app in python? I imagine something similar to WinForms or WPF. It would be best if there were tools to design app visually. I think something similar to Java FX\/Swing will do, too.\nI tried tkinter framework, but it was impossible to use, it's very different from WinForms for example. In my app I will need canvas or something to draw few figures.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":200,"Q_Id":53591060,"Users Score":1,"Answer":"I would recommend wxPython and wxGlade. The later includes a tutorial that should get you started with wxPython as well.\nDepending on the type of drawing, matplotlib might be an option. wxGlade includes examples for this. Otherwise have a look at the link posted by wich or at the wxPython demo, whether the drawing capabilities match your requirements.","Q_Score":0,"Tags":"python,winforms","A_Id":53599507,"CreationDate":"2018-12-03T09:45:00.000","Title":"Python gui application tools?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have few questions about programming a game (3d or 2d) with a python language and Unity game engine\nCan we make a game with python in Unity game engine?\nif yes how?\nplease share basic tutorials about this topic.","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":29060,"Q_Id":53618324,"Users Score":3,"Answer":"Currently there is not a way to directly use python within unity. You can use an interpreter that will call functions. This can only take you so far beyond the built in functions that unity currently used. \nSince you already know Python and probably learned Java in school or have at least seen it. C# is a very simple language to pick up that is very versatile so I would recommend learning it.\nOtherwise you can go Piglet or Arcade Game Engine. These engines are built for Python, Piglet does not need outside libraries \/ dependencies. You could also go with a Blueprint style coding method, both are available with unity and unreal.","Q_Score":3,"Tags":"python,python-3.x,unity3d","A_Id":53618520,"CreationDate":"2018-12-04T17:18:00.000","Title":"can we make a game with python in unity?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to play an audio while the Kivy application is loading while running on Android devices? That is play an audio while the presplash image, defined in the buildozer.spec file, is displayed on the screen.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":224,"Q_Id":53650445,"Users Score":1,"Answer":"There is no prebuilt way to do it. It would be possible to achieve by editing the Java code managing app loading, in the same place that the presplash image is set up.","Q_Score":0,"Tags":"android,python,audio,kivy,buildozer","A_Id":53657667,"CreationDate":"2018-12-06T11:29:00.000","Title":"Kivy & Buildozer: How to play audio while Android Application is loading?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I recently ported an installer from an unmaintainable and complicated batch script to python and thought it would be a nice idea to have a neat graphical front end for the console installer. I decided to use Kivy because I used it for some pet projects at home and I and UI designing went nice and fast.\nHowever, what I did not know until recently, is that Kivy seems only to work with OpenGL 2.0. Unfortunately our company's software is frequently installed on virtual machines and their virtualized graphics adapters often don't support OpenGL that is newer than 1.0 or 1.1 (VirtualBox for example). This prevents the Kivy app from starting or if it does start, doesn't render correctly.\nI searched the internet for a way to get Kivy to work without OpenGL 2.0. Some posts on github and I think on reddit suggested to use Angle instead of sdl2 or switching to glew. I tried the suggested solutions but with no success.\nI wonder, is there actually a way to get Kivy apps to work without OpenGL 2.0, like OpenGL 1.1 ?\nI use Python 3.6.4 and Kivy 1.10.1 on Windows as a dev and target system.","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":2371,"Q_Id":53671970,"Users Score":3,"Answer":"Kivy targets OpenGL ES 2.0 as a minimum version. Note that OpenGL ES is not the same as OpenGL, it's closer to OpenGL 3.0.\nThis is a minimum required version, anything newer should work fine.\nYou can use angle on Windows if you want. I think we do it because it's more stable than relying on Windows OpenGL drivers, but I'm not sure.","Q_Score":7,"Tags":"python-3.x,kivy","A_Id":53675937,"CreationDate":"2018-12-07T14:57:00.000","Title":"Is there a way to use Kivy with OpenGL 1.1?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I know for the Button widget you can use the enter and leave signals to get it to perform actions upon hover over. I want to do the same for the Combobox (I have a dropdown menu I want to be able to access upon hovering over it). However, the enter signal doesn't seem to exist for this. Is there an alternative I could use? Thanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":86,"Q_Id":53677260,"Users Score":0,"Answer":"According to the documentation, the enter signal in the Gtk.Button class is deprecated.\nYou should use the enter-notify-event signal, which belongs to the Gtk.Widget class and it is inherited by all its childs, Gtk.ComboBox included.","Q_Score":0,"Tags":"python,gtk3","A_Id":53677991,"CreationDate":"2018-12-07T21:53:00.000","Title":"Python GTK 3+: Is there a \"enter\" like signal I can use for Combobox?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I have used the place_forget command in order to hide a button when switching frames, how can I bring the button back at a later stage in the program? Or would I have to recreate it?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1064,"Q_Id":53776905,"Users Score":3,"Answer":"You will need to call place again. You do not have to recreate the widget as long as you keep a reference to the original widget.","Q_Score":0,"Tags":"python,button,tkinter","A_Id":53788316,"CreationDate":"2018-12-14T09:33:00.000","Title":"Tkinter - place_forget command","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using Windows 10\nI wish to use wxPython as a GUI for my Python3 programs. I am using SublimeText 3 to write and launch my scripts\nWhen I launch my script from within Sublime the program runs but the wxPython window does not open. It opens as expected if I run the program from the cmd prompt.\nMy internet searching leads me to believe that Sublime is suppressing the window from opening and that this behavior can be changed within Sublime's settings, but I can only find instructions for Sublime Text 2.\nHow can I prevent Sublime Text 3 from suppressing the wxPython window?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":257,"Q_Id":53791719,"Users Score":0,"Answer":"If you are using Windows, the correct extension would be *.pyw. Change the name of your WX Python script changing the extension \".py\" for \".pyw\" and try to run it from ST3.\nGood luck.","Q_Score":1,"Tags":"python,python-3.x,wxpython,sublimetext3","A_Id":58882531,"CreationDate":"2018-12-15T10:58:00.000","Title":"Using wxPython within Sublime Text 3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I used sudo apt-get install python3.6-tk and it works fine. Tkinter works if I open python in terminal, but I cannot get it installed on my Pycharm project. pip install command says it cannot find Tkinter. I cannot find python-tk in the list of possible installs either. \nIs there a way to get Tkinter just standard into every virtualenv when I make a new project in Pycharm?\nEdit: on Linux Mint\nEdit2: It is a clear problem of Pycharm not getting tkinter guys. If I run my local python file from terminal it works fine. Just that for some reason Pycharm cannot find anything tkinter related.","AnswerCount":6,"Available Count":1,"Score":-0.0333209931,"is_accepted":false,"ViewCount":58399,"Q_Id":53797598,"Users Score":-1,"Answer":"Python already has tkinter installed. It is a base module, like random or time, therefore you don't need to install it.","Q_Score":14,"Tags":"python,tkinter,pycharm","A_Id":53797731,"CreationDate":"2018-12-15T21:55:00.000","Title":"how to install tkinter with Pycharm?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using Pygame with sprites and animations. I have the sprites but I need to put the Pycharm project into the folder that all the sprites are in but whenever I move the project it takes it out of my Pycharm folder and puts it in the folder with sprites which then means when I open up Pycharm I have to go to File Explorer and find the project that uses the sprites and then make a new Pycharm folder to open it. can I get the project in with the sprites and in the pycharm folder.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":280,"Q_Id":53831211,"Users Score":0,"Answer":"Moving the sprites into the project folder should work.","Q_Score":1,"Tags":"python,pygame,pycharm","A_Id":53868896,"CreationDate":"2018-12-18T10:39:00.000","Title":"Moving A Pycharm Project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My system will goes to sleep if there is no keyboard and mouse action for more than 5 min ( I cannot make any changes in sleep time. For security reason it is set to 5 min). \nI am using pyautogui for automation. Pyautogui works in background based on screen resolution by taking keyboard and mouse control. It is taking more than 5 min in my case to complete the execution. After 5 min it going to sleep and keyboard interrupt is generated.\nPlease let me know is there any solution for these.","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":1488,"Q_Id":53845031,"Users Score":1,"Answer":"One thing I've found to work is running the pyautogui script in a virtual machine, which lets it use the virtual mouse & keyboard. This has the twofold benefit of a. allowing you to do other work while the script is running, and b. the virtual mouse & keyboard are not interrupted with the computer going to sleep.\nHope this helps!","Q_Score":2,"Tags":"python,python-3.x,automation,python-2.x,pyautogui","A_Id":58416808,"CreationDate":"2018-12-19T05:21:00.000","Title":"Automation using Pyautogui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My system will goes to sleep if there is no keyboard and mouse action for more than 5 min ( I cannot make any changes in sleep time. For security reason it is set to 5 min). \nI am using pyautogui for automation. Pyautogui works in background based on screen resolution by taking keyboard and mouse control. It is taking more than 5 min in my case to complete the execution. After 5 min it going to sleep and keyboard interrupt is generated.\nPlease let me know is there any solution for these.","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1488,"Q_Id":53845031,"Users Score":0,"Answer":"If you are waiting for some action to be completed, you can simulate a minor mouse movement in a new thread. This will prevent system from sleep.","Q_Score":2,"Tags":"python,python-3.x,automation,python-2.x,pyautogui","A_Id":53845111,"CreationDate":"2018-12-19T05:21:00.000","Title":"Automation using Pyautogui","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"The height is only two lines after running a file when it is focused. A white rectangle is below and next the console window is below it. When being lost focus , it is covered partial by the console window. How can I get the editor to be bigger?\nThe account I have is free account :(\nI access the page on smartphone","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":24,"Q_Id":53881052,"Users Score":0,"Answer":"PythonAnywhere doesn't really work that well on smartphones right now -- only on desktop computers and iPads.","Q_Score":0,"Tags":"pythonanywhere","A_Id":53905664,"CreationDate":"2018-12-21T07:54:00.000","Title":"File editor is too small at files in pythonanywhere","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a script for automatizing some tasks at my job. However, I need to make my script portable and try it on different screen resolution. \nSo far right now I've tried to multiply my coordinate with the ratio between the old and new resolutions, but this doesn't work properly.\nDo you know how I can convert my X, Y coordinates for mouse's clicks make it works on different resolution?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1023,"Q_Id":53900943,"Users Score":1,"Answer":"Quick question: Are you trying to get it to click on certain buttons? (i.e. buttons that look the same on every computer you plug it into) And by portable, do you mean on a thumb drive (usb)?\nYou may be able to take an image of the button (i.e. cropping a screenshot), pass it on to the opencv module, one of the modules has an Image within Image searching ability. you can pass that image along with a screenshot (using pyautogui.screenshot()) and it will return the (x,y) coordinates of the button, pass that on to pyautogui.moveto(x,y) and pyautogui.click(), it might be able to work. you might have to describe the action you are trying to get Pyautogui to do a little better.","Q_Score":2,"Tags":"python-3.x,resolution,pyautogui","A_Id":54048053,"CreationDate":"2018-12-23T03:14:00.000","Title":"Pyautogui mouse click on different resolution","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am researching lot of in kivy for payment gateway and wallet like concept and how its feasible, secure and implementation level for android and ios application. Anyone knows its production level implementation please let me know","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":801,"Q_Id":53901798,"Users Score":1,"Answer":"You can integrate with any Payment Gateway using documentation given on their Api's documentation page.Google pay and many other have their documentation on How to implement it on any platform (Android,Ios,Web). You can check https:\/\/developers.google.com\/pay\/india\/api\/","Q_Score":4,"Tags":"python,python-3.x,kivy,kivy-language","A_Id":54264649,"CreationDate":"2018-12-23T06:52:00.000","Title":"How to implement concept like payment gateway and wallet in kivy android and ios","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When i try to install tkinter with the command pip install tkinter in windows 10 I get this error:\n\nCould not find a version that satisfies the requirement tkinter(from versions: )\n No matching distributions found for tkinter","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":30709,"Q_Id":53910070,"Users Score":3,"Answer":"use pip install tkintertable it also imports Tkinter","Q_Score":3,"Tags":"python,tkinter","A_Id":60260425,"CreationDate":"2018-12-24T06:46:00.000","Title":"how to install tkinter using pip in windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to detect if two widgets that I have created (a widgets.Text field and a widgets.SelectMultiple Field) are already linked without creating a separate boolean variable to keep track, as that can get messy. I wasn't sure if there is a built-in method like .isLinked already available? I haven't found anything outside of the link\/unlink for handling this. I also have not looked at the Link object that is returned, but not sure if that will help me in this case.\nI have a widgets.SelectMultiple list, that I will call the selection field, that contains over a hundred different entries. To keep track of the items that the user has selected, I have a separate widgets.Text box that stores the results. I have linked these two widgets so that when items are selected, they appear in the results field. When these items are link-ed, everything's great and synced up. However, there are instances where I'm going to unlink the widgets. For example, I have a custom widgets.Text search field that shrinks the list in the widgets.SelectMultiple based on user input to narrow down the results. During the state of the user interacting with the search field, I want to unlink so I don't have any exceptions thrown, and then link again once the user has completed their search and chosen their item. At any point, the user can also choose to mouse-select an entry, even if they are in the middle of a search, so this is why I would like to check if we are linked or not (will need to manually add it to the widgets.values list of the results field if unlink-ed.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":23,"Q_Id":53948283,"Users Score":0,"Answer":"Actually I should have just dug a little deeper. The Link object returned is exactly what I need. It returns None if the link is non-existent, so I can just use that. Thanks for entertaining me Stack Overflow...","Q_Score":0,"Tags":"python,python-2.7,jupyter-notebook,ipython","A_Id":53948575,"CreationDate":"2018-12-27T16:48:00.000","Title":"Is there a way to check if two Jupyter iPython widgets are already linked?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"While writing a kivy app that uses java api calls through pyjnius, can you run the code on your system's OS like windows, Linux etc. to see how far you've gone and test your progress OR you can only test the code on an android device","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":137,"Q_Id":53984983,"Users Score":2,"Answer":"Pyjnius works on the desktop, but the Android APIs are not available there so you can't test your Android API calls that way. For this reason, there's not much reason to install pyjnius on the desktop if you're targeting Android.","Q_Score":0,"Tags":"android,python,mobile,kivy,pyjnius","A_Id":53992570,"CreationDate":"2018-12-31T07:54:00.000","Title":"Running pyjnius on Windows, Linux etc","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to bind\/map a global hotkey, which also works when application window is minimized and user not focused on it. I'm looking for a cross-platform way. Can I do this using Tkinter?","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1252,"Q_Id":53995857,"Users Score":3,"Answer":"I want to bind\/map a global hotkey, which also works when application window minimized and not focused on it. I'm looking for a cross-platform way.\n\nYou can't do that with tkinter. Tkinter has no support for this.","Q_Score":2,"Tags":"python,tkinter,cross-platform,global-hotkey","A_Id":53997224,"CreationDate":"2019-01-01T13:32:00.000","Title":"How bind\/map global hotkey when using Python Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating a time conversion app using python. So what I want to implement in the project is that, when the user change the combobox, the value automatically change\/converted depending on the units. For example, I have a base value of 1 second, if I select millisec, the value will be converted. If I select again a unit under combobox, the base number \"1\" will be converted instead of the value in millisec.\nIs there a good logic about this? been trying things like when the user click the combobox, last value will be stored. But again, I want the base value to be converted.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":59,"Q_Id":54015337,"Users Score":1,"Answer":"I'm assuming the 'value' is inputted by some means such as an input box or etc. I am also assuming that you are trying to display the result in that same input box (or whatever component you are using).\nIf this is the case, you could hook onto when the value is changed and store the value it is changed to in some variable - your base value. When you programatically update the input box with the converted value, make sure the component is updated but the hooked function is not called. If this is not supported in whatever UI framework you are using, then you can make use of boolean flags:\n\nDeclare a flag which shall store whether or not the base value has been entered (initially false)\nDeclare a variable to store the base value\nHook onto when the component is changed.\nWhen the component is changed, if the flag is false, store the value of the component in that base value variable you declared and set the flag to true. Otherwise, if the flag is true, don't do anything.\nDo your calculations, etc and update the component programatically \nOnce you have updated the component programatically, reset the flag to false.","Q_Score":0,"Tags":"python,time","A_Id":54015435,"CreationDate":"2019-01-03T01:40:00.000","Title":"Automatic Conversion Depending on Units in ComboBox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been programming a Python desktop app in Python 3.7 with tkinter. Many of my friends have said using it as an mobile application will get more users. I have been working with sklearn and different modules in Python to run along side the GUI. Is it possible to call that script in Kotlin?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2094,"Q_Id":54021771,"Users Score":1,"Answer":"Yes it is possible.\nPython has REPL, it's own interactive interpreter and as it turns out Kotlin has a REPL as well. You'll still have to do research and find the interfaces to use with your front end.\nNOTE: In Intellij Idea Kotlin has REPL. I'm afraid I don't know if it's the same with other IDEs. \nIf it's only for Android, you can use QPython.\nQPython is a script engine which runs Python programs on android devices.","Q_Score":1,"Tags":"android,python-3.x,kotlin","A_Id":54022074,"CreationDate":"2019-01-03T11:52:00.000","Title":"Is there a way to call Python script inside of a Kotlin project?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to set the border color for the pygame window, not the background, but the area were the close, maximise, and minimize buttons are","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":241,"Q_Id":54048841,"Users Score":0,"Answer":"That cannot be set. It is system specific. Unless of course, you want to remove it altogether and make your own version. \u2013","Q_Score":0,"Tags":"python,python-3.x,windows,pygame","A_Id":66067818,"CreationDate":"2019-01-05T03:55:00.000","Title":"pygame on windows set window border color and\/or window border text color","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In windows, we can use pyinstaller to build python code like Tkinter to an exe file for user use, How to in Linux, I don't like user to do it in terminal to run the code, Any advice? Thanks,","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":85,"Q_Id":54058547,"Users Score":1,"Answer":"Linux comes with Python preinstalled, so on Linux you can just prepend a shebang #! line with the path to the interpreter to a Python script and then set the executable bit +x on the file with chmod. Then you can run it by name or click on it in the file explorer application.\nIf you need more than one file, you can use the zipapp module to group a folder together into a single executable .pyz archive with the shebang.","Q_Score":0,"Tags":"python,linux,user-interface,tkinter","A_Id":54058567,"CreationDate":"2019-01-06T04:08:00.000","Title":"How to build a package for Tkinter like exe in window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I just made a tkinter widget on python. I wish to pass it to my friend who has python but not tkinter library.\nHe is right now receiving a module not found error","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":215,"Q_Id":54103741,"Users Score":2,"Answer":"This assumes that your terminal is in the current directory where the project is located.\nYou have to run pip freeze on terminal to list the libraries installed and save the output on requirements.txt. On unix based OSes, you can run pip freeze > requirements.txt, making the libraries saved on requirements.txt automaticallly. To install those libraries coming from the requirements.txt you can run pip install -r requirements.txt.\nMuch better if you have a background in using Virtual Environments.","Q_Score":0,"Tags":"python,import,module,automation,package","A_Id":54104164,"CreationDate":"2019-01-09T05:29:00.000","Title":"How to package all the required libraries with the python program so that it can run in all systems?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"While I was testing an uix example of Kivy (modalview.py), the cursor suddenly disappeared while over the application window. When I move out of the window, the cursor reappears. The cursor disappears only when it is inside the Kivy window, but I can still interact with the widgets (i.e. buttons, ...).\nSince then, I have this behaviour with any Kivy application and only these applications.\nI have reinstalled Python and Kivy, I have restarted my computer, updated my touchpad and GPU drivers (even though there should be absolutely no reason, but I'm desperate...), nothing changes.\nAny suggestion?\nThanks!\nI'm working with:\nWindows 10\nPython 3.7.2\nKivy 1.10.1","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":178,"Q_Id":54170061,"Users Score":1,"Answer":"The solution (thanks to inclement) is to simply check the Kivy settings.\nThe best way to access them (to me) is launching the \"Settings.py\" in \"Lib\\site-packages\\kivy\\uix\".\nFrom there, the \"show\/hide cursor\" can be toggled on.","Q_Score":1,"Tags":"python,windows,window,kivy","A_Id":54170324,"CreationDate":"2019-01-13T14:55:00.000","Title":"kivy application cursor don't show when over the window","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Recently, I made a pygame game. I want to show it to my friends. But unfortunately, I cant make an executable file, only a .py file. I have tried to use tools such as py2exe which might not support Python 3.6 and pyinstaller. I think pyinstaller may be useful, and I can also make an exe successfully but it didn't work at all. It just showed it couldn't open the sound file which is already in the same file. \nI have tried two ways to load files firstly, just load the path then the exe converted shows it can't open the file which is already in the same path with the exe.\nSecondly, I use the os.path which the exe showed it cant open .....\/temp\/... which is a long path but my computer doesn't have this folder at all. \nI am a new guy to learn python. I have searched for a day and can't make it work. Can you help me?","AnswerCount":5,"Available Count":1,"Score":0.0399786803,"is_accepted":false,"ViewCount":26594,"Q_Id":54210392,"Users Score":1,"Answer":"I too had the same problem and spent days looking through google. Today finally I realised what was the problem.\nBefore trying to convert it, remember to install Pygame via the Terminal as well. Just type in \"pip install pygame\"","Q_Score":14,"Tags":"python,pygame","A_Id":67803799,"CreationDate":"2019-01-16T04:22:00.000","Title":"How can I convert pygame to exe?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I admit at the beginning that I am a novice python developer, so I apologize in advance for questions that may seem stupid.\nI prepared python script with GUI (Tkinter), which use plenty external libraries. I'm working on Windows. Currently, I share my program in the form of an .exe file for Windows users, who do not have Python installed on their PCs. Everything works.\nRecently I received a query if I can compile my code on an executable file that is usable for Mac users. \nI have a number of questions related to this:\n1) can I do it from a PC with Windows or i need Mac? I guess I have to have access to a Mac.\n2) will my code work on mac without any editing? What about external libraries? Do you know any easy way to copy\/paste my \"python with used libraries\" from Windows to Mac?\n3) will I create a executable file in the same way as Windows, I mean I will use a \"Pyinstaller\" type library?\nThank you in advance for your help.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5196,"Q_Id":54220377,"Users Score":0,"Answer":"You shouldn't have any trouble. Just make sure the version of python is the same, as I believe the default on mac is 2.7.\nAlso, python scripts aren't compiled, rather interpreted, so making the file executable doesn't really mean it's a binary file in this case. I'm not sure what method you used to run python on a computer that doesn't have python on it, as there are a few, but if you can manage to do that on windows, it should work on mac.","Q_Score":1,"Tags":"python,python-3.x,windows,macos,exe","A_Id":54220554,"CreationDate":"2019-01-16T15:30:00.000","Title":"How to create executable file on mac from python script developed on windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can i use online python IDEs to work with GUI code. I am working in Kivy framework to build GUI.\n I have tried Codeenvy , and some other online IDEs. But i couldnt able work with GUI there.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":77,"Q_Id":54230051,"Users Score":3,"Answer":"Kivy is a graphical framework for the desktop, using SDL2 as a backend in most cases. It has no way to run in your browser.","Q_Score":0,"Tags":"python-3.x,kivy","A_Id":54262456,"CreationDate":"2019-01-17T06:17:00.000","Title":"How to use Python GUI online?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Every time I run my python game, I get an annoying alert in the console saying:\nHello from the pygame community. https:\/\/www.pygame.org\/contribute.html\nHow do I delete this?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":6812,"Q_Id":54246668,"Users Score":3,"Answer":"Mac OS\n\nNavigate to: \/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python3.7\/site-packages\/pygame\/ and open _init_.py\n\n(hint: this is the Library for your Macintosh HD, not your users library)\n\nscroll down to the bottom of the page, then delete the line saying:\nprint('Hello from the pygame community ... )\n\n\nIf you can't find your Library folder, then you probably still have the default settings set to hide it.\n\ntype defaults write com.apple.finder AppleShowAllFiles YES; in the terminal \nhold option + right click on finder and click relaunch.\n\n\nWindows\n(this is untested, if you have problems let me know so I can update)\n\nNavigate to: C:\\Python\\Lib\\site-packages\\pygame and open _init_.py\nscroll down to the bottom of the page, then delete the line saying: print('Hello from the pygame community ... )","Q_Score":9,"Tags":"python,python-3.x,python-2.7,pygame","A_Id":54246669,"CreationDate":"2019-01-18T01:40:00.000","Title":"How do I delete the \"Hello from the pygame community\" console alert while using pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a GUI program where the user can draw on a canvas in Tkinter. What I want to do is that I want the user to be able to draw on the canvas and when the user releases the Mouse-1, the program should wait for 1 second and clear the canvas. If the user starts drawing within that 1 second, the canvas should stay as it is. \nI am able to get the user input fine. The draw function in my program is bound to B1-Motion.\nI have tried things like inducing a time delay but I don't know how to check whether the user has started to draw again.\nHow do I check whether the user has started to draw again?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":129,"Q_Id":54276610,"Users Score":0,"Answer":"You can bind the mouse click event to a function that sets a bool to True or False, then using after to call a function after 1 second which depending on that bool clears the screen.","Q_Score":1,"Tags":"python,python-3.x,tkinter,tkinter-canvas","A_Id":54276767,"CreationDate":"2019-01-20T12:48:00.000","Title":"How to wait for some time between user inputs in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm attempting to create a back end framework to interact with hardware over a serial connection. I need to be able to specify exactly how these hardware modules will interact without recompilation and running on a system with limited resources.\nI already have the cpp code that is being re-used that interacts with the hardware and has the broad functionality to send messages to the devices. \nRun-time impact is a serious consideration and it is running on a very limited arch distro that we don't want to change too much for hardware reasons.\nIt would make the most sense to me to interface with a scripting language that can be easily generated to have a set of references to the cpp base that can be loaded on command. (Sort of like a plugin system)\nPython - is a really good option but I have almost no experience working with embedded python, I have looked into it and I guess where I might be confused is how the interpreted script would link to functionality in the original program without something like pybind11 and embedded python both working together. Binder certainly has a appeal. No Boost please - maybe a little.\nLUA - is a robust option that is well tested but a little more difficult to generate on command. LuaBridge also has the functionality that I desire. Biggest concern is run time impact but I'm not an expert of course.\nJust make the whole thing in cpp and load libraries like a regular person - solid option but likely the most difficult to generate and run syntax checks on easily.\nMake the entire thing in a scripting language and get rid of the overhead of a compiler - I mean technically this is a option\nThese of course aren't all of the options but this is by far out of my area of expertise and I think it would be beneficial to discuss.\nI would really like to know what I should spend my time researching. I have spent far too much time already looking into pybind and I find myself not being able to sleep easy at night.\nIdeally this workflow would run somewhat like this:\nOn the main Controller :\n\nInterface program is run (cpp)\nInterface program does diagnostics and checks module status (already done)\nInterface checks for run script to execute module functionality\n\nThe Script :\n\nGenerated from some source\nRuns tests to verify generation does not have syntactical mistakes\nGets moved into a folder where the Interface program can grab it (In a \"totally\" safe way) I'm kidding I know the issues with that setup but we aren't considering it at this moment\n\nThat was super long and I'm sorry I'm just very lost and out of my comfort zone.\nYeah I'm sorry I didn't clarify why generated code was important. We built a very simple top level gui to interact with the hardware and that needs to be translated into a script to interact with the main interface for the controller.\nAnother option I came up with last night:\nWrite a very simple custom scripting langauge that I can parse on the cpp side and link that way","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":106,"Q_Id":54285876,"Users Score":0,"Answer":"If you are generating a script, you can probably simplify things to a simple byte code that gets interpreted. Then you don't have to mess with parsing or syntax validation. Each \"instruction\" can be a simple opcode followed by zero or more operands, where each operand will be an integer, float or string (and any other primitive data types that your hardware supports\/needs). You can use something like msgpack for encoding and decoding instructions compactly. \nIf that model works, you can gradually add tools on the developer side, such as a minimal assembler, or even a script interpreter that generates the byte code and thus avoids any complexity within your constrained hardware environment.","Q_Score":1,"Tags":"python,c++,c,lua","A_Id":54352053,"CreationDate":"2019-01-21T08:25:00.000","Title":"What is a good way to generate code to interface with a running cpp application that doesn't require a recompile?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use canvas.create_rectangle() to draw a rectangle and assign the drawn item to a specifier. But after I delete the item using canvas.delete(specifier), I can still run canvas.delete(specifier) successfully without causing error. May I know what is the reason behind this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":82,"Q_Id":54287094,"Users Score":3,"Answer":"There's no way to really know why? since that's not documented anywhere (that I know of).\nIt's just a design decision made by the authors of tkinter: i.e. It is not considered an error if no items match. My guess is that since the intent is to get rid of something, whether or not it was there beforehand isn't important. \nIf knowing whether it is or not does matter in your situation, you could use the Canvas.find_all() method first and see if the list it returns is empty.","Q_Score":0,"Tags":"python,tkinter","A_Id":54287618,"CreationDate":"2019-01-21T09:41:00.000","Title":"What does canvas.delete() do?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a very specific question. \nI have a tkinter button. Each time I click it I get a pop-up window with an Entry box. Enter a text and press enter I can change the text of this button. I can do it as many time as the as I want. \nNow the question is:\ncan I make the button text to have different color and font size?\nSay the original button text is \"btn 1\". The first time I click it. The text becomes \"btn 1\\nFirstClick\". The second time the text is \"\"btn 1\\nFirstClick\\nSecondClick\".\nI have all the code worked out as I wanted. But now I want \"FirstClick\" to be in Red and \"SecondClick\" to be in Green\".\nIs that possible? I googled and can't find the answer.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":184,"Q_Id":54298498,"Users Score":0,"Answer":"You cannot use multiple fonts or colors in a single button. Your only option would be to create a custom widget that looks and behaves like a button, but which is implemented with a Text or Canvas widget. Those two widgets allow you to use multiple colors and fonts at the same time.","Q_Score":0,"Tags":"python,button,tkinter","A_Id":54299033,"CreationDate":"2019-01-21T22:14:00.000","Title":"Tkinter: Use different font (color, size, etc.) for the text within the same button?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I found this rather annoying bug and I couldn\u2019t find anything other than a unanswered question on the opencv website, hopefully someone with more knowledge about the two libraries will be able to point me in the right direction.\nI won\u2019t provide code because that would be beside the point of learning what causes the crash.\nIf I draw a tkinter window and then root.destroy() it, trying to draw a cv2.imshow window will result in a X Window System error as soon as the cv2.waitKey delay is over. I\u2019ve tried to replicate in different ways and it always gets to the error (error_code 3 request_code 15 minor_code 0).\nIt is worth noting that a root.quit() command won\u2019t cause the same issue (as it is my understanding this method will simply exit the main loop rather than destroying the widgets). Also, while any cv2.imshow call will fail, trying to draw a new tkinter window will work just fine.\nWhat resources are being shared among the two libraries? What does root.destroy() cause in the X environment to prevent any cv2 window to be drawn?\nDebian Jessie - Python 3.4 - OpenCV 3.2.0","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":269,"Q_Id":54314386,"Users Score":0,"Answer":"When you destroy the root window, it destroys all children windows as well. If cv2 uses a tkinter window or child window of the root window, it will fail if you destroy the root window.","Q_Score":0,"Tags":"python-3.x,opencv,tkinter,cv2","A_Id":54315569,"CreationDate":"2019-01-22T18:26:00.000","Title":"tkinter.root.destroy and cv2.imshow - X Windows system error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a script that uses PyWinAuto to do some UI automation, and it works, but actions like toggling checkboxes, locating a text box and one of my functions which uses print_control_identifiers are slow (or slower than a human doing the same thing).\nFrom what I understand of how it works, this is due to recursive searches through the windows controls. I'm trying to limit the depth that I have to go to when calling print_control_identifiers, I think my main issue is the \"best match\" lookup that occurs when doing an action on an item. I'm currently trying to use the suggested IDs in an attempt to speed this up.\nAny tips as to speeding up execution?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":330,"Q_Id":54326634,"Users Score":1,"Answer":"child_window(..., control_type=\"...\") performs search faster because preliminary filtering by control_type doesn't require inter-process communication as well as class_name.\nbest_match algorithm can be improved in general (I suspect it has N^3 complexity). This work is not started, I'd be happy to discuss any help.","Q_Score":1,"Tags":"optimization,python-3.7,pywinauto","A_Id":54327145,"CreationDate":"2019-01-23T11:50:00.000","Title":"Optimising Pywinauto","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to to use pdfkit in python to generate pdf from string . But its not working . But then I get the following error :-\nOSError: No wkhtmltopdf executable found: \"b''\"\nI am using ubuntu 16 and python3.6.6\nI installed the wkhtmltopdf by using sudo apt-get wkhtmltopdf and tried implementing the pdfkit again , but then I get the error COULD NOT CONNECT THE X DISPLAY . \nI also tried putting export DISPLAY=:0 in environment, but still getting the error \nCOULD NOT CONNECT TO DISPLAY 0","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":91,"Q_Id":54339662,"Users Score":0,"Answer":"you need to do export DISPLAY=localhost:10.0","Q_Score":0,"Tags":"python-3.x,wkhtmltopdf,pdfkit","A_Id":56264701,"CreationDate":"2019-01-24T05:03:00.000","Title":"Getting Error Could Not Connect to display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a utility to start up a django server process that outputs its logs to a TextCtrl in a wxpython window. Unfortunately, a couple different approaches have led to weird issues where the operating system (OSX in this case) crashing the program with complaints about \"Illegal Instruction\" after a few successful log entries.\nI'm currently doing this by implementing a logging.Handler subclass that posts events to wx that contain the logging records to be shown in the window. Is there a better approach?\nThanks!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":81,"Q_Id":54347547,"Users Score":1,"Answer":"wxPython requires it to be the main thread, so I am guessing that is the likely root cause of your issue. You have a couple of good approaches to try though.\nFirst you could launch the Django server process as a thread from your wxPython program. Then you can use wxPython's thread-safe methods (wx.CallAfter, wx.PostEvent) to communicate with the UI.\nOr you could just launch Django separately and log to a file. Then launch wxPython and have it basically tail the log file.","Q_Score":0,"Tags":"django,wxpython","A_Id":54406886,"CreationDate":"2019-01-24T13:15:00.000","Title":"Django logging to wxpython window?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have an application engine where in-program communication is done using PyPubSub.\nPlanned is a somewhat responsive GUI that e.g. enables\/disables widgets based on the model state. This would be implemented using wxPython.\nAs wxPython has as an own pubsub lib (which is PyPubSub) that works across the GUI, question is: how to maintain the MVC model.\nIs it possible (and more importantly: does it make sense) to mix the two messaging systems while maintaining the MVC pattern? E.g. to keep these two messaging systems separate while enabling the GUI having subscribers to the topics of the engine?\nOr shall I just use the model's (that is, the app engine's) pubsub within the GUI and not use the wxPython built-in one?\nAny help is appreciated on this rather conceptual question.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":438,"Q_Id":54361345,"Users Score":2,"Answer":"Summary (by author of pypubsub): if you import from pypubsub instead of wx.lib.pubsub, everything will work, you will not have \"two messaging systems\". \nDetails: \nThere is nothing in the wx package that actually uses wx.lib.pubsub; the latter is still in wx.lib only for legacy reasons (see below), and it is entirely your choice whether you want to make use of publish-subscribe in your wxPython application. \nHistory of pypubsub\/wx.lib.pubsub: The wx.lib.pubsub was originally a module developed for wxPython and included in its source code. It was moved out as a standalone library called pypubsub (over 10 years ago!), since nothing in wxPython depended on it, and vice versa. For backwards compatibility, wx.lib.pubsub was kept alive as a specific \"release\" of the standalone pypubsub (for example, wxPython 3 used pypubsub 3.3). However the latest wxPython (4.0.4) has deprecated its wx.lib.pubsub: you should instead install standalone pypubsub directly from pip install or github, and use from pubsub import pub (instead of from wx.lib.pubsub import pub).\nIf you can, you should use wxPython 4.0.4, Python 3.7, and pypubsub 4.0.0 (4.0.1 will be coming out soon and support keyword-only args).","Q_Score":0,"Tags":"wxpython,publish-subscribe,pypubsub","A_Id":54385277,"CreationDate":"2019-01-25T08:15:00.000","Title":"mixed use of PyPubSub and wxPython's built-in pubsub module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I want to create an interactive text box in a tkinter GUI, the text box should get the text to wrap to the next line after the length of 30 characters, like it would do using the wraplength=30 attribute in a label widget. I am trying to get it to work using an Entry widget, this is what I am aiming for (apart from the wraplength attribute needs to be changed to something that works in an Entry widget:\nent = Entry(root, width=30, wraplength=30)\nI also need to be able to make the Entry widget taller than one line, is there a way i can do that, for example making it vertically fill a frame (similarly to expand=True making it horizontally fill a frame).\nThank you!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":4245,"Q_Id":54371743,"Users Score":0,"Answer":"but text can't use (show=\"\")","Q_Score":1,"Tags":"python,tkinter","A_Id":69076512,"CreationDate":"2019-01-25T19:33:00.000","Title":"wrap text in an entry widget in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create an interactive text box in a tkinter GUI, the text box should get the text to wrap to the next line after the length of 30 characters, like it would do using the wraplength=30 attribute in a label widget. I am trying to get it to work using an Entry widget, this is what I am aiming for (apart from the wraplength attribute needs to be changed to something that works in an Entry widget:\nent = Entry(root, width=30, wraplength=30)\nI also need to be able to make the Entry widget taller than one line, is there a way i can do that, for example making it vertically fill a frame (similarly to expand=True making it horizontally fill a frame).\nThank you!","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":4245,"Q_Id":54371743,"Users Score":1,"Answer":"The entry widget doesn't support wrapping. If you want to have multiple lines -- even if it's one long line that's wrapped -- you'll need to use either a Text, Label, or Message widget. Only the Text widget supports user input, the other two are strictly for display.\nAs for making the entry widget taller, you can do that with a geometry manager. For example, you can use the sticky option of grid or the fill and expand options of pack. This will make the widget taller, but the text will still just appear as a single line.","Q_Score":1,"Tags":"python,tkinter","A_Id":54372471,"CreationDate":"2019-01-25T19:33:00.000","Title":"wrap text in an entry widget in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use visual studio code for coding (python) and now I have to write a program with pygame for my project and I can't import pygame in visual studio code (I can import it with the python script, it just can't be imported in visual studio code).","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":65104,"Q_Id":54376745,"Users Score":0,"Answer":"Another possible solution is the you could be using VS code in restricted mode.\nmake sure you're in a trusted browser on the app","Q_Score":4,"Tags":"python,visual-studio-code,pygame","A_Id":72452905,"CreationDate":"2019-01-26T08:15:00.000","Title":"How to import pygame in visual studio code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use visual studio code for coding (python) and now I have to write a program with pygame for my project and I can't import pygame in visual studio code (I can import it with the python script, it just can't be imported in visual studio code).","AnswerCount":4,"Available Count":3,"Score":0.0996679946,"is_accepted":false,"ViewCount":65104,"Q_Id":54376745,"Users Score":2,"Answer":"If it works in the console when you type 'python yourscript.py' but not in vs code, you should press ctrl+shift+p and use clic on Python select interpreter to switch to the right env. if it sstill doesn't work then install the package by running 'python -m pip install pygame'","Q_Score":4,"Tags":"python,visual-studio-code,pygame","A_Id":57072821,"CreationDate":"2019-01-26T08:15:00.000","Title":"How to import pygame in visual studio code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I use visual studio code for coding (python) and now I have to write a program with pygame for my project and I can't import pygame in visual studio code (I can import it with the python script, it just can't be imported in visual studio code).","AnswerCount":4,"Available Count":3,"Score":0.1973753202,"is_accepted":false,"ViewCount":65104,"Q_Id":54376745,"Users Score":4,"Answer":"Open the terminal of Vscode.\nType pip install pygame or pip3 install pygame.\nImport pygame and enjoy it.","Q_Score":4,"Tags":"python,visual-studio-code,pygame","A_Id":56724870,"CreationDate":"2019-01-26T08:15:00.000","Title":"How to import pygame in visual studio code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a simple game in Python, using the Pyglet graphics library. I have an image, 6000x300 pixels, that I want to use as a scrolling background for the game. At the moment, I have made a sprite with the image and move it left and right depending on the player's position. The problem I have is that the sprite is glitchy: sometimes the 400 or so pixels at the start are duplicated several times along the length of it, and the motion of the sprite is sometimes jerky and sometimes smooth.\nIs this expected behavior for an image of that size? Is there a workaround? If not, can anyone suggest an better way to make a scrolling background?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":82,"Q_Id":54378952,"Users Score":0,"Answer":"Well, it's a strange one. I got home and ran the program on my newer desktop (my laptop is about 8 or more years old...) with the intention of making a video to help to explain the problem, and guess what? It runs perfectly. Must be a bug with Pyglet and very old hardware...","Q_Score":0,"Tags":"python,linux,pyglet","A_Id":54380533,"CreationDate":"2019-01-26T13:45:00.000","Title":"Pyglet large sprites glitch","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I develop a software that is for teachers to test their students. The main feature of the software is the cheat prevention it has. I want to achieve that by locking the option to exit the window in any way except a custom exit button in the top of the screen (already developed it and it's functionality). Is there a way to lock the option to exit a window, and make it always on the top?\nI want to lock the option to press the windows button, the ctrl-alt-delete buttons, the ctrl-shift-esc, the f4 ext... How do I do that? using python and wxpython for \nGUI","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":54418478,"Users Score":0,"Answer":"You can catch wx.EVT_CLOSE but you can't catch OS-level keyboard shortcuts, like CTRL+ALT+DELETE. \nwxPython can only catch keyboard shortcuts that aren't already mapped to the OS. I would focus on catching the close event and just vetoing it as that will prevent the user from closing the application. It won't protect you from the user restarting the OS, but that's about as good as you can do without locking down the user's desktop.","Q_Score":0,"Tags":"python,windows,user-interface,wxpython","A_Id":54425704,"CreationDate":"2019-01-29T10:05:00.000","Title":"How to make a window unexitable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create a C camera module that python can interact with. The way I envision it working is:\n\nPython callable C methods to setup the camera (eg set gain, set trigger, etc)\na C thread is started somewhere polling\/called back with frames, when a frame is received in the thread - it is sent to a socket.\n\nBasically Python will call the C methods to which will pass messages to the C thread. I'll make it thread safe using C mutexes or semaphores to pass the control command over to the C thread.\nThe question is where do I start the C thread? Is it best to start it in the PyMODINIT_FUNC or should I have another function to start the thread which returns an object holding a reference to the C thread or is there a better simple way? I need something reasonable quick to implement.\nCheers. Mitch.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":82,"Q_Id":54456740,"Users Score":0,"Answer":"Ended up just starting the thread in a \"start\" function and storing the thread id in a static variable and stopping the thread in a \"stop\" method. Works fine, raises errors where appropriate - no issues.","Q_Score":0,"Tags":"python,c,multithreading","A_Id":55000635,"CreationDate":"2019-01-31T08:57:00.000","Title":"Python creating C threads","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"With the previous version of pyautogui, when an image wasn't found the return was \"None\", so I used to handle it with except TypeError:.\nBut since the update (version 0.9.41), it isn't working, as it's returning ImageNotFoundException, but it isn't recognised as an exception. When I try to do except ImageNotFoundException: it gives the error:\n\n[E0712] Catching an exception which doesn't inherit from Exception: ImageNotFoundException\n\nHow should this error be handled?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":3074,"Q_Id":54461133,"Users Score":1,"Answer":"I had the same problem as you, and also couldn't figure out why handling this with an except wasn't possible. Now I have figured it out on python 3.7, this should work if you've installed the PyScreeze package:\nfrom pyscreeze import ImageNotFoundException\nI hope it can help you out :)","Q_Score":2,"Tags":"python,exception,pyautogui,except","A_Id":54495077,"CreationDate":"2019-01-31T12:55:00.000","Title":"Python PyAutoGUI return \"ImageNotFoundException\", but \"except\" doesn't recognise it as an exception","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I remember the dialog box prompting me with a checklist which included Tkinter. I did not uncheck the box. This is the first time I have tried to import Tkinter after this install and get the standard \"module not installed\" error. \nWhen I go to install using pip install Tkinter I get a message saying that it could not find a version that satisfies the requirement. No matching distribution found. \nIf I don't have to re-install Python that would be great, has anybody ever encountered this before\/know what could cause this?","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":79,"Q_Id":54468918,"Users Score":-1,"Answer":"Uninstall your python ans install the new Python 3.7.2 on the official website !\nYour packtage will be complete !\nIf it's still bot work, try to change the path of installation.","Q_Score":0,"Tags":"python,tkinter","A_Id":54469139,"CreationDate":"2019-01-31T20:42:00.000","Title":"Tkinter was installed with Python 3.6.0 but is now not importing and cannot pip install\/uninstall (Windows 7)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm programming a 2D game with Python and Pygame and now I want to use my internal graphics memory to load images to.\nI have an Intel HD graphics card (2GB VRAM) and a Nvidia GeForce (4GB VRAM).\nI want to use one of them to load images from the hard drive to it (to use the images from there).\nI thought it might be a good idea as I don't (almost) need the VRAM otherwise.\nCan you tell me if and how it is possible? I do not need GPU-Acceleration.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2376,"Q_Id":54524347,"Users Score":0,"Answer":"You have to create your window with the FULLSCREEN, DOUBLEBUF and HWSURFACE flags.\nThen you can create and use a hardware surface by creating it with the HWSURFACE flag.\nYou'll also have to use pygame.display.flip() instead of pygame.display.update().\nBut even pygame itself discourages using hardware surfaces, since they have a bunch of disadvantages, like\n- no mouse cursor\n- only working in fullscreen (at least that's what pygame's documentation says)\n- you can't easily manipulate the surfaces\n- they may not work on all platforms \n(and I never got transparency to work with them).\nAnd it's not even clear if you really get a notable performance boot.\nMaybe they'll work better in a future pygame release when pygame switches to SDL 2 and uses SDL_TEXTURE instead of SDL_HWSURFACE, who knows....","Q_Score":0,"Tags":"python,pygame","A_Id":54532945,"CreationDate":"2019-02-04T21:09:00.000","Title":"Use VRAM (graphics card memory) in pygame for images","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently developing an embedded multi-touch kivy program with python 3.52 in linux. Kivy is good, but I find GUI developing is quite difficult in some way, and animations are often quite laggy.\nAlso, I found that the program gets quite slow if I put many widgets in a single page. My program contains a lot of widgets so I am also thinking implementing a webview could help.\nSo I am looking for html and css views in particular screens for better look and feel (and maybe improvement of animation by using transition?).\nI've found Cefpython, but it says it works only for python 2.7 and says it is not stable. And it seemed like it is just getting url from the internet not bringing html and css from a file system. (Correct me if I am wrong.)\nActually, I don't even need a function as a browser, and all I need is html & css for UI\/UX development for couple of screens. \nMy embedded system doesn't always support internet(meaning it should work without internet). So I can't put any url in it. Once again, I am only trying to use them for styling. Is there a good way of doing it? Or there is no such thing that I want?\nOr is there any other recommendation?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":4686,"Q_Id":54559271,"Users Score":1,"Answer":"No, unless you are willing to implement html and css parsers and a web renderers, of course. I would say it's better to find why you find it difficult to do certain things with kivy, and how to remedy that. I've yet to find an UI\/layout\/template that is easier to do with the web technologies than with kivy, but i'm way more profficient at kivy than at web front end, so i might be biased.","Q_Score":5,"Tags":"python,html,css,embedded,kivy","A_Id":54582469,"CreationDate":"2019-02-06T17:24:00.000","Title":"Can I use html&css in kivy and python3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm trying to use the pyautogui module for python to automate mouse clicks and movements. However, it doesn't seem to be able to recognise any monitor other than my main one, which means i'm not able to input any actions on any of my other screens, and that is a huge problem for the project i am working on.\nI've searched google for 2 hours but i can't find any straight answers on whether or not it's actually possible to work around. If anyone could either tell me that it is or isn't possible, tell me how to do it if it is, or suggest an equally effective alternative (for python) i would be extremely grateful.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5548,"Q_Id":54581006,"Users Score":0,"Answer":"not sure if this is clear but I subtracted an extended monitor's horizontal resolution from 0 because my 2nd monitor is on the left of my primary display. That allowed me to avoid the out of bounds warning. my answer probably isn't the clearest but I figured I would chime in to let folks know it actually can work.","Q_Score":4,"Tags":"python,automation","A_Id":67995225,"CreationDate":"2019-02-07T19:36:00.000","Title":"Using pyautogui with multiple monitors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I'm starting a new kivy project inside my virtualenv, It download again all requirements like SDK, NDK etc...\nHelp please!!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":320,"Q_Id":54605762,"Users Score":0,"Answer":"If you are using buildozer, it should reuse the sdk and ndk saved in ~\/.buildozer\/ unless you use different versions in buildozer.spec, if it downloads the same version every time, that's likely a bug. If you use python-for-android directly, you should be able to point it to your already downloaded sdk\/ndk directories.","Q_Score":0,"Tags":"python,kivy,buildozer","A_Id":54607442,"CreationDate":"2019-02-09T11:27:00.000","Title":"Re-Downloading all requirments when starting a new kivy project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been coding a text editor, and it has the function to change the default font displayed in the wx.stc.SyledTextCtrl. \nI would like to be able to save the font as a user preference, and I have so far been unable to save it. \nThe exact object type is .\nWould anyone know how to pickle\/save this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":103,"Q_Id":54615125,"Users Score":1,"Answer":"Probably due to its nature, you cannot pickle a wx.Font.\nYour remaining option is to store its constituent parts.\nPersonally, I store facename, point size, weight, slant, underline, text colour and background colour.\nHow you store them is your own decision.\nI use 2 different options depending on the code. \n\nStore the entries in an sqlite3 database, which allows for multiple\nindexed entries.\nStore the entries in an .ini file using\nconfigobj \n\nBoth sqlite3 and configobj are available in the standard python libraries.","Q_Score":0,"Tags":"python,fonts,wxpython,pickle,wxstyledtextctrl","A_Id":54687573,"CreationDate":"2019-02-10T09:38:00.000","Title":"How to pickle or save a WxPython FontData Object","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to make a rainbow straight line but can't figure out the way the RGB values in turtle.pencolor() should change over time...\nI tried using a hexadesimal increment from 000000 to FFFFFF but I got a a black to green line loop before getting an invalid color value.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2041,"Q_Id":54616531,"Users Score":0,"Answer":"Also, if you have even less patience, you can set the turtle module's \"tracer\" function to (0, 0)\neg. t.tracer(0, 0)\nThis will make the drawing appear instantly.\nt.tracer(20, 0) will make the turtle go hyperspeed but still with some animation\nyou also need t.update() at the end if you use this method.","Q_Score":4,"Tags":"python,colors,turtle-graphics","A_Id":65442640,"CreationDate":"2019-02-10T12:45:00.000","Title":"How can I cycle colors using turtle module in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a project where one client needs to take several snapshots from a camera (i.e. it's actually taking a short-duration video, hence a stream of frames), then send all images to a server which then performs some processing on these images and returns a result to the client.\nClient and server are all running Python3 code.\nThe critical part is the image sending one.\nSome background first, images are *640*480 jpeg* files. JPEG was chosen as a default choice, but lower quality encoding can be selected as well. They are captured in sequence by a camera. We have thus approximately ~600 frames to send. Frame size is around 110KiB.\nThe client consists of a Raspberry Pi 3 model B+. It sends the frames via wifi to a 5c server. Server and client both reside in the same LAN for the prototype version. But future deployments might be different, both in term of connectivity medium (wired or wireless) and area (LAN or metro). \nI've implemented several solutions for this:\n\nUsing Python sockets on the server and the client: I'm either sending one frame directly after one frame capture, or I'm sending all images in sequence after the whole stream capture is done.\nUsing Gstreamer: I'm launching a GStreamer endpoint on my client and directly send the frames to the server as I stream. I'm capturing the stream on the server side with OpenCV compiled with GStreamer support, then save them to the disk.\n\nNow, the issue I'm facing is that even if both solutions work 'well' (they get the 'final' job done, which is to send data to a server and receive a result based on some remote processing), I'm convinced there is a better way to send a large amount of data to a server, using either the Python socket library, or any other available tools.\nAll personal researches are done on that matter lead me to solutions similar to mine, using Python sockets, or were out of context (relying on other backends than pure Python).\nBy a better way, I assume:\n\nA solution that saves bandwidth as much as possible.\nA solution that sends all data as fast as possible.\n\nFor 1. I slightly modified my first solution to archive and compress all captured frames in a .tgz file that I send over to the server. It indeed decreases the bandwidth usage but also increases the time spent on both ends (due to the un\/compression processes). It's obviously particularly true when the dataset is large.\nFor 2. GStreamer allowed me to have a negligible delay between the capture and the reception on my server. I have however no compression at all and for the reasons stated above, I cannot really use this library for further development.\nHow can I send a large number of images from one client to one server with minimal bandwidth usage and delay in Python?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1651,"Q_Id":54667373,"Users Score":0,"Answer":"you can restream camera using ffmpeg over network so that client can read it both ways. it will reduce delays.","Q_Score":3,"Tags":"python,image,sockets,opencv,gstreamer","A_Id":71076309,"CreationDate":"2019-02-13T10:02:00.000","Title":"Efficient way of sending a large number of images from client to server","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"ModuleNotFoundError: No module named '_tkinter'\n\nI want to import turtle in Python 3.7\n\nTraceback (most recent call last): File \"my.py\", line 1, in \n from turtle import * File \"\/usr\/local\/lib\/python3.7\/turtle.py\", line 107, in \n import tkinter as TK File \"\/usr\/local\/lib\/python3.7\/tkinter\/init.py\", line 36, in \n import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter'","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1480,"Q_Id":54693107,"Users Score":0,"Answer":"The IDE tells you that your python is not confingured for Tk (tkinter), which is your problem. While I am not certain on how to fix this becuase I never use turtle or Tk, I have a few ideas.\n\nI am using python 3.7 and importing both turtle and Tk works just fine for me, so I definitely recommend updating to 3.7.\nLook for Tk in your python module library and reinstall it.\nJust find out how to confingure Tk with python 3.2 if updating doesn't work.\n\nI hope I helped!","Q_Score":1,"Tags":"python-3.7","A_Id":54699744,"CreationDate":"2019-02-14T14:47:00.000","Title":"No module named '_tkinter' configured","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"ModuleNotFoundError: No module named '_tkinter'\n\nI want to import turtle in Python 3.7\n\nTraceback (most recent call last): File \"my.py\", line 1, in \n from turtle import * File \"\/usr\/local\/lib\/python3.7\/turtle.py\", line 107, in \n import tkinter as TK File \"\/usr\/local\/lib\/python3.7\/tkinter\/init.py\", line 36, in \n import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter'","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1480,"Q_Id":54693107,"Users Score":0,"Answer":"if you are using linux go to terminal and type sudo apt-get install python3-tk\nif you are using windows go to command prompt and type cd C:\/Program Files\/Python\/python37\/Scripts press enter then type pip install tkinter\nhope it helped!","Q_Score":1,"Tags":"python-3.7","A_Id":71962791,"CreationDate":"2019-02-14T14:47:00.000","Title":"No module named '_tkinter' configured","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am handling my second year project which includes some machine learning backend along with a Mobile application front end.In simple terms i am creating\na androing\/react native application which would take an input from the user and prosses in a backend development which includes python for some machine learning.\nMy question is, is it possible to connect these 2 together. I have gone through some stuff altho i am not very clear on how to create a connection on this. \nAlso some opinions on either i should go with android or react native or any other language to go on python or not would be very useful. \nThank you","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":809,"Q_Id":54720796,"Users Score":0,"Answer":"Yes. you can develop a python web service (REST OR SOAP) and use this for the backend for your application. \nalso, if you develop a service application (server-client) you must develop a service with python (or any languages) in your server after that connect your mobile application (reactjs, android studio, swift, ...) to this server.","Q_Score":1,"Tags":"java,python,mobile,native,backend","A_Id":54720908,"CreationDate":"2019-02-16T07:18:00.000","Title":"Is it possible to use Python backend and a Android\/Native application as Front end","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am handling my second year project which includes some machine learning backend along with a Mobile application front end.In simple terms i am creating\na androing\/react native application which would take an input from the user and prosses in a backend development which includes python for some machine learning.\nMy question is, is it possible to connect these 2 together. I have gone through some stuff altho i am not very clear on how to create a connection on this. \nAlso some opinions on either i should go with android or react native or any other language to go on python or not would be very useful. \nThank you","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":809,"Q_Id":54720796,"Users Score":0,"Answer":"Yes, it is possible.\nFor example, you can use Python as backend (server), with some exposed HTTP \"interface\", then make an Android application that communicates with these Python backend with HTTP request \/ response.\nOr, if you are making a serverless application, you can make this Python backend as a .so library or using SL4A then call them in your Android application.","Q_Score":1,"Tags":"java,python,mobile,native,backend","A_Id":54720835,"CreationDate":"2019-02-16T07:18:00.000","Title":"Is it possible to use Python backend and a Android\/Native application as Front end","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Using pygame, would it be more efficient to:\n\nBlit a single sprite from a portion of a spritesheet each frame\nAt startup, blit each sprite from a spritesheet to their own Surfaces, then blit those Surfaces\n\nIs there any performance differences between the two? Would it take more draw calls to use the first method, versus individual Surfaces at startup (i.e. does doing this at startup store copies of those pixels in ram\/vram)?\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":131,"Q_Id":54738650,"Users Score":3,"Answer":"It would be faster to blit the images into a surface, then blit those surfaces.\nHowever it would consume more memory, since you'll need to keep those surfaces somewhere in memory.\nWhy?\nWhen you go to blit the image from your spritesheet, you'll end up subsurfing\/clipping the spritesheet surface, which will mean you'll need to generate another surface on the spot. However, this process won't take long.\nThe performance benefit most likely isn't worth it, so I'd recommend just go with whichever method you're most comfortable with. If you're concerned about performance, check out the builtin CProfile python module.\nVRAM never comes into this equation. pygame.Surface is derived from SDL_Surface from the SDL library for the C programming language. SDL_Surface is primarily targeted toward software rendering, which means the surface pixels are stored in standard RAM.","Q_Score":3,"Tags":"python,pygame","A_Id":54740204,"CreationDate":"2019-02-17T23:26:00.000","Title":"Pygame - More efficient to blit a sprite from spritesheet, or blit invidual sprites to their own surfaces?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make my tkinter Text to be only an output and not an input. Through some research I've found that text.config(state=\"disabled\") disables user input, but it still allows for selecting text, which I do not want.\nHow can I get my Text widget to be unselectable and unwritable?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1388,"Q_Id":54792599,"Users Score":0,"Answer":"I believe you will have to replace it with another widget that such as a Label or LabelFrame to accomplish this. As well you could use a from tkinter import messagebox and have the text you want pop up in another window (like an info window or error message window). I think that as far as the Text widget goes, setting the state to disabled is the best you can do for your purposes unfortunately and users will be able to copy that text despite being unable to edit it.","Q_Score":1,"Tags":"python,tkinter","A_Id":54792777,"CreationDate":"2019-02-20T17:59:00.000","Title":"How can I make a tkinter text widget unselectable?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Every example I've found thus-far for development with Kivy in regards to switching screens is always done using a button, Although the user experience doesn't feel very \"native\" or \"Smooth\" for the kind of app I would like to develop.\nI was hoping to incorperate swiping the screen to change the active screen.\nI can sort of imagine how to do this by tracking the users on_touch_down() and on_touch_up() cords (spos) and if the difference is great enough, switch over to the next screen in a list of screens, although I can't envision how this could be implemented within the kv language\nperhaps some examples could help me wrap my head around this better?\nP.S.\nI want to keep as much UI code within the kv language file as possible to prevent my project from producing a speghetti-code sort of feel to it. I'm also rather new to Kivy development altogether so I appologize if this question has an official answer somewhere and I just missed it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":237,"Q_Id":54805487,"Users Score":0,"Answer":"You might want to use a Carousel instead of ScreenManager, but if you want that logic while using the ScreenManager, you'll certainly have to write some python code to manage that in a subclass of it, then use it in kv as a normal ScreenManager. Using previous and next properties to get the right screen to switch to depending on the action. This kind of logic is better done in python, and that doesn't prevent using the widgets in kv after.","Q_Score":0,"Tags":"android,python,kivy,screen,swipe","A_Id":54843815,"CreationDate":"2019-02-21T11:00:00.000","Title":"Kivy Android App - Switching screens with a swipe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to receive single byte data from user from a plaintext_edit but i want to make sure it is entered in hex format, 0x with prefix or else will result in unknown type\nExample : 0x3f\n-Thanks","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":28,"Q_Id":54805705,"Users Score":0,"Answer":"You didn't say but I am guessing you are using pyqt. Define a handler for the control's keyPressEvent and filter the user input there. That won't raise a type error. Instead you ensure that only valid data gets entered.","Q_Score":0,"Tags":"python,python-3.x,hex","A_Id":54839192,"CreationDate":"2019-02-21T11:11:00.000","Title":"Python: Pyqt Receive Hex format integer only from Plaintext","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"is it possible to code in python inside android studio? \nhow can I do it.\nI have an android app that I am try to develop. and I want to code some part in python.\nThanks for the help\nhow can I do it.\nI have an android app that I am try to develop. and I want to code some part in python.\nThanks for the help","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":10022,"Q_Id":54809592,"Users Score":4,"Answer":"If you mean coding part of your Android application in python (and another part for example in Java) it's not possible for now. However, you can write Python script and include it in your project, then write in your application part that will invoke it somehow. Also, you can use Android Studio as a text editor for Python scripts. To develop apps for Android in Python you have to use a proper library for it.","Q_Score":7,"Tags":"android,python-3.x,android-studio","A_Id":54809908,"CreationDate":"2019-02-21T14:37:00.000","Title":"is it possible to code in python inside android studio?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Currently I am working to learn how to use Gtk3 with Python 3.6. So far I have been able to use a combination of resources to piece together a project I am working on, some old 2.0 references, some 3.0 shallow reference guides, and using the python3 interpreters help function.\nHowever I am stuck at how I could customise the statusbar to display a progressbar. Would I have to modify the contents of the statusbar to add it to the end(so it shows up at the right side), or is it better to build my own statusbar?\nAlso how could I modify the progressbars color? Nothing in the materials list a method\/property for it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":217,"Q_Id":54875813,"Users Score":2,"Answer":"GtkStatusbar is a subclass of GtkBox. You can use any GtkBox method including pack_start and pack_end or even add, which is a method of GtkContainer. \nThus you can simply add you progressbar to statusbar.","Q_Score":0,"Tags":"python-3.x,progress-bar,gtk3,statusbar","A_Id":54889989,"CreationDate":"2019-02-25T22:42:00.000","Title":"Python Gtk3 - Custom Statusbar w\/ Progressbar","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I try to compile PJSUA2 for Python. I could manage to compile the source with Visual Studio 2015 Community edition. \nMy question is, how can I install the Python module now? \nThe guide suggests to use make and make install. I tried to install also minwg, but it is not working as the project was compiled with VS. \n\nI have also tried to compile with minwg, but I never could succeed due to undefined requirements. Also official PJSUA guide recommend to use VS for Windows.\n\nFollowing settings have been applied to build from source:\n\nSwig location has been added to path\nJAVA_home system variable has been added\nJava location has been added to path\nEmpty pjlib\/include\/pj\/config_site.h has been created\nOpened source in VS 2015 Community (all suggested VS package and module has been installed)\nSet following project to do not compile:\n\n\npjsua_cli_uwp_comp\npjsua_cli_wp8\npjsua_cli_wp8_comp\n\nSet swig_java_pjsua2 to build.\nAdd following folders to swig_java_pjsua2 VC++ include directories\n\n\nc:\\Program Files\\Java\\jdk-11.0.2\\include\nc:\\Program Files\\Java\\jdk-11.0.2\\include\\win32\n\nBuild solution","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2011,"Q_Id":54882875,"Users Score":0,"Answer":"Thank You very much Krisz for this awesome work!\n\nI just got it working for Python 2.7 \/ 32bit and some things are slightly different, so I will add them here:\nEnvironment:\n\nWindows 10\nSWIG 4.0.1\nPJSIP 2.9\nPython 2.7.14 (32bit)\nVisual Studio Express 2015 (V 14.0.25431.01 Update 3)\n\nWhaddado:\n\nImportant: Check if your Python-interpreter is really x64 or win32 like the following:\nstart a python session and enter:\n\nimport platform\nplatform.architecture()\n\nIf you have 32bit, consider this in your choice for target platform in VS.\nwhen you add this %inline%-Snippet to pjsip-apps\/src\/swig\/pjsua2.i, add it at the end of the file!\nwhen starting the swig-command, omit the \"-py3\"-parameter, if you use Python 2.x\nthere is a little typo in Krisz' description, at \"pjsua.py located under pjsip-apps\/src\/swig\/python\" -> of course pjsua2.py is meant. Do not use the pjsua.py.\n\nfinally copy _pjsua2.lib and pjsua2.py into \\Lib\\site-packages\\ and the _pjsua2.pyd into \\DLLs\\ to make them available everywhere.","Q_Score":4,"Tags":"python,sip,voip,pjsua2","A_Id":59667572,"CreationDate":"2019-02-26T10:01:00.000","Title":"How to build PJSUA2 (swig) with Visual Studio 2015","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've got a WPF application wich embedded IronPython. I'm trying to access my WPF page from Python so I can modify controls defined in XAML from Python but can't manage to do it. I'm using a NavigationWindow to transition from page to page, so I'd like to be able to access the current page pointed to by the NavigationWindow.\nI'm capable of accessing controls from a separate Window via Application.Current.MainWindow, but have had no success trying to access a page in the way described above.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":118,"Q_Id":54884303,"Users Score":0,"Answer":"Navigation window is a content control, if you want to get the page from it you can just use the .content property on the navigation window instance. Or just use the content property from the NavigationEventArgs within the onNavigated function.","Q_Score":0,"Tags":"c#,.net,wpf,ironpython","A_Id":54885560,"CreationDate":"2019-02-26T11:17:00.000","Title":"How to get WPF Page pointed by NavigationWindow from code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing an application in PyQt5 which will be used for calibration and test of a product. The important details:\n\nThe product under test uses an old-school UART\/serial communication link at 9600 baud.\n...and the test \/ calibration operation involves communicating with another device which has a UART\/serial communication link at 300 baud(!)\nIn both cases, the communication protocol is ASCII text with messages terminated by a newline \\r\\n.\n\nDuring the test\/calibration cycle the GUI needs to communicate with the devices, take readings, and log those readings to various boxes in the screen. The trouble is, with the slow UART communications (and the long time-outs if there is a comms drop-out) how do I keep the GUI responsive?\nThe Minimally Acceptable solution (already working) is to create a GUI which communicates over the serial port, but the user interface becomes decidedly sluggish and herky-jerky while the GUI is waiting for calls to serial.read() to either complete or time out.\nThe Desired solution is a GUI which has a nice smooth responsive feel to it, even while it is transmitting and receiving serial data.\nThe Stretch Goal solution is a GUI which will log every single character of the serial communications to a text display used for debugging, while still providing some nice \"message-level\" abstraction for the actual logic of the application.\nMy present \"minimally acceptable\" implementation uses a state machine where I run a series of short functions, typically including the serial.write() and serial.read() commands, with pauses to allow the GUI to update. But the state machine makes the GUI logic somewhat tricky to follow; the code would be much easier to understand if the program flow for communicating to the device was written in a simple linear fashion.\nI'm really hesitant to sprinkle a bunch of processEvents() calls throughout the code. And even those don't help when waiting for serial.read(). So the correct solution probably involves threading, signals, and slots, but I'm guessing that \"threading\" has the same two Golden Rules as \"optimization\": Rule 1: Don't do it. Rule 2 (experts only): Don't do it yet.\nAre there any existing architectures or design patterns to use as a starting point for this type of application?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":397,"Q_Id":54898967,"Users Score":0,"Answer":"Okay for the past few days I've been digging, and figured out how to do this. Since there haven't been any responses, and I do think this question could apply to others, I'll go ahead and post my solution. Briefly:\n\nYes, the best way to solve this is with with PyQt Threads, and using Signals and Slots to communicate between the threads.\nFor basic function (the \"Desired\" solution above) just follow the existing basic design pattern for PyQt multithreaded GUI applications:\n\n\nA GUI thread whose only job is to display data and relay user inputs \/ commands, and,\nA worker thread that does everything else (in this case, including the serial comms).\n\nOne stumbling point along the way: I'd have loved to write the worker thread as one linear flow of code, but unfortunately that's not possible because the worker thread needs to get info from the GUI at times.\n\n\nThe only way to get data back and forth between the two threads is via Signals and Slots, and the Slots (i.e. the receiving end) must be a callable, so there was no way for me to implement some type of getdata() operation in the middle of a function. Instead, the worker thread had to be constructed as a bunch of individual functions, each one of which gets kicked off after it receives the appropriate Signal from the GUI.\n\nGetting the serial data monitoring function (the \"Stretch Goal\" above) was actually pretty easy -- just have the low-level serial transmit and receive routines already in my code emit Signals for that data, and the GUI thread receives and logs those Signals.\n\nAll in all it ended up being a pretty straightforward application of existing principles, but I'm writing it down so hopefully the next guy doesn't have to go down so many blind alleys like I did along the way.","Q_Score":0,"Tags":"python,pyqt5","A_Id":54964121,"CreationDate":"2019-02-27T05:59:00.000","Title":"How to architect a GUI application with UART comms which stays responsive to the user","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Problem: I created a Tkinter Frame containing a ttk.TreeView widget. Each row contains text from Reddit posts. However, lenghty posts (or with plenty of newlines) are not completely visible in the row.\nQuestion: Is it in any way possible to resize individual rows based on the content that is loaded in?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":150,"Q_Id":54946365,"Users Score":0,"Answer":"No, it is not possible to resize individual rows of a treeview.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":54947613,"CreationDate":"2019-03-01T14:11:00.000","Title":"Tkinter dynamic TreeView row resize","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm a beginner, I have really hit a brick wall, and would greatly appreciate any advice someone more advanced can offer.\nI have been having a number of extremely frustrating issues the past few days, which I have been round and round google trying to solve, tried all sorts of things to no avail.\nProblem 1)\nI can't import pygame in Idle with the error:\nModuleNotFoundError: No module named 'pygame' - even though it is definitely installed, as in terminal, if I ask pip3 to install pygame it says:\nRequirement already satisfied: pygame in \/usr\/local\/lib\/python3.7\/site-packages (1.9.4)\nI think there may be a problem with several conflicting versions of python on my computer, as when i type sys.path in Idle (which by the way displays Python 3.7.2 ) the following are listed:\n'\/Users\/myname\/Documents', '\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python37.zip', '\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python3.7', '\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python3.7\/lib-dynload', '\/Users\/myname\/Library\/Python\/3.7\/lib\/python\/site-packages', '\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python3.7\/site-packages'\nSo am I right in thinking pygame is in the python3.7\/sitepackages version, and this is why idle won't import it? I don't know I'm just trying to make sense of this. I have absoloutely no clue how to solve this,\"re-set the path\" or whatever. I don't even know how to find all of these versions of python as only one appears in my applications folder, the rest are elsewhere?\nProblem 2)\nApparently there should be a python 2.7 system version installed on every mac system which is vital to the running of python regardless of the developing environment you use. Yet all of my versions of python seem to be in the library\/downloaded versions. Does this mean my system version of python is gone? I have put the computer in recovery mode today and done a reinstall of the macOS mojave system today, so shouldn't any possible lost version of python 2.7 be back on the system now?\nProblem 3)\nWhen I go to terminal, frequently every command I type is 'not found'.\nI have sometimes found a temporary solution is typing:\nexport PATH=\"\/usr\/local\/bin:\/usr\/bin:\/bin:\/usr\/sbin:\/sbin\"\nbut the problems always return!\nAs I say I also did a system reinstall today but that has helped none!\nCan anybody please help me with these queries? I am really at the end of my tether and quite lost, forgive my programming ignorance please. Many thanks.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":54953355,"Users Score":0,"Answer":"You should actually add the export PATH=\"\/usr\/local\/bin:\/usr\/bin:\/bin:\/usr\/sbin:\/sbin\" to your .bash_profile (if you are using bash). Do this by opening your terminal, verifying that it says \"bash\" at the top. If it doesn't, you may have a .zprofile instead. Type ls -al and it will list all the invisible files. If you have .bash_profile listed, use that one. If you have .zprofile, use that.\nType nano .bash_profile to open and edit the profile and add the command to the end of it. This will permanently add the path to your profile after you restart the terminal.\nUse ^X to exit nano and type Y to save your changes. Then you can check that it works when you try to run the program from IDLE.","Q_Score":0,"Tags":"python-3.x,macos,command-line,terminal,pygame","A_Id":72088835,"CreationDate":"2019-03-01T22:45:00.000","Title":"Pygame\/Python\/Terminal\/Mac related","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have some custom text editor with multitabs logic, created with Python3 and PyQt5. I want to open txt-files in this editor with double click and I want to add new tab in my editor each time when I do double-click on file. I added batch, with calls 'python editor.py', when I click on txt. Thats OK, but instead of open new tab in current IDE it always start new python process and open new IDE. I want to make it work on Win10. How to make logic to add new tab to current editor? Probably I don't even need new python process, if my editor is already running.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":95,"Q_Id":55004164,"Users Score":0,"Answer":"Solved with qlocalsocket and qlocalserver!","Q_Score":0,"Tags":"python,python-3.x,pyqt,pyqt5","A_Id":55021494,"CreationDate":"2019-03-05T13:37:00.000","Title":"Add txt file to custom PyQt editor with double click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I am within a GUI, interacting with said GUI using python 2.7 and sikulix API. If I click on something from within that GUI that opens another window in full screen, sikulix is currently having difficulty interacting with the newly opened window, it can still for some reason only see the old window even though it is underneath. I am able to make the newly opened window smaller, then take the original window and drag it down to a lower place in the screen, then re-maximize the new window and this will allow me to interact with the new window. --- Is there a better way to do this? (using CentOS)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":623,"Q_Id":55024795,"Users Score":0,"Answer":"Sikuli \"sees\" whatever there is on the screen so if there is a window, Sikuli can't ignore it. What probably happens in your case is that you progress too fast and Sikuli is still observing the previous screen. What you need to do is to wait sufficient time to ensure the new window has actually opened.","Q_Score":0,"Tags":"python-2.7,sikuli,sikuli-x","A_Id":55025126,"CreationDate":"2019-03-06T13:55:00.000","Title":"What is the easiest way to change windows with Sikulix?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to change the font color of a single word in a Tkinter label widget.\nI understand that something similar to what I would like to be done can be achieved with a Text widget.. for example making the word \"YELLOW\" show in yellow: \nself.text.tag_config(\"tag_yel\", fg=clr_yellow)\nself.text.highligh_pattern(\"YELLOW\", \"tag_yel\")\nBut my text is static and all I want is to change the word \"YELLOW\" to show as yellow font and \"RED\" in red font and I cannot seem to figure out how to change text color without changing it all with label.config(fg=clr).\nAny help would be appreciated","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":533,"Q_Id":55069724,"Users Score":1,"Answer":"You cannot do what you want. A label supports only a single foreground color and a single background color. The solution is to use a text or canvas widget., or to use two separate labels.","Q_Score":1,"Tags":"python,python-2.7,tkinter","A_Id":55069875,"CreationDate":"2019-03-08T19:25:00.000","Title":"Change color of single word in Tk label widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to create an Combobox with checkboxes with wxpython? \nLike most webpages have filter options in a drop down list for products where you could choose which Brand (etc.) you want.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":318,"Q_Id":55076458,"Users Score":1,"Answer":"Try with a ComboCtrl with a CheckListBox popup, or with a wx.ListCtrl plus \nCheckListCtrlMixin if you need more than one column.","Q_Score":1,"Tags":"python,wxpython","A_Id":55080070,"CreationDate":"2019-03-09T10:38:00.000","Title":"wxPython - Combobox with Checkboxes possible?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm currently doing a project on my school pc and I want to use pygame, since I have experience with pygame. I have downloaded pygame using this line in the command prompt python -m pip install -U pygame --user when I try this line python3 -m pygame.examples.aliens that is used to see if pygame is downloaded right, it works fine.\nBut, when I import it in the project I get this error message\n\nFile \"C:\/Users\/user\/Documents\/Programming\/test.py\", line 10, in\n \n import pygame\nModuleNotFoundError: No module named 'pygame'\n\nextra info:\nI use Spyder\nIt is a Windows pc\nThanks in advance :)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":210,"Q_Id":55078224,"Users Score":0,"Answer":"If you have used pygame before this, then have a look if you have any files named pygame.py as I had the same problem as you and my problem was naming a file the same as a core module so check that. \nI have done the commands that you put and on the python3 -m pygame.examples.aliens. I got a ModuleNotFoundError: No module named 'pygame'. \nWhen I changed the second command to python instead of python3 it worked after I installed pygame like this pip install pygame to uninstall pygame from how you did it when you install pygame change it to uninstall then try this version.","Q_Score":0,"Tags":"python,pygame,spyder","A_Id":55079252,"CreationDate":"2019-03-09T14:15:00.000","Title":"Error importing the installed pygame module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to call C# functions from IronPython. I've read some topics about it, and it seems to follow these steps: \n\nCreate a dll from the C# functions\nUse clr.AddReference\nUse your function from IronPython\n\nMy noob question is: do I need to have my source code in C# in order to create the dll? Or is C++ ok? Why?\nThanks a lot,\nArnaud","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":55137908,"Users Score":1,"Answer":"Any .NET-based language can be used to generate the DLL, which you can use in your IronPython code.","Q_Score":1,"Tags":"c#,dll,ironpython","A_Id":55137981,"CreationDate":"2019-03-13T09:03:00.000","Title":"Do I need C# to create a dll to be used in IronPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to develop a C# application to monitor a Sick PLC using modbus. I have an example program for talking to the PLC which is written in Python and uses the module pyModbus. Is there a C# nugget package that has the same functionality as pyModbus?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":158,"Q_Id":55159006,"Users Score":0,"Answer":"It's not a Nuget package, but instead a full Visual Studio solution. AdvancedHMI includes a Modbus driver and also has lots of tools that will connect to the driver data without having to write code.\nwww.advancedhmi.com","Q_Score":0,"Tags":"c#,python,plc,pymodbus","A_Id":55191802,"CreationDate":"2019-03-14T09:29:00.000","Title":"C# equivalent for pyModbus","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to know help on which is more efficient to do. This is my situation I already have a GUI using PyQt programmed for windows I want it to be also installed on an android phone. Should I find away to packaged(through pyqtdeploy or any other means) to android or make another similar GUI with same functionalities using Kivy because its much more android friendly?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":768,"Q_Id":55162793,"Users Score":1,"Answer":"For now, I think you should learn Kivy because pyqtdeploy is a young project. The Dev team still working on it to fix some bugs.\nBut in the future, if pyqtdeploy become efficient, it will be the best choice ! \nPyQt5 has many incredible widgets and you use also QML to design more advanced interface for mobile devices (Android & iOS).","Q_Score":1,"Tags":"android,python,kivy,pyqt5,python-3.7","A_Id":60206953,"CreationDate":"2019-03-14T12:40:00.000","Title":"PyQt5 GUI for android vs Kivy GUI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to write a pygame programme where I am receiving data from a Raspberry Pi over a socket connection. However I only want the Pygame code to run once the string has arrived. This involves the code waiting for some time, then when a string is received from the Raspberry Pi, pygame runs code to update the display.\nCurrently my Pygame freezes and shuts down when waiting for data to income. \nAny ideas. Thanks.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":188,"Q_Id":55171411,"Users Score":0,"Answer":"Pygame \"freezes\" is most likely due to the network call being blocking. Consider spinning a new thread to handle the data communication while Pygame takes over the main thread and updates the display with some \"waiting\" message. Once you have received the data, the second thread should pass it to the main thread which will display it.","Q_Score":2,"Tags":"python,pygame,python-sockets","A_Id":55171549,"CreationDate":"2019-03-14T20:26:00.000","Title":"Only running Pygame display code once data revieved from python socket connection","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My question is about the usage of thread in the pyqt5 application. I am fair newly to the GUI world, I am an embedded guy. I m having a hard time bundling my python3 application in Windows that uses Joblib to achieve parallelism. I am doing read and write of 10 UARTs concurrently.\nI want to deliver this application as Windows OS installation to the customer, not as code in the factory. \nI am planning to abandon the usage of Joblib in my pyqt5 application because of creating windows package. \nI checked with other GUI guy at my work, he said pyqt5 threads have a lot of issues and synchronizing threads are big mess, not that easy, but his answer is not convincing to me. \nI am sure in this world many using Pyqt5 build in multi-thread or multi-parallel mechanism, I just want to write parallelly to the Uarts and read the data from Uarts stream.\nSomeone can provide the good source to learn more about pyqt5 multithread or parallel processing example?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":67,"Q_Id":55200334,"Users Score":1,"Answer":"I am not a python expert, however as PyQt5 is a library with Qt5 bindings I would not use threads for achieving what you want.\nQt provides very convenient mechanism of signals. \nYou can write data to all your UARTs and then wait for signals telling you can read data (assuming you are going to use QSerialPort class).\nThis would of course work in one thread, but as long as you don't need super speed or read\/write tons of data, you may find it suitable.","Q_Score":0,"Tags":"python-3.x,multithreading,pyqt5,joblib,python-windows-bundle","A_Id":55200458,"CreationDate":"2019-03-16T18:45:00.000","Title":"widely used multi-thread or concurrent processing for pyqt5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I have the files frame.py and bindings.py both with classes Frame and Bindings respectively inside of them, I import the bindings.py file into frame.py by using from bindings import Bindings but how do I go about importing the frame.py file into my bindings.py file. If I use import frame or from frame import Frame I get the error ImportError: cannot import name 'Bindings' from 'bindings'. Is there any way around this without restructuring my code?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":83,"Q_Id":55237179,"Users Score":0,"Answer":"Instead of using from bindings import Bindings try import bindings.","Q_Score":0,"Tags":"python","A_Id":55237563,"CreationDate":"2019-03-19T09:10:00.000","Title":"Call function from file that has already imported the current file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My team and I implemented a game in Python using Pygame. Whenever the game is run, alongside the GUI there is an extra black window that opens alongside, a .exe window. Is there anyway to stop it from opening?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":46,"Q_Id":55239504,"Users Score":0,"Answer":"That is a command window, specifically one running python[Version Number].exe. To remove it simply change the scripts file extension to .pyw instead of .py, which changes the file type to the same thing [Python], but without the console window opening too.\nSo for example, script.py would become script.pyw","Q_Score":0,"Tags":"python,python-3.x,pygame","A_Id":55240130,"CreationDate":"2019-03-19T11:05:00.000","Title":"Pygame Code screen keeps opening with game","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have seen a couple of questions asking how to force a screen redraw in tkinter (which can be done using update_idletasks. I would like to do the opposite: suspend Tkinter's automatic screen redrawing until I have completed some major surgery to the application window - insert, delete, reposition a large number of widgets on a canvas, and then activate automatic screen redrawing after I'm done. Is that possible? I can't find any documented way of doing this. I'm using Tkinter with Python 3.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":498,"Q_Id":55262942,"Users Score":1,"Answer":"I would like to do the opposite: suspend Tkinter's automatic screen redrawing until I have completed some major surgery to the application window - insert, delete, reposition a large number of widgets on a canvas, and then activate automatic screen redrawing after I'm done. Is that possible?\n\nYes, it's possible. That's precisely how tkinter works by default. \nTkinter runs in a single thread. While any of your code is running, tkinter has no ability to update the screen unless you explicitly call update or update_idletasks for it to be updated.","Q_Score":1,"Tags":"python,tkinter,redraw","A_Id":55264073,"CreationDate":"2019-03-20T14:17:00.000","Title":"Python Tkinter pause screen redraw","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to convert a web application into a desktop application by embedding cefpython3.\nThe application (sometimes) requires the back button for navigation.\nIs there a simple way (ie without requiring another graphics framework like Qt) to get it?\nNote: It seems that Shift+Backspace and Alt+Right Arrow don't work also.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":149,"Q_Id":55338968,"Users Score":1,"Answer":"If you have control over the web application then you can implement back\/forward buttons using HTML5 and Javascript. When button is clicked use javascript bindings to communicate with Python and call appropriate CEF functions such as Browser.GoForward and Browser.GoBack. In case of third party web application you can still inject custom javascript to add buttons by using LoadHandler and Frame.ExecuteJavascript.\nIf you want to do it using OS native controls and don't want to use third party libraries then you can use OS native APIs via ctypes\/pyobjc modules.\nThe Tkinter library is lightweight, so you can consider using it. There is the tkinter_.py example available (doesn't work on Mac though).\nYou can handle keyboard events by implementing KeyboardHandler.\nYou can also navigate through mouse context menu.","Q_Score":1,"Tags":"cefpython","A_Id":55341706,"CreationDate":"2019-03-25T13:31:00.000","Title":"Back button in cefpython3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"basically I have this window with a bunch of buttons but I want the background of the window to be invisible\/transparent so the buttons are essentially floating. However, GTK seems to be pretty limited with CSS and I haven't found a way to do it yet. I've tried making the main window opacity 0 but that doesn't seem to work. Is this even possible and if so how can I do it? Thanks.\nEdit: Also, I'm using X11 forwarding.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":65,"Q_Id":55423219,"Users Score":0,"Answer":"For transparency Xorg requires a composite manager running on the X11 server. The compmgr program from Xorg is a minimal composite manager.","Q_Score":1,"Tags":"python,gtk3","A_Id":55425036,"CreationDate":"2019-03-29T18:04:00.000","Title":"Python GTK+ 3: Is it possible to make background window invisible?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently using an Android device (of Samsung), Pydroid 3.\nI tried to see any graphs, but it doesn't works.\nWhen I run the code, it just shows me a black-blank screen temporarily and then goes back to the source code editing window.\n(means that i can't see even terminal screen, which always showed me [Program Finished]) \nWell, even the basic sample code which Pydroid gives me doesn't show me the graph :(\nI've seen many tutorials which successfully showed graphs, but well, mine can't do that things.\nUnfortunately, cannot grab any errors.\nUsing same code which worked at Windows, so don't think the code has problem.\nOf course, matplotlib is installed, numpy is also installed.\nIf there's any possible problems, please let me know.","AnswerCount":8,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":8119,"Q_Id":55434255,"Users Score":2,"Answer":"I also had this problem a while back, and managed to fix it by using plt.show()\nat the end of your code. With matplotlib.pyplot as plt.","Q_Score":4,"Tags":"android,python,matplotlib,pydroid","A_Id":56324221,"CreationDate":"2019-03-30T18:02:00.000","Title":"Matplotlib with Pydroid 3 on Android: how to see graph?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently using an Android device (of Samsung), Pydroid 3.\nI tried to see any graphs, but it doesn't works.\nWhen I run the code, it just shows me a black-blank screen temporarily and then goes back to the source code editing window.\n(means that i can't see even terminal screen, which always showed me [Program Finished]) \nWell, even the basic sample code which Pydroid gives me doesn't show me the graph :(\nI've seen many tutorials which successfully showed graphs, but well, mine can't do that things.\nUnfortunately, cannot grab any errors.\nUsing same code which worked at Windows, so don't think the code has problem.\nOf course, matplotlib is installed, numpy is also installed.\nIf there's any possible problems, please let me know.","AnswerCount":8,"Available Count":3,"Score":1.2,"is_accepted":true,"ViewCount":8119,"Q_Id":55434255,"Users Score":0,"Answer":"After reinstalling it worked.\nThe problem was that I forced Pydroid to update matplotlib via Terminal, not the official PIP tab.\nThe version of matplotlib was too high for pydroid","Q_Score":4,"Tags":"android,python,matplotlib,pydroid","A_Id":60702515,"CreationDate":"2019-03-30T18:02:00.000","Title":"Matplotlib with Pydroid 3 on Android: how to see graph?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm currently using an Android device (of Samsung), Pydroid 3.\nI tried to see any graphs, but it doesn't works.\nWhen I run the code, it just shows me a black-blank screen temporarily and then goes back to the source code editing window.\n(means that i can't see even terminal screen, which always showed me [Program Finished]) \nWell, even the basic sample code which Pydroid gives me doesn't show me the graph :(\nI've seen many tutorials which successfully showed graphs, but well, mine can't do that things.\nUnfortunately, cannot grab any errors.\nUsing same code which worked at Windows, so don't think the code has problem.\nOf course, matplotlib is installed, numpy is also installed.\nIf there's any possible problems, please let me know.","AnswerCount":8,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":8119,"Q_Id":55434255,"Users Score":0,"Answer":"You just need to add a line\nplt.show()\nThen it will work. You can also save the file before showing\nplt.savefig(\"*imageName*.png\")","Q_Score":4,"Tags":"android,python,matplotlib,pydroid","A_Id":66386763,"CreationDate":"2019-03-30T18:02:00.000","Title":"Matplotlib with Pydroid 3 on Android: how to see graph?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created numerous python scripts on my pc laptop, and I want to run those scripts on my android phone. How can I do that? How can I move python scripts from my windows pc laptop, and use those python scripts on my samsung adroid phone? \nI have downloaded qpython from the google playstore, but I still don't know how to get my pc python programs onto my phone. I heard some people talk about \"ftp\" but I don't even know what that means. \nThanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":385,"Q_Id":55438484,"Users Score":0,"Answer":"Send them to yourself via email, then download the scripts onto your phone and run them through qpython.\nHowever you have to realize not all the modules on python work on qpython so your scripts may not work the same when you transfer them.","Q_Score":0,"Tags":"android,python,ftp,qpython","A_Id":56649272,"CreationDate":"2019-03-31T06:41:00.000","Title":"How does one transfer python code written in a windows laptop to a samsung android phone?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created numerous python scripts on my pc laptop, and I want to run those scripts on my android phone. How can I do that? How can I move python scripts from my windows pc laptop, and use those python scripts on my samsung adroid phone? \nI have downloaded qpython from the google playstore, but I still don't know how to get my pc python programs onto my phone. I heard some people talk about \"ftp\" but I don't even know what that means. \nThanks","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":385,"Q_Id":55438484,"Users Score":0,"Answer":"you can use TeamViewer to control your android phone from your PC. And copy and paste the code easily.\nor\nYou can transfer your scripts on your phone memory in the qpython folder and open it using qpython for android.","Q_Score":0,"Tags":"android,python,ftp,qpython","A_Id":56236136,"CreationDate":"2019-03-31T06:41:00.000","Title":"How does one transfer python code written in a windows laptop to a samsung android phone?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Pygame does not work in Pycharm despite everything works at python IDLE.\nIt says:\nAttributeError: module 'pygame' has no attribute 'init'","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":162,"Q_Id":55454791,"Users Score":0,"Answer":"Even though the given information is not enough for properly answering this question, I can tell you a one cause for this error from my personal experience. \nMost probably you have named your source file as pygame.py or you have a directory named pygame somewhere in your path.","Q_Score":0,"Tags":"python,pygame,pycharm","A_Id":55484039,"CreationDate":"2019-04-01T12:10:00.000","Title":"Pycharm IDE issue\/problem on pygame module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a rather small Pygame based python script and I just bought a Mac so I'm trying to run my script on here. Everything has been installed correctly (Checking by typing 'import Pygame') into python terminal as-well as running a basic hello world program. However, when I try running this script, IDLE gets brought to the front but nothing happens from there. (The script is supposed to pop-up a new window). Is this a problem with my installations or my code? (Code works on windows setup).","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":238,"Q_Id":55465005,"Users Score":0,"Answer":"You could try to run the script again on a windows computer to see if you forgot to save some changes or if the file got corrupted somehow. You could also use bootcamp to install Windows on your mac since you could have one windows version on your mac for coding purposes and the regular mac OS for other stuff if you like.","Q_Score":0,"Tags":"python,macos,pygame","A_Id":55489181,"CreationDate":"2019-04-01T23:41:00.000","Title":"How to get Pygame script to run on macOS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to add Dicom tags to a series of Dicom images and want to save that modified batch.\nI have written a simple python script using pydicom which can edit and add dicom tags in a single Dicom image, but i want to do same procedure for complete image set (say 20 or 30 images).\ncan anybody suggest me a way to do such task using pydicom or python?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":848,"Q_Id":55500824,"Users Score":1,"Answer":"Just collect your filenames in a list and process each filename (read the file, edit contents, save as new or maybe use the same name).\nHave a look at the os module from python. For instance, os.listdir('path') returns a list of filenames found in the given path. If that path points to a directory that contains only dicom images you now have a list of dicom filenames. Next use os.path.join('path', filename) to get an absolute path that you can use as input for reading a dicom file with pydicom.\nAlso you might want to use a for loop.","Q_Score":2,"Tags":"python-3.x,pydicom","A_Id":55502000,"CreationDate":"2019-04-03T17:20:00.000","Title":"How to add dicom tags for a series of dicom images?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"It gives me the error only after I have converted it to an exe, works fine as a .py file\nI tried to find the file missing and replace it but it still didn't work.\nThe error I get is:\n\nTraceback (most recent call last):\nFile \"tkinter_init_.py\", line 1705, in call\nFile \"CompilerGui.py\", line 259, in \ndone = ttk.Button(window, text=\"Compile\", command=lambda:finish(texts,\n window, search_folder))\nFile \"CompilerGui.py\", line 210, in finish cb.the_main(q_list, values)\nFile \"CompilerBase.py\", line 323, in the_main\nfile_written = write_docx(values_dict, file_to_write)\nFile \"CompilerBase.py\", line 100, in write_docx\nmy_docx = docx.Document()\nFile \"site-packages\\docx\\api.py\", line 25, in Document\nFile \"site-packages\\docx\\opc\\package.py\", line 128, in open\nFile \"site-packages\\docx\\opc\\pkgreader.py\", line 32, in from_file\nFile \"site-packages\\docx\\opc\\phys_pkg.py\", line 31, in new\ndocx.opc.exceptions.PackageNotFoundError: Package not found at\n 'C:\\Users\\LENOVO\\AppData\\Local\\Temp_MEI92522\\docx\\templates\\default.docx'","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":500,"Q_Id":55506179,"Users Score":0,"Answer":"Another fairly simple fix would be to just copy the default.docx into your app directory, change my_docx = docx.Document() to my_docx = docx.Document(docx='default.docx'), and add datas=[('default.docx', '.')] to your .spec file.","Q_Score":1,"Tags":"python,pyinstaller,python-docx","A_Id":55540238,"CreationDate":"2019-04-04T00:34:00.000","Title":"How to fix PackageNotFoundError for exe files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"]How do I get my sprite to appear on the screen. i have been days at this and I couldn't get it to appear on the screen and it kept either taking over the screen as black.\nimport pygame\npygame.init()\nwin = pygame.display.set_mode((600,600))\npygame.display.set_caption(\"Napoleon\")\nbg = pygame.image.load(\"apple.png\").convert()\nwin.blit(bg, [0,0])\nflower= pygame.image.load(\"flower2.png\").convert()\nwin.blit(flower, [603,29])\npygame.display.update()","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":710,"Q_Id":55573424,"Users Score":5,"Answer":"Instead of convert() try convert_alpha(). Assuming your image has an alpha channel (PNG should be good) and it has been applied to your background. If your image has no alpha channel and you need a background gone, you should look into the set_colorkey() function.\nAlso, for future reference, you can format your code in your question by highlighting it all and pressing CTRL+K. Makes it much easier to read (and you'll get faster answers!)","Q_Score":3,"Tags":"python,python-3.x,pygame,python-3.6,python-3.7","A_Id":55573521,"CreationDate":"2019-04-08T12:22:00.000","Title":"How do I upload a png image in pygame as a sprite, without the black background?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm testing pyglet, and it has everything(except for a good guide) but the only thing that i don't understand is: how do I move the camera to show hidden content?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":682,"Q_Id":55616146,"Users Score":0,"Answer":"Try using an offset. Fo\/x, lets say x = 0, and camoffset = 5. You can render the x as x+camoffset. It works.","Q_Score":0,"Tags":"python-3.x,2d,viewport,pyglet","A_Id":55623339,"CreationDate":"2019-04-10T15:19:00.000","Title":"Is there a way to move the camera of a 2d world in pyglet?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We've been working on a GUI in tkinter and I'm not sure if it is in python 2 or 3. At first I couldn't get it to run until I changed the import statement from \"from tkinter import *\" to \"from Tkinter import *\". It runs but I'm still not 100% sure if the code is written in python 2. \n(I couldn't share the code since I was getting an error when I tried to post my question)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":166,"Q_Id":55658498,"Users Score":0,"Answer":"Yes, tkinter is nearly identical between python 2 and 3. The imports have changed, but other than that there are no significant differences.","Q_Score":0,"Tags":"python,tkinter","A_Id":55658515,"CreationDate":"2019-04-12T19:44:00.000","Title":"Is tkinter code written the same for python 2 as it is in python 3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running ML model, which predicts fingure gestures.I am trying to simulate key press event in python using pynput library and I check it's working fine.But I have other program which Is a game written in python using pygame library , which opens up in a new window , but the problem is key press controls doesn't work on that, but it works when I manually press keyboard buttons.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2335,"Q_Id":55728777,"Users Score":0,"Answer":"I solved the problem by emulating key press event using keyboard.press and listen the same event using keyboard.Listner() both are present in keyboard library.So I didn't use pygame functions to listen the event. Thanx everyone for ur help.","Q_Score":1,"Tags":"python-3.x,pygame,pynput","A_Id":55774018,"CreationDate":"2019-04-17T13:32:00.000","Title":"How to simulate key press event in python on another program running in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"if I try to import tkinter in my project, pycharm underlines tkinter as being a missing library.\nWhen I try to install the library, pycharm suggests to import the 'future' library instead of the tkinter library. I don't know why.\nIf I go to the project interpreter window, I cannot find the tkinter library after clicking on the install packages button.\nOn the pycharm terminal, if I try to pip install tkinter it returns:\nCould not find a version that satisfies the requirement tkinter (from versions: )\nNo matching distribution found for tkinter\nI get the same result when trying pip install python-tk, pip install python3-tk, and pip install tk.\nDoes anyone know why this is?\nI imported the project from windows into Ubuntu Mint 19.1, I am using interpreter Python 3.7.2. \nPlease let me know if I can add any more useful info.","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1159,"Q_Id":55739464,"Users Score":0,"Answer":"I fixed the issue by uninstalling PyCharm, and reinstalling it from the command line. The previous version I had installed it through the Linux Mint 19.1 Software Manager, and the version installed behaved in very strange ways; for instance it showed a completely different file tree to the one in my machine when trying to setup interpreters.\nHere is the command I used, as per JetBrains recommendation:\nsudo snap install [pycharm-professional|pycharm-community] --classic\nNote: I had to install snap first :)","Q_Score":2,"Tags":"python-3.x,ubuntu,tkinter,pycharm","A_Id":55747123,"CreationDate":"2019-04-18T05:08:00.000","Title":"tkinter is not recognized as a library when importing it on a pycharm project using python 3.x \u00bfWhy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm doing a homework and I want to know how can I move turtle to a random location a small step each time. Like can I use turtle.goto() in a slow motion?\nSomeone said I should use turtle.setheading() and turtle.forward() but I'm confused on how to use setheading() when the destination is random.\nI'm hoping the turtle could move half radius (which is 3.5) each time I update the program to that random spot.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":120,"Q_Id":55805378,"Users Score":0,"Answer":"Do you mean that you want to move a small step, stop, and repeat? If so, you can \u2018import time\u2019 and add \u2018time.sleep(0.1)\u2019 after each \u2018forward\u2019","Q_Score":1,"Tags":"python,python-3.x,turtle-graphics","A_Id":55810553,"CreationDate":"2019-04-23T06:19:00.000","Title":"Move turtle slightly closer to random coordinate on each update","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Question: Is there a way to make a Python game window display within Unity rather than opening a new window outside of Unity?\nContext: I have an assignment which is making a game in Unity 3D and I'm not enjoying it all that much. I have found great success and joy in creating games using the Python Arcade library when compared with Unity and the progress I make in Python is staggering compared.\nI haven't tried all that much as this seems to be a pretty special problem but I will search.\nExpected Outcome: I want to be able to display the Python game through an in-Unity sprite such as an arcade machine sprite which the Python game window will be displayed on\/in. It is important that the Python game will be displayed in Unity just in case I may be able to get away with this for my assignment, and that a player can interact with the Python game through controls in Unity.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":99,"Q_Id":55863377,"Users Score":2,"Answer":"What you ask for it more likely to be 10x more complex than writing a simple arcade game. Not meaning to diss your favourite game library but unity is fantastic and trying to avoid learning the basics of it is simply a mistake.\nWhile there are few thing 'not possible' within unity, embedding a view rendered by something completely different like a python framework sounds like weeks of work - where as writing a game on an assignment level once you grasp the basics is more like a few hours","Q_Score":0,"Tags":"c#,python,unity3d","A_Id":55863717,"CreationDate":"2019-04-26T08:08:00.000","Title":"Is it possible to display a python game window (or any file window) in Unity 3D?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im creating a form with python3 and tkinter, with a fwe buttons and a scrollbar. When I navigate the form via tab and ctrl-tab, it focus all the buttons AND the scrollbar too. I would like to exclude the scrollbar (and possibly other widgets) from the tabstop index. Is that possible?\nRegards","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":63,"Q_Id":55879331,"Users Score":1,"Answer":"You need to set the takefocus attribute of the scrollbar and other widgets to False.","Q_Score":0,"Tags":"python,tkinter","A_Id":55881902,"CreationDate":"2019-04-27T09:57:00.000","Title":"Create a widget without tab index","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to generate a vCard QR code with the pyqrcode library but I cannot figure out the way to do it.\nI have read their documentation 5 times and it doesn't say anything about vCard, only about URL and on the internet, I could found only about wifi. Does anybody know how can I do it?\nI want to make a vCard QR code and afterward to display it on django web page.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3595,"Q_Id":55884546,"Users Score":0,"Answer":"Let's say :\nWe've two libraries:\n\npyqrcode : QR reader \/ writer \nvobject : vCard serializer \/ deserializer\n\nFlow:\na. Generate a QR img from \"some\" web site :\nweb site send JSON info => get info from JSON and serialize using vobject to obtain a vcard string => pyqrcode.create(vcard string) \nb. Show human redeable info from QR img :\npyqrcode read an QR img ( created from a. ) => deserialize using vobject to obtain a JSON => show info parsing JSON in the web site.\nOR... after deserialize using vobject you can write a .vcard file","Q_Score":3,"Tags":"python,django,vcf-vcard","A_Id":55886326,"CreationDate":"2019-04-27T20:18:00.000","Title":"How can I create a vCard qrcode with pyqrcode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"In C++ there are .h and .cpp files for design and implementation of code respectively. Is there a similar way to structure files in Python? Can I define my class in one file, and then put all the code for that class in another?\nI feel like the answer is \"no\". I've tried looking up the answer, but the closest results were just how to merge c++ and python.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":548,"Q_Id":55910940,"Users Score":0,"Answer":"It would be much less worthwhile to do than in c++ because as AlexG mention python is not a compiled language. However, you could achieve a \"similar\" effect by linking to another python file. For example, if you wanted to have all of your functions created in a single file, and all of your logic done using those functions in another you would simply use import filename and you could reference your functions in the second file like you would in a .h and .cpp file.","Q_Score":0,"Tags":"python,c++","A_Id":55911047,"CreationDate":"2019-04-29T21:19:00.000","Title":"Is there a Python version of .h and .cpp files?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am an electrical engineer building a Python application to interface with PSS\/E (Power Systems Simulation for Engineers by PTI Siemens). The way the code currently works, the program contains a main method which calls methods from two classes (in separate files) which I have written. Throughout the different steps of the program, the user interacts with it through a terminal (Enter file paths, press enter to continue, etc). \nI am working on implementing a GUI with Tkinter. The user would browse to select several files, select certain options, then press 'Start'. Then, the user would interact with the GUI at the different steps of the program, instead of typing into the terminal. \nWhat would be the philosophy used to implement a GUI into this program? I am thinking that on the one hand, I can have a file for the GUI, initiate the program from this file, then call the main method when the user pushes 'start'. The options\/file paths from the user, would be passed to the main method as parameters. On the other hand, I'm thinking of integrating the GUI into my main method. Have a separate file with the class\/methods for the Tkinter widgets, and call them from main as needed. Which (if any) of these would be the best way to go, and why? I also have a question about how to deal with Python 2.7 being 'retired' in January of 2020, since my code is dependent on version 2.7. I will ask this in another question to allow for some elaboration on this GUI question. Thanks in advance for your input.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":55911002,"Users Score":1,"Answer":"While it is possible to write a GUI program as a straight port of a terminal program that works as you describe, with the main program driving the flow of interaction with the user, most GUI programs are written as a set of event handlers, also called callback functions. Because the event loop is calling back to you using the handlers you provide to it. \nUsually the main program just declares your controls, binds them to handlers, and starts the event handling loop.\nThere are various ways to organize such a program, and it depends a lot on your workflow. \nBut the event handling functions usually drive the overall logic, rather than the main program. This allows the user to interact with your program in a less linear way.\nIt is often useful to decouple the event handling logic and create a 'model' that represents the state of your program and logic unrelated to the GUI. Then the event handlers would call functions or methods of your model to change the state of the program.","Q_Score":0,"Tags":"python-2.7,tkinter,architecture,psse","A_Id":55911362,"CreationDate":"2019-04-29T21:23:00.000","Title":"Which Function Should be in the Driver's Seat on a GUI Application?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Recently I have been working on an assignment to convert five file formats (.dae, .stl, .step, igs, obj) to .stl. using FreeCAD Python console and help from people on StackOverflow and FreeCAD forum, I was able to do that. \nThe last part of this assignment is to convert .sldprt (Solidworks Parts File) to .stl. Unfortunately, FreeCAD does not support importing this file format and I can not use its Python console to convert this file format to .stl. \nI have been searching Python APIs that can read\/export .sldprt files but I haven't been able to find any. I did find some online sources (GradCAD, Datakit Cross manager etc.) but I need to accomplish this by a Python script (preferably Python 2).\nIs there another way I can convert .sldprt file to .stl using Python? Can someone point me in the right direction where to start?","AnswerCount":2,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":3169,"Q_Id":55941384,"Users Score":4,"Answer":"Since sldprt is a proprietary format, you are only able to do that if SOLIDWORKS is installed on the executing machine. This is done with the SOLIDWORKS API. With that condition out of the way, you will need to write some sort of bridge between Python and the SOLIDWORKS COM API objects which is a big hassle. If this is a school assignment, I would suggest you write a console application in C# or VB.NET that opens the file and converts it to whatever target format. You can command that application from your Python program.\nThere are a bunch of cloud services that can do CAD files conversion. Those can be a good alternative if you can't afford a SOLIDWORKS license or don't have access to one.","Q_Score":4,"Tags":"python,solidworks,stl-fileformat","A_Id":55943185,"CreationDate":"2019-05-01T19:10:00.000","Title":"Convert .sldprt file to .stl using Python script","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would know if it's possible to unload a image after use.\nIn fact, I load a lot of image for the main, for the settings, the game and creadits too.\nBut there are image useful in a part but completely useless in the three others. I mean for 90%, they are useful in only 1 part.\nSo, I wonder if exist a way to delete the image from the memory of the program, and by the way make it less heavy...","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":359,"Q_Id":55981326,"Users Score":2,"Answer":"The garbage collector will do it automatically when there are not anymore references to the images.\nFor example, say you have myimage = pygame.image.load('path\/to\/image). If at some point you set myimage = None and you do not have any other reference to that image, the garbage collector will free the memory.\nOf course you can also do del myimage. The del statement will delete the reference immediately (but not the object itself).\nIf your game is properly designed (with classes, functions) it's very likely that the garbage collector is already doing its work and you do not need to take care of deleting things.","Q_Score":2,"Tags":"python,pygame","A_Id":55981594,"CreationDate":"2019-05-04T09:51:00.000","Title":"Pygame : Is it possible to unload a image for save memory?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to Python and to train myself, I would like to use Python build a database that would store information about wine - bottle, date, rating etc. The idea is that:\n\nI could use to database to add a new wine entries\nI could use the database to browse wines I have previously entered\nI could run some small analyses\n\nThe design of my Python I am thinking of is: \n\nDesign database with Python package sqlite3\nMake a GUI built on top of the database with the package Tkinter, so that I can both enter new data and query the database if I want.\n\nMy question is: would your recommend this design and these packages? Is it possible to build a GUI on top of a database? I know StackOverflow is more for specific questions rather than \"project design\" questions so I would appreciate if anyone could point me to forums that discuss project design ideas.\nThanks.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2745,"Q_Id":55985778,"Users Score":0,"Answer":"If it's just for you, sure there is no problem with that stack.\nIf I were doing it, I would skip Tkinter, and build something using Flask (or Django.) Doing a web page as a GUI yields faster results, is less fiddly, and more applicable to the job market.","Q_Score":0,"Tags":"python,database,sqlite,user-interface","A_Id":55985903,"CreationDate":"2019-05-04T18:47:00.000","Title":"Python: how to create database and a GUI together?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I was trying to insert an image in pygame, I heard people say your images have to be in the same directory as pygame and I'm not sure what that means. I was hoping someone could help me, Thank You.\nI know all the commands and how to insert an image but it gives me an error because the image is not in the same directory\nMy wish is to have my image as a background in my screen.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":25,"Q_Id":55988633,"Users Score":1,"Answer":"Imagine you have a pygame folder and inside that lies those executables that fires up your pygame instance, so for that you need to load that image also.\n\npygame\/\n-----------mygame.py\n\nNow your pygame instance searches for the image which can have either relative or absolute pathnames.\nIn the same directory quintessentially means the folder\/directory where your executable instance is running (eg mygame.py etc), so you have to copy-paste your image to that directory in layman terms and run the mygame.py again.\nDirectory structure updates to:\n\npygame\/\n-----------mygame.py\n-----------background.jpg","Q_Score":0,"Tags":"python","A_Id":55989070,"CreationDate":"2019-05-05T03:39:00.000","Title":"What to do when there is an issue with inserting images in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Using a Text Widget in Tkinter, I want to highlight on the vertical scrollbar where the locations of found text are, similar to how Chrome highlights locations of words found in the Vertical Scrollbar if you use the Find option on a webpage. How can that be accomplished?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":64,"Q_Id":56013208,"Users Score":1,"Answer":"How can I create Marks in a Tkinter Text Widget's Vertical Scrollbar?\n\nYou can't. The tkinter scrollbar doesn't support it. You will have to create your own scrollbar by drawing the various pieces on a canvas and then write code that mimics the scrollbar api.","Q_Score":0,"Tags":"python-3.x,tkinter,scrollbar","A_Id":56014318,"CreationDate":"2019-05-06T22:34:00.000","Title":"How can I create Marks in a Tkinter Text Widget's Vertical Scrollbar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to reassign self inside its own class?\nI have a form for that class which have okay button and cancel button. If the user click okay, I will only pass its value to another window. However, if I click cancel, I want to return the state of that form to its previous state. So if the user click that form and it contains value, then the user add a field, but he\/she decided to click cancel, I want to reassign the previous state of the instance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":739,"Q_Id":56014968,"Users Score":0,"Answer":"I agree with the comment, it will be helpful if you can show more details. But if I understand you correctly, a better way to implement this is creating a bidirectional linked list structure in which each element is a state rather than modifying an instance. So you can treat ok and 'cancel' button as two opposite operators operating on the forward and backward pointers of this linked list. The length of this list is the steps the user can go back with.","Q_Score":1,"Tags":"python,python-3.x","A_Id":56015465,"CreationDate":"2019-05-07T03:05:00.000","Title":"Method's parameter 'self' reassigned","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to build a system, in which I want to use both Python and C. Python will be used for GUI on wxPython module and C will be used to handle backend processes. I have some pre-built C functions which will be rearranged and sent to a C compiler as files by the GUI. After compilation is done, the resulting file will be given as an argument to another executable and run the executable.\nI've tried to run some exe from inside Python. Now I'm looking for an IDE which supports working with both the languages simultaneously i.e. coding and debugging.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":169,"Q_Id":56082628,"Users Score":1,"Answer":"You could try using Eclipse. You can install Python and C\/C++ on it.","Q_Score":0,"Tags":"c,python-3.x,vscode-debugger","A_Id":56082687,"CreationDate":"2019-05-10T17:55:00.000","Title":"Is there any IDE where I can debug C and Python codes simultaneously?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there some way I can create custom styles in wxPython? I searched all the docs and websites referring to wxPython styling and could find nothing. Do I have to create the custom style using the wxPython canvas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":346,"Q_Id":56159215,"Users Score":1,"Answer":"wxPython uses native widgets in its core widgets as much as possible. Most of the widgets are going to be \"native\" to the system you are using, so unfortunately you can't fully manipulate how the control paints itself.\nSometimes, you can modify widgets via the methods mentioned in the documentation, such as using SetBackgroundColour() or SetForegroundColour(). Depending on your OS's widget, they may or may not work.\nThe other option is to use the wx.PaintDC, wx.ClientDC, wx.WindowDC, wx.ScreenDC and\/or wx.MemoryDC to draw custom widgets directly.","Q_Score":1,"Tags":"python,user-interface,wxpython","A_Id":59923520,"CreationDate":"2019-05-16T00:19:00.000","Title":"Python - Custom styling in wxPython","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I run my Qt application I get the message \n\nQt WebEngine seems to be initialized from a plugin. Please set\n Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before\n constructing QGuiApplication.\n\nThe app runs fine regardless of the fact that this is getting dumped to the terminal. I cant seem to find the root cause or really understand what this message is trying to tell me. What is this message saying and how can I fix it?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":7357,"Q_Id":56159475,"Users Score":0,"Answer":"Using PySide6 instead of PySide2 solved my problem with python 3.9 and QT 5.15 if it can help","Q_Score":9,"Tags":"python,pyside2,qtwebengine","A_Id":67457543,"CreationDate":"2019-05-16T01:06:00.000","Title":"Qt WebEngine seems to be initialized","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1},{"Question":"I'm trying to have it so that when a tkinter button is pressed, a value is assigned, and then the gui is exited. \nMy problem is that root.quit has no effect from functions other than the one that called it, even nested functions.\nCode:\n\nfrom tkinter import Tk,Button\ndef buttonDialogWindow():\n root = Tk()\n def buttonPress(isHeadArg):\n #Do something\n root.quit\n Button(root, text='Front of String', command = buttonPress(1)).pack()\n Button(root, text='Back of String', command = buttonPress(0)).pack()\n root.protocol(\"WM_DELETE_WINDOW\", root.quit)\n root.mainloop()\nbuttonDialogWindow()\n\nRunning the code makes the buttons appear. Clicking them has no effect on the GUI, and the mainloop does not exit.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":87,"Q_Id":56178798,"Users Score":0,"Answer":"Answer: \nThe problem was that when I set the value of command, I was calling the function rather than declaring it. Using parentheses made the function get called -- if you have no parameters, the normal way to write this would be to write \n command = buttonPress \nIf you do have parameters, I found a workaround using lambda: my code currently has\n command = lambda: buttonPress(1) \nfor the commands.","Q_Score":0,"Tags":"tkinter,python-3.7","A_Id":56179545,"CreationDate":"2019-05-17T02:31:00.000","Title":"How to have a tkinter button destroy\/quit the root window in a nested function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a python script that I wanted to compile to an executable. I used cython first, to create a .c file and then I wanted to compile that to an executable with g++. This however causes an error stating that something in structmember.h (which is a header file that comes with python) is apparently wrong.\nI have tried to find other people with the same problem, but I couldn't.\nI used this to compile:\ng++ Training_set.c -o Training_set.exe \nThe error i got was:\nTraining_set.c:17362:26: fatal error: structmember.h: No such file or directory\ncompilation terminated.\nstructmember.h:21:5 error: 'Py_ssize_t\" does not name a type\nstructmember.h:67:11 error: expected constructor, destructor or type conversion before '(' token\nstructmember.h:68:17 error: expected constructor, destructor or type conversion before 'Pymember_SetOne'","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":283,"Q_Id":56192695,"Users Score":0,"Answer":"So i managed to fix my problem, somehow if I put all header files in a subdirectory and provide the path to them with -I it does work.","Q_Score":0,"Tags":"c,python-3.x,g++,header-files","A_Id":56197871,"CreationDate":"2019-05-17T19:46:00.000","Title":"How to fix error from structmember.h when compiling with g++","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to remove the topbar of a window (the title, icon, resize and close window buttons) without root.overrideredirect(True) because this method will toggle other things that I need too. Is there a different way to remove the topbar with tkinter?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":56198979,"Users Score":0,"Answer":"The only way to remove it is with overrideredirect.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":56200116,"CreationDate":"2019-05-18T12:33:00.000","Title":"Need to remove windows topbar in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a driver which is written in C#, .NET 4.7.0 and build as DLL. I don't have sources from this driver. I want to use this driver in python application.\nI wrapped some functionality from driver into method of another C# project. Then I built it into DLL. I used RGiesecke.DllExport to make one method available in python. When i call this method from python using ctypes, I get WinError -532462766 Windows Error 0xe0434352.\nIf I exclude driver code and keep only wrapper code in exported method everything runs fine.\nCould you please give me some advice how to make this working or help me find better sollution? Moving from python to IronPython is no option here.\nThank you.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":306,"Q_Id":56224958,"Users Score":0,"Answer":"PROBLEM CAUSE:\nPython didn't run wrapper from directory where it was stored together with driver. That caused problem with loading driver.","Q_Score":1,"Tags":"c#,python,dll,wrapper,dllexport","A_Id":56241575,"CreationDate":"2019-05-20T16:35:00.000","Title":"Use C# DLL in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working in OpenCV (camera calibration and then creating 3d model) and till now I always printed a checkerboard pattern on paper and then took pictures needed for calibration. I tried to find a way to draw the pattern on the full screen with pre-defined square sizes (so I could set that square size in the calibration process), but I only found the Python turtle module which seems to only be for drawing on part of screen, and it always draws an arrow on last square. I need to draw the pattern with some small offset from the screen borders and, inside those offsets, draw a checkerboard with uniform squares. Also, I saw some people are drawing patterns in GIMP, but not on the full screen. \nOpenCV has the function drawChessboardCorners but it requires founded corners from previous imported images, which need to be calibrated, so I think it doesn't make sense. \nIf anybody has an idea how to solve this problem, either with some program or module in some programming language (Python if possible), I would be grateful.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1120,"Q_Id":56275319,"Users Score":0,"Answer":"Prepare your chessboard pattern in your favourite graphics editor, save the file onto the computer you want to use to display it for your calibration, then just display it when needed. I think you might be over-thinking the problem...","Q_Score":0,"Tags":"python,python-3.x,opencv,camera-calibration","A_Id":56275671,"CreationDate":"2019-05-23T12:32:00.000","Title":"Drawing full screen chessboard pattern?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a GUI in python, and using tkinter. I'm having trouble settling on an approach and need guidance.\nBackground: there's a server (not a webserver) that wants to present a lot of information to users, and let them edit some of it. It needs to send down information that a (relatvely) dumb python client uses to fill the window. Read only fields are Labels. The fields are generally single line Entry widgets, but some are multiline Text. There are some buttons, checkboxes and dropdowns. Asynchronously, the server can also update widgets, add them and remove them. In some cases, there are tables presented, to which the user needs to be able to add and remove rows.\nThe real problem is, the layout is dense and chaotic. The first row might contain 3 dropdown fields. The next might be 20 short Labels. The next might be a single long Entry field, and then I might want two tables (of different lengths) side by side,and then etc.. Based on user input of external factors, widgets, rows or entire tables might have to be dyamically added, or vanish.\nI considered Grid, but it's unusable. A row with a single, long entry widgit in it, makes the first column wide and thereby pushes 12 of the 13 columns in the next row right off the window. \nI considered Place, but this app will run on 3 different operating systems and users will be able to select their own fonts, so I'll never get the positions right. If there was some way to ask a widget how big it was, I'd happily use that to compute my own layouts in pixels, but it's apparently impossible to ask the size of a widget until AFTER it's been laid out by a geometry manager, which of course is too late. \nSo what I think I'm left with is Pack, where each row is its own frame, and some of those rows have tables (grids) in them. But I'm concerned that that means lots and lots of frames to render, and some of the users are on old, slow hardware. Plus... it looks just plain complex.\nAm I missing a better way? Grid would be fine if I could convince it to stop trying to make columns line up. Place would be crunchy, but ok, if I could get the size of each widget in advance. Is placing within a lot of frames really the best I have?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":182,"Q_Id":56284263,"Users Score":0,"Answer":"Short answer, there's no better way; and the frame count isn't high enough to cause performance problems; so generating a frame per row is what works.","Q_Score":0,"Tags":"python-3.x,tkinter,geometry","A_Id":56409926,"CreationDate":"2019-05-23T23:58:00.000","Title":"python3 tkinter: can I get ragged grids without aligned columns?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As you may know, from August 1, 2019 all Android-releases must be compliant with the Google Play 64-bit requirement.\nWill Kivy + Buildozer allow us to create such apps?\nThank you in advance!","AnswerCount":3,"Available Count":2,"Score":0.2605204458,"is_accepted":false,"ViewCount":879,"Q_Id":56312843,"Users Score":4,"Answer":"Buildozer already allows you to create such apps, just change the android.arch configuration token in buildozer.spec to arm64-v8a instead of the default armeabi-v7a.\nWe don't support APKs with multiple architectures bundled together, mostly because this would significantly increase their size due to all the compiled components, but you can upload one APK of each type to Google Play.\nWe'll probably update the defaults and provide more documentation about it within the next few months.","Q_Score":2,"Tags":"android,python,google-play,kivy","A_Id":56313205,"CreationDate":"2019-05-26T10:51:00.000","Title":"Kivy and Google Play 64-bit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As you may know, from August 1, 2019 all Android-releases must be compliant with the Google Play 64-bit requirement.\nWill Kivy + Buildozer allow us to create such apps?\nThank you in advance!","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":879,"Q_Id":56312843,"Users Score":0,"Answer":"It's simple, Just go to line 232 in the buildozer.spec file and change the arch to arm64-v8a and then build the app and then again build the app by changing the arch of buildozer.spec file to armeabi-v7a. On Google Play console, upload both the files.","Q_Score":2,"Tags":"android,python,google-play,kivy","A_Id":67867070,"CreationDate":"2019-05-26T10:51:00.000","Title":"Kivy and Google Play 64-bit","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Because it has a method known as draw. Which considers the text attribute of the sprite so we can store surfaces , images and rectangles .But what if we want to store the circle sprite which requires position and radius to be drawn","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":31,"Q_Id":56334560,"Users Score":1,"Answer":"A sprite is an image; images happen to have rectangular shape because that's a natural consequence of the way they are represented.\nIf you want to draw a circle, you have two options: you can draw an image of the circle, which would be a sprite that you position like any other sprite, using its corner as its reference point; or you can draw an actual circle, where a sprite library would not be a huge help.","Q_Score":1,"Tags":"python,python-3.x","A_Id":56334647,"CreationDate":"2019-05-28T03:18:00.000","Title":"Can only be rectangular objects stored in pygame.sprite.Group","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a canvas that has a width of w and a height of h. I'm trying to fit my (1000 x 800) image on it using image = image.zoom(w).subsample(800). But it's giving me the error: _tkinter.TclError: not enough free memory for image buffer. Can someone please help?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1456,"Q_Id":56362497,"Users Score":1,"Answer":"When you call zoom, the first parameter specifies how much to multiply each pixel by. If you only provide an x value, the y value will be the same as the x value. Thus, if w is 1000, zoom(x) will attempt to create an image that is one million pixels wide by 800,000 pixels tall. That's nearly a terabyte of image data.","Q_Score":0,"Tags":"python,tkinter,photoimage","A_Id":56362992,"CreationDate":"2019-05-29T14:06:00.000","Title":"Cannot zoom tkinter PhotoImage: _tkinter.TclError: not enough free memory for image buffer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am creating a simple Kivy app in python, but I can't figure out how to upload the .py as app to my iPhone for free.\nCan someone help me with this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":152,"Q_Id":56400561,"Users Score":1,"Answer":"according to kivy documentation: \n\nIn order to submit any application to the iTunes store, you will need an iOS Developer License. For testing, you can use a physical device or the XCode iOS emulator.\n\nI suggest using a cheap android phone to test out your application. You will need to package your application for Android. In order to do this, you will need to use Linux.","Q_Score":1,"Tags":"python,ios,kivy","A_Id":56408450,"CreationDate":"2019-05-31T19:09:00.000","Title":"How to upload a python file with Kivy to iPhone for free?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I developed an ML model which requires two arguments, which are the path of the two files used by the model function. The task at hand requires a web page which could take those arguments for the model and deliver it to the function. \nThe job could also be done using Tkinter in python for developing a GUI Frame, but my situation requires a web page for further development.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":175,"Q_Id":56422270,"Users Score":1,"Answer":"You could use flask, pyramid, or django to make a web-app that will call your ML function.It doesent have to be hosted on a server you can run it locally on your computer.\nWhat isn't clear is why in your particular case you can't use Tkinter. Is your webpage suppose to be accesed by someone else ? From outside you local network ? \nThe question isn't verry clear.","Q_Score":0,"Tags":"python,html","A_Id":56422428,"CreationDate":"2019-06-03T06:44:00.000","Title":"How to run a python script from a HTML page without the use of a server? It should serve the purpose of a GUI Frame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I'm creating GUI using python tkinter to visualize Road Scenarios (the main vehicle & close by vehicles). I draw in the canvas lines to give road top view (as the Picture below).\nThe user can insert a rectangle (vehicle) then move it freely on the canvas.\nWhat I want is: after the user moves the rectangle to where ever he wants, the y coordination of the rectangle will relocate to the nearest lane, to have a nice looking png at the end.\nMy thought about it:\n\nDivide the canvas to regions (each Region represent a lane)\nCreate a function which knows when the rectangle finished moving, then modify the y coordination of it to the nearest Region (lane).\n\nNot sure how to apply this in Code though. Any useful canvas functions or another approach are much appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":105,"Q_Id":56447346,"Users Score":0,"Answer":"The approach I mentioned at the question worked for me.\n\nA list identifing the y-axis sides of each Region was created.\nAfter creating the items needed, they all share a common Tag.\nChoose which part of the items you want to consider the original Point (which will be used later as the item's current location). Canvas.bboc(CURRENT) can be sufficient to do that.\nDetect when does the item enter a Region, by comparing if the item's current Location is within the boundaries of a Region.\nUse Canvas.coords() or Cancas.move() methods to move the items at the middle of the regoin they have entered.","Q_Score":0,"Tags":"python,tkinter,tkinter-canvas","A_Id":56496502,"CreationDate":"2019-06-04T15:51:00.000","Title":"Dividing canvas to regions, then attracting nearby items to the nearest region?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a program that can read and store the data from a qr scanning device but i don't know how to get the input from the barcode scanner as an image or save it in a variable to read it after with openCV","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":601,"Q_Id":56469264,"Users Score":0,"Answer":"Typically a barcode scanner automatically outputs to the screen, just like a keyboard (except really quickly), and there is an end of line character at the end (like and enter). \nUsing a python script all you need to do is start the script, connect a scanner, scan something, and get the input (STDIN) of the script. If you built a script that was just always receiving input and storing or processing them, you could do whatever you please with the data. \nA QR code is read in the same way that a barcode scanner works, immediately outputting the encoded data as text. Just collect this using the STDIN of a python script and you're good to go!","Q_Score":0,"Tags":"python,input,qr-code,barcode-scanner","A_Id":56469292,"CreationDate":"2019-06-05T23:27:00.000","Title":"How to use python with qr scanner devices?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make a GUI with PyQt5. It will have a notification button with an icon. I want to add a small bubble with the number of notifications on the icon.\nIf a number is not possible, I would like to use a red dot as a backup method.\nBut how should I keep track of the new notifications (like a listener for notification) and change the icon while the window is running?\nI have been googling about this problem, but only mobile development stuff and non-PyQt5 related results come up.\nExpected result: Let's say we have a list. And the icon of the button will automatically change when a new item is added to the list. Then when the button is clicked, the icon will change back.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":830,"Q_Id":56484679,"Users Score":0,"Answer":"A possible solution to updating the icon would be to have a separate image file for each icon and its associated notification number. You can keep track of the number of current notifications in a counter variable. Use that number to call the corresponding icon.","Q_Score":3,"Tags":"python,python-3.x,pyqt,pyqt5","A_Id":56487888,"CreationDate":"2019-06-06T20:28:00.000","Title":"How to add notification number to a button icon?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with wxPython, the Python bridge to wxWidgets, so I guess a wxWidgets user could reply. I'm playing with the KeyEvent class and since I'm testing my code on other platforms and other keyboards, I've made an incredible (to me) discovery: other keyboard layouts don't seem to be very well supported.\nHere's what I mean: if you run the demo (KeyEvents.py in my case) and press on random letters, with a QWERTY keyboard, everything works. Switch to another layout, things still work... somewhat. Right now I have an AZERTY keyboard mostly used in France, so when I press the a key (which is on the English position of the q) a 'a' is reported. So far so good. But if I press a \u00e9 (a key which is on the English 2 key), a 2 is reported. Reading the documentation didn't exactly help me to figure out what is going on. Is that a kind of mistake no one has noticed since wx is out? I would guess and hope not, but better late than never I guess.\nTo be more technical still, the KeyDown and KeyUp events have this problem. I have an AZERTY kleyboard, I press on the 2 key, and a 2 is reported, whereas a \u00e9 is written on screen. Admittedly, the Char event does report a \u00e9, but, if I understood correctly, a Char event is not triggered in any context a KeyDown event is triggered. Perhaps I missed something here and perhaps that's the solution for me and international users.\nThanks in advance for your reply,","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":113,"Q_Id":56566858,"Users Score":1,"Answer":"Char event is not triggered in any context a KeyDown event is\n triggered.\n\nFalse.\nDue to each country has its own keyboard layout, wxWidgets sends two events when a key is pressed: One (key event) is the somewhat hardware code for that key; the other (char event) is the \"translated\" code, normally a Unicode point, but an ASCII code if you disabled Unicode support.\nKeyevent is useful if you just want to do something on key-down or key-up events. If working with chars, then use only char event.","Q_Score":0,"Tags":"python,wxpython,wxwidgets","A_Id":56567608,"CreationDate":"2019-06-12T16:39:00.000","Title":"wx.KeyEvent and non-QWERTY keyboards","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"General idea:\nMany items (majority small images) are created on the canvas. The user can click on any item and move it. \nI need the user to know which item was last clicked, by showing (drawing) a border\/change brightness\/any method.. around that item.\nIs there any Image\/item options to help apply this idea.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1023,"Q_Id":56580739,"Users Score":0,"Answer":"For example this is your button-\nB1 = Button(root, text = \"Click me\", command = clickme)\nwe can pass more parameters here such as--\nhighlightcolor=\nThe color to use for the highlight border when the button has focus. The default is system speciific. (highlightColor\/HighlightColor)\nand\nhighlightthickness=\nThe width of the highlight border. The default is system specific (usually one or two pixels). (highlightThickness\/HighlightThickness)\n...\nOR\n...\nWhenever the button is clicked you must be specifying some action to do in a function. What you can do is you can tell that function to slight increase the thickness of border by above parameters. :)","Q_Score":0,"Tags":"python,tkinter,python-imaging-library,tkinter-canvas","A_Id":56580912,"CreationDate":"2019-06-13T12:41:00.000","Title":"highlight clicked items in tkinter canvas?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Learning python workflow on android tablet\nI have been using Qpython3 but find it unsatisfactory\nCan anybody tell me how best to learn the python workflow using an android tablet... that is what IDE works best with android and any links to pertinent information. Thank you.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":2770,"Q_Id":56605247,"Users Score":1,"Answer":"Try pydroid3 instead of Qpython.it have almost all scientific Python libraries like Numpy,scikit-learn,matplotlib,pandas etc.All you have to do is to download the scripting library.You can save your file with extension ' .py ' and then upload it to drive and then to colab\nHope this will help.......","Q_Score":0,"Tags":"android,python","A_Id":59534068,"CreationDate":"2019-06-14T21:20:00.000","Title":"Using python on android tablet","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written some bunch of python files and i want to make a window application from that. \nThe structure looks like this:\nSay, a.py,b.py,c.py are there. a.by is the file which i want application to open and it is basically a GUI which has import commands for \"b.py\" and \"c.py\". \nI know this might be a very basic problem,but i have just started to packaging and deployment using python.Please tell me how to do that , or if is there any way to do it by py2exe and pyinstaller?\nI have tried to do it by py2exe and pyinstaller from the info available on internet , but that seems to create the app which is running only \"a.py\" .It is not able to then use \"b\" and \"c \" as well.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1980,"Q_Id":56680262,"Users Score":0,"Answer":"I am not sure on how you do this with py2exe. I have used py2app before which is very similar, but it is for Mac applications. For Mac there is a way to view the contents of the application. In here you can add the files you want into the resources folder (where you would put your 'b.py' and 'c.py').\nI hope there is something like this in Windows and hope it helps.","Q_Score":0,"Tags":"python,file,window","A_Id":56680443,"CreationDate":"2019-06-20T06:34:00.000","Title":"Building a window application from the bunch of python files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I can not import Pygame in pycharm. I\u2019ve looked at videos and other posts. I have it installed, both on the PyCharm interpreter and on my system. I get an error that says no module named Pygame, module Pygame does not have an init attribute.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":84,"Q_Id":56691815,"Users Score":1,"Answer":"Go to File > Settings > Double Click on Project: (Your project name) > Project Interpreter > The + Button on the right side of the window. Also make sure you typed import pygame on the first line of the program.","Q_Score":0,"Tags":"python,pygame,pycharm","A_Id":58721253,"CreationDate":"2019-06-20T18:19:00.000","Title":"Pygame In PyCharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to know where are the pygame Impact font for use it in my own game. If I use pygame.font.get_fonts() Impact is in the list.\nI navigate to all Python and PyGame folders (Without change anything) and the most similar I found is font.h\nI'm using Windows 10 with Python 3.7 and PyGame 1.9.4\nThe path where I looking is C:\\Users\\[Username]\\AppData\\Roaming\\Python\\Python37\\Include\\pygame\nI excepted that the font will be on a pygame folder of Python37 folder.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":412,"Q_Id":56708653,"Users Score":1,"Answer":"The fonts available will be system dependent. However, you can get a list of all of the fonts available by calling: pygame.font.get_fonts().\nYou can load any TrueType font file (*.ttf) with pygame.font.Font(). To load the font file myfont.ttf in your project directory simply call pygame.font.Font(\"myfont.ttf\", size). Substitute the path to your file for the first parameter if you have it in a different location. You can use either a relative or an absolute file path.\nSo I assume there are no fonts pre-saved in a directory.","Q_Score":1,"Tags":"python,text,fonts,pygame","A_Id":56709344,"CreationDate":"2019-06-21T18:22:00.000","Title":"Where are Pygame Fonts located on Windows?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to be able to work on a small Pygame game in the Visual Studio 2017 IDE. I installed Python3.7 and the latest version of pygame with the installation pip, but I run the program, it can not find the module '' Pygame ''","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1129,"Q_Id":56719788,"Users Score":0,"Answer":"Run the following command:\npip install pygame","Q_Score":0,"Tags":"python-3.x,visual-studio-2017,pygame","A_Id":56719803,"CreationDate":"2019-06-22T23:03:00.000","Title":"How to install pygame on visual studio 2017?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to skip the Android P setup wizard programmatically to reach Home Screen to proceed doing other scripted jobs. Since the ADB already recognizes the device when plugged on first setup wizard page, I was trying to skip initial setup using it. Is there any way to do that using ADB or by other tools, potentially Python?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1244,"Q_Id":56791662,"Users Score":0,"Answer":"I think I may have tried this before and I don't believe there is. While the ADB recognizes that there is a device attached, that doesn't mean it can read it. The device would have to be set up completely before it would be able to interact and read\/send data to the ADB.","Q_Score":1,"Tags":"android,python,adb","A_Id":56791764,"CreationDate":"2019-06-27T13:03:00.000","Title":"Is there any way to skip Android device setup wizard using ADB when device is on Android P?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Im new on Python-Kivy library. So im working hard on kivy's documentation.For now i can create a mini games like characters moves,jumps,background moves etc. In widget controls, im using collide_widget option for check widgets impacts.So i have 2 questions about these:\n1- My image's widgets are ALWAYS RECTANGLE. So when i try to use collide_widget for not rectangle images (like character or ball) Python giving me return 'TRUE'. Because i can't define image's widget's like ellipse or something custom shape.Is there any selection for make these widgets ellipse or somethng else for collide_widget controls.\n2- Im seeing only 'collide_widget' control for widgets impact controls? Is there any other check ways for widgets impacts.If so , can you give me a documentation for read and learn.\nThanks for answering already..As you can see im new at Kivy so these widget controls made me fatigue.If there no any option for change this images widgets to ellipse or custom shapes ( like character ) should i use integral for check this image's outside position controls ..?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":26,"Q_Id":56842790,"Users Score":0,"Answer":"Is there any selection for make these widgets ellipse or somethng else for collide_widget controls.\n\nImplement your own collision detection that does what you want, and optionally override collide_widget with that implementation.\n\nIm seeing only 'collide_widget' control for widgets impact controls? Is there any other check ways for widgets impacts\n\nKivy is not a physics engine, its widget layer is primarily there for the purposes of constructing a gui. If you want collision functionality, code it yourself or use a library. For instance, pymunk is an advanced and powerful option.","Q_Score":0,"Tags":"python,widget,kivy","A_Id":56842898,"CreationDate":"2019-07-01T21:40:00.000","Title":"Widget Shapes and Widget Impact Checks","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running a pyautogui script to automate an app I have and the script uses both keyboard and mouse \nI want to be able to normally use my PC while the script is on (which needs the app to be in focus and control the mouse and keyboard) \nI'm wondering if there is a way to be able to make the script run in the background and make windows think the app is in focus and register all mouse clicks and keyboard input to that app \nI've tried to run the script in a VM but that was too slow, maybe there is a an app to make a virtual mouse or a virtual desktop I can use or something similar? \nany method is welcome, thanks\nEDIT: Solution is pywin32","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1308,"Q_Id":56909862,"Users Score":1,"Answer":"You can't do that in pyautogui I believe.\nTry exploring pywinauto instead if you are automating on windows. That module takes control of a desktop application using windows win32.\nHope this helps :))","Q_Score":0,"Tags":"python,python-3.x,pyautogui","A_Id":56910433,"CreationDate":"2019-07-05T22:37:00.000","Title":"How to use pyautogui script in the background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm building a python program that displays the time, weather, and anything else that would be suitable to be put in an information center. Is it possible to run this program natively on android and get live updates like the python program?\nI've googled it and haven't been able to find anything close to an answer.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":56,"Q_Id":56918220,"Users Score":1,"Answer":"No, you cannot run tkinter programs on the android platform.","Q_Score":0,"Tags":"java,android,python-3.x,tkinter","A_Id":56918728,"CreationDate":"2019-07-06T23:06:00.000","Title":"Can a tkinter python program be mirrored on an android app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to just import parts of tkinter, like you can import parts of Java swing without having to import the entire library when you only need to use 4 or 5 modules. I am writing small python program with pop-up input\/output window a few textboxes and buttons and only want to use grid layout manager.\nI have looked through all the python and tkinter documentation and searched tutorial websites and youtube unable to find an example.\nGeneral python\/tkinter language query.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":47,"Q_Id":56937837,"Users Score":1,"Answer":"You have to have all of tkinter in memory even if you don't use it all. You can import individual pieces like you can with any other python module, but that won't make your program any smaller or more efficient. Under the hood python will import the entire module, even if it only makes part of the module visible to your code.\nArguably, the only real effect would be in making your code a bit harder to understand by deviating from best practices.","Q_Score":0,"Tags":"python,tkinter","A_Id":56941119,"CreationDate":"2019-07-08T15:09:00.000","Title":"Importing tkinter modules","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am calling a c#-dll from python. The DLL is my GUI.\nThe GUI contains a dataGrid with 2 columns for 2 strings. \nIf I call the GUI by Python with clr.AddReference(\"myGUI.dll\")\nI can comfortably run the GUI and debug my python script and manually access the c# stuff and add rows to the grid in the script or manually. \nBut if the rows in the grid are full, and a scroll-bar appears, this is the moment, the GUI hangs. It's sometimes possible to add some rows and change something at the GUI items, but if I click on any object, nothing happens, and windows reports after some time: \"app is not responding\".\nDoes anybody know this issue? What can I do?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":38,"Q_Id":56958565,"Users Score":0,"Answer":"After trying a lot of stuff, the following works for me:\nIn Form1_Load I fill the dataGrid with a lot of rows, so that the scrollbar appears. Then I can reduce or fill them via Python - no problem any more, scrollbar disapears for less rows and appears again, if needed. No blocking GUI anymore.\nTo let the scrollbar appeare once seems to call initially anything in the form. Which works automatically since it is called once.","Q_Score":0,"Tags":"c#,python,datagrid","A_Id":57577406,"CreationDate":"2019-07-09T18:22:00.000","Title":"C# GUI for python hangs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Recently, I want to deploy a Deeplearning model (Tensorflow) on mobile (Android\/iOS) and I found that Kivy Python is a good choice to write cross-platform apps. (I am not familiar with Java Android) \nBut I don't know how to integrate Tensorflow libs when building .apk file. \nThe guide for writing \"buildozer recipe\" is quite complicate for this case.\nIs there any solution for this problem without using native Java Android and Tensorflow Lite?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1955,"Q_Id":56967553,"Users Score":0,"Answer":"Fortunately found someone facing the same issues as I am but unfortunately I found that Kivy couldn't compile Tensorflow library yet. In other words, not supported, yet. I don't know when will they update the features.","Q_Score":7,"Tags":"android,python,tensorflow,kivy","A_Id":66493760,"CreationDate":"2019-07-10T09:24:00.000","Title":"Building Kivy Android app with Tensorflow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a problem while I load my python pyqt5 gui on a windows vista computer using windows powershell.\nI get the following error:-\nqt.qpa.plugin: Could not load the Qt platform plugin \"windows\" in \"\nThis application failed to start because no Qt platform plugin coul\nx this problem.\nAvailable platform plugins are: minimal, offscreen, webgl, windows.\nIt worked perfectly on a windows 10 computer. There had been errors where it was not been able to find the plugin. I have solved that. But now, even though it is able to find the plugin, it doesn't load. \nCan you help me out?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2127,"Q_Id":56997836,"Users Score":0,"Answer":"I had the same error using the conda base environment. I tried many attempts from different discussions about this, but in the end it worked with creating a (new) conda-env and installing dependencies such as matplotlib (which again depends on pyqt which is then also installed by conda)","Q_Score":2,"Tags":"python,qt,plugins,pyqt5","A_Id":58610523,"CreationDate":"2019-07-11T22:01:00.000","Title":"Qt platform plugin not loading even though it is found","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to implement my own QGraphicsItems to display in a QGraphicsScene. One advantage of this is, that I can keep the positions and sizes of my business objects, without having to convert between them and the display coordinate system.\nBut: Unfortunately the sizes are small, like 0.5 (meters). This is not a problem with the QPolygons, but when I want to display text at half the size of the objects, below a point or pixel size of 0.5, nothing gets displayed.\nI got around that somewhat by having the labels separately created in the scene as QSimpleTextItems and scaling them afterwards, but I don't want that kind of separation.\nAm I missing something? Like a way to scale everything times 100 behind the scenes?\nUpdate:\nI now also tried scaling the QPainter object up, so that I can use more \"normal\" font sizes, but it seems this does not change the behaviour.\nScaling everything by 100 and then setting the font (point) size to 0.2 * 100, does also not show the labels.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":32,"Q_Id":57009308,"Users Score":0,"Answer":"I solved this problem by creating a QGraphicsTextItem object inside my custom QGraphicsItem object.\nThis text object I can scale down to whatever size I need and just call its paint() method in the paint method of my custom object.\nThis works pretty well, although I'm not yet sure, if, for example, clicking the text, automatically translates to a click on my custom object, or if they are two separate entities.\nI guess it comes down to the bounding rectangle, though.","Q_Score":0,"Tags":"python,qt,pyside2","A_Id":57036712,"CreationDate":"2019-07-12T14:44:00.000","Title":"How small can the Text in a QGraphicsScene get?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to continuously display some data that I receive in a Flask Server in a GUI that I designed with PySimpleGUI. Currently my GUI and my Flask Server are two seperate projects, what would be the cleanest\/best practise method to connect them?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":424,"Q_Id":57035196,"Users Score":0,"Answer":"The way you \"receive data\" in PySimpleGUI will be inside the event loop. Usually communicating with a GUI subsystem is through something like a queue. \nUse a timeout values on your window.Read(timeout=100) call so that it doesn't completely block. This will enable it to read the queue or make a function call or do whatever it has to do to get the data.","Q_Score":1,"Tags":"python,flask,pysimplegui","A_Id":57047683,"CreationDate":"2019-07-15T07:36:00.000","Title":"How to receive data in a PySimpleGUI GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Is there a way to print a Page\/Widget\/Label in Kivy? (or some other way in python).\nUnfortunately, I don't know how to ask the question correctly since I am new to software development. \nI want to build a price tracking app for my business in which i will have to print some stuff.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":200,"Q_Id":57046969,"Users Score":2,"Answer":"Not directly, no, but the printing part isn't really Kivy's responsibility - probably you can find another Python module to handle this.\nIn terms of what is printed, you can export an image of any part of the Kivy gui and print that.","Q_Score":4,"Tags":"python,kivy","A_Id":57047007,"CreationDate":"2019-07-15T20:45:00.000","Title":"Does Kivy have laserjet printer support?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed pygame through pip. I know for a fact it is there, as I have seen the file labeled 'pygame' in the file explorer. However Python does not agree with me that it is certainly there.\nWhat makes this odd is that i've installed pygame using pip before on a different user, it worked fine, and i did nothing differently this time.\n\n\n\nimport pygame\n Traceback (most recent call last):\n File \"\", line 1, in \n import pygame\n ModuleNotFoundError: No module named 'pygame'","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":95,"Q_Id":57048553,"Users Score":0,"Answer":"Check your virtual environment. It seems that you are not using the environment where you have installed pygame. If you are using Anaconda, the environment is specified in parentheses. You can activate your environment using:\nconda activate \nHope this works!","Q_Score":0,"Tags":"python,pip,pygame","A_Id":57048649,"CreationDate":"2019-07-16T00:13:00.000","Title":"Unable To Import Pygame After Pip Install","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been going through source code of python. It looks like every object is derived from PyObject. But, in C, there is no concept of object oriented programming. So, how exactly is this implemented without inheritance?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":86,"Q_Id":57058653,"Users Score":2,"Answer":"What makes the Object Oriented programming paradigm is the relation between \"classes\" as templates for a data set and functions that will operate on this data set. And, the inheritance mechanism which is a relation from a class to ancestor classes. \nThese relations, however, do not depend on a particular language Syntax - just that they are present in anyway. \nSo, nothing stops one from doing \"object orientation\" in C, and in fact, organized libraries, even without an OO framework, end up with an organization related to OO.\nIt happens that the Python object system is entirely defined in pure C, with objects having a __class__ slot that points to its class with a C pointer - only when \"viwed\" from Python the full represenation of the class is resented. Classes in their turn having a __mro__ and __bases__ slots that point to the different arrangements of superclasses (the pointers this time are for containers that will be seen from Python as sequences).\nSo, when coding in C using the definitions and API of the Python runtime, one can use OOP just in the same way as coding in Python - and in fact use Python objects that are interoperable with the Python language. (The cython project will even transpile a superset of the Python language to C and provide transparent ways f writing native code with Python syntax)\nThere are other frameworks available to C that provide different OOP systems, that are equaly conformant, for example, glib - which defines \"gobject\" and is the base for all GTK+ and GNOME applications.","Q_Score":1,"Tags":"python","A_Id":57059180,"CreationDate":"2019-07-16T13:41:00.000","Title":"how is every object related to pyObject when c does not have Inheritance","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I used pyautogui and PIL to capture screenshot after clicking on battery icon. But the screenshot doesn't contain battery status window. When I use print-screen key, status window is available in the screenshot. Need suggestions to solve this.","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":51,"Q_Id":57092057,"Users Score":2,"Answer":"You can use greenshot opensource tool for windows, using hotkey you can take almost anything as a screenshot.","Q_Score":0,"Tags":"python,python-3.x,robotframework","A_Id":57104608,"CreationDate":"2019-07-18T10:07:00.000","Title":"How to take a screenshot in windows 10 when there is an extra pop up on desktop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I used pyautogui and PIL to capture screenshot after clicking on battery icon. But the screenshot doesn't contain battery status window. When I use print-screen key, status window is available in the screenshot. Need suggestions to solve this.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":51,"Q_Id":57092057,"Users Score":0,"Answer":"I think PrintScreen is best for taking screenshots on windows 10. But if you want to use any third-party apps for taking screenshots then pick-pick is a free and good app. It also allows you to take a fullscreen screenshot.","Q_Score":0,"Tags":"python,python-3.x,robotframework","A_Id":69063851,"CreationDate":"2019-07-18T10:07:00.000","Title":"How to take a screenshot in windows 10 when there is an extra pop up on desktop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to display an outline of a dog in a window. I then need to be able to change the colour for different part of the dog by inputting numbers into entry boxes- for example if I put a '1' in the 'head' entry box, the head changes to a yellow colour. The dog should be white by default. \nI can just create 4 images (one for the head, body, legs, and tale) to change each part of the bod. I've thought about changing the rgb values of each image to change the colour, but this would also change the colour for the outline (meant to stay black). The only other thing I could think of was making a red, blue, green, yellow, blue, etc. version of each image (head, body, legs, tail), and then just displaying the red version of the image when I need to (and the same for other colours).\nI need to know if there is any other way to do this (perhaps with the canvas widget?) before I code it because It will take a long time to change the colour of each image. I just have no idea where to start.\nThanks in advance for your answers","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":348,"Q_Id":57139284,"Users Score":0,"Answer":"You will have to make different widgets for each part of the dog(e.g: Head, Abdomen etc.) and you will need different images for the dogs part and color, after that you can implement a button that changes the color with the 'if' function.","Q_Score":0,"Tags":"python-3.x,tkinter,tkinter-canvas,tkinter-entry,tkinter-layout","A_Id":57139424,"CreationDate":"2019-07-22T04:42:00.000","Title":"Create an image or photo that can change colour in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently working on a project where I wanted to automate a GUI using python. I am trying to make some basic mouse movements using pyautogui.\nSetup 1 - Here, I am using Windows 7. Commands such as pyautogui.mouseUp, pyautogui.mouseDown are working perfectly fine.\nSetup 2 - Here, I am using Windows 10. Commands pyautogui.mouseUp and pyautogui.mouseDown are not working. \nNote - \nAny suggestions or advises please?\nI am using 19 inch desktop monitors in both the cases (both setups). Hence, ruling out resolution issues. '","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":564,"Q_Id":57169835,"Users Score":0,"Answer":"Can you use the the pyautogui.moveTo(x, y) function to move the mouse to a specific point instead of up or down?","Q_Score":1,"Tags":"python,python-3.x,pyautogui","A_Id":57169930,"CreationDate":"2019-07-23T18:01:00.000","Title":"How to fix 'Pyautogui.mouseUP' and mouseDown issues in Windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am also trying to understand how to use Tkinter so could you please explain the basics?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":229,"Q_Id":57179821,"Users Score":1,"Answer":"What is the difference between the _tkinter and tkinter modules?\n\n_tkinter is a C-based module that exposes an embedded tcl\/tk interpreter. When you import it, and only it, you get access to this interpreter but you do not get access to any of the tkinter classes. This module is not designed to be imported by python scripts.\ntkinter provides python-based classes that use the embedded tcl\/tk interpreter. This is the module that defines Tk, Button, Text, etc.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":57184692,"CreationDate":"2019-07-24T09:38:00.000","Title":"What is the difference between the _tkinter and tkinter modules?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to transfer an image saved to a raspberry pi from the rpi to an android application to display it. I am treating the raspberry pi as the server and the android app as the client. My server side is implemented using python. I am using pylab to save a figure to the raspberry pi and then later open the image and read the contents as a byte array. This byte array is then passed to the android app, written in java. \nI can view the image on the rpi when I open it, but once it is sent to the android, something is happening to it that causes the incorrect number of bytes to be read and the image to be corrupted. I realized that java reads big endian while the raspberry pi byte order is little endian. I am not sure if this is what is causing the problem in transferring the image? \nSo, I am wondering if there is a way to either encode the byte array as big endian when it is sent from python or a way to decode the byte array as little endian when it is received by java. I tried simply reversing the image byte array in python but that did not work. Any suggestions would be very helpful!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":448,"Q_Id":57197445,"Users Score":0,"Answer":"I am not an expert in hardware differences between a Pi and other platforms, but this process can be performed using ByteBuffer.\nYou can get an instance of ByteBuffer using ByteBuffer.wrap(byteArray) or ByteBuffer.allocate(capacity).\nYou can then set the endian-ness of the buffer using buffer.order(ByteOrder.BIG_ENDIAN); or buffer.order(ByteOrder.LITTLE_ENDIAN);\nThe data can then be returned with buffer.get().","Q_Score":0,"Tags":"java,python,tcp,raspberry-pi,endianness","A_Id":57197538,"CreationDate":"2019-07-25T08:24:00.000","Title":"Convert Image from Little to Big Endian","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I've made a python program using Tkinter(GUI) and I would like to enter it by creating a dedicated icon on my desktop. (I want to send the file to my friend, without him having to install python or any interpreter)\nthe file is a some-what game that I want to share with friends and family, which are not familiar with coding.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5445,"Q_Id":57251789,"Users Score":0,"Answer":"you can install Pyinstaller by using pip\n\npip install pyinstaller\n\ngo to the directory where your file is saved and type:\n\npyinstaller.exe --onefile --windowed path\/to\/your\/file.py \n\n--onefile (compresses your files into one .exe file)\n--windowed (removes the console when you run your file) \npath\/to\/your\/file.py (or simply file.py when you want to convert the file in the same directory)\nif you have any error using it, remove the --windowed flag and run file.exe on command line to see the error","Q_Score":2,"Tags":"python,user-interface,interface,createfile","A_Id":57252683,"CreationDate":"2019-07-29T10:22:00.000","Title":"run python program via clickable desktop icon","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a tkinter python app that is meant to run on a raspberry pi. When I run the code from the build in IDE on the pi it runs fine and the window opens up, same on IDLE on my windows PC, however when I try and run the program from the command line, it does nothing when I hit enter on the command python3 filename. As well as this, when I enter the python shell from the command line I am able to get a tkinter window to appear using root = Tk(), so I cannot figure out why my program won't run.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":518,"Q_Id":57257206,"Users Score":0,"Answer":"I've now fixed this myself so posting the answer in case anyone needs it. My mainloop() function was actually MainPage.mainloop() which for some reason stopped the window from opening from the command prompt...","Q_Score":1,"Tags":"python,tkinter,raspberry-pi3","A_Id":57267030,"CreationDate":"2019-07-29T15:41:00.000","Title":"Tkinter app runs on windows but doesn't open window on raspberry pi","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working with QComboBox in PyQt5. I want each item in the QComboBox to hold a value. To demonstrate my idea, I have 3 items in my firstC that are named USD, EUR, BGN\nI want each of the items to have a value, like example USD to be able to print('1') on the console, the second item to (EUR) print('2') and so on...\nMy idea behind this is, when an Item in the QComboBox is selected, to hold a value.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":57278216,"Users Score":0,"Answer":"have you looked into QComboBox's \"ItemData\" methods?\nYou can use combobox.setItemData(intex, value[, role]) and similary getItemData and itemData","Q_Score":0,"Tags":"python,pyqt,qcombobox","A_Id":57278905,"CreationDate":"2019-07-30T18:44:00.000","Title":"How to add value to each Item in QComboBox","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm looking to make a bot for a game via on-screen keyboard. \nIs it possible to make pyautogui execute only on the on-screen keyboard and no other window?\nIs there any way to map the buttons into shortcuts that I can easily call.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":187,"Q_Id":57335921,"Users Score":0,"Answer":"You can use the locateOnScreen() function to find the coordinates of a button using a screenshot.\nWindow-specific functions are on the Roadmap (via PyGetWindow), but not implemented in pyautogui yet.\nYou may be able to check that the coordinates returned by locateOnScreen() are within your desired window if you can get the window's rectangle coordinates in some other way, like by calling PyGetWindow's getWindowsWithTitle() function yourself.","Q_Score":0,"Tags":"python,pyautogui","A_Id":57335949,"CreationDate":"2019-08-03T06:15:00.000","Title":"Using pyautogui exclusively for on-screen keyboard","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is tkinter able to make a smooth text transition(slowly appear into the Window)? In Windows 10, Python 3 ? I have tried searching through the web but no similar questions, I have tried seeing if the widget has an option to do that, but no luck!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1717,"Q_Id":57337718,"Users Score":1,"Answer":"You might be able to fake it using images. Use a timeout function to replace them one after the other. Not sure if that would be fast enough to appear smooth.\nBut for things like this I think other toolkits would be better suited. For example pysdl2.","Q_Score":1,"Tags":"python,python-3.x,user-interface,tkinter","A_Id":57337842,"CreationDate":"2019-08-03T11:03:00.000","Title":"Smooth Transition in Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written some code in Python which allows 3D objects to be defined in 3D object space and mapped onto a 2D screen. Currently the finished 2D polygons are drawn on the screen using the PyGame library, which works effectively, but I would like to go the full way and write code myself to complete the drawing operations PyGame does for me. This means I would like to manually control the drawing of each pixel on the screen, with the use of GPU support to accelerate the entire rendering process. From some reading it seems OpenGL is suitable for this sort of thing, but I'm not sure what the complete purpose of OpenGL is and whether I could achieve what I am trying to do in a better way. Do I really need to use OpenGL? Or is there another way for me to directly access my GPU to draw at the pixel by pixel level?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":279,"Q_Id":57342295,"Users Score":0,"Answer":"It sounds like OpenGL's programmable shaders are what you're looking for (in particular fragment shaders). They run massively parallel on a pixel-by-pixel basis, in the sense that basically you write a function that takes a single pixel location and computes its color. Note that this means that the individual pixels can't exchange information, though there are certain ways around that.\n(Technically when I said \"pixel\" I meant \"fragment\", which is sort of a generalized version of a pixel.)","Q_Score":0,"Tags":"python,opengl,graphics,3d,pygame","A_Id":57345654,"CreationDate":"2019-08-03T21:42:00.000","Title":"Do I need to use OpenGL to draw at the pixel by pixel level (Python). Is there a way I can do such a thing without using a code library?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently developing mobile applications in Kivy. I would like to create an app to aid in the development process. This app would download an APK file from a network location and install\/run it. I know how to download files of course. How can I programmatically install and run an Android APK file in Kivy\/Android\/Python3?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":33,"Q_Id":57343625,"Users Score":0,"Answer":"Look up how you would do it in Java, then you should be able to do it from Kivy using Pyjnius.","Q_Score":0,"Tags":"python,android,python-3.x,kivy","A_Id":57345743,"CreationDate":"2019-08-04T03:43:00.000","Title":"Install & run an extra APK file with Kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"That question wasn't very clear. \nEssentially, I am trying to make a multi-player Pac-Man game whereby the players (when playing as ghosts) can only see a certain radius around them. My best guess for going about this is to have a rectangle which covers the whole maze and then somehow cut out a circle which will be centred on the ghost's rect. However, I am not sure how to do this last part in pygame. \nI'd just like to add if it's even possible in pygame, it would be ideal for the circle to be pixelated and not a smooth circle, but this is not essential.\nAny suggestions? Cheers.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":214,"Q_Id":57393670,"Users Score":1,"Answer":"The best I can think of is kind of a hack. Build an image outside pygame that is mostly black with a circle of zero-alpha in the center, then blit that object on top of your ghost character to only see a circle around it. I hope there is a better way but I do not know what that is.","Q_Score":3,"Tags":"python,python-3.x,pygame","A_Id":57401296,"CreationDate":"2019-08-07T11:43:00.000","Title":"How do I display a large black rectangle with a moveable transparent circle in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I currently have a python application that runs perfectly from the CLI and when I run it from an IDE. I want to make it into an application that will launch in 1 click from any mac computer. (Like any desktop application). Ideally, I can send someone the file, they do a simple install, then the program works. I have tried using platypus (works great for 1 file programs) and other methods of bundling apps. But none of them seem to work as the program is kinda complex.\nProgram Requirements:\n\nPython3\nPython Libraries tkinter, socket, threading, PIL etc\n~8 individual python files (controlled by 1 main menu)\nLots of images\n\nI would like to have an install process, where you click next a bunch of times and agree to things, but if this isn't possible I can live without it.\nAny help is greatly appreciated!","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":172,"Q_Id":57402681,"Users Score":1,"Answer":"Use PyInstaller to build your package. I do not think they have an actual installer, but you could build your own GUI installer by using some CMD commands and something like tkinter.","Q_Score":1,"Tags":"python,python-3.x,macos,bundle","A_Id":57402706,"CreationDate":"2019-08-07T21:46:00.000","Title":"How to create a mac app from python files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have a static C library, that I need to call into from Python. I was looking at ctypes for this however it can only work with dynamically loaded libraries. Is there an equivalent or alternative for staticly linked libraries?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2502,"Q_Id":57469224,"Users Score":0,"Answer":"One option I've used to do this is to execute a python script from within a C\\C++ application. The Boost.Python implementation is what I used to accomplish this. I statically linked the library file to the C app and ran the python script from the app. The methods in the C app that call into your static C library can be exposed to the python script.\nAlthough the above is a solution...another way to do it is to build a pipe client in python, then connect to a C app (that is running a pipe server) that is statically linked to your library.","Q_Score":0,"Tags":"python,c,static-libraries","A_Id":57469331,"CreationDate":"2019-08-12T22:58:00.000","Title":"Call into static C library from Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Ive created a simple PyQT4 scraping program and had generated an exe of the program using pyinstaller-3.5. I have tested it locally and shared a zip archive with the end user. It was reported that upon launching the exe an error pops up stating that \n\n\"Windows cannot access the specified device, path, or file. You may not have appropriate permissions to access the item.\"\n\nI have made sure that this exe is able to run on Windows 7 and Windows 10 workstations, other than the workstation that the program was developed on. \nThis is a generic Windows error and possibly a common problem when it comes to shipping exe applications. \nWhat are some known workarounds for this issue?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":398,"Q_Id":57565017,"Users Score":0,"Answer":"There is one scenario where you can run into permissions problems. If you use PyInstaller to create an MSI installer, it will try to install your program into %PROGRAMFILES% and the install directory will have limited write permissions. In this scenario, if your python program tries to do any writes, you will get permissions errors. You should be able to reproduce this problem by installing on your own machine.\nI have had this same problem with my own program, and I manually change the permissions on a config.ini file after install. This could probably be automated by a post install script that fires after MSI is finished doing its thing.","Q_Score":0,"Tags":"python,windows-10,exe,pyinstaller","A_Id":57565416,"CreationDate":"2019-08-19T23:26:00.000","Title":"Exe, created with PyInstaller 3.5, cannot run on end-user's computer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to span a tabWidget across the entire window in the second row instead of having it just in a single column\nI have already tried resizing both the table and the column with no changes. When I resize the column in row 2, it resizes every column which I don't want.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":132,"Q_Id":57577268,"Users Score":0,"Answer":"Solved myself. I created 2 QHBOXLayout(). One for each row that I had. Then created a QVBoxLayout() and then by using x.addLayout() I added my Horizontal Layouts to the vertical layout. Ex:\nhorLay01 = QtGui.QHBoxLayout()\nhorLay02 = QtGui.QHBoxLayout()\nvertLay01 = QtGui.QVBoxLayout()\nvertLay01.addLayout(horLay01)\nvertLay01.addWidget(tabs, 1)\nvertLay01.addLayout(horLay02)\nThis was able to create my even spaced top and bottom sections while spanning my QTabWidget() across the entire screen. Subsequently, It resizes the widgets based on screen space which is a plus.","Q_Score":0,"Tags":"python,python-3.x,pyqt,pyqt4","A_Id":57593995,"CreationDate":"2019-08-20T15:44:00.000","Title":"Span a widget over mutliple columns?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a Pygame project in a folder called \"Project\". In it is my code and another folder named \"Images\". I want to load an image in the \"Images\" folder, but every time I try to do so, it comes with up an error, saying: \n\npygame.error: Couldn't open Images\/Frame1.png\n\nI've tried using: \nimage = pygame.image.load(\"Frame1.png\"),\nimage = pygame.image.load(\"Images\/Frame1.png\") , image = pygame.image.load(\"Images\/Frame1.png\").convert() and image = pygame.image.load(\"Images\/Frame1.png\").convert_alpha() .\nBare in mind that I've only imported the Pygame module.\nAll the codes above come up with the same error. I'm using Python v3.7.3 for Mac OSX. Any help would be greatly appreciated.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":767,"Q_Id":57596338,"Users Score":2,"Answer":"Try importing the os library and using image = pygame.image.load(os.path.join(os.path.dirname(__file__), 'Images','Frame1.png')).convert_alpha(). This worked for me when I did my own pygame project.","Q_Score":2,"Tags":"python,pygame","A_Id":57596685,"CreationDate":"2019-08-21T17:10:00.000","Title":"Load an image that is in a subfolder using Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hi I want to click on 'Done' button in the virtual keyboard on android devices.\nHere i am entering an password in the devices after that i have to press 'Done' key in the virtual keyboard to proceed further.\nIs there any way to do this by using Python 2.7 and appium?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":835,"Q_Id":57707321,"Users Score":0,"Answer":"Use adb shell input keyevent 4 \nto close the keyboard and then use \nadb shell input keyevent 66 to press the enter key","Q_Score":0,"Tags":"python-2.7,robotframework,keypress,appium-android","A_Id":57731623,"CreationDate":"2019-08-29T09:38:00.000","Title":"How to press the 'Done' key in virtual board in android devices by using appium and python 2.7?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I get an image from an Android ImageView using Python Appium? This image should be in PNG format.\nI want to test if an icon has the correct image and I fail to use the method find_element_by_image provided by Appium.\nThe screenshot method doesn't seem to be ideal for me because it takes a screenshot instead of giving me the original image, which would contain the white background while the original image doesn't have it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1256,"Q_Id":57709096,"Users Score":4,"Answer":"Although I didn't find a way to get the image but I have found a workaround to test the images.\nYou can use element.screenshot(path) to save the correct images to a local folder. (of course use find_element_by_something to get the element) Then save the images to compare using element.screenshot(temp_path).\nFinally, from PIL import Image, ImageChops and use ImageChops.difference(Image.open(path1), Image.open(path2)) is None for image comparison. The expression returns True if they match pixelwise.","Q_Score":0,"Tags":"python,android,imageview,appium","A_Id":57719750,"CreationDate":"2019-08-29T11:23:00.000","Title":"Python Appium Get Image from Android ImageView","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have recently bought a Hyperpixel 4.0 from pimoroni for my raspberry pi.\nI have also made a Pygame interface with the aim of using the touch screen as the input device.\nThis works perfectly when I am in the desktop interface, even when the window is full screen.\nHowever, I don't want to run it in the desktop, I want it to run in the terminal (no startx)\nWhen I do this, the mouse calibration is not correct and makes it unusable.\nI have tried several methods including forcing Pygame to detect the touch screen to no avail. It either works, it the mouse goes crazy.\nCan anyone help here? I can't find much online.\nThanks!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":378,"Q_Id":57713766,"Users Score":0,"Answer":"The problem is that the Raspbian window system calibrates the Hyperpixel touch locations, but pygame directly accesses the touch device but is not calibrated.\nMy solution was to use a desktop application in full screen mode.\nI tried doing a matrix based calibration of my own, but it appears that the behavior is nonlinear.","Q_Score":0,"Tags":"python,pygame,mouse,touchscreen,calibration","A_Id":60443867,"CreationDate":"2019-08-29T15:49:00.000","Title":"Raspberry Pi Pygame touch screen issues","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am learning Python (v 3.7) on a Mac using PyCharm. As I practice using the turtle library, the program runs without error, outputs the correct graphics, but then the graphics screen disappears immediately after the code completes runnning. Adding time.sleep(5) at the end of my program persists it and also shows that the focus changed from PyCharm to a Python program menu (which I can't find or turn on in the hope of keeping running). \nWhen I use Thonny, the output persists, so I can check my work. How can I make it persist in PyCharm?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":443,"Q_Id":57719474,"Users Score":1,"Answer":"A well-structured Python turtle program will end with a call to mainloop() or one of its variants (exitonclick(), done()) This turns control over to the underlying tkinter event handler which will keep your window open, awaiting user events. Without this, the program simply ends and the window closes.\nYou don't need time.sleep() nor input(\"Press Enter to continue...\"). Some Python programming environments clash with mainloop() but even those tend to disable it behind the scenes so the same code works everywhere.","Q_Score":0,"Tags":"python,python-3.x,pycharm,turtle-graphics","A_Id":57735571,"CreationDate":"2019-08-30T01:35:00.000","Title":"How to persist Python turtle graphics screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a replacement for a very out of date application at work written in possibly Delphi (don't have source code) and decided to use Python with wx.\nThe old one behaves such that when you alt+tab or peek on the task bar icon it only shows the main window as an entry but if you bring it to front all other windows created by it are brought up as well.\nIn wx every subframe I open becomes it's own entry and you have to manually focus each and every one. Is there a way to achieve the above-mentioned behavior with wx?\nI tried setting the main frame as a parent but that didn't do nothing.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":57751480,"Users Score":0,"Answer":"So my model was go through login to a 'Mainframe', sort of a task panel from where you'd open up other windows. These 'Subframes' were each a wx.Frame with wx.Panel in them.\nSimply changing the subFrame1(wx.Frame) to subFrame1(wx.Dialog) solved my issue - the dialogs do not appear in the alt+tab menu, nor in taskbar and upon selecting the Mainframe everything is brought to front.","Q_Score":0,"Tags":"python,windows,wxpython","A_Id":57860559,"CreationDate":"2019-09-02T04:35:00.000","Title":"Binding wx Frames together","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to get a value of RGB from a pixel in python using pygame\nnot getting the RGB from pixels in an image","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":72,"Q_Id":57761194,"Users Score":1,"Answer":"Use pygame.Surface.get_at((coordinateX, coordinateY))","Q_Score":0,"Tags":"python,pygame","A_Id":57762474,"CreationDate":"2019-09-02T18:09:00.000","Title":"How to read a pixel color in python (not from an Image)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have to create a setup screen with tk that starts only at the first boot of the application where you will have to enter names etc ... a sort of setup. Does anyone have any ideas on how to do so that A) is performed only the first time and B) the input can be saved and used in the other scripts? Thanks in advance","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":39,"Q_Id":57843754,"Users Score":1,"Answer":"Why not use a file to store the details? You could use a text file or you could use pickle to save a python object then reload it. On starting your application you could check to see if the file exists and contains the necessary information, if it doesn't you can activate your setup screen, if not skip it.","Q_Score":0,"Tags":"python,python-3.x,tkinter","A_Id":57843779,"CreationDate":"2019-09-08T16:32:00.000","Title":"Create Python setup","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to run a omxplayer into a kivy application. The problem is that when I start the omxplayer its appearance behind the kivy app, so it is not visible.\nI tried using: Window.clearcolor = (0,0,0,0) but it doesn't work. I think that is because I'm running the app in a linux terminal.\nHow can I show the player in front of all applications?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":646,"Q_Id":57855165,"Users Score":1,"Answer":"I finally did it. Here the explanation.\nRaspberry video core put the different application's screens in differents layers. The terminal is in layer -127 and, according to kivy docs, kivy run in layer 0 by default. In my python code I run omxplayer with the next line of code:\nPopen(['omxplayer', '--layer', '100000', '--live', '--refresh', '--video_queue', '4', '--fps', '30', '--win', '\"0 0 800 480\"', 'rtsp:\/\/192.168.0.88'])\nThe importart thing is --layer 100000, that is an option that allows us to choose the layer of omxplayer.\nIn my case, ran it in layers like 128 but it didn't work, so I suspect that kivy is not in layer zero. I ended putting 100000 and it works.\nIts good to say that the kivy app keeps running in a lower layer, so every input signal (keyboard, buttons, etc.) is still working.","Q_Score":0,"Tags":"python,kivy,raspberry-pi3,omxplayer","A_Id":57944977,"CreationDate":"2019-09-09T13:36:00.000","Title":"How to put omxPlayer on top of Kivy application in raspbian lite?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have no problem with pushing a kivy app to my android phone as long as it's very simple.\nBut when I try to import pandas it just crashes. The app starts loading and then just closes. \nDoes anyone know what can be the issue and how can I open a debugger or something similar? I know pandas can be imported with Kivy because there are some examples out there using pandas.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":98,"Q_Id":57874858,"Users Score":0,"Answer":"writing and running a kivy app that uses\/imports pandas poses no problem when you run it ordinarily. but when you convert it to an apk, it will load and crash. this is because python4android doesn't support pandas explicitly for now. what you can do is apply a patch.","Q_Score":0,"Tags":"python,android,pandas,kivy","A_Id":57875490,"CreationDate":"2019-09-10T16:26:00.000","Title":"How to debug an andorid app made with Kivy that crashes when importing pandas?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using after to create a delayed callback. I noticed though that many different objects have an after method, and it isn't clear if there's any difference between calling after on say a tk.Frame or a tk.Button.\nI haven't seen a single guide mention if you can expect identical behavior regardless of what object after is called on. Looking at the implementation, it seems like it just delegates to self.tk.call('after', ms, name) in a common base class of widgets, but that alone doesn't mean that the behavior will be identical for all subclasses.\nIf I have multiple widgets on-hand when I need to call after, is there any reason to choose one over another, or can I expect identical behavior regardless?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":38,"Q_Id":57965486,"Users Score":3,"Answer":"I'm using after to create a delayed callback. I noticed though that many different objects have an after method, and it isn't clear if there's any difference between calling after on say a tk.Frame or a tk.Button.\n\nNo, there is no difference. You can call after using any widget you want and it will behave exactly the same.\n\nLooking at the implementation, it seems like it just delegates to self.tk.call('after', ms, name) in a common base class of widgets, but that alone doesn't mean that the behavior will be identical for all subclasses.\n\nActually, it does. The fact that you call it as a method on a widget is an artifact of the Tkinter implementation. In the underlying tcl\/tk library it's just a function call that isn't tied to any widget.","Q_Score":4,"Tags":"python,python-3.x,tkinter","A_Id":57965503,"CreationDate":"2019-09-16T23:24:00.000","Title":"What widget should after be called on?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having a little trouble understanding what this function does:\ncanvas.create_window(0, 0, anchor='nw', window=frame)\nsince usually app=tkinter.Tk() gives a type of Tkinter.Tk, and is for all intents and purpose a window and a handler into the window instance, what does create_window create?\nAnd, from this code, it seems like create_window hooks a Tkinter.Frame into the window and the return type for create_window is an int. You can put a frame in a canvas so why create_window? And does the returned int mean anything?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":710,"Q_Id":58009398,"Users Score":2,"Answer":"what does create_window create?\n\nIt creates a canvas object, similar to a line, rectangle, image, etc. Like a line or rectangle, this canvas object has attributes that define what it looks like. In the case of a window object, one of the attributes is window which specifies a widget to be displayed as the object.\n\nYou can put a frame in a canvas so why create_window\n\nIf you add a frame in a canvas with pack, place, or grid it will appear inside the canvas but it won't be part of the canvas. That means that if you attach scrollbars to the canvas, the frame will not scroll. By using create_window, the frame becomes part of the canvas, and can be manipulated and scrolled like any other canvas object.\n\nAnd does the returned int mean anything?\n\nThe value returned from calling create_window is an integer index which can be used later to refer to this object.","Q_Score":1,"Tags":"python,user-interface,tkinter","A_Id":58012419,"CreationDate":"2019-09-19T10:52:00.000","Title":"tkinter what is a window when calling tk.canvas.create_window()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to write a program with python that works like android folders bit for Windows. I want the user to be able to single click on a desktop icon and then a window will open with the contents of the folder in it. After giving up trying to find a way to allow single click to open a desktop application (for only one application I am aware that you can allow single click for all files and folders), I decided to check if the user clicked in the location of the file and if they were on the desktop while they were doing that. So what I need to know is how to check if the user is viewing the desktop in python.\nThanks,\nHarry\nTLDR; how to check if user is viewing the desktop - python","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":256,"Q_Id":58018945,"Users Score":0,"Answer":"I don't know if \"single clicking\" would work in any way but you can use Pyautogui to automatically click as many times as you want","Q_Score":2,"Tags":"python,windows,directory,desktop","A_Id":58028985,"CreationDate":"2019-09-19T21:07:00.000","Title":"Python - how to check if user is on the desktop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I started messing around with python turtle graphics and it seems that at a certain point in my program it starts to take up a lot of memory in my task manager (around 2gb) and become a bit laggy. I'm assuming its must be the turtles so I tried to use the turtle.clearscreen() midway through the program and I saw that it still was sucking up the same amount of memory or was still increasing in size so i'm assuming its not actually deleting the turtles. \nThe only fix seems to be to exit the python turtle graphics completely which ends up ending the program however i still want the program to continue. Is anyone aware of a solution for this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":197,"Q_Id":58039113,"Users Score":0,"Answer":"Try increasing the amount of memory you have or close unnecessary tasks. I'm not sure if there is a way to decrease the ram turtle itself uses, so use these methods as a starting base.","Q_Score":0,"Tags":"python,turtle-graphics","A_Id":61620496,"CreationDate":"2019-09-21T09:50:00.000","Title":"Python turtle graphics eating a lot of memory","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having trouble sorting multiple listctrls in wxpython. I can sort one but not another. I assume it all circles around the ColumnSorterMixin requirement for a function called GetListCtrl. That function can only return one listctrl otherwise and index error will occur as it will only sort the last returned listctrl. Is there a way around this? Many thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":17,"Q_Id":58102471,"Users Score":0,"Answer":"It sounds like you are using the ColumSorterMixin when creating the class that is a parent of the listctrls, like in the demo, and putting multiple listctrls on the parent. If you instead use it as one of the base classes when deriving a new ListCtrl class then GetListCtrl can just return self, and each listctrl will then have its own sorter.","Q_Score":0,"Tags":"python,wxpython,listctrl","A_Id":58139832,"CreationDate":"2019-09-25T16:04:00.000","Title":"wxpython sorting multiple listctrls","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"A .pyw script to present a small GUI (TkInter) to the user. From a Windows Server Terminal server, it does not run for others.\nI wrote a .pyw script to present a small GUI (TkInter) to the user. On my windows desktop, with Python installed, it runs well. I uploaded the script to a Windows Server Terminal server, from where I want a number of users to run it. I can run it when I log onto the terminal server. Other users, however, cannot run it, and it does not display any error messages.\nI have ensured that everyone on the server has full access to the script.\nThe code is running perfectly","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":20,"Q_Id":58114227,"Users Score":0,"Answer":"Uhm... This was rather simpler than I thought.\nBecause it is a .pyw file, an error did not show up. I did not make use of Python's errror catching tools.","Q_Score":0,"Tags":"python,windows,shared","A_Id":58179063,"CreationDate":"2019-09-26T09:56:00.000","Title":"Shared script does not execute","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm starting to use Qt Designer.\nI am trying to create a game, and the first task that I want to do is to create a window where you have to input the name of the map that you want to load. If the map exists, I then switch to the main game window, and if the name of the map doesn't exist, I want to display a popup window that tells the user that the name of the map they wrote is not valid. \nI'm a bit confused with the part of showing the \"not valid\" pop-up window.\nI realized that I have two options:\n\nCreating 2 separated .ui files, and with the help of the .show() and .hide() commands show the correspoding window if the user input is invalid. \nThe other option that I'm thinking of creating both windows in the same .ui file, which seems to be a better option, but I don't really know how to work with windows that come from the same file. Should I create a separate class for each of the windows that come from the Qt Designer file? If not, how can I access both windows from the same class?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":64,"Q_Id":58159932,"Users Score":0,"Answer":"Your second option seems impossible, it would be great to share the .ui since in my years that I have worked with Qt Designer I have not been able to implement what you point out.\nAn .ui is an XML file that describes the elements and their properties that will be used to create a class that is used to fill a particular widget. So considering the above, your second option is impossible.\nThis concludes that the only viable option is its first method.","Q_Score":1,"Tags":"python,pyqt,qt-designer","A_Id":58159983,"CreationDate":"2019-09-29T23:15:00.000","Title":"How does Qt Designer work in terms of creating more than 1 dialog per file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have installed the tkcalendar and xlwt using pip3 install tkcalendar and pip3 install xlwt which is successful and have up to date versions.\nRunning the code using the command as python3 \/home\/pi\/programename.py works perfectly \nUsing sudo before the command like sudo python3 \/home\/pi\/programename.py fails with error\n\nImportError: No module named tkcalendar.\n\nInstlling tkcalendar module using sudo apt-get install tkcalendar gives error like E:Unable to locate package tkcalendar. Please help me how to install the package and clear the error.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":9471,"Q_Id":58213119,"Users Score":2,"Answer":"Try again with\n\npip install tkcalendar\n\nIf you use python 3:\n\npip3 install tkcalendar\n\nAnd check with:\n\nfrom tkcalendar import Calendar","Q_Score":0,"Tags":"python-3.x,import,sudo,xlwt,tkcalendar","A_Id":58420380,"CreationDate":"2019-10-03T06:00:00.000","Title":"NO MODULE NAMED TKCALENDAR","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"There will be an unordered_map in c++ dll containing some 'vectors' mapped to its 'names'. For each of these 'names', the python code will keep on collecting data from a web server every 5 seconds and fill the vectors with it.\nIs such a dll possible? If so, how to do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":62,"Q_Id":58277885,"Users Score":0,"Answer":"You can make the Python code into an executable. Run the executable file from the DLL as a separate process and communicate with it via TCP localhost socket - or some other Windows utility that allows to share data between different processes.\nThat's a slow mess. I agree, but it works.\nYou can also embed Python interpreter and run the script it on the dll... I suppose.","Q_Score":0,"Tags":"python,c++","A_Id":58279737,"CreationDate":"2019-10-07T22:25:00.000","Title":"Is it possible to have a c++ dll run a python program in background and have it populate a map of vectors? If so, how?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need to know how to make a highlighted label(or small box )appears when the mouse is on widget like when you are using browser and put the mouse on (reload\/back\/etc...) button a small box will appear and tell you what this button do\nand i want that for any widget not only widgets on toolbar","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":159,"Q_Id":58283157,"Users Score":-1,"Answer":"As the comment of @ekhumoro says\nsetToolTip is the solution","Q_Score":0,"Tags":"python,pyqt,pyqt5,python-3.7","A_Id":58285881,"CreationDate":"2019-10-08T08:59:00.000","Title":"How to show a highlighted label when The mouse is on widget","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Can we set a font, size for the text on the title bar in tkinter?\nI think it cannot be done as it is not even required. But if there is a way then please let me know.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":24,"Q_Id":58308425,"Users Score":1,"Answer":"Can we set a font, size for the text on the title bar in tkinter?\n\nNo, tkinter doesn't provide a way to do that.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":58308510,"CreationDate":"2019-10-09T16:23:00.000","Title":"Setting font for title bar","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I try to control a Sony Alpha using Python\/gphoto2 on a Raspberry PI. I've tried a number of python bindings (python-gphoto2, gphoto2-cffi, ...) but they all fail at the instruction to create a camera object (eg. my_cam = gphoto.Camera()) with the error:\n\"Could not claim interface 0 (Device or resource busy). Make sure no other program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read\/write access to the device.\"\nWe tried to kill background programs, make sure the kernel modules are not running, install the latest versions of the libraries and python packages, ... but could not get rid of the error. Furthermore C code using libgphoto2 works fine so it's not likely that the resource is really busy. We suspect the problem is missing USB libs in the python packages, and have tried to install libusb-dev, ... but it doesn't help. \nAny suggestions what else we should try? Thanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":637,"Q_Id":58332367,"Users Score":1,"Answer":"You mentioned trying python-gphoto2. I'm the author of that package. Assuming you have installed it successfully then I'd try the list-cameras.py example program. It should list any cameras recognised by libgphoto2 that are connected and switched on.\nIf C programs are working but Python ones aren't you could check that they're using the same versions of libgphoto2. Try ldd on the C program's executable and on one of the python-gphoto2 compiled modules, e.g. \/usr\/local\/lib\/python3.5\/dist-packages\/gphoto2\/_camera.cpython-35m-arm-linux-gnueabihf.so.","Q_Score":0,"Tags":"python-3.x,raspberry-pi,libgphoto2","A_Id":58384644,"CreationDate":"2019-10-10T23:32:00.000","Title":"Could not open camera using gphoto2 in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Let's say the prompt is, \"What is the store number?\" \nThe user types in 123 and hits start and what's printed is an IP address in the form of \"10.1.23.111\" where [10] and [111] are always fixed.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":58365749,"Users Score":0,"Answer":"Simple answer - you can't from just entering your 3 digits in your example (i.e: 123) as any octet within an IPv4 address (###.###.###.###) can be a value between 0-255.\nHowever, if you format the User's input to take that into consideration (i.e: 1023) to create 10.1.023.111, that'll be significantly easier.","Q_Score":0,"Tags":"python,json,selenium,tkinter","A_Id":58365799,"CreationDate":"2019-10-13T16:52:00.000","Title":"How would I take a 3 digit number from a Tkinter entry and translate it into an IP address?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Good morning guys,\ntrying to install the Pygame library on my MacBook Pro...\nI encountered some issues that I'm sure you're able to help me with!\n\nFirst of all I installed the last Python version (3.7.4)\nThan I tried to install via pip the Pygame library, but the process\nwas unsuccessful due to the lack of a Java JKD 13.\nI downloaded and installed the last JDK 13 version (Jdk-13_osx-x64)\nand this process appeared to be successful.\n\nTrying again to finally install the Pygame library an error occurred:\n\nUnable to locate an executable at \"\/Library\/Java\/JavaVirtualMachines\/jdk-13.jdk\/Contents\/Home\/bin\/apt\n\nCan anyone of you guys help me???\nThanks prior!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":861,"Q_Id":58389228,"Users Score":1,"Answer":"Apt used to be a command coming with the Java Development Kit around Java 6. \nJava 6 is also the latest 32-bit version provided by Apple but that doesn\u2019t run on the newest version of Mac OS. \nI think you should look for a newer version of pygame compatible with your system.","Q_Score":1,"Tags":"java,python,pygame","A_Id":58390511,"CreationDate":"2019-10-15T07:20:00.000","Title":"Pygame and Java JDK 13 installation troubles","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"What is the differences between using if object is None versus if not object?\nSo while I was doing some coding where I messed up the signals in the QListWidget, where in a selection instance, it is returning me 2 signals, where it returns 2 objects - QListWidgetItem and None.\nTo address to the None return, I used if object is None, but I was told that if not object would be better. Even so, it seems that using either of the 2 if would still allow me to achieve the same result.\nIs there a better case scenario as to when to use either?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":23,"Q_Id":58422436,"Users Score":2,"Answer":"not object is true when object has any falsey value, such as 0 or False.\nIf you know a priori that the variable contains either a QListWidgetItem or None, then None is the only falsey possibility, so if not object: is a simpler way to write the condition.\nYou just have to be careful about this in other context. Consider a variable that can contain a number or None. I've seen many errors due to not considering the possibility that the number might be 0.","Q_Score":0,"Tags":"python","A_Id":58422483,"CreationDate":"2019-10-16T22:25:00.000","Title":"Testing for None in if statements","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am starting to learn python and I don't know much about programming right now. In the future, I want to build android applications. Python looks interesting to me.\nCan I use python for building Android applications?","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":120,"Q_Id":58469032,"Users Score":1,"Answer":"You can build android apps in python, but it's not as powerful as android studio, and the apps made by python take more space and are less memory efficient.But the apps work well...\nThere are several ways to use Python on Android:\nBeeWare. BeeWare is a collection of tools for building native user interfaces. ...\nChaquopy. Chaquopy is a plugin for Android Studio's Gradle-based build system. ...\nKivy. Kivy is a cross-platform OpenGL-based user interface toolkit. ...\nPyqtdeploy. ...\nQPython. ...\nSL4A. ...\nPySide.","Q_Score":0,"Tags":"python,android","A_Id":58469778,"CreationDate":"2019-10-20T00:09:00.000","Title":"Can I learn python for building android applications?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am starting to learn python and I don't know much about programming right now. In the future, I want to build android applications. Python looks interesting to me.\nCan I use python for building Android applications?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":120,"Q_Id":58469032,"Users Score":0,"Answer":"As of now the official android development languages are kotlin and java in android studio IDE, with the addition of dart for cross-platform development in flutter SDK. I would advise you stick to whichever you find easiest as per your needs. Although python is more widely accepted in the domains of data science\/machine learning so your knowledge of it is still a big plus.","Q_Score":0,"Tags":"python,android","A_Id":58469135,"CreationDate":"2019-10-20T00:09:00.000","Title":"Can I learn python for building android applications?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am starting to learn python and I don't know much about programming right now. In the future, I want to build android applications. Python looks interesting to me.\nCan I use python for building Android applications?","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":120,"Q_Id":58469032,"Users Score":0,"Answer":"You could use python as the back end and vue native as the front end. Vue active can be exported as native android application and put in the app store. The frontend will call API written in back end (in your case, written in python). Check out Vuenative + flask\/ django framework.","Q_Score":0,"Tags":"python,android","A_Id":58469681,"CreationDate":"2019-10-20T00:09:00.000","Title":"Can I learn python for building android applications?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm novice. That's why I can't understand the essential difference between using Java\/Kotlin or using Python with its numerous modules for Android application development. Is there a good reason that makes Java\/Kotlin better choice? Please explain.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":680,"Q_Id":58470176,"Users Score":0,"Answer":"Java and Kotlin are the official language of Android SDK.\nThat's why all use these. On the other way, python use to make cross platfrom application.","Q_Score":0,"Tags":"java,python,android,kotlin","A_Id":58470544,"CreationDate":"2019-10-20T05:01:00.000","Title":"Why use Java\/Kotlin instead Python on Android?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a tk.Button(..., command=_on_button_click).\nOnce it is clicked, I want to know whether the Shift key is currently held down.\nBut the _on_button_click is called without any event object or similar for me to check it","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":583,"Q_Id":58509952,"Users Score":3,"Answer":"Assuming a button named button and a handler named shift_click, you can use the bind method:\nbutton.bind(\"\", shift_click)\nOf course, you will probably also want one without shift click:\nbutton.bind(\"\", not_shift_click)","Q_Score":1,"Tags":"python,tkinter,onclick","A_Id":58509991,"CreationDate":"2019-10-22T18:01:00.000","Title":"tkinter check if Shift is down when Button is pressed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was trying to install kivy_deps.glew(version).whl with \n\npip install absolute\/path\/to\/file\/kivy_deps.glew\n\nAnd I get this error:\n\nkivy_deps.glew(version).whl is not a supported wheel on this version\n\nI searched in the web and saw that some people said that the problem is because you shoud have python 2.7 and I have python 3.7. The version is of glew is cp27. So if this is the problem how to install python 2.7 and 3.7 in the same time and how to use both of them with pip.(i.e maybe you can use \n\npip2.7 install \n\nFor python 2.7 and\n\npip install\n\nFor python 3.7\nP.S: My PC doesn't have an internet connection that's why i'm installing it with a wheel file. I have installed all dependecies except glew and sdl2. If there is any unofficial file for these two files for python 3.7 please link them.\nI know this question has been asked before in stackoverflow but I didn't get any solution from it(it had only 1 anwser tho)\nUpdate: I uninstalled python 3.7 and installed python 2.7, but pip and python weren't commands in cmd because python 2.7 hadn't pip. So I reinstalled python 3.7","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":46,"Q_Id":58546918,"Users Score":0,"Answer":"I fixed it. Just changed in the name of the file cp27 to cp37","Q_Score":0,"Tags":"python,pip,kivy,fixed","A_Id":58569768,"CreationDate":"2019-10-24T18:04:00.000","Title":"Kivy_deps.glew.whl is not a supported wheel on this version","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"When I scroll with my mousewheel, it draws many intermediate steps, and I want it to only draw the immediate destination. It's a bit laggy otherwise.\nI tried intercepting wx.EVT_MOUSEWHEEL with event.StopPropagation() and doing .Scroll() manually, but it still scrolls by itself, StopPropagation() doesn't work.\nThe version of wxPython is 2.9. The widget is wx.ScrolledWindow.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":90,"Q_Id":58580556,"Users Score":0,"Answer":"You can use the following to adjust the size of a scroll event: \n\nSetScrollRate(self, xstep, ystep)\n Set the horizontal and vertical scrolling increment only.\nSee the pixelsPerUnit parameter in SetScrollbars .\nParameters:\n xstep (int) \u2013\n ystep (int) \u2013\n\nCoupled with the font size and the number of items in the window, this can of course be variable.\nNote:\n\nStopAutoScrolling(self)\n Stop generating the scroll events when mouse is held outside the window\n\nand: \n\nStopPropagation(self)\nStop the event from propagating to its parent window.\n\nNot stop the event itself","Q_Score":0,"Tags":"wxpython","A_Id":58605988,"CreationDate":"2019-10-27T15:03:00.000","Title":"How to disable smooth scrolling in wxPython?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There are plenty of minor challenges getting PyQt5 and Qt Designer to play nice with PyCharm, but after getting all the small steps in place, I cannot help but wonder if I missed the obvious.\nWhat is the most straightforward way to integrate PyCharm and Qt Designer?\nWhat I did so far:\n\nInstall Qt Designer\nSet it up as an external tool\n\n\nOpen Settings > Tools > External tools\nAdd a new tool\nSet the Arguments as $FilePath$ and the Working directory as $Projectpath$\n\nRightclick .ui files in the project explorer and launch Qt Designer from there\nSet up a File Watcher from Settings, watching for changes to Qt UI Designer Forms and running pyuic5 with the right arguments to generate the matching .py for my .ui\n\nAnswers I'm looking for:\n\nHow can you tighten the loop between Qt Designer and PyCharm? Specifically, can the Qt Designer be opened on a simple double-click from PyCharm or even in a tab in PyCharm?\nIs there a better overall workflow that achieves the same, that I'm missing here?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":20333,"Q_Id":58599351,"Users Score":6,"Answer":"If you are just looking to open the .ui files in QT Designer, there is a simpler solution. \nGo to Settings|File Types and click on \"Files Opened in Associated Applications\", the go to the Registered Patterns field and add *.ui as a pattern. It will complain that *.ui is already registered to QT Designer. Click OK to reassign the wildcard. Now, when you doubleclick on the .ui file in PyCharm it will open with the associated editor in Windows (which should be Designer).\nIf PyCharm has already associated the .ui extension with some file type, you can easily override that by selecting the file in the Project browser and selecting File|Associate with File Type... from the menu. Select Open matching files in associated application to have PyCharm open whatever application has been associated with the file type in Windows.","Q_Score":11,"Tags":"python,pycharm,pyqt5,qt-designer","A_Id":59861614,"CreationDate":"2019-10-28T22:48:00.000","Title":"Integrate Qt Designer and PyCharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new at programming and I was wondering if when you delete all items of the canvas you also delete the widgets it contains.\nI have a canvas with widgets using the create_window method, the canvas is build for the user to fill information, when done the information is saved and the canvas is cleared. Later the canvas ir redrawn for the user to fill again information.\nWhen the canvas is build widgets are created so I was wondering: if I only delete the items would I be stacking widgetes over and over somewhere, everytime the canvas is redrawn?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":27,"Q_Id":58649944,"Users Score":1,"Answer":"When you delete a window object on the canvas, only that window object on the canvas is deleted. The widget itself is not automatically deleted. If you only delete the canvas objects and keep creating new windows to be embedded on the canvas, you're creating a memory leak.","Q_Score":0,"Tags":"python,canvas,tkinter","A_Id":58650345,"CreationDate":"2019-10-31T19:18:00.000","Title":"Deleting all items of the canvas deletes also the widgets it contains?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make an app. I have got it to work where all my files are in the same folder but it gets very messy and I would like to separate my files into separate folders of the structure: Start, Prelogin, andFirebaseLoginScreen`. So is what I am trying to do possible in kivy? \nI have tried #: import name x.y.z as the pointer where x is the folder name, y is the name of kv-file and z is the class in kv-file I want to import, but I get so many weird errors when I try to do it. I have pretty much added every folder and everything to my PYTHONPATH but nothing works. \nStart contains main.py and main.kv where main.kv then points to the screenmanger in ``Prelogin. Prelogin contains some files that consist of labels and text about the app and then points to the screenmanger in FirebaseLoginScreen. The FirebaseLoginScreen contains a lot of files for the login system.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1265,"Q_Id":58682138,"Users Score":0,"Answer":"The answer is simply \"yes\", there's nothing special about the import parsing in kv language, or in Python when using Kivy. If you're having issues, it's because what you're attempting is wrong or insufficient, which isn't possible to debug from the amount of information you've given.\nIf you'd like to follow it up, post another question with an example that you think should work given your PYTHONPATH manipulations.","Q_Score":2,"Tags":"python,kivy,kivy-language","A_Id":58683177,"CreationDate":"2019-11-03T16:21:00.000","Title":"Is it possible to have a folder-based structure in kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Purpose:\nI want to have the relative movement of my mouse even when she is on the border of my screen (so I can't compute the vector between 2 moment).\nApplication:\nI want to make a helper for mortar shooting in a game called 'squad', you control the mortar with your mouse. I checked the behavior of the mouse within the game and when you move the camera around, when the mouse reach the border of the screen you can keep on looking around with no problem but the mouse position is obviously not updated since it is at the same position.\nI tried the following library:\n\nPyautogui: Have the function for it but doesn't handle near-broder mouse since I guess it calculate the relative movement of the mouse from a past and actual position\nPygame: can't catch the mouse relative movement when it's outside of the Windows\nPymouse: doesn't have the function I search\nPywin32: doesn't have the function I search\nPypiwin32: doesn't have the function I search\n\nA way to make it work:\nI was able to make it work by teleporting the mouse in the middle of the screen when it's reaching the border of the game (which doesn't cause trouble because apparently the game doesn't compute it to make your mortar move), but I'm afraid that I would get banned because some anticheat-tool would see my mouse teleporting around (even if this wouldn't be cheating).\nNow I'm considering using a library to read the USB Information that the mouse send.\nAfter 6+ hours of research I'm running out of possibilities to make it and before loosing more time I would like to know if anyone as a way to do it (in Python or any other language).","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":159,"Q_Id":58701646,"Users Score":0,"Answer":"Rather than warping the cursor to the center of the screen, could you just warp it back a little from the edge? It seems like anti-cheat software would have a harder time detecting that.","Q_Score":2,"Tags":"python,mouse,motion","A_Id":58701973,"CreationDate":"2019-11-04T21:55:00.000","Title":"Getting mouse relative motion even at the border of screen","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am looking to make a python program in which I can have a sidebar GUI along with an interactive 2d pymunk workspace to the right of it, which is to be docked within the same frame.\nDoes anyone know how I might implement this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":56,"Q_Id":58718972,"Users Score":0,"Answer":"My recommendation is to use pygame as your display. If an object is chosen, you can add it to the pymunk space at the same time as using pymunk to get each body's space and draw it onto the display. This is how I've written my games.","Q_Score":0,"Tags":"python,user-interface,pymunk","A_Id":59110191,"CreationDate":"2019-11-05T20:27:00.000","Title":"Implementing a built in GUI with pymunk and pygame in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'd like to find the window background color in HEX format. Looking for a solution that works on all platforms... Windows\/Linux\/Mac... \nThe following code print (self.cget('bg')) just prints SystemButtonFace but I'd like to get the actual HEX format. The reason is that I need to use this color as a base to create a new slightly darker color shade.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":783,"Q_Id":58758439,"Users Score":1,"Answer":"The winfo_rgb method on all widgets will accept a color name and return the r, g, and b components as integers in the range of 0-65535 (16 bits). You can then convert those to hex using standard python string formatting.","Q_Score":0,"Tags":"python,tkinter","A_Id":58758652,"CreationDate":"2019-11-07T23:41:00.000","Title":"How can I get HEX or RGB color code of the window background color?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have an image, where four corner points are defined. Now I want to get the pixel values of the region, that is defined by the 4 corners. Problem is, although it is a rectangle, it has a \"slope\", which means neither the two upper corner points nor the lower one are at the same height. How can I still solve this issue?\nI have not found anything for this yet.. I'd appreciate any kind of support! :)","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2611,"Q_Id":58790535,"Users Score":0,"Answer":"It is not very easy to iterate through a slanted rectangle. Therefore, what you can do is to rotate the whole image such that the rectangle is parallel to the sides again. \nFor this, you can compute the slope of one side as difference in the y coordinate over the difference in the x coordinate of the corners. The value you get is the slope. The arctangent of the slope is the angle to the horizontal. You need to rotate the image with the opposite (negative) of this value. \nTo make it more efficient, you can crop a bit the image.","Q_Score":2,"Tags":"python,image,opencv","A_Id":58790592,"CreationDate":"2019-11-10T16:14:00.000","Title":"How to get pixel values inside of a rectangle within an image","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two files. One is interface.py (Tkinter code) that contains the interface of the application. Another file is logic.py. The interface contains a button. What I want is that when I click the button the logic.py file starts its execution. How can I perform this task?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":114,"Q_Id":58797084,"Users Score":0,"Answer":"The easiest way is to use main function inside the file you want to execute, and then to call it (import logic, then Button(command=logic.main).pack()) or to use __import__ or import logic inside the button command function.","Q_Score":1,"Tags":"python,image,tkinter","A_Id":58799979,"CreationDate":"2019-11-11T07:22:00.000","Title":"How to call or execute new file when a button is clicked in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a python3.7\/kivy1.11\/numpy1.17 program that I transform into an apk with buildozer on ubuntu 19.04, ok it works.\nBut my program uses a text file for its configuration and that's the problem!\nHow to link this.txt file to the apk and incidentally where to find this file on the mobile?\nSorry, but Android is still a little bit of a mystery to me.\nIn my spec file I only mentioned my txt file as \n \"source.include_exts = py,kv,txt\"\nbut of course it doesn't work.\nThank you for any suggestions as to how to proceed.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":298,"Q_Id":58898307,"Users Score":1,"Answer":"Buildozer packages whatever folder you tell it, and it's unpacked with the same structure on Android. Just make sure the text file is in that folder, add its extension to source.include_exts (as you already did) and access it the same way you would on the desktop.","Q_Score":0,"Tags":"android,python-3.x,kivy,buildozer","A_Id":58900315,"CreationDate":"2019-11-17T07:08:00.000","Title":"Buildozer android and the attached txt files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a simple program in Python and I need to change windows in which the application works multiple times. I could use pyautogui.click(x, y); to click on the taskbar but thats not efficent enough. \nIs there anyway I can do it with a command like: open('appname') or: summon('appname')\nThanks for the help!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":580,"Q_Id":59017614,"Users Score":0,"Answer":"you using GUI without Tkinter? very interesting. you need to open program with python script?\ntry:\nimport os\n# If program isnt in a folder with script\nos.system(\"start LETTER:\\Path\\To\\Program\")\n# If program in a folder with a script or program is a command in command line\nos.system(\"start ProgramName\")\nWith it you can launch any program without limit (if you have a good CPU, GPU and RAM :D)","Q_Score":0,"Tags":"python,automation","A_Id":59017659,"CreationDate":"2019-11-24T12:24:00.000","Title":"I want to open an already opened app in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am running an application that uses pyautogui.moveTo() and pyautogui.click() for a long period of time (an hour+). To decrease the battery drain on my laptop, I'd ideally want the screen to turn off in this period, but because the autogui functions mimic using the mouse, the computer will not turn the screen off. I'm using Windows 10, and I'm not sure if I could use some functions from PyWin32 or WMI as demonstrated in this post, because the screen will brighten again when the mouse moves each time. \nHaving the laptop turning off and on the screen repeatedly doesn't seem like it would save too much power, but I'm not sure.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":434,"Q_Id":59024219,"Users Score":0,"Answer":"I am not sure this is what you want but many to all laptops have a brightness setting and windows devices definitely do. This should save some power on your device.","Q_Score":0,"Tags":"python,windows,operating-system,pyautogui","A_Id":59024247,"CreationDate":"2019-11-25T01:48:00.000","Title":"Is it Possible to use pyAutoGui and Dim the Screen in Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a folder containing 5100 images in png format , each image having 32 * 32 pixels (height and width) . How can I resize the image in python by increasing its height and width(for image processing)? Also , will doing this can help my model improve the accuracy?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":59103295,"Users Score":0,"Answer":"If you are using python, you can use .resize() option to resize the image. This, as per my knowledge, won't have any impact on the accuracy","Q_Score":0,"Tags":"python-3.x,data-science","A_Id":59103470,"CreationDate":"2019-11-29T10:44:00.000","Title":"Resizing a small image into bigger image","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I understand this is a recurring question but I think my use case is a bit different from the norm:\n\nOn one end, I have a number of tasks running that update the state of a Model object, all running asynchronously with Advanced Python Scheduler\nOn the other end, I have a terminal UI framework (asciimatics) that is basically a loop refreshing the screen.\n\nMy goal is to have the UI display the state of the Model. How do I do this in python?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":143,"Q_Id":59111669,"Users Score":1,"Answer":"Solved my own question. In case anyone stumbles upon a similar problem: the short answer is to use multithreading.\n\nIf you're using APS as well, you can just use the BackgroundScheduler class. It will schedule your tasks in separate threads and won't block the main one.\nIf you are using something else for your background tasks, just run them in a separate thread with the threading module.","Q_Score":1,"Tags":"python,python-3.x","A_Id":59111885,"CreationDate":"2019-11-29T22:38:00.000","Title":"How do I run separate tasks at the same time in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Ok so I'm working with wxPython with a friend of mine, now it just so happened that he implemented a new picture into the script and its working just fine for him. But if he sends the project to me I get the error:\n\"wx._core.wxAssertionError: C++ assertion \"strcmp(setlocale(LC_ALL, NULL), \"C\") == 0\" failed at ....\\src\\common\\intl.cpp(1579) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a mismatch between C\/C++ and Windows locale.\nThings are going to break, please only change locale by creating wxLocale objects to avoid this!\"\nThe code in the line that breaks is the following:png2 = wx.Image(\"BlackBorder.png\", wx.BITMAP_TYPE_ANY).ConvertToBitmap() this lies inside the __init__(self) method for wxPython\nIt doesnt really tell me what is wrong I feel like so I really appreciate any help.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":337,"Q_Id":59142313,"Users Score":0,"Answer":"IIRC, there are some versions of the PNG library that call setlocale in some situations. Try explicitly creating and holding a wx.Locale object at the start of your application and see if that helps.","Q_Score":0,"Tags":"python-3.x,wxpython","A_Id":59218015,"CreationDate":"2019-12-02T15:44:00.000","Title":"wxPython \"Things are going to break\" error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I understand in the case where custom behavior is required, e.g. an elaborately constructed and operated QGraphicsScene for example, subclassing the QObject in question is something of a no-brainer reasonable course of action.\nHowever, what if you want to subclass simply for the purpose of code cleanliness. For example, if I have a QDockWidget that requires say dozens of widgets and layouts to be added to it, I can certainly create the QDockWidget first and then execute all of the code on that instance necessary to gussy it up. Or, I could also provide all of that UI build code inside of a subclassed QDockWidget instance, so that in the main application code I simply need to only create an instance of my \"custom\" QDockWidget and move on. This makes the main application code much cleaner.\nIs this a misuse of the purpose of subclassing?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":54,"Q_Id":59224917,"Users Score":2,"Answer":"Definitely, it's not a misuse!\nLogically, subclassing is intended to be used to extend\/manipulate the functionality of the inherited class.\nSo, you are doing it right.","Q_Score":0,"Tags":"python,qt,subclass","A_Id":59225065,"CreationDate":"2019-12-07T10:07:00.000","Title":"When is it Pythonic\/good practice to subclass in Qt","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making a game with Pygame, and now I stuck on how to process collision between player and wall. This is 2D RPG with cells, where some of them are walls. You look on world from top, like in Pacman.\nSo, I know that i can get list of collisions by pygame.spritecollide() and it will return me list of objects that player collides. I can get \"collide rectangle\" by player.rect.clip(wall.rect), but how I can get player back from the wall?\nSo, I had many ideas. The first was push player back in opposite direction, but if player goes, as example, both right and bottom directions and collide with vertical wall right of itself, player stucks, because it is needed to push only left, but not up.\nThe second idea was implement diagonally moving like one left and one bottom. But in this way we don't now, how move first: left or bottom, and order becomes the most important factor.\nSo, I don't know what algorithm I should use.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":298,"Q_Id":59225511,"Users Score":0,"Answer":"If you know the location of the centre of the cell and the location of the player you can calculate the x distance and the y distance from the wall at that point in time. Would it be possible at that point to take the absolute value of each distance and then take the largest value as the direction to push the player in.\ne.g. The player collides with the right of the wall so the distance from the centre of the wall in the y direction should be less than the distance in x.\nTherefore you know that the player collided with the left or the right of the wall and not the top, this means the push should be to the right or the left.\nIf the player's movement is stored as in the form [x, y] then knowing whether to push left or right isn't important since flipping the direction of movement in the x axis gives the correct result.\nThe push should therefore be in the x direction in this example\ne.g. player.vel_x = -player.vel_x.\nThis would leave the movement in the y axis unchanged so hopefully wouldn't result in the problem you mentioned.\nDoes that help?","Q_Score":0,"Tags":"python,algorithm,pygame,collision","A_Id":59225861,"CreationDate":"2019-12-07T11:29:00.000","Title":"Walls logic in Pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am interested in porting some of my old fractal imaging programs over from Borland C to python. In Borland C, the putpixel command would place a specified color pixel within a rasterized graphical field. Is there a simple way to do this in matplotlib?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":59273850,"Users Score":0,"Answer":"After posting this I discovered that there is a putpixel command in PIL (Python Imaging Library), which has tools for dealing with pixel oriented graphics. Matplotlib can also do the job as suggested by the answer above.","Q_Score":1,"Tags":"python,linux,windows,matplotlib,plot","A_Id":59314615,"CreationDate":"2019-12-10T19:08:00.000","Title":"Is there a Matplotlib equivalent to the Borland C command putpixel?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I'm trying to build a bot to automate some actions in a mobile game that I'm running on my pc through Bluestacks.\nMy program takes a screenshot of the window, looks for certain button templates in the image and returns their coordinates.\nI would now like to be able to send a click event to the window at those coordinates, but since I would also like to do other things while the bot runs in the background I'm looking for a way to send the mouse event directly to the window (even if it's minimized\/in the background), without influencing the movement of the mouse while I'm doing other stuff or bringing the window to the foreground\/unminimizing it. Is this possible?","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":9394,"Q_Id":59285854,"Users Score":0,"Answer":"If you really want to automate bluestacks, you could use adb (which could do the assigned work like clicking a button, even when the window is minimized) you could use\nPpadb (pure Python adb module) for automating it. And ppadb could be used in mac and Linux also, but win32 is restricted to Windows.","Q_Score":4,"Tags":"python,android-emulator,mouseevent,bluestacks","A_Id":65160153,"CreationDate":"2019-12-11T12:28:00.000","Title":"Is there a way to send a click event to a window in the background in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can I get the left, top, width and heigth as an int value instead of the standard 'Box(left, top, width, height)'. I need these values to make if statements like: \"if left < 250\".\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":198,"Q_Id":59454458,"Users Score":0,"Answer":"Update:\nYou can just use x[0] for the left, x[1] for the top etc.\nNOTE: this doesn't work when x=\"None\". use 'try' to prevent the code from crashing when trying to call x[something].","Q_Score":0,"Tags":"python,automation,bots,pyautogui","A_Id":59459131,"CreationDate":"2019-12-23T11:21:00.000","Title":"Python: How to get the left or top in pyautogui.locateOnScreen as int?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have noticed that both of the instructions tk.Tk() and tk.Frame make a new window, so what is the difference between them? and what is the advantage of using one over the other ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":688,"Q_Id":59506238,"Users Score":2,"Answer":"I have noticed that both of the instructions tk.Tk() and tk.Frame make a new window\n\nThat is not correct. tk.Frame will not make a new window, except for the fact that any widget will force the creation of a root window if you haven't already created the root window.\nWidgets in a tkinter application exist in a hierarchy, and that hierarchy must have a root window. The root window is special in that it doesn't have a parent. All other widgets must have a parent. Every application must have an instance of tk.Tk, and except for very rare circumstances you should never have more than one instance of tk.Tk.\ntk.Frame is a frame: a widget with a border and not much else. Like all other widgets (except tk.Tk), it must have a parent. \nThe advantage to using tk.Tk is that your application must have an instance of it. If you don't create one, one will be created for you. The zen of python says explicit is better than implicit, so you should always explicitly create it.\nThe advantage to using tk.Frame is that it makes it easy to collect widgets into groups and be able to manage them as a group (add a border, lay them out as a group, etc).","Q_Score":0,"Tags":"python,tkinter","A_Id":59506289,"CreationDate":"2019-12-27T21:34:00.000","Title":"difference between tk.Tk() and tk.Frame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I made Pong using PyGame and I want to use genetic algorithms to have an AI learn to play the game. I want it to only know the location of its paddle and the ball and controls. I just don't know how to have the AI move the paddle on its own. I don't want to do like: \"If the ball is above you, go up.\" I want it to just try random stuff until it learns what to do.\nSo my question is, how do I get the AI to try controls and see what works?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":945,"Q_Id":59525215,"Users Score":0,"Answer":"So you'd want as the AI input the position of the paddle, and the position of the ball. The AI output is two boolean output whether the AI should press up or down button on the next simulation step.\nI'd also suggest adding another input value, the ball's velocity. Otherwise, you would've likely needed to add another input which is the location of the ball in the previous simulation step, and a much more complicated middle layer for the AI to learn the concept of velocity.","Q_Score":2,"Tags":"python,machine-learning,pygame,artificial-intelligence,genetic-algorithm","A_Id":59525463,"CreationDate":"2019-12-30T03:00:00.000","Title":"How to give an AI controls in a video game?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a pygame project that crashes whenever I call pygame.mixer.music.load('.\/sounds\/background music.mp3').\nIt was working perfectly fine yesterday, please note that I have made no changes to the code.\nAny advice would be appreciated as I have tried everything that I could think of to fix this issue.\nI checked my pygame folder and there does exist a \"libmpg123.dll\" file.\n\nTraceback (most recent call last):\n File \"C:\/Users\/ngtaw\/PycharmProjects\/snakeversus\/snakeversus.py\", line 291, in \n pygame.mixer.music.load('.\/sounds\/background music.mp3')\n pygame.error: Failed loading libmpg123.dll: Attempt to access invalid address.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":486,"Q_Id":59525541,"Users Score":0,"Answer":"Managed to solve this by updating pygame from pygame 1.9.6 to pygame 2.0.0.dev6.","Q_Score":1,"Tags":"python,pygame","A_Id":59526905,"CreationDate":"2019-12-30T03:53:00.000","Title":"I get an error even though no changes was made to my project. \"Attempt to access invalid address\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am building a GUI software using PyQt5 and want to connect it with MySQL to store the data. \nIn my computer, it will work fine, but what if I transfer this software to other computer who doesn't have MySQL, and if it has, then it will not have the same password as I will add in my code (using MySQL-connector)a password which I know to be used to connect my software to MySQL on my PC. \nMy question is, how to handle this problem???","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":35,"Q_Id":59530440,"Users Score":2,"Answer":"If you want your database to be installed with your application and NOT shared by different users using your application, then using SQLite is a better choice than MySQL. SQLite by default uses a file that you can bundle with your app. That file contains all the database tables including the connection username\/password.","Q_Score":0,"Tags":"python,mysql,python-3.x,mysql-python","A_Id":59538866,"CreationDate":"2019-12-30T11:55:00.000","Title":"Will pyqt5 connected with MySQL work on other computers without MySQL?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I hope you are doing great this new year,\nI am creating a GUI program (Python3 Tkinter) which displays the output of another python script into a big entry.\nSituation:\nMy GUI has only 1 button which execute this command:\npython external_python_script.py -h\nHowever I want the whole output of this command execution to be displayed into an entry, and not into the CMD.\nSo far this is my solution, but not effective:\ncommand_textbox = os.system(python external_python_script.py -h) #simply execute the code in brackets\nscript_output.insert('1.0',command_textbox) #the whole output of the script will be displayed in this entry\nWhat happened when I did this?\nIn the GUI program, when I pressed the button, into the Entry it is displayed only this 0\nAny help is greatly appreciated, thank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":93,"Q_Id":59554357,"Users Score":0,"Answer":"Thank you guys for helping me, Subprocess is the solution. So I put only these 2 lines of code and I got the solution I wanted:\nfinal_command = subprocess.run(command, capture_output=True)\noutput_box.insert('1.0',final_command)","Q_Score":0,"Tags":"python,python-3.x,user-interface,tkinter","A_Id":59567045,"CreationDate":"2020-01-01T16:55:00.000","Title":"Why the output of an external Python Script isn't displaying into my Python Tkinter GUI?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running a application that I created using Python and KivyMD in the iPhone Simulator of Xcode. So far I do have a really bad performance. The animations, transistions, opening\/ widgets just perform very bad and laggy. It results in a delay of mouse click and instruction performance of about 1s. The app I developed is yet pretty simple, does contain several basic widgets like a button, textinput, spinners and does have a connection to a postgreSQL database. Not the functions in the app (select data from the database etc) cause the lag, it's just the performance in total.\nIs there anything that has to be set up in Xcode to make it run smooth? Already checked if I had accidentally enabled the slow-animations but didn't. Also curious if it is just the simulator or if it would also run as bad on my actual device.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":215,"Q_Id":59570740,"Users Score":0,"Answer":"The iPhone simulator is runs super heavy on a system. I've experienced something similar and was able to fix it by closing applications running in the background to free up some CPU and RAM. You could also try the obvious restarting xcode.","Q_Score":0,"Tags":"python,iphone,xcode,kivy,ios-simulator","A_Id":59572249,"CreationDate":"2020-01-02T22:19:00.000","Title":"Bad Xcode iPhone simulator performance - Python Kivy app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm running a application that I created using Python and KivyMD in the iPhone Simulator of Xcode. So far I do have a really bad performance. The animations, transistions, opening\/ widgets just perform very bad and laggy. It results in a delay of mouse click and instruction performance of about 1s. The app I developed is yet pretty simple, does contain several basic widgets like a button, textinput, spinners and does have a connection to a postgreSQL database. Not the functions in the app (select data from the database etc) cause the lag, it's just the performance in total.\nIs there anything that has to be set up in Xcode to make it run smooth? Already checked if I had accidentally enabled the slow-animations but didn't. Also curious if it is just the simulator or if it would also run as bad on my actual device.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":215,"Q_Id":59570740,"Users Score":0,"Answer":"I've used Kivy to develop a number of iOS apps. The iPhone simulator from Xcode is just tremendously slow no matter what. Your program likely runs just fine on a physical device!","Q_Score":0,"Tags":"python,iphone,xcode,kivy,ios-simulator","A_Id":59581582,"CreationDate":"2020-01-02T22:19:00.000","Title":"Bad Xcode iPhone simulator performance - Python Kivy app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"The information I got as follows.\n\n Traceback (most recent call last):\n File \"C:\\CocosCreator\\resources\\cocos2d-x\\tools\\cocos2d-console\\bin\\cocos.py\", line 983, in \n run_plugin(command, argv, plugins)\n File \"C:\\CocosCreator\\resources\\cocos2d-x\\tools\\cocos2d-console\\bin\\cocos.py\", line 875, in run_plugin\n plugin.run(argv, dependencies_objects)\n File \"C:\\CocosCreator\\resources\\cocos2d-x\\tools\\cocos2d-console\\plugins\\plugin_new\\project_new.py\", line 258, in run\n self.parse_args(argv)\n File \"C:\\CocosCreator\\resources\\cocos2d-x\\tools\\cocos2d-console\\plugins\\plugin_new\\project_new.py\", line 104, in parse_args\n description=self.__class__.brief_description())\n File \"C:\\CocosCreator\\resources\\cocos2d-x\\tools\\cocos2d-console\\plugins\\plugin_new\\project_new.py\", line 43, in brief_description\n return MultiLanguage.get_string('NEW_BRIEF')\n File \"C:\\CocosCreator\\resources\\cocos2d-x\\tools\\cocos2d-console\\bin\\MultiLanguage.py\", line 52, in get_string\n fmt = cls.get_instance().get_current_string(key)\n File \"C:\\CocosCreator\\resources\\cocos2d-x\\tools\\cocos2d-console\\bin\\MultiLanguage.py\", line 158, in get_current_string\n ret = ret.encode(self.encoding)\n File \"C:\\CocosCreator\\resources\\utils\\Python27\\lib\\encodings\\cp1252.py\", line 12, in encode\n return codecs.charmap_encode(input,errors,encoding_table)\nUnicodeEncodeError: 'charmap' codec can't encode characters in position 0-8: character maps to \n\nany one knows why this happened?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":159,"Q_Id":59575574,"Users Score":0,"Answer":"Take a look at the versions of NDK and SDK, NDK. The recommended version is R17 - R19","Q_Score":1,"Tags":"python,android","A_Id":64781397,"CreationDate":"2020-01-03T08:54:00.000","Title":"cocos creator can not build for android platform","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"if I press around my image button it clicks, I only want when the image is clicked that it opens not the surroundings can anybody help me with this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":19,"Q_Id":59602594,"Users Score":0,"Answer":"Override on_touch_down to call super().on_touch_down only if the touch meets your collision requirements.","Q_Score":0,"Tags":"python,kivy","A_Id":59602813,"CreationDate":"2020-01-05T17:49:00.000","Title":"Image button in kivy is not concise","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently setting up Python on my new Windows 10 machine. I have installed Python 2.7.15 and 3.6.1 (both of which I currently still need for different applications, installing from installers that I have previously successfully used on my previous Windows7 machine) and some packages via pip. Both Python installations are 32 bit.\nOne of those packages is PyQt5 (which only exists for Python3, anyway).\nNow, I am trying to run one of my Python3 scripts which uses PyQt5 and I get \n\"ImportError: DLL load failed: %1 is not a valid Win32 application.\" on the first line importing PyQt5.\nI have tried using both pip install PyQt as well as py -3.6-32 -m pip install PyQt5 (after I found that this probably means an 32 bit\/64 bit incompatibility between Python and the package). Neither solved the problem.\nDoes anyone have an idea what else I can try?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1080,"Q_Id":59667538,"Users Score":0,"Answer":"Restarting the machine several times seems to have solved the issue. (There were no changes after the first reboot, but after the second reboot it worked.)","Q_Score":0,"Tags":"python,python-3.x,pyqt5,32bit-64bit","A_Id":59713870,"CreationDate":"2020-01-09T15:43:00.000","Title":"Installing PyQt5 in Windows10 32bit Python3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"My kivy\/python app works perfectly on windows but when I try to run the apk using buildozer I get an error that says: ModuleNotFoundError: No module named 'requests Where do I have to install the module?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":202,"Q_Id":59669557,"Users Score":1,"Answer":"Add it to your requirements line in buildozer.spec.","Q_Score":1,"Tags":"python,kivy,buildozer","A_Id":59670264,"CreationDate":"2020-01-09T17:46:00.000","Title":"How to use modules like request when making an android apk using kivy and python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Essentially , what I want to do is , press a button that I program in Flutter and when that button is pressed , a python script should start running on my Android device . \nI want to use youtube-dl (used to download Youtube videos) library in python but I wanna know if there is a way to run the library in flutter . \nAny Help is appreciated . Thanks in advance .","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":12878,"Q_Id":59697971,"Users Score":1,"Answer":"I think you should create a flask API in python and deploy it in the Heroku platform. After getting the endpoint of that API you can request that API in flutter easily.","Q_Score":13,"Tags":"python,android,android-studio,flutter,youtube-dl","A_Id":71706682,"CreationDate":"2020-01-11T19:33:00.000","Title":"Is there a way I can run a python Script when a button programmed in flutter is pressed?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I try to set up a wx.dataview.DataViewListCtrl. I have multiple columns with text content. Some Entries of the first column are wider than the selected default width. They are cut off. I could set the column width by hand but I like to set it up automatically to the maximum content or header width. Is there an automated way to do so? If not, how can I calculate the ideal width. I'm on Ubuntu Linux. The used backend is gtk. A C++ answer using wxDataViewListCtrl could help, too. I'm able to translate it.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":598,"Q_Id":59703405,"Users Score":2,"Answer":"You can set the column width to wxCOL_WIDTH_AUTOSIZE (probably mapped to wx.COL_WIDTH_AUTOSIZE in Python) to make it fit its existing elements.","Q_Score":1,"Tags":"python,python-3.x,wxpython,wxwidgets","A_Id":59735996,"CreationDate":"2020-01-12T11:37:00.000","Title":"Set column width to maximum content or header width for a wx.dataview.DataViewListCtrl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So an Entry widget's text can be retrieved using the .get method but my question is: \nCan you italicize the text that .get receives from the widget?\nAdding the font parameter to the Entry only changes the text displayed in the Entry and not its actual output that .get gives you, so I'm at a loss.\nWhat I'm actually trying to accomplish by doing this is italicizing only a certain part\/string of the text of an Entry field while keeping the other parts of the text unitalicized, so if you have any tips for doing that instead, I'd appreciate the help!\nThanks in advance for the advice!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":241,"Q_Id":59711487,"Users Score":1,"Answer":"What I'm actually trying to accomplish by doing this is italicizing only a certain part\/string of the text of an Entry field while keeping the other parts of the text unitalicized,\n\nThat is impossible. The Entry widget can only display text in a single font.\nIf you want to have multiple fonts, you will need to use either a Text or Canvas widget, with the Text widget being the easiest solution.","Q_Score":1,"Tags":"python,tkinter,tkinter-entry,text-formatting,italic","A_Id":59718311,"CreationDate":"2020-01-13T06:28:00.000","Title":"How can I italicize the resulting text from an Entry widget in tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to check an entry boxes input:\nProductNameEntry.get() to check whether any of the inputted data contains any integers if so it should return an error message.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":34,"Q_Id":59735569,"Users Score":0,"Answer":"Entry box data is a str.\nTo check if there are numbers in the string you can use any([char.isdigit() for char in your_string]) which returns True when there's a number in the your_string","Q_Score":0,"Tags":"python,validation,tkinter","A_Id":59735630,"CreationDate":"2020-01-14T14:15:00.000","Title":"Python Tkinter type check","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm having a trouble while implementing a log-in system in an interface I'm creating:\nI want it to have two type of user: admin and user, so depending on what you choose you input your credentials and then if they're correct the system opens either the admin interface or the user interface.\nMy problem is that given the knowledge I have right now, I have to have a \"mother window\" while executing tkinter which is the first windows that opens when you run the program, in this case that mother window would be the log-in window, the thing is that if I close that log-in window once the user inputs his\/her credentials, then the whole program doesn't work.\nIs there a solution for this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":43,"Q_Id":59735640,"Users Score":1,"Answer":"The simplest solution is to create two functions or two classes, one for the login window and one for the main window. Have these functions or classes return a single frame that contains everything needed for that part of the code.\nThen, call the first function or class to login in, then destroy it and call the second function or class. When you destroy a frame, all of its children are also automatically destroyed.","Q_Score":1,"Tags":"python-3.x,tkinter","A_Id":59737043,"CreationDate":"2020-01-14T14:19:00.000","Title":"Creating a log-in system using Tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I make a step-by-step GUI Layout with Tkinter Python 3.7? What I mean is that I want to have the user enter some information, press the \"NEXT\" button and enter some more information, etc. I don't think there's really a feasible way to completely change the layout like this with Tkinter, so I'm hoping there's something I'm missing. How do I do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":48,"Q_Id":59832178,"Users Score":0,"Answer":"I don't think there's really a feasible way to completely change the layout like this with Tkinter,\n\nThat is incorrect. This is trivially easy with Tkinter. Create a function or class for each step. All of the widgets for that step should be inside a single frame.\nYou then just need to call the first function or class to create the frame. When the user clicks \"next\", destroy the frame and create the next frame. And so on.","Q_Score":0,"Tags":"python,python-3.x,user-interface,tkinter","A_Id":59832246,"CreationDate":"2020-01-20T23:21:00.000","Title":"Step-by-step tkinter GUI layout","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am habing trouble with xlwings and win32com.client, both xlwings and win32com.client have been working fine up until recently. \nWhen i try to import xlwings for example.\nimport xlwings\nI get an ERROR below:\n_pickle.UnpicklingError: invalid load key, '\\x00'\nI get a similar error when i run the code below:\nimport win32com.client, \nbut get no error when i run \nimport win32com\ni have tried uninstalling python and reinstalling it again but the issue still persist and reloading the modules.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":182,"Q_Id":59848450,"Users Score":0,"Answer":"I managed to resolve the issue by just uninstalling python and re-installing it again. Then re-installing xlwings. note that i am using python 3.7.","Q_Score":2,"Tags":"python,pywin32,win32com,xlwings","A_Id":59861913,"CreationDate":"2020-01-21T20:06:00.000","Title":"error when running xlwings and win32com.client","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am habing trouble with xlwings and win32com.client, both xlwings and win32com.client have been working fine up until recently. \nWhen i try to import xlwings for example.\nimport xlwings\nI get an ERROR below:\n_pickle.UnpicklingError: invalid load key, '\\x00'\nI get a similar error when i run the code below:\nimport win32com.client, \nbut get no error when i run \nimport win32com\ni have tried uninstalling python and reinstalling it again but the issue still persist and reloading the modules.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":182,"Q_Id":59848450,"Users Score":0,"Answer":"I resolved this issue uninstalling xlwings, erasing the content of this folder\nC:\\Users\\YOUR_USERNAME\\AppData\\Local\\Temp\\gen_py\\3.8\nand then reinstalling xlwings.\n(Anaconda 3 Python 3.8).","Q_Score":2,"Tags":"python,pywin32,win32com,xlwings","A_Id":72180306,"CreationDate":"2020-01-21T20:06:00.000","Title":"error when running xlwings and win32com.client","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made GUI application with PyQt and wrapped it up with pyinstaller.\nAs you know, make it for onefile (sole exe file) is quite slow.\nSo, what I want to do is wrap it by using pyinstaller but not in onefile, but i still don't want to execute the exe file in the folder. I want to move the exe file to desktop directory so I can use it like onefile. I tried it but it says there is no .dll on desktop directory.\nI assume that there is quite simple solution.\nHow can I solve this problem?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":546,"Q_Id":59859582,"Users Score":4,"Answer":"Keep the file in the folder and create a shortcut on the desktop instead. You can have also shortcuts in the Start menu for example or pin the exe (create shortcut) in TaskBar. If you are going to distribute it a simple installer can automate the creation of the said shortcuts.","Q_Score":2,"Tags":"python,pyqt,pyinstaller","A_Id":59859685,"CreationDate":"2020-01-22T12:15:00.000","Title":"pyinstaller move .exe file to Desktop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am wondering if there is a software library that enables opening a jpeg and converting a subset of it to an uncompressed array (such as Pillow). This would be in contrast to the more usual method which is to open the file, convert it fully to a bit array, then take a subset of the bit array. \nIn my case the subset that I have in mind is the upper left corner. The files decompress to 2544 \u00d7 4200 pixels, but I am only interested in the top left 150 x 900 pixels. \nThe background is below:\nI am hopeful that the JPEG format is a string of compressed subpanels and an algorithm could stop when it had processed enough subpanels to fulfill the required subset of the image.\nI have been searching for a while but have not found any mention of such an algorithm which, admittedly, is a special case.\nBackground\nI use pyzbar to capture a barcode from the top left corner of a JPEG image as produced a high-speed scanner. Generally this required about 250 msecs per image. The actual Pyzbar time is about 2.5 msecs while the other 99% of the time is spent reading the image from a file, having it decompressed using Pillow, extracting the upper left corner.\nThe non-profit where I do this work as a volunteer cannot really afford to replace the $25K scanner and the channel that this clunker has is the overall bottleneck. Telling the scanner to send uncompressed images would slow the whole process down by at least 90%","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":48,"Q_Id":59868088,"Users Score":0,"Answer":"I don't know of an existing library that can do this, but it is possible to modify jpegtran.c and jdtrans.c from the IJG C library to only read as many MCU rows as necessary when cropping, and in your specific case the decode time should be reduced by ~75% (900 \/ 4200 lines).\nSince you are using Python, you could obtain a suitably cropped jpeg with:\nos.popen(\"jpegtran -crop 152x904 %s\" % inputfile).read()\nThis assumes the input jpeg is not progressive.","Q_Score":0,"Tags":"python-imaging-library,jpeg","A_Id":59870902,"CreationDate":"2020-01-22T20:53:00.000","Title":"Open only the top left corner of a JPEG?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So for a while now I have been building my virtual assistant in python which has required the use of several external libraries. I have also been converting the scripts to an exe using pyinstaller. However only the other day, windows defender told me that there was something wrong which was only affecting the exe file I had created\nIt said Trojan: Win32\/Wacatac.C!ml\nI simply don't understand how this was only flagged up now and not before considering I have been working on this project for over a month now.\nHere is a list of the modules I have used:\nnewsapi, Wikipedia, threading, autocorrect, random, time,email, calendar, datetime, math, sys, webbrowser, pyttsx3, io, speech_recognition,imaplib, pickle, wmi, docx, comtypes, googletrans, qhue, pyowm, ast, pyaudio, pycaw, tkinter, smtplib, email, bs4, requests","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3325,"Q_Id":59900656,"Users Score":4,"Answer":"It's a false positive. There's nothing malicious about your third-party modules, the issue has to do with PyInstaller.\nPyInstaller comes with pre-compiled bootloader binaries. Since many actual amateur viruses are written in Python, and then converted to executables using PyInstaller, most anti-virus software will flag those pre-compiled bootloader binaries as being malicious. The only real solution is to compile your own bootloader.","Q_Score":1,"Tags":"python,python-3.x,python-3.6,libraries","A_Id":59900803,"CreationDate":"2020-01-24T16:49:00.000","Title":"Concerned about malicious libraries in my project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was working on my game using pygame and I tried to implement a high score mechanism. But when I run my program it just crashed and it seems it deleted itself forever. Now when I open my code there is just 0 writen in. Is there a way to get my code back and why did it delete itself? (I tried to implement high score by making a new .txt file and by storing scores into it. I wrote it all in my same game script.)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":50,"Q_Id":59911489,"Users Score":1,"Answer":"What you most likely did was open your file and override it with 0. Whenever you open files you have to consider the mode you open it in (and which file you open.). For example, opening a file with 'w' will remove all previous content in the file and fill it with whatever you write to it.\nIf this is what happened, then no, there's no way to get back your code (unless you've saved a copy somewhere else or are using a Version Control System like git or svn).\nIf you're using the editor Pycharm, then you can right-click your project and press Local history and then Show History to open saved versions. Then click revert to go back to the version where you had your code.","Q_Score":0,"Tags":"python,pygame","A_Id":59912637,"CreationDate":"2020-01-25T17:05:00.000","Title":"Deleted program by itself","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a GUI by using QtDesigner and PyQt5. There are 60 push buttons and I want to disable\/enable 50 of them by pushing 61th push button. How it can be achieved?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":398,"Q_Id":59968959,"Users Score":2,"Answer":"One option is to add the buttons you want to enable\/disable to a button group. In QtDesigner this can be done by selecting the buttons, right-clicking on the selection and choosing \"Assign to button group\" in the popup menu. You can then iterate over buttongroup.buttons() to enable\/disable them.","Q_Score":1,"Tags":"python,qt,pyqt,pyqt5","A_Id":59972099,"CreationDate":"2020-01-29T14:13:00.000","Title":"How to enable\/disable many controls including push buttons simultaneously in PyQt5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a gui programm with Tkinter. In the program are several buttons which open new main tkinter windows but when i click on the 'x' of one of these windows all the other ones close too although they are different windows. Only the Buttons, which cause the new tkinter main windows, are in the same main window.\nplease help :))","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":40,"Q_Id":60019993,"Users Score":0,"Answer":"This is how tkinter is designed to work. When you destroy a window, all of its children are destroyed. Since everything is a child of the root window or one of its children, when you destroy the root window all other widgets are destroyed along with it.","Q_Score":0,"Tags":"python,tkinter","A_Id":60020316,"CreationDate":"2020-02-01T18:36:00.000","Title":"Python tkinter main window closes all other windows too, why?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to run my python3 code through the kivy launcher on my android device but it crashes on launch, pointing towards the requests module in the error log. Is there any way to get the requests module to work on my android device? \nAs a side note, I am not using buildozer for this as I do not have a Linux machine, its strictly through the kivy launcher.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":474,"Q_Id":60026650,"Users Score":0,"Answer":"@Mark.97\nCopy the modules required into the \"kivy\" folder on the mobile.\nI was able to run the application successfully with kivy launcher after copying the following modules.\n- requests\n- idna\n- certifi\n- chardet\n- urllib3","Q_Score":0,"Tags":"python,android,kivy","A_Id":62085035,"CreationDate":"2020-02-02T13:39:00.000","Title":"ImportError: No module named requests on android kivy launcher","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am having a problem that I can not use cv2.imshow() because of following error message\n\nqt.qpa.plugin: Could not find the Qt platform plugin \"cocoa\" in \"\"\nThis application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.\n\nLast Macbook I was using initially did not have QT so I have no idea how should I deal with it.\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":8481,"Q_Id":60032540,"Users Score":43,"Answer":"I had the same issue after updating opencv - python to 4.2.0.32.\nUninstall opencv-python and install the lower version (e.g pip install opencv-python==4.1.0.25) solves this issue.","Q_Score":10,"Tags":"python,python-3.x,qt,opencv","A_Id":60032783,"CreationDate":"2020-02-03T02:50:00.000","Title":"OpenCV cv2.imshow is not working because of the qt","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This problem has been reported earlier but I couldn't find the exact solution for it. I installed ActiveTCL and downloaded tktable.py by \"Guilherme Polo \" to my site-packages, also added Tktable.dll, pkgindex.tcl, and tktable.tcl from ActiveTCL\\lib\\Tktable2.11 to my python38-32\\tcl and dlls . I also tried setting the env variable for TCL_LIBRARY and TK_LIBRARY to tcl8.6 and tk8.6 respectively. But I am still getting invalid command name \"table\".\nWhat is that I am missing? Those who made tktable work on windows 10 and python 3 , how did you do it? I am out of ideas and would be grateful for some tips on it.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":180,"Q_Id":60038092,"Users Score":0,"Answer":"Seems like there was problem running the Tktable dlls in python38-32 bit version. It worked in 64 bit version. \nThanks @Donal Fellows for your input.","Q_Score":0,"Tags":"python-3.x,tkinter,tcl,python-module,tktable","A_Id":60208713,"CreationDate":"2020-02-03T11:14:00.000","Title":"Tktable module installation problem. _tkinter.TclError: invalid command name \"table\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on a tkinter app and I would like to use the pycurl module in my project but without being installed on any host machine... Like a portable version into my package.\nI didn't see any topic on the web speaking about it but still keeping hope to have a sort of workaround for it.\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":57,"Q_Id":60058971,"Users Score":0,"Answer":"You could create a binary file of your project using pyinstaller. It will bundle all the dependencies that are required by your application, users can just run the binary file without worrying about installing or setting up dependencies.","Q_Score":0,"Tags":"python,pycurl","A_Id":60059827,"CreationDate":"2020-02-04T13:57:00.000","Title":"Use pycurl without installation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I blit surfaces in my pygame file but the problem is they just stay there. My (hopefully temporary) solution was to just move them far off the window when they aren't in use (i.e. (-5000,0) ), but this decreases performance every time I blit a new surface. Is there any way to delete them? del doesn't seem to do it.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":219,"Q_Id":60121997,"Users Score":1,"Answer":"The memory of a Surface is freed when there is no reference to it anymore, when Python's garbage collection cleans it.\nYou don't need to use del, just make your program so that you don't refer to unused surfaces anywhere. You can assign None to it if not else.\nSometimes you don't need to keep creating new surfaces all the time but can just use the ones that you already have. But it works fine also to create new and have Python clear the old. I've written some screensaver like Pygame visualizers for VJing and installations way back and have had them running for days, constantly adding new images to the screen and removing old, no memory leaks. And never needed del.","Q_Score":0,"Tags":"python,pygame,pygame-surface","A_Id":60122104,"CreationDate":"2020-02-07T22:30:00.000","Title":"Is there a way to delete Pygame Surfaces? Or any way to remove them from memory to increase performance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm writing a short application in python using tkinter. Everything works except for an unexpected pause - it should be generating an event twice a second, but frequently it will pause for 5 or 6 seconds between signals. I've put print statements to find where the delay is, and found it is the following statement:\n\nself.frame.after(ms, self.tick_handler)\n\nms is 500 so this should send the event at around .5 seconds. Usually it does, but frequently it hangs for as much as 5 or 6 seconds before tick_handler() gets the signal. The program is pretty simple, with a single worker thread receiving all input from a single queue, events coming from a single tkinter frame. The after() statement is in the worker thread. I've tried shutting off gc (gc.disable()) but that makes no difference. There is minimal activity outside this on my computer.\nIf I send other input during the pause using mouse or keys it is handled immediately, so the worker thread is not blocked. It looks as if the signal request is received but not fired for some time. I know I can't expect real time performance so .6 seconds wouldn't be noteworthy, but 6.0 seconds?\nThis is the first time I've worked with tkinter. Is there something I am missing about event handling?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":51,"Q_Id":60123791,"Users Score":0,"Answer":"I Think You Did Not Include tkinter.mainloop() At The End\nPS: I'm Not Sure...","Q_Score":0,"Tags":"python,events,tkinter","A_Id":60125600,"CreationDate":"2020-02-08T03:55:00.000","Title":"delay in setting 'after' function in python tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to create Skype patcher with replaced font (stock is incorrectly displaying japanese kanji as chinese equivalent) for Windows. Maybe Python is not the best options, but current problem is not related with Python itself: asar utility produces output with readonly permissions, and changing permission attempt can't do anything. But, maybe, os.chmod is just not working on Windows?\n\n\nimport tkinter as tk\nfrom tkinter import filedialog\nimport subprocess\nimport os\nimport shutil\n\n\ndef change_permissions_recursive(path, mode):\n for root, dirs, files in os.walk(path, topdown=False):\n for dir in [os.path.join(root,d) for d in dirs]:\n os.chmod(dir, mode)\n for file in [os.path.join(root, f) for f in files]:\n os.chmod(file, mode)\n\n\nroot = tk.Tk()\nroot.withdraw()\ndir_path = filedialog.askdirectory(initialdir=\"C:\\Program Files (x86)\\Microsoft\\Skype for Desktop\")\ncmd = \"asar.cmd extract \\\"\" + dir_path + \"\/resources\/app.asar\\\" tmp\/app\"\nprocess = subprocess.Popen(cmd, stdout=subprocess.PIPE, creationflags=0x08000000, cwd=\"utils\")\nprocess.wait()\nchange_permissions_recursive(\"utils\/tmp\/app\/fonts\", 0o777)\nshutil.copyfile(\"utils\/meiryo.ttf\", \"utils\/tmp\/app\/fonts\")","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":487,"Q_Id":60139536,"Users Score":0,"Answer":"Something wrong with shutil.copy itself: when rewrite same logic with powershell, all works as expected","Q_Score":0,"Tags":"python,file-permissions","A_Id":60140996,"CreationDate":"2020-02-09T17:48:00.000","Title":"Python chmod for windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have a Django web app which currently uses HTML templates with CSS styling. Fairly typical for a Django app. I've been looking to create a more animated GUI for this app and was looking to Kivy to do this. Is it possible to combine these two frameworks to coexist in the same app?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":972,"Q_Id":60146791,"Users Score":0,"Answer":"This can be achieved using Django Serializing, Where you can connect asynchronously with Django models. As per my understanding you want use Django models to fetch data right? Django Serializing will convert models into required format xml, json","Q_Score":1,"Tags":"python,django,kivy","A_Id":63215065,"CreationDate":"2020-02-10T08:44:00.000","Title":"Can I create a Kivy GUI for my Django Web App?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am trying to install micropython-umqtt.robust on my Wemos D1 mini.\nThe way i tried this is as follow.\nI use the Thonny editor\n\nI have connected the wemos to the internet.\nin wrepl type:\nimport upip\nupip.install('micropython-umqtt.simple')\nI get the folowing error: Installing to: \/lib\/\nError installing 'micropython-umqtt.simple': Package not found, packages may be partially installed\nupip.install('micropython-umqtt.robust')\nI get the folowing error: Error installing 'micropython-umqtt.robust': Package not found, packages may be partially installed\n\nCan umqtt be installed on Wemos D1 mini ? if yes how do I do this ?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":747,"Q_Id":60238513,"Users Score":0,"Answer":"I think the MicroPython build available from micropython.org already bundles MQTT so no need to install it with upip. Try this directly from the REPL:\nfrom umqtt.robust import MQTTClient\nor\nfrom umqtt.simple import MQTTClient\nand start using it from there\nmqtt = MQTTClient(id, server, user, password)","Q_Score":2,"Tags":"mqtt,esp8266,micropython","A_Id":60254287,"CreationDate":"2020-02-15T11:54:00.000","Title":"umqtt.robust on Wemos","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to install micropython-umqtt.robust on my Wemos D1 mini.\nThe way i tried this is as follow.\nI use the Thonny editor\n\nI have connected the wemos to the internet.\nin wrepl type:\nimport upip\nupip.install('micropython-umqtt.simple')\nI get the folowing error: Installing to: \/lib\/\nError installing 'micropython-umqtt.simple': Package not found, packages may be partially installed\nupip.install('micropython-umqtt.robust')\nI get the folowing error: Error installing 'micropython-umqtt.robust': Package not found, packages may be partially installed\n\nCan umqtt be installed on Wemos D1 mini ? if yes how do I do this ?","AnswerCount":2,"Available Count":2,"Score":0.1973753202,"is_accepted":false,"ViewCount":747,"Q_Id":60238513,"Users Score":2,"Answer":"Thanks for your help Reilly, \nThe way I solved it is as follow. With a bit more understanding of mqtt and micropython I found that the only thing that happens when you try to install umqtt simple and umqtt robust,is that it makes in de lib directory of your wemos a new directory umqtt. Inside this directory it installs two files robust.py and simple.py. While trying to install them I kept having error messages. But I found a GitHub page for these two files, so I copied these files. Made the umqtt directory within the lib directory and in this umqtt directory I pasted the two copied files. Now I can use mqtt on my wemos.","Q_Score":2,"Tags":"mqtt,esp8266,micropython","A_Id":60473411,"CreationDate":"2020-02-15T11:54:00.000","Title":"umqtt.robust on Wemos","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Good Morning everyone,\nHopefully some may help, I am new to visual code transferring over from thonny since im using C# I ust decided to start using visual code for both python and C#. When I code in Visual code and than close the program the text editor is blank as if nothing is there but I can still run the code as if there was. Does anyone happen to know where this problem stems from ir a solution?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":56,"Q_Id":60338644,"Users Score":0,"Answer":"Fixed it, turns out I was using python and its not like C# so I had to open the .py file rather than the .sln file","Q_Score":2,"Tags":"c#,python-3.x,ide,text-editor","A_Id":60353527,"CreationDate":"2020-02-21T12:26:00.000","Title":"Visual Code Does not show any text, any suggestions?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Good Morning everyone,\nHopefully some may help, I am new to visual code transferring over from thonny since im using C# I ust decided to start using visual code for both python and C#. When I code in Visual code and than close the program the text editor is blank as if nothing is there but I can still run the code as if there was. Does anyone happen to know where this problem stems from ir a solution?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":56,"Q_Id":60338644,"Users Score":0,"Answer":"I had something like that with visual studio 2019.\nWhen ever i was copying nuget packages to offline system. \nBecause winrar lock files when it copies visual studio couldn't access packages and couldn't rendered text.","Q_Score":2,"Tags":"c#,python-3.x,ide,text-editor","A_Id":60339279,"CreationDate":"2020-02-21T12:26:00.000","Title":"Visual Code Does not show any text, any suggestions?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a Python GUI application using tkinter.\nThe problem I have is that you can run as many instances as you want.\nBut I only want one instance to be running, if the application is already running and I click again EXE or shortcut, instead it should bring existing running application to the focus.","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":591,"Q_Id":60386033,"Users Score":1,"Answer":"A simple cross-platform trick is to write the process id (pid) of the first instance to a file in a known location (eg: my_program.pid in the system temporary directory). Each time you start up, check to see if that file exists. If it exists, read the pid and check if the process is running. If the process is still running, exit. If not, keep running and write your process id to the file. When the program that wrote the file exits, it should delete the file. \nThere are possible race conditions (eg: the running program could quit in the brief moment after checking but before your program decides to quit), but unless you're building a commercial-grade application, this is usually good enough.","Q_Score":2,"Tags":"python,tkinter","A_Id":60387370,"CreationDate":"2020-02-25T00:44:00.000","Title":"How to tell tkinter application to run only one instance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"so basically I'm trying to make a command line interface using python and I have text area where commands are being entered.\nwhat I wanted to achieve is each command is executing without pressing the button at all( simply on pressing enter)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":200,"Q_Id":60402442,"Users Score":0,"Answer":"You can bind the Enter key to a function with .bind('', function).","Q_Score":0,"Tags":"python,user-interface,tkinter,tkinter-text","A_Id":60404029,"CreationDate":"2020-02-25T20:11:00.000","Title":"can I run a command in Tkinter without Button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a function that takes in a couple of large multi-dimension float arrays as input. As a result, I crash the stack.\nI'm a beginner to C\/C++ so I will apologize in advance if this question is dumb. Anyways, after looking around the net, this problem is not particularly new and the general solution is either make it as a global variable or use vector (instead of array).\nHowever, this piece of C++ code was intended to be used as a shared library and takes input from a Python script and returns (or modifies) the value (also in arrays). Therefore I don't think it would be possible to declare as global (correct me if I am wrong).\nSo, apart from using vector, is there any other way to do so? The reason that put me off from using C++ vector is there is no equivalent data type in Python. I'm using ctypes for communication between Python and C++ if that matters.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":455,"Q_Id":60432331,"Users Score":1,"Answer":"There is no way in C\/C++ to pass an array as a function argument by value. You can pass a pointer to the array and the size of the array. In C++, you also can pass a reference to the array and the size of the array (in template parameters). In either case, the array is not copied and the called function accesses the array in-place, where the caller allocated it.\nNote that the array can be wrapped in a structure, in which case it can be passed by value. In C++, std::array is an example of such. But the caller has to initialize that structure instead of the raw array. std::vector is similar in that it is a structure and it automatically copies elements when the vector is copied, but unlike C arrays and std::array it dynamically allocates memory for the elements.\nHowever, if you're integrating with C API, you are most likely limited to a pointer+size or pointer+size wrapped in a C structure solutions. The rules of working with the array (e.g. who allocates and frees the array, are writes to the array allowed, etc.) are specific to the particular API you're working with. Often, there is a dedicated set of functions for working with arrays provided by the library. You should read the API documentation about conventions taken in Python.","Q_Score":2,"Tags":"python,c++,shared-libraries,ctypes","A_Id":60432874,"CreationDate":"2020-02-27T11:33:00.000","Title":"C++ - How to take a large array as input for a function","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've installed pygame on vscode but vscode can't import pygame showing this error ModuleNotFoundError: No module named 'pygame'\nAny help?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1134,"Q_Id":60432460,"Users Score":1,"Answer":"If you are working with virtual environments make sure you are on the environment where pygame is installed when you run your code.","Q_Score":0,"Tags":"python,visual-studio-code,pygame,vscode-python","A_Id":60432561,"CreationDate":"2020-02-27T11:41:00.000","Title":"How can I import pygame in vscode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've installed pygame on vscode but vscode can't import pygame showing this error ModuleNotFoundError: No module named 'pygame'\nAny help?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1134,"Q_Id":60432460,"Users Score":0,"Answer":"1) open terminal in visual code\n2) run command \n\n\npip install pygame\n\n\n3)import pygame in your code","Q_Score":0,"Tags":"python,visual-studio-code,pygame,vscode-python","A_Id":60432644,"CreationDate":"2020-02-27T11:41:00.000","Title":"How can I import pygame in vscode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hello!\n\nI am working on my first program with Python. It is a window made with tkinter which displays 7 listboxes. I am using a sqlite database to store some info like date, order number and status. So the first listbox displays orders from today's date. Then the next box displays orders from tomorrow and so on. I created an .exe with pyinstaller. Everything works fine except that if i leave the program open for more than one day, when the system date changes(i'm on windows 10) it does not also change in my program. My program \"thinks\" the date is the same as when i executed it last time.\nI get the date for each boxlike this:\nday2_date=(date.today()+timedelta(days=1)) #e.g date for second box\n\nIs there a way to refresh this or anyway to fix this?\nThank you very much!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":118,"Q_Id":60457942,"Users Score":0,"Answer":"It could be a matter of the flow of your program.\nIf day2_date=(date.today()+timedelta(days=1)) is only invoked when reading the database at startup, it is not going to change.\nThis might be internal to Tk event handling, if nothing invokes the method that refresh the variable, it is not going to refresh on its own.","Q_Score":0,"Tags":"python,date","A_Id":60458034,"CreationDate":"2020-02-28T19:15:00.000","Title":"Date not updating when system date changes Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"As the title says i want to know how to make PyQt5 program starts like pycharm\/spyder\/photoshop\/etc so when i open the program an image shows with progress bar(or without) like spyder,etc","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":41,"Q_Id":60485134,"Users Score":2,"Answer":"Sounds like you want a splash screen. QSplashScreen will probably be your friend.","Q_Score":0,"Tags":"python,python-3.x,pyqt5","A_Id":60485172,"CreationDate":"2020-03-02T08:41:00.000","Title":"How to make PyQt5 program starts like pycharm","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I work with wxpython and threads in my project. I think that I didn't understand well how to use wx.CallAfter and when to us it. I read few thing but I still didn't got the point. Someone can explain it to me?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":636,"Q_Id":60506389,"Users Score":2,"Answer":"In a nutshell, wx.CallAfter simply takes a callable and the parameters that should be passed to it, bundles that up into a custom event, and then posts that event to the application's pending event queue. When that event is dispatched the handler calls the given callable, passing the given parameters to it.\nOriginally wx.CallAfter was added in order to have an easy way to invoke code after the current and any other pending events have been processed. Since the event is always processed in the main UI thread, then it turns out that wx.CallAfter is also a convenient and safe way for a worker thread to cause some code to be run in the UI thread.","Q_Score":1,"Tags":"python,python-3.x,multithreading,wxpython","A_Id":60511961,"CreationDate":"2020-03-03T11:36:00.000","Title":"wxPython wx.CallAfter()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been tasked with creating a (python) script that will disable a feature in our source code. The code is generated via third party configure software, through which a gui allows changes in settings to disable this feature. These changes take effort, and time to generate, hence the script. \nTheoretically, there are a bunch of flags in the header files (i.e #define thisFeature STD_ON) which I can flip easily with the script. \nThe part that is more difficult is changes in the source files, for which some functions are added\/removed by the third party configuring software. These may change in the future, so I need to think of a solution that will remain usable. I cannot change the code for the third party application, as I need to avoid the generation process which takes time. I need to make changes so that when we build the product, the required changes are made and compile. Any suggestions would be great.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":98,"Q_Id":60529668,"Users Score":0,"Answer":"You will either introduce assumptions, which turn into future errors when they fail, or end up reimplemeting the AUTOSAR generator. Their point is to allow a implementation of a configured system under complete control of the supplier of the combination of the static code and the generated code. \nEither way, when you need an update of the supplied component you will have much more trouble than when using what is delivered.\nSo I am afraid the answer is \"There is none.\" (i.e. no alternative).\nYou can make assumptions on your system and create something which within those assumptions achieves your goal short term.\nBut long term, whoever decided on using AUTOSAR in your project did that for the reasons which fail when you go around the official generator.\nSo in sooner or maybe later, the effort you spend now is lost and might finally cause more damage than the benefits you might harvest short term.","Q_Score":1,"Tags":"python,c,embedded,autosar","A_Id":60530012,"CreationDate":"2020-03-04T15:41:00.000","Title":"Another approach to making changes in C source code with python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a Python project for school, and am using the Tkinter canvas object as the main interface, because of the visuals. I desperately need a way to hide an object on the canvas, and am not sure how.\nI know this is probably a dumb question, but I really need an answer.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":466,"Q_Id":60531841,"Users Score":1,"Answer":"To hide a canvas object, you can use canvas.itemconfig(item, state='hidden') where item is the item ID returned by canvas.create_xxxx(...).\nTo show the hidden item, use canvas.itemconfig(item, state='normal').","Q_Score":0,"Tags":"python,tkinter,tkinter-canvas","A_Id":60532072,"CreationDate":"2020-03-04T17:44:00.000","Title":"How do you hide an image on a Tkinter canvas?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I converted a python script to an exe using pyinstaller. I want to know how I can change the icon it gave me to the default icon. In case you don't know what I mean, look at C:\\Windows\\System32\\alg.exe. There are many more files with that icon, but that is one of them. Sorry if this is the wrong place to ask this, and let me know if you have any questions","AnswerCount":3,"Available Count":2,"Score":-0.0665680765,"is_accepted":false,"ViewCount":516,"Q_Id":60540092,"Users Score":-1,"Answer":"I would suggest to use auto-py-to-exe module for conversion of python script to exe. At first install using command pip install auto-py-to-exe after that run it through python command line just by typing auto-py-to-exe, you'll get an window where you'll get the icon option.\nPlease vote if you find your solution.","Q_Score":0,"Tags":"python,exe,pyinstaller","A_Id":60540688,"CreationDate":"2020-03-05T07:24:00.000","Title":"How can I replace an EXE's icon to the \"default\" icon?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I converted a python script to an exe using pyinstaller. I want to know how I can change the icon it gave me to the default icon. In case you don't know what I mean, look at C:\\Windows\\System32\\alg.exe. There are many more files with that icon, but that is one of them. Sorry if this is the wrong place to ask this, and let me know if you have any questions","AnswerCount":3,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":516,"Q_Id":60540092,"Users Score":0,"Answer":"You'll need to extract the icon from the exe, and set that as the icon file with pyinstaller -i extracted.ico myscript.py. You can extract the icon with tools available online or you can use pywin32 to extract the icons.","Q_Score":0,"Tags":"python,exe,pyinstaller","A_Id":60555543,"CreationDate":"2020-03-05T07:24:00.000","Title":"How can I replace an EXE's icon to the \"default\" icon?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"[qt.qpa.plugin] Could not find the Qt platform plugin \"cocoa\" in \"\"\nThis application failed to start because no Qt platform plugin could be initialized. Reinstall application may fix this problem.\nProcess finished with exit code 134 (interrupted by signal 6: SIGABRT)\nPlease help me fix this. I am doing a school project so helping me would be very nice. Thanks!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":144,"Q_Id":60574601,"Users Score":1,"Answer":"The error is that you are missing a plugin and you will have to install it on your mac. \npip3 install opencv-python-headless from your terminal should do the job assuming you are on python3","Q_Score":0,"Tags":"python,qt","A_Id":60574627,"CreationDate":"2020-03-07T05:10:00.000","Title":"How can I fix a sigabrt error on my macOS Hight Sierra?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make an GUI application using Kivy framework in Python. I am using Kivy for interface i.e. GUI design and Selenium, BeautifulSoup, CSV libraries for background purpose. Can anybody confirm that does Kivy work with other libraries too?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":55,"Q_Id":60587355,"Users Score":1,"Answer":"Yes, of course, Kivy is just a library providing window drawing and manipulation. What else your Python code does is not limited.","Q_Score":0,"Tags":"python,selenium,beautifulsoup,kivy","A_Id":60588214,"CreationDate":"2020-03-08T12:13:00.000","Title":"Can I build GUI application, using kivy, which is dependent on other libraries?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a application in python using wxpython library with multiple windows which will be inter-related to each other using buttons, i.e. we can go from one window to other and again come back to the previous window using buttons just like an app.\nThere should be one window on the screen at any time if possible. Is this possible using wxpython library. If so then can you suggest me how.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":53,"Q_Id":60588206,"Users Score":0,"Answer":"It is really simple. Normally you create one window (usually a frame or a dialog). If you want more windows, you will just create more frames or dialogs.","Q_Score":0,"Tags":"python-3.x,user-interface,wxpython","A_Id":60596374,"CreationDate":"2020-03-08T13:55:00.000","Title":"Multi-window application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using a barcode scanner, scandit 5.14.2 on Linux with a trial license. I am trying to run a python module sample i.e. CommandLineBarcodeScannerImageProcessingSample.py but I am getting the following error\n\nProcessing frame failed with code 15: The Scandit SDK license\n validation failed. Your app ID does not match the license key's app\n ID.\n\nI have tried creating a new license key with Application ID \/ Bundle ID as the name of the file i.e. CommandLineBarcodeScannerImageProcessingSample.py but still getting the same error.\nSame goes with CommandLineBarcodeScannerCameraSample.py but all c scripts run fine.\nIn FAQs of scandit it is mentioned that I should use program_invocation_name as bundle id. Is there something I am missing? Any suggestion would be very helpful","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":621,"Q_Id":60665224,"Users Score":0,"Answer":"One does not need to create a new license ID for sample code from Scandit. One needs do the following:\n\nlogin to your dashboard\ngo to the License Keys tab. There is a default license key already made. Use that.","Q_Score":0,"Tags":"python,barcode-scanner","A_Id":63200079,"CreationDate":"2020-03-13T05:22:00.000","Title":"Scandit python code 15 Your app ID does not match the license key's app ID","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using a barcode scanner, scandit 5.14.2 on Linux with a trial license. I am trying to run a python module sample i.e. CommandLineBarcodeScannerImageProcessingSample.py but I am getting the following error\n\nProcessing frame failed with code 15: The Scandit SDK license\n validation failed. Your app ID does not match the license key's app\n ID.\n\nI have tried creating a new license key with Application ID \/ Bundle ID as the name of the file i.e. CommandLineBarcodeScannerImageProcessingSample.py but still getting the same error.\nSame goes with CommandLineBarcodeScannerCameraSample.py but all c scripts run fine.\nIn FAQs of scandit it is mentioned that I should use program_invocation_name as bundle id. Is there something I am missing? Any suggestion would be very helpful","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":621,"Q_Id":60665224,"Users Score":0,"Answer":"if you use android app, you need to check the app id inside the object defaultConfig on key androindId. That value must match with the bundle ID in scandist dashboard.","Q_Score":0,"Tags":"python,barcode-scanner","A_Id":65236543,"CreationDate":"2020-03-13T05:22:00.000","Title":"Scandit python code 15 Your app ID does not match the license key's app ID","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using a barcode scanner, scandit 5.14.2 on Linux with a trial license. I am trying to run a python module sample i.e. CommandLineBarcodeScannerImageProcessingSample.py but I am getting the following error\n\nProcessing frame failed with code 15: The Scandit SDK license\n validation failed. Your app ID does not match the license key's app\n ID.\n\nI have tried creating a new license key with Application ID \/ Bundle ID as the name of the file i.e. CommandLineBarcodeScannerImageProcessingSample.py but still getting the same error.\nSame goes with CommandLineBarcodeScannerCameraSample.py but all c scripts run fine.\nIn FAQs of scandit it is mentioned that I should use program_invocation_name as bundle id. Is there something I am missing? Any suggestion would be very helpful","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":621,"Q_Id":60665224,"Users Score":1,"Answer":"I know it\u00b4s a little bit late, but I think I found a solution for the problem.\nI experienced exactly the same issues and could fix it with creating a new licencse key with the Bundle ID 'python3'. Then you have to use the generated license key in your python samples.\nLet me know if that worked.","Q_Score":0,"Tags":"python,barcode-scanner","A_Id":61222436,"CreationDate":"2020-03-13T05:22:00.000","Title":"Scandit python code 15 Your app ID does not match the license key's app ID","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am coding a PyQt5 based GUI application needs to be able to create and run arbitrary Python scripts at runtime. If I convert this application to a .exe, the main GUI Window will run properly. However, I do not know how I can run the short .py scripts that my application creates. Is it possible to runs these without a system wide Python installation?\n\nI don't want ways to compile my python application to exe. This problem relates to generated .py scripts","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":58,"Q_Id":60684325,"Users Score":2,"Answer":"No, to run a Python file you need an interpreter.\nIt is possible that your main application can contain a Python interpreter so that you don't need to depend on a system-wide Python installation.","Q_Score":1,"Tags":"python,python-3.x","A_Id":60684407,"CreationDate":"2020-03-14T15:27:00.000","Title":"Run generated .py files without python installation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made an android app using python-kivy (Buildozer make it to apk file)\nNow I want to put an image for the icon of the application. I mean the picture for the app-icon on your phone.\nhow can I do this? I cannot find any code in kv","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":867,"Q_Id":60695079,"Users Score":1,"Answer":"Just uncomment icon.filename: in the buildozer spec file and write a path to your icon image.","Q_Score":0,"Tags":"python,kivy,buildozer,appicon","A_Id":60695266,"CreationDate":"2020-03-15T16:27:00.000","Title":"How to put an icon for my android app using kivy-buildozer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Currently I am making a very simple interface which asks user to input parameters for a test and then run the test. The test is running brushless dc motor for several minutes. So when the run button is pressed the button is engaged for the time period till the function is finished executing. I have another stop button which should kill the test but currently cant use it since the run button is kept pressed till the function is finished executing and stop button cant be used during the test. I want to stop the test with pressing the stop button even if the run button function is currently being executed. The run button should release and the function should continuously check the stop function for stopping the test. Let me know how this can be executed.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":23,"Q_Id":60709906,"Users Score":0,"Answer":"Your problem is that all your code it taking place sequentially in a single thread. Once your first button is pressed, all of the results of that pressing are followed through before anything else can happen.\nYou can avoid this by running the motor stuff in a separate thread. Your stop button will then need to interrupt that thread.","Q_Score":0,"Tags":"python,kivy,kivy-language","A_Id":60711486,"CreationDate":"2020-03-16T16:42:00.000","Title":"Overriding button functionality in kivy using an another button","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an Gtk.ComboBox which calls a function on changed. This helps me figuring out if the user selected something from the dropdown (trigger a loading function) or types something in (don't trigger a loading function) Now when I update\/refresh the combobox entries which are available, the combobox signals changed gets triggered really often. So my idea was to disable its signals, update the combobox entries, enable signals again. How can I achieve this in Python 3, GTK 3? I'm also using Glade because I have a big amount of signals, so I don't want to connect them manually if possible.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":345,"Q_Id":60719873,"Users Score":0,"Answer":"Just ignore any None values when retrieving combo.get_active_id()\nThen hook up to the changed signal of the internal entry of the combo to see what the user changes in the entry","Q_Score":0,"Tags":"python,gtk,signals","A_Id":60795333,"CreationDate":"2020-03-17T09:51:00.000","Title":"Disable GTK Widget signals and callback function","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So, I am trying to make a video game in Tkinter (no, I don't want to use PyGame), but I have ran into a bit of a problem.\nI have realized that sometimes you may want to have two widgets overlap (e.g. sprite on top of background) but have the contents of both widgets to be visible. For example, I might have a sprite with transparent sections.\nHow do I set the \"background\" option of a widget so that there is no visible background?\nNote: \"you can't do this\" answers are acceptable.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":66,"Q_Id":60732275,"Users Score":1,"Answer":"This is not really posible in Tkinter. But you can set the transparency of the whole window with root.attributes('-alpha', 0.5)\nFor windows, you can do root.attributes(\"-transparentcolor\", \"red\"), but again it will be applied to the whole window, not just the single widget.","Q_Score":1,"Tags":"python-3.x,tkinter,sprite,alpha-transparency","A_Id":60732523,"CreationDate":"2020-03-18T01:15:00.000","Title":"Tkinter contents of both widgets visible when overlapping","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have used to create a Texture with gradient color and set to the background of Label, Button and etc. But I am wondering how to set this to color of Label?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1136,"Q_Id":60736027,"Users Score":0,"Answer":"You can't set the color property to a gradient, that just isn't what it does. Gradients should be achieved using images or textures directly applied to canvas vertex instructions.","Q_Score":0,"Tags":"python,kivy","A_Id":60746769,"CreationDate":"2020-03-18T08:43:00.000","Title":"How to set text color to gradient texture in kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to install Pygame, but this doesn't work..\nI'm on Mac, using MacOs Mojave, and SublimeText.\nI tried python3.8 -m pip install Pygame and python3 -m pip install -U pygame in the terminal, which is given on Pygame.org, but it prints:\nerror: command 'gcc' failed with exit status 1","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":122,"Q_Id":60760196,"Users Score":0,"Answer":"It appears that you have an issue where macOS Mojave doesn't install all Mac SDK headers by default. Try installing them with the following command:\nsudo installer -pkg \/Library\/Developer\/CommandLineTools\/Packages\/macOS_SDK_headers_for_macOS_10.14.pkg -target \/\nIt's only an issue with Mac versions above 10.14 (included) please let me know if this fixes it","Q_Score":0,"Tags":"python,macos,gcc,pygame,macos-mojave","A_Id":60792126,"CreationDate":"2020-03-19T15:23:00.000","Title":"How to install Pygame on MacOS Mojave?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I will try and make my question clear. \nI have two buttons, the first one is on top of the second one.\nWhen I press the first one, it receives the touch but the second one also receives the touch because the touch occurs within its boundary box.\nWhat do i do in the on_touch_down or on_touch_up function to make the second button below the \nfirst one not to receive the touch or to do nothing with the touch.\nAny help will be appreciated thank you.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":60782703,"Users Score":0,"Answer":"What do i do in the on_touch_down or on_touch_up function to make the second button below the\nfirst one not to receive the touch or to do nothing with the touch.\n\nReturn True to indicate that you have consumed the touch and it shouldn't keep being passed on.\nThis should be the default behaviour for buttons, it sounds like you may have broken it by overriding on_touch_down without correctly passing out the return value.","Q_Score":0,"Tags":"python,events,kivy,touch","A_Id":60782854,"CreationDate":"2020-03-20T23:06:00.000","Title":"How do you make a button in kivy receive a touch without the one below it receiving the touch","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is it possible to replace text in label with an image in kivy?\nI have a label containing a text but i want to replace the text with an image. \nIs this possible in kivy?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":35,"Q_Id":60788785,"Users Score":0,"Answer":"The answer is technically yes, but this isn't something exposed by the label api so you'd have to mess about doing stuff manually. It would probably be a better idea to put an Image on top of (or behind) the Label, and use this to display the imgae when necessary.","Q_Score":0,"Tags":"python,image,label,kivy","A_Id":60789147,"CreationDate":"2020-03-21T14:09:00.000","Title":"How to replace text in label with an image in kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created a more or less complex kivy app. When I run it on my pc (which isn't the best but also isn't the worst) the CPU needs about 40% power for running it. I thought it was the fault of my code, but it needs even a bit more power when running the pong example in the kivy_venv. So my question is will this issue solve when creating an apk for play store or will it still need this much power?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":97,"Q_Id":60812697,"Users Score":0,"Answer":"There's nothing about making an APK that is expected to reduce cpu usage, but that much cpu usage shouldn't be necessary. I wonder if there's something you're doing to cause it, or perhaps you have found a bug.","Q_Score":1,"Tags":"python,android,kivy,cpu,game-development","A_Id":60821758,"CreationDate":"2020-03-23T11:28:00.000","Title":"Does the CPU Usage of a kivy app drop when creating an apk","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I used turtle.write to write something on the screen. How do I hide it completely. Not the turtle icon thing, but what's written.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":86,"Q_Id":60820902,"Users Score":2,"Answer":"@penny12 use turtle.clear() to hide text created with turtle.write()","Q_Score":3,"Tags":"python,turtle-graphics,python-turtle","A_Id":60820966,"CreationDate":"2020-03-23T20:11:00.000","Title":"How do I hide something a turtle drew previously?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was wondering if there is any way to use selection_glyph as the renderer of HoverTool in bokeh, i am using python and tried to add a name label to the selected glyph and then using plot.hover.names, but it does not work. \nBasically i have a plot with many glyphs and i want the tooltip to appear when a glyph is selected (single click), and not when a mouse is just hovered over it? is it possible at all? thanks in advance","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":79,"Q_Id":60828308,"Users Score":0,"Answer":"I'm afraid that's not possible with the vanilla HoverTool and without creating additional renderers.\nThe tool works with renderers, not with glyphs, and it doesn't know anything about selection. So you can either create a glyph that's rendered only when something is selected (which is finicky at best), or you can create a custom version of HoverTool.","Q_Score":0,"Tags":"python-3.x,bokeh","A_Id":60829103,"CreationDate":"2020-03-24T09:35:00.000","Title":"Using selection_glyph as renderer for hovertool","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"My .kv file is not supported by VScode. VScode suggested two extensions to work with .kv files which are Kivy and KVlang. I installed them both but I still get an error: Kivy files require #:kivy !ex.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":342,"Q_Id":60903888,"Users Score":1,"Answer":"You need to declare #:kivy 1.x at the top of your .kv file. Replace the 1.x with whatver version you are using for example I am using 2.0 so mine looks like #:kivy 2.0","Q_Score":1,"Tags":"python-3.x,visual-studio-code,kivy-language","A_Id":66583902,"CreationDate":"2020-03-28T16:54:00.000","Title":".kv file is not supported","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I finished making Snake in Pygame and I wanted to convert it into an app in pyinstaller. I'm working on a Mac. Even though I clearly installed the pygame module, and I even to installed it on the files path, when I run the .exe app after I converted it, it still gives me the ImportError: no module named pygame.\nYou can obviously tell, I DO have pygame because I made my program in it. Happily, when I run the code from an editor, the program works fine. Can you please help?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":181,"Q_Id":60977235,"Users Score":0,"Answer":"If you used a virtual environment to develop your game then the module will not be installed to your main python path. Just do a pip install for the modules you are missing then try running pyinstaller again. Or run the pyinstaller in your virtual environment which might work but I have not tested.","Q_Score":0,"Tags":"python,python-3.x,pygame,pyinstaller,importerror","A_Id":60977386,"CreationDate":"2020-04-01T17:53:00.000","Title":"PyInstaller doesn't read libraries","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a tkinter script that I usually use in the terminal and it runs fine. However, I want to be able to put it on Jupyter server, so that my non-technical customers don't have to have Python on their computer to use the GUI.\nI've been trying to do this but I keep getting the common display error. But I don't have any admin rights to this Jupyter server, so I'm not sure I can change any settings or anything. \nDoes this mean its not possible for me to use tkinter in this scenario? Thanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":284,"Q_Id":60979055,"Users Score":0,"Answer":"You should not use tkinter in this situation. For a python\/tkinter application to work, the people who want to run it need to have Python.\nSince your users can interact with a Jupyter server, it is probably better to deploy your script as a Jupyter notebook. In that case everybody with a relatively recent web browser can use it.\nIf it is not a good fit for a notebook, then maybe some other kind of web application.","Q_Score":0,"Tags":"python,tkinter,jupyter-notebook","A_Id":60979378,"CreationDate":"2020-04-01T19:42:00.000","Title":"Possible to use tkinter GUI in Jupyter server?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"for my GUI I want to use a grid with 6 columns. The size of the table is set. How do I fill the width of the grid with the columns? Can you set the size of the columns? I only found padx to change the padding, but not the actual size of the columns.\nFor now, this is supposed to work on a canvas. Is that even possible?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":476,"Q_Id":60989909,"Users Score":0,"Answer":"With only the information you passed i would recommend you following:\nGrid layouts your objects. Its not a table. \nIf you work with grid here. The simplest thing should be to set the width of the object you put on the wanted grid. For example:\n\nIf you add a Label set the label to the width you want it to be. This label will then\n be displayed in the grid with its width and height.\n\nIf you want to display a table. Or even better load a table from a database. I would recommend a Treeview. Its good for design allows multiselect and its easy to fill and you dont have the layout problems :)","Q_Score":1,"Tags":"python,tkinter","A_Id":60990158,"CreationDate":"2020-04-02T10:54:00.000","Title":"Column width using tkinter in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How do I get the instance of a parent widget from within the child widget in kivy? This is so that I can remove the child widget from within the child widget class from the parent widget.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":61,"Q_Id":60994891,"Users Score":0,"Answer":"use parent. or root.ids.","Q_Score":0,"Tags":"python,widget,kivy,instance","A_Id":60995063,"CreationDate":"2020-04-02T15:13:00.000","Title":"In a child widget, how do I get the instance of a parent widget in kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm still trying to migrate an old app from wx2.8 to wx4.\nAfter several different styling adjustments, i got a very similar app under normal conditions (we want to support wx28 and wx4 until we're done, but we currently only have to change the imports).\nWe also have to support the 125% windows GUI scaling, though. And with these settings, components with a \"defaultSize\" (i.e. (-1,-1) ) do get very different scalings between the two versions, especially in the y directions.\nUnfortunately, this destroys our layout (sadly, a wild mix between fixed size and default size components).\nIs ther any way to set the behavior on different Window scalings? I know that one can get the scaling by checking ScreenDC.GetPPI, but i hesitate to change every component separately and would rather like some kind ob global setting. \nSo, is there a way to change the defaultSize behavior globally? Or is there at least some kind of reference about what changed, so i won't miss anything?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":61014878,"Users Score":0,"Answer":"Usually the best thing to do is to always use sizers for layout, and when you do need to specify specific values for size and position, then use values based on font sizes. To help with this there are the wx.Window.GetCharWidth and GetCharHeight methods. \nThere is also the concept of \"Dialog Units\", where each unit is a fraction of the average character sizes. See wx.Window methods ConvertDialogToPixels and ConvertPixelsToDialog.","Q_Score":0,"Tags":"wxpython","A_Id":61377260,"CreationDate":"2020-04-03T15:08:00.000","Title":"wxPython 2.8 to wxPython 4 - default size difference","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was working on an app with Tkinter and everything was working fine, but after modifying a function (that has nothing to do with the Tkinter environment) all of a sudden I started getting the following error:\nfrom tkinter import *\nImportError: No module named tkinter\nI tried opening another Tkinter file to see if it had something to do with my app, but on the other file, I'm also seeing the same error. So I'm guessing it doesn't have to do with my app. Is there any way that Tkinter uninstalled itself if it was working before? I'm also getting the same error when importing Pandas. It's weird because it was all working before.\nHas anyone encountered this problem before? What could be the problem?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":245,"Q_Id":61017063,"Users Score":0,"Answer":"No python module can uninstall itself. You can type pip install tkinter again in cmd.","Q_Score":0,"Tags":"python,pandas,tkinter","A_Id":65972771,"CreationDate":"2020-04-03T17:14:00.000","Title":"Can Tkinter \"uninstall\" itself?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am just learning python and have started making a game using pygame.\nIn my game I have a list that contains all of the obstacles that the player must over come in each of the levels. Although this list quickly became very big and has started to take up many lines of my project. \nI was wondering if I should have a dedicated text file that contains this list and import it into my project or if there is a better way of doing this. I know this is a kind of vague questions but I was just wondering if importing a long list into my project could be a good way about going with this problem.\nI really hope someone knows what to do because I am not quite sure and I would really appreciate someone else's opinion on the matter.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":43,"Q_Id":61024759,"Users Score":1,"Answer":"I guess it depends on how many obstacles you got or if you want it to look neat and tidy then yeah. if your not doing obstacles = [obstacle(100,100,24,50), obstacle(100,100,24,50), obstacle(100,100,24,50), obstacle(100,100,24,50), obstacle(100,100,24,50)...] then do that and see if it still looks like a lot. its no better or worse. Completely up to you","Q_Score":0,"Tags":"python,list,pygame","A_Id":61024923,"CreationDate":"2020-04-04T06:56:00.000","Title":"Dealing with long lists of number in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"CLion was working fine with my python files. Then I added one .cc and created a CMakeLists.txt for it, now when I tab to a python file all the imports and built-in functions like open or int are counted as errors.\nI've looked into Settings -> Editor -> File Types and everything looks okay.\nHow can I fix this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":30,"Q_Id":61062140,"Users Score":0,"Answer":"The problem was the cmakelists was in a subdirectory, when I moved it to the root folder the .py files are treated as expected","Q_Score":0,"Tags":"python,clion","A_Id":61079321,"CreationDate":"2020-04-06T14:29:00.000","Title":"Clion is not recognizing .py files as python files when I added a CMakeLists for one cc file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am working on tiny program to capture screen print, I want to do it in a similar fashion that Win Snipping Tool is working. First I need to overlay all screens with a 50% opacity layer and then, using the mouse, draw a rectangle and read vertices coordinates. Honestly, I have no idea how to bite this. I tried with win32api \/ gui and it is great to get mouse coordinates, but still was unable to draw a rectangle. My idea (one of many) is to (using PIL \/ ImageGrab) take shots of both displays, put an overlay and print them as a full screen on all windows, but I failed while doing this. Other idea is to take img grab and create two new windows using BeeWare \/ Toga (that is GUI framework I am using) in full screen, but I was unable to find any method to open window on second display. Any ideas and hints will be greatly appreciated, I am really counting on you, as I feel I reached dead end.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":575,"Q_Id":61096325,"Users Score":0,"Answer":"Well,It is very easy to use tkinter.\nOk,It is the principle when I make my screenshot application:\n\nUser presses the button to start.\nMake a new window whose width and height should full cover all the screens,and hide the title bar(If it is had to achieve,maybe use width=9999 and height=9999).\nTake a screenshot of all the desktop(You can use ImageGrab.grab((),all_screens=True)) to do that.\nMake the screenshot showed in a Canvas(I know that toga have this widget).\nStart your mouse listener thread and save the position of pressed.\nWhen user moves his mouse,create a rectangle(toga's Canvas have a function rect()).Maybe use this rect(pressed_x,pressed_y,move_x,move_y).And delete the last rectangle(Then it will always show only one rectangle).\nWhen user released his mouse,save the position of released.And use ImageGrab.grab((pressed_x,pressed_y,released_x,released_y),all_screens=True) to crop the selected area.\nIf you want to show it in application interface.toga has a widget called ImageView.You can put the image in it.","Q_Score":0,"Tags":"python,user-interface,python-imaging-library,pywin32,beeware","A_Id":61097779,"CreationDate":"2020-04-08T08:21:00.000","Title":"Overlay all screens and draw rectangle with a mouse","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a Python desktop application using PyQt5 for the UI. I create the exe file using PyInstaller from inside PyCharm with the following options: --onefile --windowed --icon=QRev.ico QRev.py \nThe resulting exe has the QRev.ico icon when viewed in Windows Explorer but when executed a generic or perhaps the PyInstaller icon appears in the Windows 10 taskbar rather than the QRev Icon.\nIf I pin QRev.exe to the taskbar the icon works as expected. The problem occurs when the exe is executed from anywhere other than the taskbar, the icon in the taskbar is not correct. How can I fix this so that the QRev icon is shown in the taskbar?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":1215,"Q_Id":61104261,"Users Score":2,"Answer":"Finally figure it out after a friend found a similar post for Tkinter. \nThe icon in the taskbar comes from inside the code not from PyInstaller. For pyqt5 I simply added the command: self.setWindowIcon(QtGui.QIcon('QRev.ico'))","Q_Score":0,"Tags":"python,windows,icons,pyinstaller","A_Id":61122645,"CreationDate":"2020-04-08T15:23:00.000","Title":"Python exe created with PyInstaller shows custom icon in Windows Explorer but not in Taskbar when executed","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"When I want to run a game I programmed, I get the error message:\nModuleNotFoundError: No module named 'pygame'\nI had problems installing pygame on my iMac (OSX Catalina). I have python 3.8.\nFrom the command line I achieved installing pygame with:\npip3 install --user pygame\nSo what to next:\nCheck if I have the correct pygame version installed?\nDoes it matter where I install pygame?\nWhat could be the reason of the error message?\nMy game worked on my MacBookPro but I had to give it away because of a damage. I remember, that I had to install some different version of pygame (some development version), because I couldn't install the normal one.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":75,"Q_Id":61137170,"Users Score":0,"Answer":"I could solve the problem now. python3 -m pip install --user --pre pygame=2.0.0-dev6 worked for me.","Q_Score":0,"Tags":"python-3.x,pygame,macos-catalina","A_Id":61138555,"CreationDate":"2020-04-10T09:09:00.000","Title":"wrong version of pygame installed or not installed correctly","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently working on a introductory project for kivy. I got an error while trying to understand the concept by playing around with the codes. I would like to know what is the difference between the 2 codes below. Thank you.\nOrginal:\nsm = WindowManager(),\nsm.current = \"second\"\nCurrent:\nWindowsManager().current = \"second\"","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":61137960,"Users Score":0,"Answer":"method 1: you create a WindowManager instance and call it sm, then you assign the attribute current with \"second\".\nmethod 2: you create a temp WindowManager instance and assign the attribute current with \"second\". Then the temp instance will be removed by garbage collection. (i.e. nothing really happens.)","Q_Score":1,"Tags":"python,class,kivy","A_Id":61138040,"CreationDate":"2020-04-10T10:02:00.000","Title":"Difference in instantiating a Class in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've searched about this but found nothing. Only opening images has documented. Maybe I can open a page as an image but I want full access on text like copy\/paste and highlighting. \nIs there any way to open a pdf within a kivy app?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1234,"Q_Id":61145384,"Users Score":1,"Answer":"This is not supported by Kivy. PDF rendering and interaction is quite complicated, I don't know how difficult it would be to implement.","Q_Score":1,"Tags":"python,pdf,kivy,kivy-language","A_Id":61146981,"CreationDate":"2020-04-10T17:22:00.000","Title":"How to open a pdf within Python Kivy app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i have a question when using the Button widget in tkinter. I am new to this.\nI noticed that when we use the command in the Button widget, sometimes we call a simple function just like that and sometimes we use lambda function and then we call it. What is the difference?\nFor example: tk.Button(window, text = \"Click Me!\", command = myfunction)\ntk.Button(win,text=\"Result\",command=lambda: result(en1.get())\nCant we just use it without lambda?\nTHank you.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":936,"Q_Id":61150428,"Users Score":1,"Answer":"Use of lambda:\n\nThe parentheses are the main reason that the function gets executed when given as command to a Button without lambda. If the function(which you are passing to the Button as a command) has no parameters(to be passed to itself), then you can simply pass it as a command avoiding the parentheses(). And hence you don't need to use lambda in this case. Like in this Example:command=func.\n\nSo using lambda is only necessary when the function has its own parameters(to be passed to itself).Like in this Example:command=lambda:func(a,b,c)\n\n\nWhat lambda Does:\n\nWhen you have to pass arguments to the function itself you have cannot avoid parentheses().\nSo in the case of buttons, lambda basically delays the execution of the function until the user clicks the button, by creating another function on the spot, which does not get called until the button is actually clicked. Hence the function does not get executed, where it is given as command to the Button.\n\nAny Questions will be answered.","Q_Score":1,"Tags":"python,button,tkinter","A_Id":61156251,"CreationDate":"2020-04-11T00:02:00.000","Title":"Difference between using or not lambda function in python tkinter button command","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I finished writing the code for a simple game using Kivy. I am having a problem converting it to Android APK, since I am using a windows computer. From some earlier research I got to know that using a Virtual machine is recommended, but I have no idea on how to download and use one :(, and if my slow PC can handle it... please help me. If possible, kindly recommend another way to convert to APK.\nI am a beginner at coding as a whole, please excuse me if my question is stupid.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":87,"Q_Id":61156256,"Users Score":0,"Answer":"you could just try downloading a virtual box and installing linux operating system or you could directly install it and keep it a drive called F or E and you could just install python on that and all the required pakages and start the build using buildozer as it is not available for windows. So try doing it. But I need to do it just now. Tell me after you have tried that cuz there are a lot of people online on youtube who would heloo you doing that work","Q_Score":0,"Tags":"python,android,kivy,virtual-machine","A_Id":63098290,"CreationDate":"2020-04-11T11:45:00.000","Title":"Packaging Kivy application to Android - Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to download pygame, but knowing I am running on Anaconda, I tried to pass by their site.\nI saw that I had to use the command \"conda install -c pygame\", it didn't work.\nI tried conda install -c Jo_Byr cogsci pygame (Jo_Byr is my username on Anaconda), didn't work either.\nThen it was turn of conda install -c jonat cogsci pygame (jonat is my computer username), and all variants with jonat, Jo_Byr or none as username and pygame or cogsci pygame for the package, but nothing worked.\nI can send screenshots of the anaconda prompt cmd if necessary, just tell me which one.\nThanks in advance, sorry if someone already spoke of this issue, I didn't find anything about it.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":63,"Q_Id":61174858,"Users Score":0,"Answer":"I have had this problem before. I tried many commands but no results I got. then I downloaded pygame file separately and install it via cmd or terminal.these files are usually with an extension of .whl or wheel. just google it and find all the libraries u need.","Q_Score":0,"Tags":"python,pygame,anaconda","A_Id":61175036,"CreationDate":"2020-04-12T16:43:00.000","Title":"Pygame and Anaconda","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using classes and such to make a calculator in Tkinter, however I want to be able to be able to reuse widgets for multiple windows. How can I do this if this is possible?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":124,"Q_Id":61176189,"Users Score":0,"Answer":"As you commented:\n\nI'm making a calculator, as mentioned and I want to have a drop down menu on the window, that when selected it closes the root window and opens another, and I want to have the drop down menu on all the different pages, 5 or 6 in all\n\nIn this case, just write a function that creates the menu.\nThen call that function when creating each of the windows.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":61181898,"CreationDate":"2020-04-12T18:23:00.000","Title":"Is it possible to reuse a widget in Tkinter? If so, how can I do it using classes?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm using classes and such to make a calculator in Tkinter, however I want to be able to be able to reuse widgets for multiple windows. How can I do this if this is possible?","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":124,"Q_Id":61176189,"Users Score":1,"Answer":"A widget may only exist in one window at a time, and cannot be moved between windows (the root window and instances of Toplevel).","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":61176580,"CreationDate":"2020-04-12T18:23:00.000","Title":"Is it possible to reuse a widget in Tkinter? If so, how can I do it using classes?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"What would be the bast way to make a GUI for Sudoku? I already made a GUI in Pygame with: buttons, number input to cell, grid display; but it doesn't feel right to draw grid and buttons 30 times per second even when nothing is changing. Is there any better way?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":78,"Q_Id":61209811,"Users Score":0,"Answer":"The safest course is to re-paint the screen, even at 30fps\/when nothing is changing. \nSecondly, will modifying the code actually make a difference to the load on the PC?\nThe theme seems to be: if the Sudoku board hasn't changed, why bother? So, put the screen-update 'behind' the same condition which examines input. If the user instructs that a digit is to be inserted in a chosen-square (for example), and thus the appearance of the board is to be changed, then after updating the graphic(s)\/sprite positions, the logic must call for a screen-update! \nThis will be slightly more complicated if you have also changed the mouse-pointer and must update the mouse's appearance as it is moved!\nBefore you do this, monitor the PC's performance graphs, then perform a Before-After analysis. It'll be interesting to read the results...\nRegards =dn","Q_Score":0,"Tags":"python-3.x,user-interface,pygame","A_Id":61219365,"CreationDate":"2020-04-14T14:13:00.000","Title":"Python GUI for sudoku","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have written a very short python-function (using pyautogui) which entails the following:\n\nMove the mouse to the taskbar and click on a certain location within that taskbar, this \"reopens\" a certain program. \nThen, within the opened program go to some location (moveTo...)\n\nNow, I have noticed the following odd behavior: The first step always works, i.e. the specific program window is appears on the screen. However, depending on the specific program the second step either works or goes wrong. More specifically, I noticed that for notepad it works (i.e. the cursor moves to the specified location), whereas for a different program the mouse does not move at all.\nCan anyone shed some light onto this behavior?\nThank you very much for your help!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2397,"Q_Id":61211006,"Users Score":0,"Answer":"it seems like the program is overwriting the script as a security method.\ncould you try and convert the code into exe file and run as an admin. this should overwrite the program.","Q_Score":1,"Tags":"python,pyautogui","A_Id":61537741,"CreationDate":"2020-04-14T15:08:00.000","Title":"pyautogui mouse click not working in certain programs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Suppose we're writing a CPython extension module in C.\nWhen defining an extension, we are required to supply a PyMODINIT_FUNC PyInit_(void). Nowhere in this declaration is a native calling convention specified.\nWhether on Linux or on Windows, how can the extension developer ensure that the PyInit_ function is compiled using the correct calling convention, so that the interpreter calls it successfuly during runtime? Is there some magic in the Python headers that takes care of this for us? Or something else?\nThe same question applies to native functions contained in the extension module, and exposed to Python wrapped as function objects. How do we ensure that these are compiled in a manner compatible with the Python interpreter calling convention?","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":219,"Q_Id":61213535,"Users Score":2,"Answer":"The default calling convention is automatically made by the compiler. PyMODINIT_FUNC is either void (in Python 2) or PyObject * (in Python 3), nothing more.\nThe Python dynamic module loader uses the default convention of the platform (not that it has any jurisdiction over that; it's to the platform).","Q_Score":1,"Tags":"c,cpython,calling-convention","A_Id":61213901,"CreationDate":"2020-04-14T17:19:00.000","Title":"How is a C extension compiled with the correct native calling convention?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently working on coding a Python IDE in Python. I have set up my program to be able to open files when the user clicks on the 'open' button in my 'file' menu. This allows the user to edit files once they have opened the IDE program.\nHowever, I am wondering if it is possible to give python and text files the option to \"open with\" or \"edit with\" my application when they are right clicked in file explorer instead of from my program.\nI hope this question makes sense; it is quite difficult to phrase.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":20,"Q_Id":61226835,"Users Score":0,"Answer":"No you can't. The function \"open with\" is managed by the OS so you can not change this setting without run some code before or asking the user to modify this setting before.","Q_Score":0,"Tags":"python,file,ide,file-handling,text-editor","A_Id":61231388,"CreationDate":"2020-04-15T10:45:00.000","Title":"Giving files the option to be opened with a python-coded application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have developed a basic app with Kivy but on_release does not work properly on my button bind. I can get on_press to work every time but on_release works sporadically (maybe one in ten to twenty times) and sometimes on a different part of the screen than you've touched.\nI'm pretty confident it's not a coding issue and one of the Kivy devs said it is not a known issue and should work but they haven't said where I might dig deeper. \nIn tandem with this, I have been receiving an SDL error in terminal:\nINFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums\/mailing list EVDEV KeyCode 330\nThis appears on both touch and release. EVDEV advised to upgrade to SDL2, which I did and it has not solved the error which could just apparently be ignored if not for the spam it creates.\nI'm not sure if these two issues are linked but don't know where to start with troubleshooting.\nCan anyone please help with what steps I could follow to try and get this resolved?\nI mostly want to fix on_release but if we fix the other error in the process then that would be great too.\nI am running a Raspberry Pi Zero W, Raspbian Buster w\/Desktop and a Hyperpixel 4.0 square screen\nThanks!","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":746,"Q_Id":61227587,"Users Score":1,"Answer":"I have been having the same problem. I am using Kivy 1.11.1 with SDL reporting as 2.0.9+dfsg1-1+rpt1 in dpkg. I have read that this is fixed in a later SDL version but I've not worked out how to upgrade this. Take care if you extract the SDL RPI tarball, as on my system it trashed the \/usr permissions (and didn't upgrade the version as reported by dpkg).\nIf I run mtdev-test (see google), the touchscreen events come through smoothly. When running kivy apps, the touchscreen events seem to be laggy, coinciding with the 330 error report. Press\/release seems to work, but motion events are erratic.\nWith my touchscreen, the error problem can be demonstrated really well with the kivy example demo\/touchtracer, which works great with a USB mouse but is terrible with the touchscreen.","Q_Score":0,"Tags":"python,raspberry-pi,kivy,sdl,touchscreen","A_Id":61318083,"CreationDate":"2020-04-15T11:29:00.000","Title":"Kivy on_release not working on touchscreen - SDL issue?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a question related to an annoying behavior I have observed recently in tkinter. When there's no fixed window size defined, the main window is expanded when adding new frames, which is great. However, if prior to adding a new widget the user only so much as touches the resizing handles, resizing the main window manually, then the window does not expand to fit the new widget. Why is that so and is there a way to prevent this behavior?\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":84,"Q_Id":61262515,"Users Score":1,"Answer":"The why is because tkinter was designed to let the user ultimately control the size of the window. If the user sets the window size, tkinter assumes it was for a reason and thus honors the requested size. \nTo get the resize behavior back, pass an empty string to the geometry method of the window.","Q_Score":0,"Tags":"python-3.x,tkinter","A_Id":61262980,"CreationDate":"2020-04-17T01:04:00.000","Title":"Tkinter - how to prevent user window resize from disabling autoresize?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm compiling my kivy app to an apk with buildozer.\nThe first apk bugged, so now I want to change some code.\nIs it sufficient just to delete the apk in the bin folder, or do I have to delete the whole .buildozer folder, in order to make my changes apply?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":61287341,"Users Score":1,"Answer":"If you only change your python code, you don't need to delete anything.","Q_Score":1,"Tags":"python,kivy,apk,buildozer","A_Id":61288821,"CreationDate":"2020-04-18T10:03:00.000","Title":"changing code in kivy app while compiling with buildozer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to make a word game that initially, it has a label and a textinput, after keying input into the textinput and hit enter, i want it to remove the that textinput widget and add 2 things (1) Label with the text (2) A new textinput widget. \nI have been trying to think what should i put for the callback function (fix_it) as the only way i know to remove widgets is by their names i.e. self.layout.remove_widget(self.new_inp), this will remove any subsequent textinput widgets, which i would not be able to see any textinput widgets. \nI would appreciate any help from this community. thank you.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":61288024,"Users Score":0,"Answer":"Not exactly sure what you are asking, but the inp argument of your fix_it method is the TextInput instance. So you can remove it with self.layout.remove_widget(inp).","Q_Score":0,"Tags":"python,kivy","A_Id":61289829,"CreationDate":"2020-04-18T11:01:00.000","Title":"What other ways are there to remove widgets from kivy?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want the user to be able to key into the textinput widget, without the person moving the mouse and click on the textinput widget. Is it possible ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":61300649,"Users Score":0,"Answer":"Try focus:True and it should take focus to the textinput field","Q_Score":0,"Tags":"python,kivy","A_Id":61302723,"CreationDate":"2020-04-19T06:54:00.000","Title":"Running a kivy app, at one screen, for any keyboard button pressed, am i able to key into TextInput widget?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I receive API data every 5 minutes and run a Python code to check if the incoming data fulfills certain conditions. The data is in JSON format, but I convert it to a data frame and perform my checks there.\nIn case one of the checks generates a hit, I'd like to get notified. I'd like to find a fast and resource-preserving way for Python to notify me.\n\nI think I can't use \"print()\" as I won't be watching Python all the time. \nI could use \"data.to_excel\", but I'd still have to have a window of my folder open and check manually if a new excel file appears.\nI read that Tkinter is widely used to generate a new window so I guess that's the way to go.\n\nWhat would be the most efficient (minimalistic) code to generate a window (preferably one with an audio sound when it appears) with one line of text, e.g. \"Condition1\/2\/3\/4 fulfilled, timestamp, string\"\nThank you for your kind help","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":77,"Q_Id":61311388,"Users Score":1,"Answer":"You can do something even easier than that to help you notify when you got something. You can use the os library to just open the file whenever something gets printed to it. Let's say you use the data.to_excel. Afterwards, you can just open it.\nTo do that, you can just import os, and the function is os.system(path_of_excel_file). In the path tho you have to be careful and use backslashes for spaces or other special characters.","Q_Score":2,"Tags":"python,audio,tkinter,window,memory-efficient","A_Id":61311475,"CreationDate":"2020-04-19T20:43:00.000","Title":"Python - notify user every time a loop yields an output Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm creating an array of surfaces (Pre-Rotated or pre-effect treated) and its working nicely and extremely fast for python anyhow. However I notice there is a massive amount of memory being used and I tracked it down to the fundamental loading of the original image or creating a surface copy. \nThe image i'm testing with is 65kb png file on disk. Loading the image or copying a surface with this same image resuls in 1.2mb additional memory usage. I could understand 2,3,4x but 20x? So preloading a solid number of small images to make things faster sounds good until I understood this memory impact. The net is if I pre-rotated this image by 5 degrees aka 72 images (360\/5) python image memory is sitting at 100mb not including the routine overhead of the modules etc... This seems quite unbelievable actually. \nAnyone got any ideas as to why\/how\/tips\/tricks etc... ?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":55,"Q_Id":61311402,"Users Score":0,"Answer":"Found kind of an answer that helps drastically. It looks like the image load routine bit depth is tied directly to the display.set_mode bit depth which on my system is 32bit default basically forcing 32bit depth on all images uploaded. Considering I only need max 16 bit depth on the display as well as the images this got the bloat down to about 7x or so. Still larger than I think is reasonable but makes what i'm trying to do within the realm of possibility.","Q_Score":2,"Tags":"python,pygame","A_Id":61313493,"CreationDate":"2020-04-19T20:45:00.000","Title":"How to reduce the impact of large memory usage on small images loaded?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been writing games in the pygame library for a while on my computer. I have been wanting to begin writing games for iOS that could potentially be put on the App Store. If I were to want to do this in Python, what is the best library to use?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":322,"Q_Id":61313771,"Users Score":0,"Answer":"There's a few options that you can try, such as Kivy, Pymob and maybe BeeWare, but I wouldn't recommend this language to do app development and even less for IOS. My suggestion is to start to learn Dart and use Flutter or React Native that also provides a large variety of options. As far as gamedev, the best and most well-known platform is Unity, using C#.","Q_Score":2,"Tags":"python,ios,python-3.x,pygame","A_Id":61314082,"CreationDate":"2020-04-20T01:20:00.000","Title":"What is the best library to write iOS games in Python 3?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i have a problem with PyQt5 Designer. I install PyQt with -pip install PyQt5 and then -pip install PyQt5-tools\neverything OK. But when i try to run Designer it open messagebox with error: This application failed to start because no Qt platform plugin could be initialized!\nhow to deal with it?","AnswerCount":3,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":16045,"Q_Id":61324972,"Users Score":10,"Answer":"Try running it using command: pyqt5designer\nIt should set all the paths for libraries.\nWorks on Python 3.8, pyqt5-tool 5.15","Q_Score":11,"Tags":"python,qt,user-interface,pyqt,pyqt5","A_Id":62589185,"CreationDate":"2020-04-20T14:29:00.000","Title":"PyQt5 Designer is not working: This application failed to start because no Qt platform plugin could be initialized","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i have a problem with PyQt5 Designer. I install PyQt with -pip install PyQt5 and then -pip install PyQt5-tools\neverything OK. But when i try to run Designer it open messagebox with error: This application failed to start because no Qt platform plugin could be initialized!\nhow to deal with it?","AnswerCount":3,"Available Count":3,"Score":0.2605204458,"is_accepted":false,"ViewCount":16045,"Q_Id":61324972,"Users Score":4,"Answer":"I found a way of solving this:\nGo to you python instalation folder Python38\\Lib\\site-packages\\PyQt5\\Qt\\bin\nThen copy all of that files to your clipboard and paste them at Python38\\Lib\\site-packages\\pyqt5_tools\\Qt\\bin\nThen open the designer.exe and it should work.","Q_Score":11,"Tags":"python,qt,user-interface,pyqt,pyqt5","A_Id":61577871,"CreationDate":"2020-04-20T14:29:00.000","Title":"PyQt5 Designer is not working: This application failed to start because no Qt platform plugin could be initialized","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"i have a problem with PyQt5 Designer. I install PyQt with -pip install PyQt5 and then -pip install PyQt5-tools\neverything OK. But when i try to run Designer it open messagebox with error: This application failed to start because no Qt platform plugin could be initialized!\nhow to deal with it?","AnswerCount":3,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":16045,"Q_Id":61324972,"Users Score":26,"Answer":"Go to => \nPython38>lib>site-packages>PyQt5>Qt>plugins\nIn plugins copy platform folder\nAfter that go to\nPython38>lib>site-packages>PyQt5_tools>Qt>bin\npaste folder here . Do copy and replace.\n\nThis will surely work..\nNow you can use designer tool go and do some fun with python...","Q_Score":11,"Tags":"python,qt,user-interface,pyqt,pyqt5","A_Id":62443116,"CreationDate":"2020-04-20T14:29:00.000","Title":"PyQt5 Designer is not working: This application failed to start because no Qt platform plugin could be initialized","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've made a python program using Tkinter(GUI) and I would like to enter it by creating a dedicated icon on my desktop (I want to send the file to my friend, without him having to install python or any interpreter).\nThe file is a some-what game that I want to share with friends and family, which are not familiar with coding.\nI am using Ubuntu OS.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":61344451,"Users Score":-1,"Answer":"you can use pip3 install pyinstaller then use pyinstaller to convert your file to a .exe file than can run on windows using this command pyninstaller --onefile -w yourfile.\nit can now run without installing anything on windows. and you can use wine to run it on ubuntu","Q_Score":1,"Tags":"python,deployment,pyinstaller","A_Id":61344731,"CreationDate":"2020-04-21T13:14:00.000","Title":"how to make my python project as a software in ubuntu","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm just setting up a firebase database for my kivy app and the first thing I need to do is \"add an app to get started\", the choices being IOS, Android, Web or Unity. Is this saying that I need to set up and maintain code for an Android-Kivy app and an IOS-Kivy app? The idea behind Kivy is that it is write once, use everywhere so I'm hoping to just have one version.\nOr have I misunderstood this part?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":134,"Q_Id":61350876,"Users Score":1,"Answer":"If you want to target both Android and iOS for any cross-platform development tool (not just Kivy), you will need to add both an Android and iOS app to your Firebase project. Firebase doesn't know anything about Kivy (or Flutter, or Unity), so you have to tell it which OS is being targeted.","Q_Score":0,"Tags":"python,google-cloud-firestore,firebase-authentication,kivy,kivy-language","A_Id":61351245,"CreationDate":"2020-04-21T18:46:00.000","Title":"Firestore authentication asking to select \"android\/ios\" or \"web\" for kivy app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I need help.\nI'm doing a UI automation, and it works properly.\nHowever, it waits for all controls get done, but for example, the textbox I want to send keys is activated.\nBecause of that, my automation is very slow, and I couldn't find any helpful information in module documentation.\nThank you all","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":289,"Q_Id":61354217,"Users Score":1,"Answer":"I find out the solution. If you have the same problem, you should always search for controls, with child_window function. \nIf you use the bracket notation, pywiauto will search all controls from root window, and depending the application, it takes a long time.\nHowever, using child window, you can filter by control type, title and automation id","Q_Score":0,"Tags":"python,user-interface,automation,pywinauto","A_Id":61492419,"CreationDate":"2020-04-21T22:20:00.000","Title":"Pywinauto waiting too long to do an action","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been teaching myself Python3\/API\/PyQt5 and OOP for the last few weeks and I have finally made an app that works, yay!\nI've been working on Ubuntu 19 and the app works fine when I run it from the terminal. The problem is trying to compile it (correct term?) to make it an executable for Linux and Windows.\nI used pyinstaller app.py --onefile -w --icon=\"app.ico\" to make the files and I get no errors that I can see. \nI used Windows 10 to compire the exe.\nHere is the problem: On Linux I get a \"shared library\" file that doesn't execute and on windows the exe is just broken. All I get is an error saying \"this program cannot run on your system\", or something similar to that.\nThis is a very simple, 1 script app with a PyQt5 GUI. I'm pretty new to all of this and this has by far been the hardest part. I've been stuck on this for days and I can't get it to work.\nI can give you guys the app code if it will help, I just don't think I have enough rep to post links so it might have to be a code block.\nI will be grateful for any help you guys can give as I'm out of ideas.\nCheers!\nEditing to add: windows 8.1 gives the error message \"Error -3 from inflate: invalid block lengths\" when the app.exe is run","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":2355,"Q_Id":61354226,"Users Score":0,"Answer":"After a lot more tinkering I finally have a working exe. \nI used -D to make a directory rather than the --onefile as that doesn't work. It makes an exe that doesn't work. Windows complains that it can't unpack the app.\nThe exe that is inside the dist directory works on Windows 8.1 and Windows 10. Didn't test on Win 7.\nI also included the png and ico files and used a clean env with python 3.8 instead of my working env with 3.7 installed. I'm not sure if any of these things made a difference but if anyone else is looking for an answer, this might help.\nMy final command: \n pyinstaller -y -D -w -i \"FULL PATH TO ICON .ico\" --add-data \"FULL PATH TO IMAGE .png\";\".\" \"FULL PATH TO PY FILE \/app.py\"","Q_Score":0,"Tags":"python,pyqt5,pyinstaller","A_Id":61393568,"CreationDate":"2020-04-21T22:20:00.000","Title":"Executables made with pyinstaller not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I've been teaching myself Python3\/API\/PyQt5 and OOP for the last few weeks and I have finally made an app that works, yay!\nI've been working on Ubuntu 19 and the app works fine when I run it from the terminal. The problem is trying to compile it (correct term?) to make it an executable for Linux and Windows.\nI used pyinstaller app.py --onefile -w --icon=\"app.ico\" to make the files and I get no errors that I can see. \nI used Windows 10 to compire the exe.\nHere is the problem: On Linux I get a \"shared library\" file that doesn't execute and on windows the exe is just broken. All I get is an error saying \"this program cannot run on your system\", or something similar to that.\nThis is a very simple, 1 script app with a PyQt5 GUI. I'm pretty new to all of this and this has by far been the hardest part. I've been stuck on this for days and I can't get it to work.\nI can give you guys the app code if it will help, I just don't think I have enough rep to post links so it might have to be a code block.\nI will be grateful for any help you guys can give as I'm out of ideas.\nCheers!\nEditing to add: windows 8.1 gives the error message \"Error -3 from inflate: invalid block lengths\" when the app.exe is run","AnswerCount":2,"Available Count":2,"Score":-0.0996679946,"is_accepted":false,"ViewCount":2355,"Q_Id":61354226,"Users Score":-1,"Answer":"To make it work on Unix systems you will probably have to use dos2unix \"appname\" in Terminal, since windows adds some weird endings to any files containing text. That's how it works for me","Q_Score":0,"Tags":"python,pyqt5,pyinstaller","A_Id":68509604,"CreationDate":"2020-04-21T22:20:00.000","Title":"Executables made with pyinstaller not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0},{"Question":"I'm trying to compile my Python project to a Windows executable (.exe) using Nuitka. I get no errors\/warnings during the compilation process, but when I'm trying to run the resulting executable I get the \"C:\\Python34\\test.exe is not a valid win32 application\" error on Windows XP and a similar one on Windows 10, too). The problem persists even when I compile a \"Hello, World!\" program. Interesting, that I can easily build and run C++ projects from the Visual Studio IDE on the same PC.\nI'm using Windows XP (x32 bits), Python 3.4.0 and Microsoft Visual C++ 2008 Professional.\nHow can I solve this problem?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":599,"Q_Id":61398507,"Users Score":0,"Answer":"I used tried the first steps from the Nuitka website and had the same with example 1. What I found: example 1 uses --mingw64 as option.\npython -m nuitka --mingw64 hello.py\nIn example 2\/Use Case 1 there is another option introduced:\npython -m nuitka --follow-imports program.py\nI only copied my hello-code from example 1 (working) and renamed it to program.py (failed - even no executable!). So I am shure, the cause will be the call and not the code.\nWhen I entered --mingw64 to the second call it worked.\nMy first thought (I am new to this and no expert for nuitka) is that the second example call implicitly uses gcc. At the first time it asks for installing it and then it seems to use it. The first call seems to force mingw64 as compiler. Could also be that the sequence of path entries makes a difference. Just the first entry will be executed unless you force it via an explicit option.","Q_Score":1,"Tags":"python,c++,compilation,nuitka","A_Id":67637799,"CreationDate":"2020-04-23T23:14:00.000","Title":"After compilation of any Python program with Nuitka I get \"is not a valid win32 application\" error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to compile my Python project to a Windows executable (.exe) using Nuitka. I get no errors\/warnings during the compilation process, but when I'm trying to run the resulting executable I get the \"C:\\Python34\\test.exe is not a valid win32 application\" error on Windows XP and a similar one on Windows 10, too). The problem persists even when I compile a \"Hello, World!\" program. Interesting, that I can easily build and run C++ projects from the Visual Studio IDE on the same PC.\nI'm using Windows XP (x32 bits), Python 3.4.0 and Microsoft Visual C++ 2008 Professional.\nHow can I solve this problem?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":599,"Q_Id":61398507,"Users Score":1,"Answer":"I have installed Microsoft Visual Studio 2010 Express instead of Microsoft Visual Studio 2008 Professional, and the problem disappeared. It looks like Nuitka just can't work with the previous version of the compiler. They even say in the docs, that Nuitka is designed for Visual Studio 2017+ (but I can't install recent versions on Windows XP), and that other versions may not work correctly.","Q_Score":1,"Tags":"python,c++,compilation,nuitka","A_Id":61424824,"CreationDate":"2020-04-23T23:14:00.000","Title":"After compilation of any Python program with Nuitka I get \"is not a valid win32 application\" error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've been working on a game for a month and it's quite awesome. I'm not very new to game developing.\nThere are no sprites and no images, only primitive drawn circles and rectangles.\nEverything works well except that the FPS gets slow the more I work on it, and every now and then the computer starts accelerating and heating up.\nMy steps every frame (besides input handling):\n\nupdating every object state (physics, collision, etc), around 50 objects some more complex than the other\ndrawing the world, every pixel on (1024,512) map.\ndrawing every object, only pygame.draw.circle or similar functions\n\nThere is some text drawing but font.render is used once and all the text surfaces are cached.\nIs there any information on how to increase the speed of the game?\nIs it mainly complexity or is there something wrong with the way I'm doing it? There are far more complex games (not in pygame) that I play with ease and high FPS on my computer. \nShould I move to different module like pyglet or openGL?\nEDIT: thank you all for the quick response. and sorry for the low information. I have tried so many things but in my clumsiness I heavent tried to solve the \"draw every pixel every single frame proccess\" I changed that to be drawn for changes only and now it runs so fast I have to change parameters in order to make it reasonably slow again. thank you :)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":500,"Q_Id":61429445,"Users Score":2,"Answer":"Without looking at the code its hard to say something helpful.\nIts possible that you got unnecessary loops\/checks when updating objects.\nHave you tried increasing\/decreasing the amount of objects? \nHow does the performance change when you do that?\nHave you tried playing other games made with pygame? \nIs your pc just bad?\nI dont think that pygame should have a problem with 50 simple shapes. I got some badly optimized games with 300+ objects and 60+ fps (with physics(collision, gravity, etc.)) so i think pygame can easily handle 50 simple shapes. You should probably post a code example of how you iterate your objects and what your objects look like.","Q_Score":0,"Tags":"python,pygame,frame-rate,game-development","A_Id":61430100,"CreationDate":"2020-04-25T17:06:00.000","Title":"Advanced game made in pygame is too slow","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to Kivy and I have built a simple app with 2 screens. The first screen is also the login screen and the second screen just shows a simple label. I want to use Twitter\/Google authentication to login and move on to the second screen.\nShould I use a button (with image) and use the on_release function call or should I use a plain image file and hook it up with an on_touch_down event to call the authentication process?\nWhat is the standard way to do it? Please advise.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":120,"Q_Id":61444508,"Users Score":0,"Answer":"i'd suggest you dive into kivyMD( a kivy frameworks that makes the job easier) adding beautiful interface to the program. what you want is just a 4 line code in KivyMD","Q_Score":0,"Tags":"python-3.x,authentication,kivy,kivy-language","A_Id":61447961,"CreationDate":"2020-04-26T16:48:00.000","Title":"Kivy application login","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am new to Kivy and I have built a simple app with 2 screens. The first screen is also the login screen and the second screen just shows a simple label. I want to use Twitter\/Google authentication to login and move on to the second screen.\nShould I use a button (with image) and use the on_release function call or should I use a plain image file and hook it up with an on_touch_down event to call the authentication process?\nWhat is the standard way to do it? Please advise.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":120,"Q_Id":61444508,"Users Score":0,"Answer":"It's entirely up to you, but in the absence of other concerns default to the Button.","Q_Score":0,"Tags":"python-3.x,authentication,kivy,kivy-language","A_Id":61446092,"CreationDate":"2020-04-26T16:48:00.000","Title":"Kivy application login","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to I use \"on_key_down\" event within .kv file?\nI have a text input box and I want to detect when a key is pressed down to block user from deleting the first word of the \"text\" property of my text input to simulate a \"bash console\" if you will","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":42,"Q_Id":61445391,"Users Score":1,"Answer":"use the event on_text instead.. i don't think on_key_down exists as an event on the input widget","Q_Score":0,"Tags":"python,events,kivy,kivy-language","A_Id":61448015,"CreationDate":"2020-04-26T17:48:00.000","Title":"Kivy lenguage: on_key_down","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm working on a program that uses ImageGrab in Pillow. I am getting the error mentioned in the title. I notice in the documentation that it says the generic pip install Pillow doesn't come with libxcb. I tried installing libxcb with pip install libxcb, but it apparently doesn't exist as that. I tried looking around on Google for it, but none of it helped.\nIf anybody could point me to the specific library that I need to install and commands to run, I'd appreciate it!\nI should mention that the python that I'm running is the Windows Store v3.8. I am trying to keep a minimal amount on my SSD and didn't want a large overhead of stuff I won't use.","AnswerCount":5,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":3619,"Q_Id":61537007,"Users Score":0,"Answer":"I had the same error while I was using the Ubuntu terminal for Windows 10. Figured that was the issue because it sometimes has weird errors when its executing more os orientated stuff. \nIf anyone else has this error and they're using the Ubuntu terminal, try running it with the Windows CMD.","Q_Score":6,"Tags":"python,python-3.x,pip,python-imaging-library","A_Id":61744033,"CreationDate":"2020-05-01T04:53:00.000","Title":"\"Pillow was built without XCB support\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to get into C++-extensions for python, with boost\/python.\nI've downloaded boost 1_73 and installed it by calling bootstrap and then b2 --with-python\nIn Visual Studio, i've included the compiler include path (the boost directory) and linker library paths (\/stage\/lib\/) that the output of b2 tells me to.\nNow I get the compiler error LNK1104 cannot open file 'boost_python37-vc141-mt-x64-1_73.lib'. I can't find any information about this specific error. For everything similar there is only the suggestion to add the above mentioned paths.\nThe code I'm trying to compile is just the hello world example supplied with boost.\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":219,"Q_Id":61541062,"Users Score":0,"Answer":"First check that file exists somewhere in your filesystem. If it doesn't, you may have accidentally built it against a different version (i.e. not 141) of the VC runtime. (This has happened to me when I've had multiple runtimes installed.) \nIf you do have the file, then you just need to ensure that the path is in the link settings section of your project config.","Q_Score":0,"Tags":"c++,visual-studio,boost-python","A_Id":61542648,"CreationDate":"2020-05-01T10:52:00.000","Title":"Using boost\/python on Windows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm building a specialized text editor using Tkinter Text widgets. Some of the files that will be edited are fairly large (300K-500K lines). Some of the functions in the editor affect the whole file (e.g., tagging certain lines based on content, etc.). I'm using autoseparators to handle these situations where an undo essentially resets the entire Text widget contents to the previous state. In other words, I get the entire Text widget contents, process it, and then delete the existing Text widget contents and then insert the edited contents. The problem is, memory usage could potentially be a problem. For example, a 295K line file (about 6.8MB) may cause a memory increase of about 25MB when a document-wide function is performed (not sure where the 3-4X comes from). During a session a user might execute numerous document-wide functions. \nI would at least like to \"clear\" the undo\/redo stack when the user opens a new file or simply creates a new blank file. I know there are lots of arguments about keeping undo\/redo across files, but for my user community this is not an issue. Clearing the stack would not affect their workflow.\nI did try turning off the Text widget undo (via configure) and then turning it back on, but that didn't seem to have any effect. \nI would appreciate any thoughts on this question or guidance on a better approach to handling this type of situation. Thanks.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":180,"Q_Id":61547176,"Users Score":2,"Answer":"The edit_reset method clears the undo stack.","Q_Score":1,"Tags":"python,tkinter,text,widget","A_Id":61549445,"CreationDate":"2020-05-01T17:08:00.000","Title":"Is there a way to clear the undo\/redo stack for the Text widget in Tkinter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"There has got to be someone on this website with the same problem as me, so I apologize in advance; I couldn't find an answer to this anywhere on stack overflow even though I'm sure it's there somewhere.\nWhen I run my Python 3.8 program, it opens my game with pygame like I'd expect. However, it also opens an empty command line window. How can I prevent the command line window from appearing? I have no use for it, as all user interaction will be through the pygame window.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":366,"Q_Id":61551881,"Users Score":0,"Answer":"I've found a solution, thanks to Mofi. \nOn Windows, right click your .py file and set the default app to pythonw, instead of python. You should be able to find it in C:\\Users\\ ######## \\AppData\\Local\\Programs\\Python\\Python##.\nNow, opening your program will open without a terminal.","Q_Score":0,"Tags":"python-3.x,cmd","A_Id":61571024,"CreationDate":"2020-05-01T22:37:00.000","Title":"Prevent Command Line From Opening in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to do the following, but I'm getting errors on my ExecuteStreamCommand:\nCannot run program \"C:\\Python36\\pythonscript.py\" error=193 not a valid Win32 application\"\nThis is being run on my home Windows work station.\n\nGetFile (Get my PDF)\nExecuteStreamCommand (Call Python script to parse PDF with Tika, and create JSON file)\nPutFile (Output file contains JSON that I will use later)\n\nDoes NiFi have a built in PDF parser? Is there something more NiFi compatible that Tika?\nIf not, how do I call one from ExecuteStreamCommand?\nRegards and thanks in advance!","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":171,"Q_Id":61561123,"Users Score":0,"Answer":"Cannot run program \"C:\\Python36\\pythonscript.py\" error=193 not a valid Win32 application\"\n\nYou need to add a reference to your Python executable to the command to run with ExecuteStreamCommand as you cannot run Python scripts on Windows with the shebang (#!\/usr\/bin\/python for example on Linux).","Q_Score":0,"Tags":"python,apache-nifi,apache-tika,tika-server","A_Id":64930368,"CreationDate":"2020-05-02T14:39:00.000","Title":"NiFi Parse PDF using Python Tika error: ExecuteStreamCommand","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an app that includes some images, however when I package for my android phone the images are blank. Right now in my kv file, the images are being loaded from my D drive, so how would I get them to load on my phone?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":162,"Q_Id":61562892,"Users Score":0,"Answer":"Include the images during the packaging and then load them using a file path relative to your main.py.","Q_Score":0,"Tags":"python,python-3.x,image,package,kivy","A_Id":61563690,"CreationDate":"2020-05-02T16:39:00.000","Title":"Image not loading on mobile device","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am a beginner in pygame and I'd like to develop a game simple game where the screen moves along with the character.\nWhat is the best method to do so?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":447,"Q_Id":61685894,"Users Score":2,"Answer":"One method would be to move the backround without moving the character so it looks like the character is moving.","Q_Score":2,"Tags":"python,python-3.x,pygame,game-physics","A_Id":61685926,"CreationDate":"2020-05-08T18:41:00.000","Title":"How to make screen move with the character in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Every time i try to upload a code or erase flash it gets me \"A fatal error occurred: Timed out waiting for packet content\"\nC:\\esptool>python esptool.py --port com4 erase_flash\nesptool.py v3.0-dev\nSerial port com4\nConnecting........_\nDetecting chip type... ESP32\nChip is ESP32D0WDQ6 (revision 1)\nFeatures: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None\nCrystal is 40MHz\nMAC: 24:6f:28:a2:5a:7c\nUploading stub...\nRunning stub...\nStub running...\nErasing flash (this may take a while)...\nA fatal error occurred: Timed out waiting for packet content","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1328,"Q_Id":61691037,"Users Score":0,"Answer":"is your USB cable a charger cable only? This happens a lot. Charger cables look almost the same as charge\/data cables. Though the heads look the same, sometimes a charger cable is slightly thinner b\/c it only has two conductors in the jacket. Charger\/Data cables however have at least 4 wires, Data +, Data -, Power and Ground. Test your cable with another data device, or try a slightly thicker cable.","Q_Score":0,"Tags":"python,arduino,esp8266,esp32,esptool","A_Id":61754602,"CreationDate":"2020-05-09T02:29:00.000","Title":"Can't upload my code to esp32 and not able able to erase flash","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I recently learn about Pyqt5 and have some confusion about it. I have finished designing my GUI using Designer and I convert it using the pyuic5 command to start writing function for it, lets say it generate a mainwindow.py. So my question is, is it a best practice to directly write a code on mainwindow.py or should I create a new python file that import it? I want to avoid problem of fixing this in the future. Thank you","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":73,"Q_Id":61724549,"Users Score":0,"Answer":"It is generally better to import it and extend it, since you can iterate design process and generate new file when design changes.","Q_Score":0,"Tags":"python,pyqt5","A_Id":61724602,"CreationDate":"2020-05-11T07:39:00.000","Title":"Is it a good idea to directly write function on pyuic5 generated py file?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Thank you everybody for the help but I deleted the program for my project. I didn't want anyone using this. Again, Thank you for your help.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":83,"Q_Id":61763927,"Users Score":1,"Answer":"If you pay close attention to the error message you will see that the error is actually being thrown by the vlc code. Which implies that the output from the TTS speech is not what vlc is expecting. \nYou need to break up your code and first verify what output you are getting from TTS. If it is audio, then you can work out how the vlc code expects it. I suspect it not in the format that the TTS is outputting.\n\nUpdated answer\n\nThe output from TTS is a data stream of audio content, in Python this will be a byte array. It looks as though VLC is looking for a string. This makes no sense if VLC is looking for audio data. If however, it was looking for a string, then that string could be a file destination. So I think you need to write the file, and give the file destination to VLC.\n\n\nIMHO based on the question you are asking and the code you have cobbled together, your coding skills are not up to the challenge, and you maybe better off spending a couple of weeks going through some Python coding tutorials. You may find the investment in training time pays off without you struggling with what are quite fundamental coding issues here.","Q_Score":0,"Tags":"python,string,byte,text-to-speech,vlc","A_Id":61772255,"CreationDate":"2020-05-12T23:44:00.000","Title":"Creating a simple IBM Assistant using their TTS and STT. I get a Bytes and Strings error. I am using VLC to play audio. How can I fix this?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I finally got to the point where I can build, error-free, a Python Kivy APK with Buildozer 1.0.\nI build 2 sample apps, one with basic Python code, another with additional Python package (paho-mqtt).\nI can install the APK with mqtt but when run, it closes immediatelly. \nThe basic Python app will not even install.\nThe smartphone is a Nokia 6.1 with Android 10.\nAs said I am using buildozer 1.0, Python 3.8.2, openjdk 1.8.0_252, Android NDK r19c running on Ubuntu 20.04 Desktop 64bit (in VirtualBox 6.1).\nAre compatibility issues among above? Can it be solved? How?\nNB: As my smartphone is not recognised by Buildozer when hooked up with USB to VM, I download the APK using 'buildozer' serve and the Chrome browser on my smartphone.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":347,"Q_Id":61797187,"Users Score":0,"Answer":"Have you tried running it on android 9?\nI also have similar issue where app working on 9 but failing on android 10.","Q_Score":1,"Tags":"python,android,kivy,apk,buildozer","A_Id":62112323,"CreationDate":"2020-05-14T12:19:00.000","Title":"Python Kivy-Buildozer APK not installing - running on Android 10?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"How to use \"VideoPlayer\" widget to create \"segment-player\"?\nFor example: I have 10 segments: seg-1.mp4, seg2.mp4... seg10.mp4. How to create video player, as in sites, which allows play video by segments.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":726,"Q_Id":61803374,"Users Score":0,"Answer":"The best way to archive that, would to inherit the Videoplayer that has direct access to the kivy.core.video widget.\nThen from reading the source you could try to have the video on the RAM (as a file object) and parse it down to the video widget.\nThe video on the RAM could be an empty video file where you append the streams you have saved and as the video plays, the stream is shown in the video widget. But it's rather complex.\nOr you could do a sub routine that reloads the source every segment of the video in the order you wish with an event driven sequence. Instead of changing the videoplayer source, you would be changing the _video widget inside the player. And remember to change the video config to autoplay so the load times would be shorter between segments.","Q_Score":0,"Tags":"python,kivy,media-player,kivy-language","A_Id":63203939,"CreationDate":"2020-05-14T17:13:00.000","Title":"VideoPlayer kivymd python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am using the Turtle module for Python and am making a fairly simple game. I started to code for Border checking and am following a video to do it, but it doesn't seem to work. I had used the same code in the past and it was fine but now nothing happens.\nThe Code:\nBorder Limitations\nglobal player\nif player.xcor() > 600 or player.xcor() < -600:\n player.right(180) \nif player.ycor() > 400 or player.ycor() < -400:\n player.right(180)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":48,"Q_Id":61807315,"Users Score":0,"Answer":"I believe you should put that inside the main game-loop, instead of a function, cross out the global.","Q_Score":1,"Tags":"python-turtle","A_Id":61838428,"CreationDate":"2020-05-14T21:02:00.000","Title":"Why does xcor and ycor not work for my border check?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to do a runtime with llvmlite, and I would like to transpiler c to llvm.\nI want to know if in a way in llvmlite itself or in some python lib, I can't find it on the internet, so I came to ask you. Thank you very much in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":159,"Q_Id":61846090,"Users Score":2,"Answer":"If you want to transform C code to LLVM IR, no need to do it using llvmlite, which is a LLVM binding library. Just call clang -c -emit-llvm on a C source from your Python code.","Q_Score":1,"Tags":"python,llvm,llvmlite","A_Id":61848986,"CreationDate":"2020-05-17T02:07:00.000","Title":"how to transpiling c to llvm in llvmlite","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I have been working on a GUI and the results are displayed in a Treeview. I was wondering if it is possible to export this information as pdf, since I did not find anything on the internet.\nThank you","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":459,"Q_Id":61856965,"Users Score":0,"Answer":"No, there is no support in tkinter to export treeview data to pdf.","Q_Score":0,"Tags":"python,tkinter","A_Id":61857350,"CreationDate":"2020-05-17T18:45:00.000","Title":"Is it possible to export ttk Treeview to pdf?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to remove a frame from the main page so I tried to use frame.grid_forget() but it gives me this error: _tkinter.TclError: bad window path name \".!frame\" what to do ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":52,"Q_Id":61874814,"Users Score":1,"Answer":"The problem is simple: When you call window.destroy(), the window doesn't exist any more. Therefore, you can't call grid or grid_forget(), because the widget's data is gone.\nOne suggestion I would make for you to avoid this annoying error would be to use .withdraw(). This way, you can still call the widget's functions, and it will only be minimized.\nTo bring it back up, use .deiconify().","Q_Score":1,"Tags":"python,tkinter","A_Id":61903778,"CreationDate":"2020-05-18T16:53:00.000","Title":"python tkinter why icant use frame.grid_forget()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So pygame is definitely on my computer, and I can call it through the Python terminal that was installed when I downloaded Python 3.8. However, I can't get Spyder to import the pygame module. When I do, it gives me this error message:\nModuleNotFoundError: No module named 'pygame'\nCould someone please walk me through how I set up pygame so that Spyder can recognize the pygame module? Thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":129,"Q_Id":61878567,"Users Score":0,"Answer":"You've only installed pygame into a different python editor. If you want it to work on spyder, you should install it via the pip that belongs to spyder.","Q_Score":0,"Tags":"python,pygame,spyder","A_Id":61878662,"CreationDate":"2020-05-18T20:37:00.000","Title":"pygame module not found (Windows 10, Spyder IDE version 4.1.3, Python 3.8)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know it's a very general question but I am open for different options.\nLet me clarify what my codes do: \n\nThe C++ code produces multiple .png files as output as follows \n.\/Debug\/mycpp input1path input2path output parameter1 parameter2 \nThe python code takes those png files to do image processing and returns them as png as well \nmypython.py inputpath outputpath\n\nWhat I want to do:\n* To create an \"executor code\" that runs and links those 2 codes\n* The only criterion is that 'the executor code' should work on Ubuntu \nAny suggestions will be appreciated. \nAdditional notes:\n* I don't want to call c++ in python, I just want to create a 3rd code (e.g. shell script) that calls c++ first then calls python after c++ has finished it's task.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":134,"Q_Id":61908313,"Users Score":1,"Answer":"Python is perfect for such scripts, it has a complete support for such scripts.\nYou should look at subprocess and os modules for the complete command set for it.","Q_Score":0,"Tags":"python,c++,linux","A_Id":61908438,"CreationDate":"2020-05-20T08:18:00.000","Title":"Running a C++ code and a Python code consecutively","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"I use PyGame for creating games, but I noticed that the programs ran a lot slower on macOS than on my Raspberry Pi. My original solution was to install Ubuntu alongside macOS on my computer, and that worked. However, I would rather only have one operating system on my computer. Does anyone know why PyGame is so much slower on my mac when running macOS?\nIf it would help, I can send code. However, I have multiple PyGame programs and they all do the exact same thing, so I figured that it was most likely not the fault of the code, but I could be wrong.\nAny help is appreciated, thanks.\nP.S. When I say slower, I mean that it is running at about 30% of the speed on macOS than it would on Ubuntu.","AnswerCount":3,"Available Count":1,"Score":-0.0665680765,"is_accepted":false,"ViewCount":329,"Q_Id":61923965,"Users Score":-1,"Answer":"MacOS is generally slower\nUnless you can install a second RAM stick it will always be that way","Q_Score":6,"Tags":"python,python-3.x,macos,pygame","A_Id":62524732,"CreationDate":"2020-05-20T22:25:00.000","Title":"PyGame slower on macOS than on Ubuntu or Raspbian","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I'm working on the little project and the problem I ran to is... I can take a screenshot with custom size but I cannot save it to disk. What should I do?\nimport pyautogui as ImageGrab\nim = ImageGrab.screenshot(region=(0,0,300,400)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":56,"Q_Id":61935323,"Users Score":0,"Answer":"Okay the solution is:\nim.save('test.png')","Q_Score":0,"Tags":"python","A_Id":61935324,"CreationDate":"2020-05-20T19:07:00.000","Title":"How do I save a custom size screenshot on python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to write a function that returns a global variable (creating the variable inside the function and returning it outside, globally)? I can't assign the variable before the function call because I'm using it on tkinter, therefore, it's on a While loop.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1347,"Q_Id":61986499,"Users Score":0,"Answer":"No, a function can set a global variable but cannot return any local variable\/ value that can impact a global state.\nGenerally, global variables are bad and make it really hard to reason about your program. Try your best to use pure functions with only local state","Q_Score":0,"Tags":"python,function,scope,global-variables","A_Id":61986513,"CreationDate":"2020-05-24T13:13:00.000","Title":"A function that returns a global variable","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am very new to this and trying to learn Docker\/Containers. I have created a user form using pyqt5 and now trying to containerize that using hyper v docker. Everything goes well until the image creation. However when I am trying to run the container, I came across the below error. Tried many an things but did not work. can some of you advise the best solution for this:\nDockerfile:\nFROM python\nRUN python -m pip install PyQT5\nRUN python -m pip install pyqt5-tools\nCOPY Test.py c:\/python_practice\/DTM\/\nCMD python c:\/python_practice\/DTM\/Test.py\nError code:\nPS C:\\Python_Practice\\DTM> docker run pydocker\nTraceback (most recent call last):\n File \"c:\/python_practice\/DTM\/Test.py\", line 1, in \n from PyQt5 import uic, QtWidgets\nImportError: libGL.so.1: cannot open shared object file: No such file or directory\nPlease note sudo apt install libgl1-mesa-glx is not working as this is windows not linux.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1281,"Q_Id":61990391,"Users Score":1,"Answer":"Try the following lines to your docker file:\nRUN apt-get update -y\nRUN apt install libgl1-mesa-glx -y","Q_Score":4,"Tags":"python,hyper-v","A_Id":65077737,"CreationDate":"2020-05-24T18:20:00.000","Title":"ImportError: libGL.so.1: cannot open shared object file: No such file or directory: HyperV Docker","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I succesfully compiled app for android, and now I want to compile python kivy app for ios using buildozer. My operation system is Windows 10, so I don't know how to compile file for ios. I downloaded ubuntu console from microsoft store, that helped me to compile apk file. How to compile file for ios? I hope you help me...","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":995,"Q_Id":62042752,"Users Score":0,"Answer":"You can only deploy to iOS if you're working on a MacOS machine.","Q_Score":0,"Tags":"python,ios,kivy,buildozer","A_Id":62052663,"CreationDate":"2020-05-27T12:05:00.000","Title":"how to compile python kivy app for ios on Windows 10 using buildozer?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I was doing a game in tkinter, then I make it executable with PyInstaller and sent it to my friends so they can run it and tell me how it feels.\nIt seems that they could download the file, but can't open it because windows forbade them telling that it's not secure and not letting them choose to assume the risk or something.\nThey tried to run as administrator and still nothing changed.\nWhat should I do or what I should add to my code so that windows can open it without problem and why windows opens other executable files without saying that(current error that my executable gets)?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":322,"Q_Id":62095008,"Users Score":0,"Answer":"compress it as a .zip file and then it will most probably work\nor install NSIS and create a windows installer for it.","Q_Score":0,"Tags":"python-3.x,windows,tkinter,pyinstaller","A_Id":62097592,"CreationDate":"2020-05-29T21:43:00.000","Title":"I am not allowed to run a python executable on other pcs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"Currently I am working on a Schoolproject and I need to send a Notification to a self written Xamarin Forms App from my API. It all runs on a local network and the App can already communicate with the Api, now i want my api to send a notification to my phone if a specific event turns true. How do I do this? (Oh and I am using Python flask for my API, if u need this Information)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":104,"Q_Id":62132040,"Users Score":0,"Answer":"Use Push notification for it. As soon as there is a need to call\nmobile app from web server send a push notification. Handle the push\nnotification on application side to make a call to web api as soon as\nit receives the push notification with specific payload. \nUse Web Sockets if server events are too frequent.","Q_Score":0,"Tags":"python,c#,api,xamarin","A_Id":62133695,"CreationDate":"2020-06-01T12:20:00.000","Title":"How do I send a get request from my Api to a Xamarin forms app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Good evening, I'm making a platformer and would like to know when you should use one of the both.\nFor example for:\n1)The player controlled character\n2)The textured tiles that make up the level\n3)The background\nShould\/Could you make everything with sprites ?\nI just want to know how you would do it if you were to work on a pygame project.\nI ask this because I see lots of pygame tutorials that explain adding textures by using surfaces but then in other tutorials, they use sprite objects instead.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":55,"Q_Id":62136622,"Users Score":3,"Answer":"Yes you could make everything including the background with sprites. It usually does not make sense for the background though (unless you;re doing layers of some form).\nThe rest often make senses as sprite, but that depends on your situation.","Q_Score":0,"Tags":"python,pygame,sprite,surface","A_Id":62137930,"CreationDate":"2020-06-01T16:31:00.000","Title":"Surfaces or Sprites in Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to write a game in VS Code, but whenever I try to open an image using:\nhero.image = pygame.image.load(\"Character.jpeg\")\n(The images are in the game folder)\nI get varied error messages. One computer it says \"pygame.error: Couldn't open Character.png\" and on another, it says something to do with incorrect sRGB profile. I have tried running the program on different computers, tried it with different images in different image formats, .gif, .png, and .jpeg.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":56,"Q_Id":62150133,"Users Score":0,"Answer":"Thank you for your answers, it turns out the problem was that the folder was stored on a cloud location, and the computer cannot do it from there. The way I fixed it was making a copy of the image on the actual PC, I didn't need to actually use that version of the image, but as long as it is there the program works.","Q_Score":0,"Tags":"python,pygame","A_Id":62226055,"CreationDate":"2020-06-02T10:39:00.000","Title":"Can't Open image files in pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"This is my first question to here. I don't know how to set Border Radius for Tkinter Entry, Thanks for your Help!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1050,"Q_Id":62156677,"Users Score":2,"Answer":"There is no option to set a border radius on the tkinter or ttk Entry widgets, or any of the other widgets in those modules. Tkinter doesn't support the concept of a border radius.","Q_Score":0,"Tags":"python,tkinter","A_Id":62158287,"CreationDate":"2020-06-02T16:26:00.000","Title":"How to set tkinter Entry Border Radius","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have been using pycharm in my mac but while importing pygame, there is no window popping up. I have copied some codes from google about pygames but it is also not working. I think there might some settings problem in mac os because in my pc the code is working perfectly. Another information is that no error is showing, which means no problem with code or interpreter.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":51,"Q_Id":62174721,"Users Score":0,"Answer":"For me, and other people, Python 3.8 doesn't work with PyGame for some reason. Try using Python 3.7.","Q_Score":0,"Tags":"python,pygame,pycharm","A_Id":62175202,"CreationDate":"2020-06-03T13:58:00.000","Title":"No Windows popping up while using pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"please can anyone help me to sort out this issue. when i try to import pygame it's not working and giving me this error \n#\nimport pygame\nImportError: No module named pygame\ni'm using python 3.8 and os catalina \nThanks.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":405,"Q_Id":62196559,"Users Score":0,"Answer":"If your import statement is # import pygame then remove the # symbol\nOpen the terminal and run pip install pygame and then try to import pygame\nIf you are using any virtual environment first activate the virtual environment from the project location and then run the above command","Q_Score":0,"Tags":"python,pygame","A_Id":62196603,"CreationDate":"2020-06-04T14:01:00.000","Title":"pygame isn't working on visual studio code (I'm using mac os catalina)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a slider beneath a ToggleButton and I'm trying to be able to re-toggle the button anytime the slider is moved. \nThe button has a gif image on it, and the button controls the gif speed by checking the current slider position once the button.state==\"down\" (is changed to down). It does this by setting the ToggleButton's gif.anim_delay property to the sliders position. However, when I move the slider I need to retoggle the button in order to update the delay. Can I toggle it automatically on_move when the slider is moved?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":62205093,"Users Score":0,"Answer":"I needed to directly set the animation delay from the slider in the .kv file","Q_Score":0,"Tags":"python,kivy,kivy-language","A_Id":62206572,"CreationDate":"2020-06-04T22:18:00.000","Title":"Kivy Slider Trigger Togglebutton","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"i'm working tkinter , python 3.7 on Windows , wondering if there way remove tk() window border frame , title bar without using overrideredirect(1).\ni have own close button , overrideredirect(1) presents me few issues can't accept:\n1.gui on top\n2.can't iconify deiconify properly\n\nno keyboard input can't type fields\nscreen disappers when out of focus\nthere is no icon at the taskbar when overideredirect(1) is used.\n\ni can't use attributes(\"-fullscreen\", true) titlebar , borders remain plus i want my window to be movable so fullscreen doesn't help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":152,"Q_Id":62211209,"Users Score":0,"Answer":"wondering if there way remove tk() window border frame , title bar without using overrideredirect(1)\n\nNo, there is not. Using overrideredirect is the only way to do it.","Q_Score":0,"Tags":"python,windows,tkinter,titlebar","A_Id":62220697,"CreationDate":"2020-06-05T08:31:00.000","Title":"Custom Title Bar Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have the current flow,\nQMainWindow -> QMdiArea -> QMdiSubWindow -> QTabWidget -> QWidget -> QGraphicsScene\/View\nNow I want to maintain a count of a certain item being added to the scene, in a mdi sub window, Now since there can be multiple subwindows, and each subwindow can have multiple tabs. I was interested if qt had a system of given child widgets access to variables in the parent class, instead of using a self.parent().parent().... chain.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":101,"Q_Id":62220031,"Users Score":0,"Answer":"You could maybe set your QObject names with setObjectName. Then using a reference to one of the upper object like QMainWindow, you can get references to certain objects using findChild or findChildren with some expected names.","Q_Score":0,"Tags":"python,pyqt,pyqt5","A_Id":62222823,"CreationDate":"2020-06-05T16:28:00.000","Title":"PyQt5: Variables available and modifiable by all children widgets?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So apparently when we are multi-threading in pyqt by using QThread, we will have to subclass QThread and it can not be directly instantiated. this implies that QThread is an abstract class.\nThat's fine, but the thing that i don't understand is that when we are subclassing QThread, we only override the run() method, but in order to actually get this multi-threading feature to work, we have to call the start() method of the QThread subclass which we did not override at all (AFAIK if we are subclassing an abstract class, we will have to override every method that it has in our child class otherwise it can not b instantiated).\nSo where does the start() and finish methods come from?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":68,"Q_Id":62234183,"Users Score":3,"Answer":"Not every method of an abstract class is itself abstract. In the case of a QThread, the methods start() and finish() will have the same behavior across all subclasses, so they have concrete implementations for you to use, but there is no base implementation of run() (since that defines what the thread does) so that is abstract and requires custom implementation.","Q_Score":0,"Tags":"python,multithreading,pyqt,qthread","A_Id":62234233,"CreationDate":"2020-06-06T15:48:00.000","Title":"(PyQt5) is QThread an abstract class?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm new to Kivy and am trying to make a game that will load and play horizontally on an android phone no matter which direction the phone is oriented. Is there an easy way to do that? I looked through the Kivy documentation as well as some other sites & didn't find much. Thanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":145,"Q_Id":62252282,"Users Score":2,"Answer":"You can set the landscape orientation in the buildozer.spec file.\n# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all) orientation = landscape","Q_Score":1,"Tags":"python,kivy,game-development","A_Id":62253618,"CreationDate":"2020-06-07T22:05:00.000","Title":"Start Kivy app horizontally on android phone","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Collision Detection in Python OpenGl\nI'm working on breakout game by using python opengl and I want to make collision detection between the ball and the bricks (Without using pygame).\nI tried a lot but I couldn't and I didn't find any tutorials about it (using Python OpenGl).\nHow can I add collision detection in it?\nMy code until now:\ndeleted the code because the problem is solved and the whole project is changed (the code wasn't good)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":435,"Q_Id":62254263,"Users Score":0,"Answer":"I finally solved my problem.\nI used a different architecture for the whole project and I could link my data structure with the new architecture.\nThe idea was not using any library, just data structure.","Q_Score":0,"Tags":"python,opengl,collision-detection,breakout","A_Id":62338382,"CreationDate":"2020-06-08T02:50:00.000","Title":"Collision Detection in Python OpenGl","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"We have a big C# application, would like to include an application written in python and cython inside the C#\nOperating system: Win 10\nPython: 2.7\n.NET: 4.5+\nI am looking at various options for implementation here.\n(1) pythonnet - embed the python inside the C# application, if I have abc.py and inside the C#, while the abc.py has a line of \"import numpy\", does it know how to include all python's dependencies inside C#?\n(2) Convert the python into .dll - Correct me if i am wrong, this seems to be an headache to include all python files and libraries inside clr.CompileModules. Is there any automatically solution? (and clr seems to be the only solution i have found so far for building dll from python.\n(3) Convert .exe to .dll for C# - I do not know if i can do that, all i have is the abc.exe constructed by pyinstaller\n(4) shared memory seems to be another option, but the setup will be more complicated and more unstable? (because one more component needs to be taken care of?)\n(5) Messaging - zeromq may be a candidate for that. \nRequirements:\nBoth C# and python have a lot of classes and objects and they need to be persistent\nC# application need to interact with Python Application\nThey run in real-time, so performance for communication does matter, in milliseconds space.\nI believe someone should have been through a similar situation and I am looking for advice to find the best suitable solution, as well as pros and cons for above solution.\nStability comes first, then the less complex solution the better it is.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":499,"Q_Id":62318896,"Users Score":0,"Answer":"For variant 1: in my TensorFlow binding I simply add the content of a conda environment to a NuGet package. Then you just have to point Python.NET to use that environment instead of the system Python installation.","Q_Score":1,"Tags":"c#,python-2.7,zeromq,shared-memory,python.net","A_Id":62543620,"CreationDate":"2020-06-11T07:07:00.000","Title":"Alternatives for interaction between C# and Python application -- Pythonnet vs DLL vs shared memory vs messaging","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have two momentary switches called IR and IB. If I press just IR, then on my computer, the letter A is shown. If I press just IB, the letter B is shown. And if I press both of them, the letter C is shown.\nWhile the code seems obvious, the problem is, I would have to press both inputs at exactly the same time to register a keypress of C without accidentally registering a keypress of A or B.\nIf anyone one knows an algorithm or pseudo code to solve this problem, I would be down to hear it.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":34,"Q_Id":62344561,"Users Score":0,"Answer":"I don't know if this is what you were expecting but if you take pyinput module and make the thread wait like 0.35 second between two inputs and if both are A and B you display C","Q_Score":0,"Tags":"python,logic,fsm","A_Id":62344881,"CreationDate":"2020-06-12T12:46:00.000","Title":"Algorith to detect if two inputs are pressed in a loop without pressing them at exactly the same time","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am on the latest version of python and I have tried all the commands to install pyjama, but the error I get is: \n\nDefaulting to user installation because normal site-packages is not writeable\n Requirement already satisfied: pygame in \/Library\/Python\/2.7\/site-packages (1.9.6)\n\nI don't know where to find this information or how to downgrade to a older version of python.\nCan anyone help??","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":313,"Q_Id":62386303,"Users Score":0,"Answer":"could you provide the commands you used for installation which results in that error? \nSeems like you've already installed it on Python2 and are trying to install it there again. If you're using pip, maybe you could try using pip3 instead. Alternatively you can also use the following command:\n\npython3 -m pip install XXX","Q_Score":0,"Tags":"python,pygame,python-3.8","A_Id":62386386,"CreationDate":"2020-06-15T10:29:00.000","Title":"Can't install pygame on python 3.8.3","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Working for quite a while with a WxPython GUI. A very weird issue occurred when it opened as LTR on a windows PC. Some frames were really messed up because of that.\nHow can I prevent WxPython GUI from flipping?\nIt should be RTL only.\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":17,"Q_Id":62390677,"Users Score":0,"Answer":"Solved by going to \"Set Regional Format\" -> Region -> and changing to \"English(United States)\"","Q_Score":0,"Tags":"windows,wxpython","A_Id":64315254,"CreationDate":"2020-06-15T14:41:00.000","Title":"WxPython GUI is flipped to LTR","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a very small and unfinished game in python using pygame. Is there an easy way to convert this to an app which I can use and test on my iPhone without rewriting the whole code in things like kivvy?","AnswerCount":1,"Available Count":1,"Score":-0.3799489623,"is_accepted":false,"ViewCount":3116,"Q_Id":62392764,"Users Score":-2,"Answer":"There isn't an easy way, it's impossible transform the code.\nBut for an easy and not professional game, you can try to do this.\nUse a site for hosting the game like Python Anywhere (free).\nNow create an app without any coding skill.\nI never use IOS, for android MIT Inventor is a good framework for create apps.\nFor Ios, you can try Appypie or Appyourself, but you can find other better alternatives.\nThe app must contain a web-browser viewer with your site.\nThe app shows a web page with your game in it.\nI can't imagine another way, it's a bit difficult and the app require internet connection.\nGood luck!","Q_Score":3,"Tags":"python,ios,python-3.x,iphone,pygame","A_Id":62393468,"CreationDate":"2020-06-15T16:32:00.000","Title":"How to convert pygame application to iOS app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hellow Developer\nI made A.exe program with python, using pyinstaller \n1. A.exe is running on window by display\n2. i hope that control A.exe program is likely to debug mode\nex) Qwidget.information(self, \"Hellow World\") \nWhat should I do?\nit's mean commuication like sqlserver\nIf there is no way \ni think eval(\"Qwidget.information(self, 'Hellow World')\")\nbut it's vulnerable.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":62421511,"Users Score":0,"Answer":"It may need to something to communicate between two program. Create an interface for both program to interact. I think the most easy way is by setting file. A program set DEBUG mode in setting file to ON\/OFF, and B program check the setting file for DEBUG mode to decide what mode to go. :-)","Q_Score":0,"Tags":"python,controls","A_Id":62421613,"CreationDate":"2020-06-17T04:29:00.000","Title":"How to control A.exe file using B.exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"We have an android application, We need to schedule the below tasks on weekly once.\n\nHave to automatically log out from our application.\nThen have to log in automatically.\n\nI google it and found Automation Testing Framework - Android UI Automation Using Python Wrapper but I wish to run the above task by scheduling.\nI am not an Android developer, Kindly assist me to accomplish this task.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":62426581,"Users Score":0,"Answer":"In case of logout user after a perticular time, then you need to create a middle layer(like intercepter) while calling api through retrofit in mobile end.\nA logic follow in middle layer and your backend:\nyou need to send specific error code your from backend after a perticular time.\nAt mobile end we check that code in middle layer if error code is match then call logout user api and at same time call login api.\nIf you want only logout and not want to login again then send another error code for that.","Q_Score":0,"Tags":"android,python-3.x,scheduled-tasks","A_Id":62428198,"CreationDate":"2020-06-17T10:13:00.000","Title":"have to schedule UI task in Android: have to automatically log out from our application and login automatically","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So far I've found that Calibri, Courier, and Times New Roman can be used with pygame.font.SysFont(). It takes the name of a font as a string as an argument. Would it be possible to put any font name, as long as its a string, as the font argument? Or is there a select number of fonts you can use?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":850,"Q_Id":62440910,"Users Score":1,"Answer":"Any font in the list returned from pygame.font.get_fonts() can be used. This is a list of all the system fonts (ones built into the running system). If you have your own .ttf file you want to use, you can instead use pygame.font.Font. The advantage of that is you know the font you want is available (since you are bundling it with your game). With system fonts, you don't necessarily know what fonts will be available on the user's system.","Q_Score":1,"Tags":"python,fonts,pygame","A_Id":68568673,"CreationDate":"2020-06-18T01:29:00.000","Title":"What fonts can be used with pygame.font.SysFont()?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"If I have a menu with too many items to fit on the screen, how do I get one of those 'more' buttons with a downward arrow at the bottom of the menu? Is that supported?","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":93,"Q_Id":62443369,"Users Score":-1,"Answer":"I solved my problem with cascading menus. I already had some, but I didn't want to use more for these particular menus items\u2014but after closer inspection, I think it's better this way.\nI'm still interested in other solutions, for scenarios where cascading menus are not a practical option, however (like if the screen is too narrow to cascade that far or something). So, I don't plan to mark this as the accepted answer anytime soon (even though in most circumstances, it's probably the best solution).","Q_Score":0,"Tags":"python,python-3.x,tkinter,tkinter-menu","A_Id":62445927,"CreationDate":"2020-06-18T06:04:00.000","Title":"Tkinter: How do I handle menus with many items?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have an PyQt5 application to update database collections one by one using QThread and send updation signal to main thread as each collection gets updated to reflect it on GUI. It runs continuously 24X7. But somehow the data stops getting updated and also GUI stops getting signals. But the application is still running as other part are accessible and functioning properly. Also no errors are found in log file.\nMostly the application runs fine but after some random period this problem arises(first time after approximately a month, then after 2 weeks and now after 23 days). However restarting the application solves the problem.\nI tried using isRunning() method and isFinished() method but no change found.\nCan anyone tell what is the problem?? Thank you in advance.\nAlso tell how to check weather the QThread is stuck or killed?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":393,"Q_Id":62447718,"Users Score":0,"Answer":"If any exception occur in the thread, then thread can be finished soon.\nso You should use settimeout function to calling any third party library(data update) in the thread.\nThat will solve your problem.","Q_Score":1,"Tags":"python,pyqt5","A_Id":62447947,"CreationDate":"2020-06-18T10:18:00.000","Title":"How to check if a QThread is alive or killed and restart it if it is killed in PyQt5?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a simple Python utility that shows the tempo of a song (BPM) that is playing. I record short fragments of a few seconds to calculate the tempo over. The problem is that now I want to show this on a display using a Pygame UI, but when I'm recording sound, the UI does not respond. I want to make it so that the UI will stay responsive during the recording of the sound, and then update the value on the screen once the tempo over a new fragment has been calculated. How can I implement this?\nI have looked at threading but I'm not sure this is the appropriate solution for this.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":101,"Q_Id":62452758,"Users Score":1,"Answer":"I'd use the python threading library.\nUse the pygame module in the main thread (just the normal python shell, effectively) an create a separate thread for the function that determines BPM. \nThis BPM can then be saved to a global variable that can be accessed by PyGame for displaying.","Q_Score":0,"Tags":"python,audio,pygame,recording","A_Id":62453148,"CreationDate":"2020-06-18T14:48:00.000","Title":"Record sound without blocking Pygame UI","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to create a qwidgets one with raised\/sunkin\/groove\/ridge relief similar to tkinter. I know how to do this in tkinter, but don't know the style sheet option in Pyqt5 for each one. Please find the tkinter option\nWidget = Tkinter.Button(top, text =\"FLAT\", relief=raised ). Hope you can help to translate to Pyqt5","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":104,"Q_Id":62476141,"Users Score":0,"Answer":"You can do this with QFrame. you can set QFrame.setFrameShadow(QFrame.Sunken). But I couldn't find for a QWidget one.","Q_Score":0,"Tags":"python,pyqt,pyqt5","A_Id":62481971,"CreationDate":"2020-06-19T18:05:00.000","Title":"Pyqt5 widget style similar to tkinter style","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I got some question. I would like to create an app to run some sql query(ill use sqlite3) and then show data with tkinter, but ill like to add 1 more column to the results where user can input some data and next save it to the xlsx. What is the problem? I can't figure out method to add that column for user input. I'll show query results as a data frame.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":75,"Q_Id":62485477,"Users Score":0,"Answer":"It will be better if you provide minimum reproducible example. You can create Entry widget to add extra column to tkinter. Get the data from .get() method and add it to sqlite database using Update. Then you can read whole database as pandas dataframe and export is to excel using to_excel method.","Q_Score":0,"Tags":"python,sql,excel,sqlite,tkinter","A_Id":62498724,"CreationDate":"2020-06-20T11:54:00.000","Title":"Python sqlite3 tkinter. Run query, add column and save to xlsx","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"This post is part of the Color Meaning Blog Series, detailing the meanings associated with colors such as red, orange, yellow, green, blue, purple, grey, black, white, brown, pink, turquoise, gold, silver, and beige.\nYellow, the color of sunshine, hope, and happiness, has conflicting associations. On one hand yellow stands for freshness, happiness, positivity, clarity, energy, optimism, enlightenment, remembrance, intellect, honor, loyalty, and joy, but on the other, it represents cowardice and deceit. A dull or dingy yellow may represent caution, sickness, and jealousy.\nStudies show that the meaning of the color yellow can be warmth, cheerfulness, increased mental activity, increased muscle energy. The color yellow helps activate the memory, encourage communication, enhance vision, build confidence, and stimulate the nervous system.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":31,"Q_Id":62506119,"Users Score":2,"Answer":"i am no python programmer but just looking at your collide function\nassuming that your colliding base on distance between 2 points on a 2D plane\nafter getting the distance, you did a (distance mod the sqrt of 2).\na mod get your the remainder of a division, to be exactly 0 means that your number will be a multiple of sqrt2, and since in computer science a floating point 0 is almost impossible to get due to how floating points values is stored.\nand after your check whether formula is getting your 0 OR an negative number. since sqrt will never get a negative value from your distance formula for your collide to be true it has to be 0.\nsuggestion for change, after getting the distance,\nDo a check whether it falls within a RANGE with each, if it is true, else false.\ngoogle: circle to point collision, my syntax maybe wrong as i am a primarily c programmer\n,hope it helps","Q_Score":1,"Tags":"python,python-3.x","A_Id":62506270,"CreationDate":"2020-06-22T01:09:00.000","Title":"Why is my collision not working in pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have got three functions and i would like a button to call it.Is it possible to make a button do function 1 while it is clicked once...perform function 2 while the button is clicked twice and third function on third time when the button is clicked\nUSING python 3.7 and kivy 1.11","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":70,"Q_Id":62511965,"Users Score":0,"Answer":"You can use on_touch_down function and create your own counter for these actions.Start after first touch_down to count clicks and record time together.\nFor an example,kivy supports on_double_tap function. But for thrice i think its only way to do it.You need to set mini click-wait second for keep counting these variables.If user don't click in time or click thrice , you have to set variables to '0'.","Q_Score":0,"Tags":"python,button,onclick,kivy","A_Id":62540168,"CreationDate":"2020-06-22T10:06:00.000","Title":"on click once..on click twice ,on click thrice are there any predefined functions in kivy which can do this","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Currently, I am working on a Tkinter GUI. In this GUI, I would like to include an Entry field where users can only enter numbers between two boundaries (for instance, a number between 0.0 and 200.0). I have looked into the validatecommand option, but this still does not provide me a solution. Is there somebody who can help me to create a Tkinter Entry with boundaries?\nThank you in advance.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":188,"Q_Id":62553669,"Users Score":2,"Answer":"You can get the value by .get() method and then write an if statement to generate an error or reset the value by .set() method when limits are exceeded.","Q_Score":0,"Tags":"python,tkinter,boundary","A_Id":62553860,"CreationDate":"2020-06-24T11:08:00.000","Title":"A Tkinter Entry with boundaries","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I know that there are 2 methods of multi-threading using QThreads, One is to subclass QThread and override the run() method, other is to create a QObject class and move it's instance to QThread. the latter is said to be a better practice.\nI found out that subclassing QThread does provide a finished method which can be used but when creating a separate QObject as a worker thread, QThread will no longer emit the finished signal. It seems that the QThrean run method creates an event loop which when is re-implemented, returns the function and emits a finished signal. but for in case of a worker class we will need to call a quit() method on the QThread object.\nIs this correct? Does it not make subclassing QThread more flexible to use?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":97,"Q_Id":62555486,"Users Score":2,"Answer":"When the run method is overridden then the logic is implemented there so you can know when it ends, but in the case of moving a QObject to a QThread there is no way to determine when the QObject logic is finished executing.\nAn alternative is to create a finished signal that you emit when you consider that the QObject logic ends.","Q_Score":2,"Tags":"python,multithreading,pyqt,signals,qthread","A_Id":62599324,"CreationDate":"2020-06-24T12:51:00.000","Title":"Why doesn't the QThread object have a finished signal when creating a worker QObject?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created a PyQt application and then made it's .exe file using auto-py-to-exe. I am observing that it has created a base_library.zip file inside my directory. I want to know it's purpose and should I unzip this file or not?\nI am using Python 3, PyQt4 and windows 10.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":738,"Q_Id":62564715,"Users Score":1,"Answer":"Auto-py-to-exe creates a base_library.zip file when selected \"One Directory\". One shouldn't try to unzip this file. Just leave it as it is.","Q_Score":1,"Tags":"python,python-3.x,pyinstaller,autopy","A_Id":63243627,"CreationDate":"2020-06-24T21:59:00.000","Title":"Use of base_library.zip file in pyinstaller","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a simple task but am struggling with the proper way to implement it:\n\nI want one shared QStandardItemModel containing a tree structure to be displayed in two different QTreeViews.\nThe first QTreeView shows the model as-is and allows the user to add, remove and rearrange the items. Clicking an item shows an item-associated QWidget within a QStackedWidget below the QTreeView. Some item types can also be renamed.\nThe second QTreeView shows the same tree model, however all items are greyed out by default. A Processor will then move along the tree structure and process each item. Whenever an item is processed, it should not longer be greyed out. Those items not greyed out should be clickable to display the item-corresponding processed image in a viewer. Whenever a change is made in the first QTreeView, the Processor starts processing from the changed position onwards again.\n\nHow do I implement the different look and functionality of the two QTreeViews? Do I assign custom QItemDelegates to each QTreeView? Should I use a QIdentityProxyModel for the second QTreeView?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":47,"Q_Id":62577076,"Users Score":0,"Answer":"It is only necessary to use a QStandardItemModel for both models since they store the same information so if you want them to look different then you must use delegates.\nIf you want some action when the view is clicked then that does not depend on the model but you have to use the view clicked signal that is independent of the other view.\nFor the second view if a delegate is required to change the color, the logic is to use a role to indicate if that item has been processed or not, and then change the color based on that role. When you say \"a change in the first QTreeView\" you should actually say \"a change in the model\" so it is only necessary to use the dataChanged signal, process the item by changing the role status before and after processing.","Q_Score":0,"Tags":"python,pyqt,pyqt5,qtreeview,qstandarditemmodel","A_Id":62577885,"CreationDate":"2020-06-25T13:56:00.000","Title":"Two different QTreeViews with one shared QStandardItemModel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a video player application, with a graph display below it. My video player is fetching frames periodically, but when I move the mouse it freezes, and by printing what's happening I can see that the main loop didn't call anything\nI've tried printing some text for every widget on_mouse_pos event but none of them is triggered, so I really don't know where should I look. Using the recorder module, I can see that there is no mouse event, so I'm not even sure the mouse event is recorder\nI have several widgets now so I'm not sure posting them here would be useful, but I'd love to hear feeedback or any idea about this problem\nThanks a lot","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":77,"Q_Id":62578991,"Users Score":0,"Answer":"So I was able to fix this, my frame pulling function was in a separate thread, moving it to a periodically triggered Clock event fixed this.\nI'm still not sure why this bug happened, my 2 cents is that opencv block the GIL while reading a frame, and this somehow interfered with how kivy manages its events","Q_Score":0,"Tags":"python,python-3.x,kivy,kivy-language","A_Id":62593957,"CreationDate":"2020-06-25T15:31:00.000","Title":"Kivy: Moving mouse freeze main loop","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have installed PyObjC for using AppKit library in my virtual env I can able to import Appkit inside pytthon3 venv\nI have tried installing the pyobjc using pip3 outside venv and installed successfully but when I try to import Appkit outside venv there it shows the import error for AppKit\nThis is outside venv\nXXX_XXX_XXX:~ dreams$ python3.\nPython 3.7.6 (v3.7.6:43364a7ae0, Dec 18 2019, 14:18:50)\n[Clang 6.0 (clang-600.0.57)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\n\n\nimport AppKit\n\n\n\nTraceback (most recent call last):\nFile \"\", line 1, in \nModuleNotFoundError: No module named 'AppKit'\nInside venv\nXXX_XXX_XX:~ dreamguys$ source activeWindowEnv\/bin\/activate\n(activeWindowEnv) XXX_XXX_XX:~ dreams$ python\nPython 3.7.6 (v3.7.6:43364a7ae0, Dec 18 2019, 14:18:50)\n[Clang 6.0 (clang-600.0.57)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\n\n\nimport AppKit","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":63,"Q_Id":62595253,"Users Score":0,"Answer":"There is a package named appkit in pip3 which has no relation to the AppKit in apple. So please check the package you need to install before importing the AppKit module.\nAppKit module provides you with the objective C classes of the apple mac system, from which we can able to get the current active window.\nIn my venv there is no problem because I have installed pyObjC only for getting the AppKit import. but in main env I have mistakenly installed the appkit library, thats where the problem arised\nComing back to my problem, I have uninstalled both appkit and pyobjc and reinstalled the same using pip3 and now my imports worked fine. Try reinstalling the pyObjC. It will solve the problem","Q_Score":0,"Tags":"ios,python-3.x,applescript,appkit","A_Id":62948693,"CreationDate":"2020-06-26T12:58:00.000","Title":"Appkit Working properly inside venv but not without using virtual env","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm trying to draw vector graphics on a canvas using Python's Tkinter and I was excited when I noticed that canvases have a postscript() method that can save the contents of the canvas to a Postscript file and it's fairly trivial to losslessly convert SVG to EPS.\nMy question is this: can it do the reverse? Can I take a postscript file from the disk and unpack it onto the canvas? Is Tk a powerful enough graphics toolkit for that?\nor would I be better off just rendering the svg down to a GIF image (or parsing the EPS file using PIL and converting it to a pixel array that way) and displaying that?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":212,"Q_Id":62603968,"Users Score":0,"Answer":"Can a Tk canvas import a postscript file and display it?\n\nNo, it cannot.","Q_Score":0,"Tags":"python,tkinter,tk,tkinter-canvas,postscript","A_Id":62604416,"CreationDate":"2020-06-26T22:59:00.000","Title":"Can a Tk canvas import a postscript file and display it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"When reading events from a simple button in PySimpleGui, spamming this button with mouseclicks will generate an event for each of the clicks.\nWhen you try to do the same with Listboxes (by setting enable_events to True for this element) it seems like there is a timeout after each generated event. If you click once every second, it will generate all the events. But if you spam-click it like before it will only generate the first event.\nI'm not sure if this behavior is intended (only started learning PySimpleGui today), but is there a way to get rid of this delay? I tried checking the docs but can't find it mentioned anywhere.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":177,"Q_Id":62622840,"Users Score":0,"Answer":"I think the reason is that a Listbox reacts to click events, but also to double click events. A Button does not. This behavior looks like consistent.","Q_Score":0,"Tags":"python,pysimplegui","A_Id":63131833,"CreationDate":"2020-06-28T12:56:00.000","Title":"PySimpleGui: how to remove event-delay in Listboxes?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a game using pygame. Whenever I share it with my friends I also have to send them all the images, fonts, and audio files. Is there any way where I can only send the .exe file and not the media files?\n(I made the exe using auto-py-to-exe)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":117,"Q_Id":62637392,"Users Score":0,"Answer":"Couldn't you make it a .zip or .rar and make your friends extract it?\nThat is the best solution, because or else you wouldn't just need to give them the images but they'd also have to download all the libraries and if you already have a .zip file just add the images into it\nI hope this helped you\nHappy coding - BSK - SK Studio","Q_Score":0,"Tags":"python,pygame","A_Id":62728324,"CreationDate":"2020-06-29T11:45:00.000","Title":"Made a game with pygame but i have to send all the images to my friends with the exe","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have a program which runs in thee background and monitors my keypresses so when I click a specific pattern of keys it runs another program\nNow the problem I am having is that if I press Ctrl+C the program terminates due to KeyboardInterrupt so\nis there a way in which the program just ignores the KeyboardInterrupt and continues executing","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":168,"Q_Id":62649720,"Users Score":0,"Answer":"Catch the exception KeyboardInterruptError and do what you need to do.","Q_Score":0,"Tags":"python,keyboard,pynput","A_Id":62649797,"CreationDate":"2020-06-30T03:12:00.000","Title":"How to Manage Keyboard Interrupt Error in python pynput module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have woff2 files that I would like to convert to ttf using Python and the fonttools library. I have seen some methods on how to convert ttf fonts to woff2 but I can't use them to do the opposite.\nThanks in advance","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":879,"Q_Id":62652904,"Users Score":1,"Answer":"Here's the one-line command (on Windows):\npython -c \"from fontTools.ttLib import woff2; import brotli; woff2.decompress('path\/to\/your.woff2', 'path\/to\/output.ttf')\"\nMake sure you have installed brotli. Use forward slash (\/) for the file path instead of backslash (\\). The output can be either TTF or OTF.","Q_Score":2,"Tags":"python,fonts,truetype,woff2","A_Id":71043460,"CreationDate":"2020-06-30T08:05:00.000","Title":"How do I convert a woff2 font to ttf using fonttools in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I have woff2 files that I would like to convert to ttf using Python and the fonttools library. I have seen some methods on how to convert ttf fonts to woff2 but I can't use them to do the opposite.\nThanks in advance","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":879,"Q_Id":62652904,"Users Score":1,"Answer":"I figured it out one can use fontTools.ttLib.woff2.decompress() to acheive this","Q_Score":2,"Tags":"python,fonts,truetype,woff2","A_Id":62711567,"CreationDate":"2020-06-30T08:05:00.000","Title":"How do I convert a woff2 font to ttf using fonttools in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a text with Python and Qt that can be used by blind and visually impaired people.\nThe text editor should be suitable for screen readers.\nI do tests with the screen readers NVDA (Windows) and\nOrca (Ubuntu).\nTexts for screen readers should actually be saved in the \"AccessibleDescription\" property. The NVDA screen reader does not read the \"AccessibleDescription\" property. AccessibleName property only. The Orca screen reader reads the \"AccessibleDescription\" property.\nQuestion:\nWhat can I do so that my application is screen-readable on all operating systems?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":295,"Q_Id":62682288,"Users Score":0,"Answer":"Short answer\nSadly, there's probably no magic solution here.\nThe only reasonnable answer is just trying and testing a maximum of different combinations of OS, screen readers, GUI toolkits and components, as much as you can. That's the only way to discover what works well for your particular scope, and what doesn't.\nThere is no uniformity at all between OS, screen readers and GUI toolkits, and probably no combination working everywhere in all cases.\nLonger answer\nThis isn't a peasure to give this answer but in fact, if you want to make sure your app is 100% screen reader accessible, your only way is basicly to stop using GUI toolkits and exclusively use the native components offered by the OS for which accessibility is well documented; and therefore of course develop as many different apps as OS you intent to support.\nAs soon as you are using a GUI toolkit, you are adding a layer, and may lose some accessibility (and often more than less) in the process.\nThe gap between the features offered by the native OS components and those proposed in the toolkit is often closed by emulation, and some of the emulations aren't made accessible, or simply can't be made accessible for various (more or less excusable) reasons.\nThat's why some components are accessible while some others aren't; why a given component can be accessible under one OS but not at all under another; and why a component can be accessible in version N of the toolkit but not the same component in version N+1.\nIn short, you have understood, accessibility is extremely fragile.\nSadly, GUI toolkits rarely well document accessibility of their components under the different OS they support.\nThat's really a shame. It has to be addressed.\nAdditionally, accessibility is often presented as being expert compicated features. It shouldn't be so. It should be easy for app developers to make accessible apps.\nSo, wwell, since there is often no documentation about accessibility, your only way is to try and test.\nThat's a lot of work, and there is no alternative. Try and test. That's all.\nDigging deeper\nThere's generally two foundamental ways to design a GUI toolkit, and depending on which has been chosen, this has a dramatic impact on natural accessibility, and what kind of accessibility the toolkit can hope to achieve.\n\nThe first way is to start from a blank page as far as the OS permits, and from there, decide literally everything: what components to provide, and how they should look and behave.\nBy doing so, you make sure that your app will look and behave exactly the same everywhere. An user might be surprised or confused the first time because look and behavior is often not 100% conform to OS conventions or user preferences, but in the long run, he\/she will always feel at home with your app regardless of the OS used.\nHowever, more importantly, create everything from a blank page also means that everything must be defined from scratch for accessibility. It requires of course a lot of work, whether for the GUI implementers, or the app developer. Different toolkits place the responsibility cursor at different places.\nSome toolkits perform better and\/or go further than others, but in general they are nowhere near what the native components of the OS can provide.\nThe second way is to use as much as possible the components proposed by the OS, and emulate only missing features when they are really needed.\nThis is excellent for accessibility, since almost all native OS components are naturally accessible or only require little effort. Users will have an app that conforms to the general look of their OS, and so won't be confused or surprised by the interface and its behavior.\nHowever, the app isn't going to look exactly the same in all computers. Sadly, for many designers and developers, this is a definitive stopper.\n\nAs the vaste majority of GUI toolkits I know of, QT is part of the first group, but isn't playing that bad in accessibility (at least under windows) if the app developer is also aware of accessibility.\nIn the second group, you have WXWidgets for example.","Q_Score":0,"Tags":"python,qt,accessibility,screen-readers","A_Id":62684147,"CreationDate":"2020-07-01T17:30:00.000","Title":"how can ensure that a Python qt application is screen readable on all operating systems","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0},{"Question":"Hi ive been developing some games in pygame and am looking to put them on a website for my friends to play, Ive been told that flask is the way for setting up a python website and then hosting on python anywhere, but so far I havent seen any guides on using pygame with flask and am unsure if the games will work with flask ie will it be able to display the pygame screen on the website as a normal browser game would","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":302,"Q_Id":62695130,"Users Score":0,"Answer":"No, it won't work like that.\nPygame doesn't have a browser \"backend\", it's purely for desktop games.","Q_Score":0,"Tags":"python,flask,pygame","A_Id":62695144,"CreationDate":"2020-07-02T11:16:00.000","Title":"Is flask compatible with pygame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have created a calculator in Python using Tkinter module,though I converted it to exe but I am not able to convert it to apk.please tell me how to do so?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1618,"Q_Id":62718170,"Users Score":1,"Answer":"I personally haven't seen anyone do that. I think it would be best to try and re-make you calculator in the Kivy framework if you want to later turn it into an APK using bulldozer. Tkinter is decent for beginners but if you want to have nice Desktop UI's use PyQT5 and if you're interested in making mobile apps use Kivy. Tkinter is just a way to dip into using GUIs in python.","Q_Score":0,"Tags":"python-3.x,user-interface,tkinter,apk,exe","A_Id":62722246,"CreationDate":"2020-07-03T15:06:00.000","Title":"How to convert py file to apk?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am trying to change the color of the borders of the buttons in tkinter.\nI tried : tk.Button.config(highlightbackground=COLOR)\nbut it says TypeError: configure() missing 1 required positional argument: 'self'\nalso, I want to make the border color using hex color codes.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":99,"Q_Id":62742124,"Users Score":0,"Answer":"You can't change the border color of buttons in tkinter. highlightbackground isn't for the border, it's for the highlight ring which lets you know when the widget has keyboard focus.","Q_Score":0,"Tags":"python,tkinter","A_Id":62742258,"CreationDate":"2020-07-05T14:41:00.000","Title":"How to change border color of buttons in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"After my kivy app is pushed to my android device through buildozer,\nFirst I can see Kivy loading symbol,then screen is blank for 30 seconds. after that my app is getting opened.\nAnd this is happening on first run as well as subsequent runs.\nI have read some answers and got to know that \"we can avoid this problem by starting with minimal GUI\nand loading the rest more lazily\".\nCould any one please let me know,how we can load like this when the app opens?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":101,"Q_Id":62791182,"Users Score":0,"Answer":"For an example, if you used on_pre_enter function and if you give this function to do many things, its normal you to wait much a time. But there is a no any code so i can't analyze your code and give any tip.Your computer's and android's processing time depends on background applications, hardware and many things does that. So try to share your minimal code just like your starting functions or you can create minimal application which has these functions so you can test your codes partly.","Q_Score":0,"Tags":"python,android,kivy","A_Id":62846739,"CreationDate":"2020-07-08T09:00:00.000","Title":"Kivy app takes 30 seconds to open in android device","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Is there a way to get a position of thumb in pixels in vertical scale widget relative to upper right corner of widget? I want a label with scale value to pop up next to thumb when mouse pointer hovering over it, for this I need thumb coordinates.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":28,"Q_Id":62799562,"Users Score":0,"Answer":"The coords method returns the location along the trough corresponding to a particular value.\nThis is from the canonical documentation for the coords method:\n\nReturns a list whose elements are the x and y coordinates of the point along the centerline of the trough that corresponds to value. If value is omitted then the scale's current value is used.\n\nNote: you asked for coordinates relative to upper-right corner. These coordinates are relative to the upper-left. You can get the width of the widget with winfo_width() and do a simple transformation.","Q_Score":0,"Tags":"python,tkinter,scale","A_Id":62799883,"CreationDate":"2020-07-08T16:42:00.000","Title":"how to get position of thumb (in pixels) inside of vertical scale widget relatively upper right corner?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"With a program, I am producing an SVG image with dimensions of 400px x 400px. However, I would like to crop the bottom of this SVG image off, based off of a variable that dictates how much of the bottom of the image should be cropped in pixels.\nThis SVG image is being generated with pyCairo with surface = cairo.SVGSurface(\"output.svg\", WIDTH, HEIGHT) and ctx = cairo.Context(surface).\nAlthough the HEIGHT variable is a constant and isn't changed, after I perform some operations on the surface object, I would like to be able to resize it once more. I can use the Pillow Image object to crop PNGs, but it does not support SVGs.\nI have also tried to open the svg file with open(\"output.svg\"). However, if I try to read it, I am unable to and it shows up as blank, thus making it unmodifiable.\nIs there any way in Python to either crop an SVG image or modify its size after it has been modified with pycairo?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":939,"Q_Id":62823182,"Users Score":1,"Answer":"You cannot crop SVG like you crop PNG because in the latter you can just drop pixels, while for the former you have defined paths that can't be easily recomputed.\nIf you're sure there's nothing in the part you are about to \"crop\", you can use set_context_size to make the svg context\/canvas smaller while preserving ratio and size inside.","Q_Score":1,"Tags":"python,svg,python-imaging-library,pycairo","A_Id":62823298,"CreationDate":"2020-07-09T20:27:00.000","Title":"How can you crop an SVG Image in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made some program by Python 3.7 and generated an exe file using pyinstaller.\nThe exe file worked fine, but the problem occurred when I uploaded it on google drive to distribute to other users.\nWhen I download the program from google drive, the exe file does not work.\nTo be exact, it actually runs only on background. Since I made GUI for this program, it must show window GUI but it doesn't.\nEven I have same problem when I run the program which is downloaded from google drive.\nWhat is the problem? and what should I do?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":360,"Q_Id":62830392,"Users Score":0,"Answer":"You said the file downloaded from Google Drive doesn't work as the one you directly generated. I have a little trouble believing that Google drive modifies your file, you can nevertheless do the test by comparing the checksum. Does the checksum of your file change when you upload it to google drive? If this is the case try to go through another platform.","Q_Score":0,"Tags":"python,pyinstaller","A_Id":62830473,"CreationDate":"2020-07-10T08:37:00.000","Title":"exe file generated by pyinstaller does not work when downloading from google drive","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made some program by Python 3.7 and generated an exe file using pyinstaller.\nThe exe file worked fine, but the problem occurred when I uploaded it on google drive to distribute to other users.\nWhen I download the program from google drive, the exe file does not work.\nTo be exact, it actually runs only on background. Since I made GUI for this program, it must show window GUI but it doesn't.\nEven I have same problem when I run the program which is downloaded from google drive.\nWhat is the problem? and what should I do?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":360,"Q_Id":62830392,"Users Score":0,"Answer":"I solved the problem myself.\nThe problem is that uploading exe file itself.\nWhen I made a zip file for exe and uploaded it, the exe file worked fine.","Q_Score":0,"Tags":"python,pyinstaller","A_Id":62830880,"CreationDate":"2020-07-10T08:37:00.000","Title":"exe file generated by pyinstaller does not work when downloading from google drive","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am currently learning KIVY in Python and trying to figure out how to freely choose position of an element such as label and buttons, like in Tkinter you can use relx and rely to choose excact position. Do anyone know if that is possible in KIVY?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":22,"Q_Id":62843150,"Users Score":1,"Answer":"Just set the pos and size to what you want. If the parent is something like a FloatLayout, also set the size_hint to None, None to avoid the layout automatically resizing it.","Q_Score":0,"Tags":"python,kivy","A_Id":62843168,"CreationDate":"2020-07-10T22:29:00.000","Title":"Python KIVY module how to change positions of buttons, labels etc freely using x axis and y axis instead of grids","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed the pygame module and it works just fine when I try to run it from PyCharm or Sublime Text, but when I try to run it from console or IDLE it says: \" Error: No module named 'pygame' \".I should mention that my python 3.8 is not installed on it's default location, but rather on other partition in the custom folder. I also had problems with PATH and python when I first installed python.","AnswerCount":8,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":2149,"Q_Id":62885343,"Users Score":0,"Answer":"Did you do import pygame at the beginning of the script? That may be the problem.","Q_Score":0,"Tags":"python,python-3.x,path,pygame,modulenotfounderror","A_Id":62885402,"CreationDate":"2020-07-13T22:36:00.000","Title":"How to fix error: \" No module named 'pygame' \"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed the pygame module and it works just fine when I try to run it from PyCharm or Sublime Text, but when I try to run it from console or IDLE it says: \" Error: No module named 'pygame' \".I should mention that my python 3.8 is not installed on it's default location, but rather on other partition in the custom folder. I also had problems with PATH and python when I first installed python.","AnswerCount":8,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":2149,"Q_Id":62885343,"Users Score":0,"Answer":"Okay so basically I've just added every possible folder associated with python to PYTHONPATH and now it does accept pygame(It doesn't give any errors when I import pygame from console), but now it won't run programs at all and it also doesn't want to open the IDLE. I can still run it normally from Sublime","Q_Score":0,"Tags":"python,python-3.x,path,pygame,modulenotfounderror","A_Id":62895251,"CreationDate":"2020-07-13T22:36:00.000","Title":"How to fix error: \" No module named 'pygame' \"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed the pygame module and it works just fine when I try to run it from PyCharm or Sublime Text, but when I try to run it from console or IDLE it says: \" Error: No module named 'pygame' \".I should mention that my python 3.8 is not installed on it's default location, but rather on other partition in the custom folder. I also had problems with PATH and python when I first installed python.","AnswerCount":8,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":2149,"Q_Id":62885343,"Users Score":0,"Answer":"If you want to use it in PyCharm you need to go to settings then Project:\"name of the project\" then Project Interpreter then on the \"plus\" sign and find and install Pygame and\/or other modules. Ofcourse first you need to set the interpreter if it is not already set.","Q_Score":0,"Tags":"python,python-3.x,path,pygame,modulenotfounderror","A_Id":62896719,"CreationDate":"2020-07-13T22:36:00.000","Title":"How to fix error: \" No module named 'pygame' \"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I installed the pygame module and it works just fine when I try to run it from PyCharm or Sublime Text, but when I try to run it from console or IDLE it says: \" Error: No module named 'pygame' \".I should mention that my python 3.8 is not installed on it's default location, but rather on other partition in the custom folder. I also had problems with PATH and python when I first installed python.","AnswerCount":8,"Available Count":4,"Score":0.0,"is_accepted":false,"ViewCount":2149,"Q_Id":62885343,"Users Score":0,"Answer":"I got this error once but all i needed to do was install it from my console too.","Q_Score":0,"Tags":"python,python-3.x,path,pygame,modulenotfounderror","A_Id":63091820,"CreationDate":"2020-07-13T22:36:00.000","Title":"How to fix error: \" No module named 'pygame' \"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I made a chat streaming function in python using threading which is for a kivy app when I compile the app for iOS the thread updates when the app starts and doesn\u2019t update again when the streaming is updated. It works perfecting when I run it in pycharm but it not updating in IOS simulator. I was wondering maybe it\u2019s because I\u2019m using an IOS simulator to run the code but I\u2019m not sure. Any body with expertise on this area I would appreciate if you assist me. Thank you","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":44,"Q_Id":62912733,"Users Score":1,"Answer":"Deployed it on my phone and it works as expected.","Q_Score":1,"Tags":"python,multithreading,kivy,ios-simulator,python-multithreading","A_Id":62916772,"CreationDate":"2020-07-15T10:22:00.000","Title":"Python threading in IOS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"As mentioned in the question, I build a kivy app and deploy it to my android phone. The app works perfectly on my laptop but after deploying it the font size changes all of a sudden and become very small.\nI can't debug this since everything works fine. The only problem is this design or rather the UI.\nDoes anyone had this issue before? Do you have a suggestion how to deal with it?\nPS: I can't provide a reproducible code here since everything works fine. I assume it is a limitation of the framework but I'm not sure.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":51,"Q_Id":62938507,"Users Score":1,"Answer":"It sounds like you coded everything in terms of pixel sizes (the default units for most things). The difference on the phone is probably just that the pixels are smaller.\nUse the kivy.metrics.dp helper function to apply a rough scaling according to pixel density. You'll probably find that if you currently have e.g. width: 50, on the desktop then width: dp(50) will look the same while on the phone it will be twice as big as before.\n\nPS: I can't provide a reproducible code here since everything works fine.\n\nProviding a minimal runnable example would, in fact, have let the reader verify whether you were attempting to compensate for pixel density.","Q_Score":0,"Tags":"python-3.x,kivy,kivy-language,buildozer","A_Id":62938952,"CreationDate":"2020-07-16T15:46:00.000","Title":"Why does the dimensions of Kivy app changes after deployment?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I would like to ask how could I add dynamically some widgets in my application one by one and not all at once. Those widgets are added in a for loop which contains the add_widget() command, and is triggered by a button.\nSo I would like to know if there is a way for the output to be shown gradually, and not all at once, in the end of the execution. Initially I tried to add a delay inside the for loop, but I'm afraid it has to do with the way the output is built each time.\nEDIT: Well, it seems that I hadn't understood well the use of Clock.schedule_interval and Clock.schedule_once, so what I had tried with them (or with time.sleep) didn't succeed at all. But obviously, this was the solution to my problem.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":33,"Q_Id":62960795,"Users Score":1,"Answer":"Use Clock.schedule_interval or Clock.schedule_once to schedule each iteration of the loop at your desired time spacing.","Q_Score":1,"Tags":"python,kivy","A_Id":62961297,"CreationDate":"2020-07-17T19:42:00.000","Title":"Add Kivy Widgets Gradually","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Not an important question, I know, but just a silly side project a friend asked of me. Is there a way I can read and alter the inputs from a drawing tablet so that I can use it in a First Person Shooter game, using something like Python.\nFrom what I know, the pen will set the mouse position to the location corresponding to the tablet, which causes you to stare at the ground and spin, verses a mouse changing the current location of the mouse, which is what a game is expecting.\nMy plan is to read the location of the pen compared to the last location, have the mouse moved to that location on the screen, instead of set to the location.\nAny tips or guidance is appreciated!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":228,"Q_Id":62974164,"Users Score":0,"Answer":"It is already possible, if you change the drawing tablet input mode from absolute to relative","Q_Score":0,"Tags":"python,input","A_Id":66992404,"CreationDate":"2020-07-18T21:52:00.000","Title":"Reading and Altering Drawing Tablet inputs for use in FPS games","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I need track data of app usage using tkinter.\nthe code of the loop is....\n'''while True:\ncurrent_app = get_active_window()\nif 'Google Chrome' in current_app:\ncurrent_app = url_to_name(get_chrome_url())\ntimestamp[current_app] = int(time.time())\ntime.sleep(1)\nif current_app not in process_time.keys():\nprocess_time[current_app] = 0\nprocess_time[current_app] = process_time[current_app] + int(time.time()) - timestamp[current_app]\nprint(process_time)'''\nI need to perform this code using a button,\nbut when i start the window doesn't respond me.\nis there any method for performing while loop along with tkinter window?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":62991190,"Users Score":0,"Answer":"That comes from the mainloop() function that is in the Tkinter. You can not insert a while loop to the Tkinter program, because it will freeze it. If the freeze is not a problem for you, then you can do such a thing, but that is not recommended.","Q_Score":0,"Tags":"python,button,tkinter,while-loop","A_Id":62991206,"CreationDate":"2020-07-20T08:11:00.000","Title":"Performing while loops using a button in tkinter","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I've always asked myself, why is there a way to import a certain function from a module,\nexample: from tkinter import ttk\ninstead of just importing the whole module, --> import tkinter\ndoes it make the program run faster ?","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":115,"Q_Id":63017089,"Users Score":1,"Answer":"There is no memory or speed difference (the whole module has to be evaluated either way, because the last line could be Y = something_else). It can only matter if you are calling a function a lot of times in a loop (millions or more). Doing the double dictionary lookup will eventually accumulate.\nAlthough import tkinter and from tkinter import ttk both import the entire tkinter module, the latter uses name binding so only ttk is accessible to rest of the code.\nFor some people this would be the preferred style since it only makes accessible the functions you explicitly stated.\nIt does however introduce potential name conflicts. Note you can also explicitly import functions and rename them with from tkinter import ttk as tkinter_ttk, a convention that meets the explicit import and is less likely to gave name space collisions.","Q_Score":0,"Tags":"python,tkinter","A_Id":63017270,"CreationDate":"2020-07-21T14:45:00.000","Title":"what is the difference between importing the whole module or importing a certain function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"How can i install Tkinter on Windows 10?\nI have tried everything. I use PyCharm. I put my code to repl.it and it worked as it should. But i like PyCharm and i want to use it for my coding. Can it be that it does not support tkinter?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1912,"Q_Id":63029161,"Users Score":0,"Answer":"tkinter is built-in in python so no need to install it. Also, I have Windows 10 and I have just finished doing a massive project with tkinter and pycharm and it as worked fine. Be aware tho, when you are trying to import tkinter watch out for the suggestion that pycharm tries to give you: the right name for the module is tkinter and not _tkinter","Q_Score":1,"Tags":"python,tkinter","A_Id":63029337,"CreationDate":"2020-07-22T07:39:00.000","Title":"How can i install Tkinter on Windows 10?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0},{"Question":"I got stuck in one Place. I have a Tkinter Application and Web Application on Django. I have a login system in both Application. Rather making two distinct User Model, I want to linked My Tkinter Desktop Application with Django user Model so that I can synchronized the User data in both Application but the problem is when I am checking the password in my tkinter Application it is checking it as a plain text but the password in django User Model cannot be decrypt. So, Is there any way that I can synchronized my Desktop Application (Tkinter) and Web Application (Django) with one User Model (Django)?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":578,"Q_Id":63048797,"Users Score":0,"Answer":"How to Connect Tkinter Application with Django User Model?-\nStep number0: Put in same directory as django application\nStep number1: Create a basic tkinter app\nStep number2: import the user models","Q_Score":0,"Tags":"python,django,tkinter","A_Id":68990480,"CreationDate":"2020-07-23T07:13:00.000","Title":"How to Connect Tkinter Application with Django User Model?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Currently, using pygame.joystick.init() only works if the controller is on before running the script. I'd like to be able to turn the game on and then turn on the controller while it is running to switch easily between keyboard and joystick.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":115,"Q_Id":63050950,"Users Score":1,"Answer":"Some reading indicates that pygame 1.# does not seem to be able to deal with joysticks being added or removed while running. That is because pygame is based on SDL, and before version 2, SDL does not handle joysticks being added or removed while running.\nSDL vesion 2 apparently does and pygame version 2 is based on SDL 2. You could try upgrading to pygame version 2 and see if that helps.","Q_Score":0,"Tags":"python,pygame","A_Id":63060417,"CreationDate":"2020-07-23T09:20:00.000","Title":"How to detect controllers while the game is running in PyGame","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"So I'm making this game with Kivy and it's a game where there's a start screen with an MDToolbar, an MDNavigationDrawer, two Images, three MDLabels and a OneLineIconListItem that says 'Start Game' and when you click on it the game is supposed to start.\nThe game screen contains:\n\nViruses\nMasked man\nSoap which you use to hit the viruses\nCurrent score in an MDLabel\nA button to go back to the start screen\n\nIssues:\n\nThe background music for the game starts playing before the game screen is shown (When the start screen is shown) - ScreenManager issue\nWhen I click the button to go back to the start screen, the button doesn't get clicked - MDFlatButton issue\n\nI used on_touch_down, on_touch_move, and on_touch_up for this game and I know that's what's causing the MDFlatButton issue. So does anyone know how I'm supposed to have the on_touch_* methods defined AND have clickable buttons?\nAnd I don't know how to fix the ScreenManager issue either.\nI know I haven't provided any code here, but that's because this post is getting too long. I already got a post deleted because people thought the post was too long and I was providing too much code and too less details. And I don't want that to happen again. If anyone needs to view the code of my project, I will leave a Google Docs link to it.\nThanks in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":267,"Q_Id":63079352,"Users Score":0,"Answer":"I fixed my app.\nJust in case anyone had the same question, I'm gonna post the answer here.\n\nTo get a clickable button, you have to create a new Screen or Widget and add the actual screen as a widget to the new class. Then, you can add buttons to the new class. This works because the button is on top of the actual screen. So when you click anywhere in the button's area, the button gets clicked and the on_touch_* methods of the actual screen don't get called.\n\n\nAnd to fix the ScreenManager issue, you just have to expirement.","Q_Score":0,"Tags":"python,android,button,kivy,game-development","A_Id":63083213,"CreationDate":"2020-07-24T18:18:00.000","Title":"KivyMD MDFlatButton not clickable & Kivy ScreenManager not working","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Writing my Second tkinter project, I faced a problem.\nThe problem is: I need to make some unclearable text in the field(like you can't clear it with backspace). Is there any way to do it?\nP. S. Don't suggest using Labels, I need unclearable text for TextField","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":63089883,"Users Score":0,"Answer":"You can create a textbox and make its state disabled.\ntb1 = Text(root, state = \"disabled\")\nNow you won't be able to edit the text inside the textbox.","Q_Score":0,"Tags":"python,python-3.x,tkinter,python-3.6","A_Id":63089993,"CreationDate":"2020-07-25T15:04:00.000","Title":"How do I make unclearable text in Tkinter's Text Field?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"help me please how can I use the pickle save if I have a lot of entry and I want to save all in one file and load form the file for each entry separately?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":63094076,"Users Score":0,"Answer":"You can't pickle tkinter widgets. You will have to extract the data and save just the data. Then, on restart you will have to unpickle the data and insert it back into the widgets.","Q_Score":0,"Tags":"python,tkinter,tkinter-entry","A_Id":63095044,"CreationDate":"2020-07-25T22:12:00.000","Title":"Tkinter pickle save and load","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am making a Music App using Kivy rather KivyMD in Python.\nI want to make the app to ask for login when the app has been opened for first time in the mobile or opened after a logout.\nPlease help me","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":140,"Q_Id":63100941,"Users Score":0,"Answer":"I don't know how to do it in Kivy and on mobile,\nbut for webpages you save a usertoken encrypted in the localstorage of your browser.\nI would use a file, where I add and delete this token\nand check the file (or Database) every time you start the app","Q_Score":0,"Tags":"python,android,kivy,kivymd","A_Id":63101052,"CreationDate":"2020-07-26T13:42:00.000","Title":"How to make the app ask for login when a user is not logged in. In KivyMD","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I'm making an app to view CAN data from a car using appJar. I have a thread getting the CAN buffer then sending it to the main loop using queueFucntion. the function queued to the main loop iterates threw the buffer and sends the data to the Label with the same address as the data.\nI found that CAN overloads the main loop queue (raise Full). when I time the function sent to the main queue it has a run time of about ~4ms but when I add a label that matches a message it shoots up to ~100ms.\nI think this means the setLabel method takes to long. and I want to know if there is a faster way. Ultimately a faster setLabel won't actually solve my problem but it will help\nupdate\nI use wing personal 7 as an IDE for python and when I ran my program from outside of wing my code ran a lot faster and didn't overflow but my question still stands.\nupdate x2\nI implemented message filtering at the module level by hijacking the module as a parent. this helped a crap tonne but as my app runs it starts developing a delay between the car and the output and I think that means the buffer is filling up.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":32,"Q_Id":63105212,"Users Score":0,"Answer":"I found that gui.addLabel() returns the actual label object.\nWhen you use gui.setLable(title, text) appJar uses a widget manager class to\nSearch a dictionary of created Label objects with a key matching the title\nsetLabel the sets that dict value using .config(text=text)\nSo basically you can bypass the searching by keeping track of the label yourself and using\nyourLabelHere.config(text='Your string here')\nIn theory, this is faster but int practice I don't really know","Q_Score":0,"Tags":"python,performance,user-interface,can-bus,appjar","A_Id":63106459,"CreationDate":"2020-07-26T20:13:00.000","Title":"Is there a faster setLabel method in appJar","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Okay, so I recently upgraded Spyder to version 4.1.4 and ever since I have the issue that all plots are extremely slow in showing. I am plotting Outline with Qt5 (v. 5.9.2). I already tried downgrading spyder back to 4.1.3 as well as 4.1.2 but neither helped.\nSo when I plot some simple data the plot in the extra window takes a few seconds to actually show the data and when I want to switch between one plot or the other it takes 5-10 seconds to show me the other plot.\nHas anyone else experienced this issue? I could not find anything online so far. Any suggestions are welcome :)","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":207,"Q_Id":63111318,"Users Score":2,"Answer":"I am experiencing the same thing. All my Qt5 applications became extremely slow after upgrading to Spyder 4.1.4, did not find a solution yet, unfortunately.\n\/e Rolling back my entire Conda environment did 'solve' it for me though.","Q_Score":3,"Tags":"python,pyqt5,spyder","A_Id":63112159,"CreationDate":"2020-07-27T08:20:00.000","Title":"Plotting Outline with PyQt5 extremely slow","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I am developing a simple game where there is a part in it that needs to erase some text after a certain amount of time. I did some research but i am not able to find any methods or functions on how i would be able to do that. It would be great if it was a method that could only erase the text and not the whole screen.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":85,"Q_Id":63117421,"Users Score":1,"Answer":"You can \"erase\" things in pygame by blitting the part of background that goes into the specific spot.\nIf the background is all just a color, you can draw on that spot with the color.","Q_Score":0,"Tags":"python,text,pygame,erase,pygame-surface","A_Id":63117465,"CreationDate":"2020-07-27T14:25:00.000","Title":"Is there a method where i can erase text in Pygame?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"Hey I'm looking for a way to develop a windows form application like the one in visual studio, that using c# and has a visual designer option but that using python instead.\nI know that I can use tkinter to create a WFA but I really need that designer option.\nAny suggestions?\n--edit--\nThanks for your replies but does PyQt work with Visual Studio 2019 or do I have to use the Qt designer?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1228,"Q_Id":63136863,"Users Score":0,"Answer":"You can try PyQT. It has a visual Builder named QT Designer and you can generate a python file from it.","Q_Score":0,"Tags":"python,designer","A_Id":63136997,"CreationDate":"2020-07-28T14:46:00.000","Title":"A windows form application framework using python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to make a script in pygame where two balls fly towards each other and when they collide they should bounce off from each other but I don't know how to do this so can you help me?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1921,"Q_Id":63145493,"Users Score":0,"Answer":"Its pretty easy you just check if the x coordinate is in the same spot as the other x coordinate. For example if you had one of the x coordinated called x, and another one called i(there are 2 x coordinates for both of the balls) then you could just say if oh and before I say anything esle this example is fi your pygame window is a 500,500. You could say if x == 250: x -= 15. And the other way around for i. If i == 250: i += 15. Ther you go!. Obviously there are a few changes you have to do, but this is the basic code, and I think you would understand this","Q_Score":0,"Tags":"python,pygame,collision-detection,collision","A_Id":63911532,"CreationDate":"2020-07-29T02:33:00.000","Title":"Pygame how to let balls collide","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created siamese model with triplet loss function.\nI tested it a little bit and notice that when object are small, like 2\/5 of the image space, model is matching images with similar background instead of object.\nSome of pictures were taken on the same background what is causing the issue as I think.\nIs there any way to maybe extract objects? train model to recognize those object, ignore background?\nShape of each image is (150, 150, 3).","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":40,"Q_Id":63153619,"Users Score":1,"Answer":"the siamese model actually deepened on encoded data simply its match between tow encoded feature representation so it not know your object of intraset you have extract object than do the matching between them\nfor example if the model you built was for face matching\nuse opencv to extract the faces and than do the matching you want to make","Q_Score":0,"Tags":"python,image,tensorflow,image-processing,deep-learning","A_Id":63157792,"CreationDate":"2020-07-29T12:28:00.000","Title":"Model is recognizing background better than objects","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I created siamese model with triplet loss function.\nI tested it a little bit and notice that when object are small, like 2\/5 of the image space, model is matching images with similar background instead of object.\nSome of pictures were taken on the same background what is causing the issue as I think.\nIs there any way to maybe extract objects? train model to recognize those object, ignore background?\nShape of each image is (150, 150, 3).","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":63153619,"Users Score":0,"Answer":"You can try to train with masks or do random croppings of the images as a data augmentation strategy or you can change your model for more finer convolutions. The easiest would be to do the random cropping and then, training; that will help the network to disentangle the object from the background.","Q_Score":0,"Tags":"python,image,tensorflow,image-processing,deep-learning","A_Id":63153804,"CreationDate":"2020-07-29T12:28:00.000","Title":"Model is recognizing background better than objects","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a small code with python. But this part of the code doesn't work when game focused on and it doesnt respond back.\npyautogui.moveRel(-2, 4)\nAlso this part works when my cursor appear in menu or etc. too. But when i switched into game (when my cursor disappear and crosshair appeared) it doesn't work (doesn't matter fullscreen or else). These type of keyboard commands are in my code also but they works fine.\nkeyboard.is_pressed('Alt')\nIt's about mouse or pyautogui ?.. How can i make mouse moves correct ?","AnswerCount":3,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":491,"Q_Id":63191480,"Users Score":1,"Answer":"I tried this code below:\nimport win32con\nimport win32api\nwin32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(10), int(10), 0, 0)\nAnd it worked in game. I think it relative with win32con. Anyway i got it.","Q_Score":1,"Tags":"python,input,mouseevent,pyautogui","A_Id":63214834,"CreationDate":"2020-07-31T12:02:00.000","Title":"\"pyautogui\" doesn't respond","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I wrote a small code with python. But this part of the code doesn't work when game focused on and it doesnt respond back.\npyautogui.moveRel(-2, 4)\nAlso this part works when my cursor appear in menu or etc. too. But when i switched into game (when my cursor disappear and crosshair appeared) it doesn't work (doesn't matter fullscreen or else). These type of keyboard commands are in my code also but they works fine.\nkeyboard.is_pressed('Alt')\nIt's about mouse or pyautogui ?.. How can i make mouse moves correct ?","AnswerCount":3,"Available Count":2,"Score":0.0665680765,"is_accepted":false,"ViewCount":491,"Q_Id":63191480,"Users Score":1,"Answer":"I was with the same problem in linux. For me it was wayland. After switching to X, it worked. In \/etc\/gdm3\/custom.conf uncomment the line #WaylandEnable=false.","Q_Score":1,"Tags":"python,input,mouseevent,pyautogui","A_Id":72378355,"CreationDate":"2020-07-31T12:02:00.000","Title":"\"pyautogui\" doesn't respond","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to change the MDToolbar left_action_item icon color. Its defaulting to white, but now i want to change it to red. Whats the simplest way to do this? I've tried almost everything (text_color, bg_color, etc) all to no avail.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":3418,"Q_Id":63220670,"Users Score":1,"Answer":"You cannot change the color of the icons in the toolbar.","Q_Score":3,"Tags":"python,kivy,kivymd","A_Id":63225819,"CreationDate":"2020-08-02T20:23:00.000","Title":"change color of icon in MDToolbar in kivyMD?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to change the MDToolbar left_action_item icon color. Its defaulting to white, but now i want to change it to red. Whats the simplest way to do this? I've tried almost everything (text_color, bg_color, etc) all to no avail.","AnswerCount":4,"Available Count":3,"Score":0.049958375,"is_accepted":false,"ViewCount":3418,"Q_Id":63220670,"Users Score":1,"Answer":"Using specific_text_color: 1,0,1,1 you can change the color of the text inside the toolbar. It changes both the text AND the icon. I have no idea how to change only the icon. Maybe this helps.\nAt the moment iam having trouble changing the icon color of a OneLineIconListItem. I think its the same constraint we are encountering?","Q_Score":3,"Tags":"python,kivy,kivymd","A_Id":63534827,"CreationDate":"2020-08-02T20:23:00.000","Title":"change color of icon in MDToolbar in kivyMD?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0},{"Question":"I want to change the MDToolbar left_action_item icon color. Its defaulting to white, but now i want to change it to red. Whats the simplest way to do this? I've tried almost everything (text_color, bg_color, etc) all to no avail.","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":3418,"Q_Id":63220670,"Users Score":0,"Answer":"Using both md_bg_color: app.theme_cls.primary_color and text_color: rgba('#F0F0F0') allowed me to change the color of icon buttons within MDToolbar.","Q_Score":3,"Tags":"python,kivy,kivymd","A_Id":68547381,"CreationDate":"2020-08-02T20:23:00.000","Title":"change color of icon in MDToolbar in kivyMD?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0}]