python-3.4

How to delete (or de-grid) Tkinter GUI objects stored in a list (Python)

三世轮回 提交于 2019-12-24 14:58:27
问题 I'm trying to make a program that creates some random amount of GUI objects in Tkinter and stores them in a list. Here (in the code below) I have a for loop that creates a random amount of radio buttons. Each time a radio button object is created it is stored in the list 'GUIobjects'. I do this because otherwise I have no way of accessing the GUI objects later on. What I need to know, now, is how to delete or de-grid the objects. I have tried self.radioButton.grid_forget(), but this only de

How to install libxml2 2.9.0 for lxml for Python 3.4.3 on win 7 64?

蓝咒 提交于 2019-12-24 12:34:47
问题 I'm using lxml 3.4.2 for Python 3.4 on a win 7 64 computer. I got lxml from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml. One of its parts is libxml2 2.9.2. I'm having a problem that a user of lxml 3.4.2 with libxml2 2.9.0 is not having, so I'd like to try libxml2 2.9.0, but can't figure out how to install it. See Python 2 v. 3 xpath for more on the problem. I don't have the ability to compile from sources. How can I install 2.9.0? 回答1: To use custom versions, you will almost certainly

Issues with http.client.BadStatusLine: ''

▼魔方 西西 提交于 2019-12-24 10:34:48
问题 I have a program that uses Dweepy (a Python module for using the dweet.io service) and it can't run the stream function (listen_for_dweets_from) for some reason. Code: collabIncomingThread = threading.Thread(None, self.listenForCollabCommands, daemon=True) collabIncomingThread.start() def listenForCollabCommands(self): print("Getting dweets...") for dweet in dweepy.listen_for_dweets_from('reggie-next-codes-' + shareid): print(dweet) contentcourse = dweet['content'] code = contentcourse['code'

pycrypto installation on Mac OS X failing

大兔子大兔子 提交于 2019-12-24 05:32:13
问题 I am trying to install pycrypto package on Mac OS X by running following command : ARCHFLAGS=-Wno-error CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib sudo -E pip install pycrypto** But it fails and show following error : /usr/bin/clang -bundle -undefined dynamic_lookup -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -L/opt/local/lib -Wno-error -L/opt/local/lib -I/opt/local/include -Wno-error build/temp.macosx-10.6-x86_64-3.4/src/_fastmath.o -lgmp -o build/lib.macosx-10.6-x86_64-3.4/Crypto

pycrypto installation on Mac OS X failing

为君一笑 提交于 2019-12-24 05:31:13
问题 I am trying to install pycrypto package on Mac OS X by running following command : ARCHFLAGS=-Wno-error CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib sudo -E pip install pycrypto** But it fails and show following error : /usr/bin/clang -bundle -undefined dynamic_lookup -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -L/opt/local/lib -Wno-error -L/opt/local/lib -I/opt/local/include -Wno-error build/temp.macosx-10.6-x86_64-3.4/src/_fastmath.o -lgmp -o build/lib.macosx-10.6-x86_64-3.4/Crypto

Python 3 http.server syntax error

我是研究僧i 提交于 2019-12-24 04:28:11
问题 Hi I try to set up my first simple Python http server. This is what I tried. Please help. >>>import os >>>os.chdir('/users/ds/my documents/pythonservers/frenchacademy') >>>os.getcwd() 'C:\\users\\ds\\my documents\\pythonservers\\frenchacademy' >>> python -m SimpleHTTPServer SyntaxError: invalid syntax >>> python -m SimpleHTTPServer 8000 SyntaxError: invalid syntax >>> -m SimpleHTTPServer SyntaxError: invalid syntax >>> python -m http.server SyntaxError: invalid syntax >>> -m http.server

SafeConfigParser: sections and environment variables

僤鯓⒐⒋嵵緔 提交于 2019-12-24 01:20:05
问题 ( Using Python 3.4.3 ) I want to use environment variables in my config file and I read that I should use SafeConfigParser with os.environ as parameter to achieve it. [test] mytest = %(HOME)s/.config/my_folder Since I need to get all the options in a section, I am executing the following code: userConfig = SafeConfigParser(os.environ) userConfig.read(mainConfigFile) for section in userConfig.sections(): for item in userConfig.options(section): print( "### " + section + " -> " + item) My

StringIO portability between python2 and python3 when capturing stdout

旧巷老猫 提交于 2019-12-24 00:57:51
问题 I have written a python package which I have managed to make fully compatible with both python 2.7 and python 3.4, with one exception that is stumping me so far. The package includes a command line script, and in my unit tests I use this code to run the script's main routine while overriding sys.argv to pass command line arguments for argparse, and capturing the script's stdout for comparison: @contextlib.contextmanager def runmain(mainfunction, arglist): """Run mainfunction with arglist in

How do I set minimum allowable width/height for widget/layout in Kivy?

孤人 提交于 2019-12-23 19:14:54
问题 I have BoxLayout with 3 elements, I need that first and last elements to occupy minimum available space. Middle element has fixed proportion (1:1), so when I resize the window, side elements become too small and content go out of it. I need e.g. label's (or button's, or even set's of different elements) text to be always inside the label. This size shouldn't be more, so I can say it should be fixed size depending on its content. UPDATE : I've made a mistake, size can be more , but not less.

How to reconfigure a logger formatter when using dictConfig

一个人想着一个人 提交于 2019-12-23 18:43:46
问题 I am using dictConfig to setup logging. One of the requirements I have is to change the default converter of the formatter (I am using a single formatter simpleFormatter for all my handlers) to time.gmtime . This would be done like this: formatter.converter = time.gmtime If I had access to the formatter. But I don't, so I can not change the default converter. I can think of two ways of doing what I want: pass the relevant parameter via dictConfig , in the formatters section (something like