python-3.4

Elements' sizes don't update on application loading in Kivy

耗尽温柔 提交于 2019-12-23 18:10:34
问题 I have on_size() event, it works when I resize window, but I can't make it work on application loading correctly (it works, but not like it must): from random import random, randint import kivy kivy.require('1.8.0') from kivy.config import Config Config.set('graphics', 'fullscreen', '0') Config.set('graphics', 'width', 640) Config.set('graphics', 'height', 480) Config.set('graphics', 'position', 'custom') Config.set('graphics', 'top', 40) Config.set('graphics', 'left', 40) from kivy.app

Python 3.X Unix Socket Example [duplicate]

微笑、不失礼 提交于 2019-12-23 13:28:11
问题 This question already has an answer here : TypeError: str does not support buffer interface [duplicate] (1 answer) Closed 3 years ago . I have been searching the last couple of hours on finding a simple Server / Client Unix Socket Example. I have found examples for Python 2.X, but I am failing at finding one that works for Python 3.X. I keep getting TypeErrors. The example that I have been working with is: client.py # -*- coding: utf-8 -*- import socket import os # import os, os.path print(

Connect to FTP TLS 1.2 Server with ftplib

风流意气都作罢 提交于 2019-12-23 09:41:44
问题 I try to connect to a FTP Server which only supports TLS 1.2 Using Python 3.4.1 My Code: import ftplib import ssl ftps = ftplib.FTP_TLS() ftps.ssl_version = ssl.PROTOCOL_TLSv1_2 print (ftps.connect('108.61.166.122',31000)) print(ftps.login('test','test123')) ftps.prot_p() print (ftps.retrlines('LIST')) Error on client side: ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:598) Error on server side: Failed TLS negotiation on control channel, disconnected. (SSL_accept(): error

SyntaxError with passing **kwargs and trailing comma

前提是你 提交于 2019-12-23 06:52:07
问题 I wonder why this is a SyntaxError in Python 3.4: some_function( filename = "foobar.c", **kwargs, ) It works when removing the trailing comma after **kwargs . 回答1: As pointed out by vaultah (who for some reason didn’t bother to post an answer), this was reported on the issue tracker and has been changed since. The syntax will work fine starting with Python 3.6. To be explicit, yes, I want to allow trailing comma even after *args or **kwds . And that's what the patch does. —Guido van Rossum

split() got an unexpected keyword argument 'expand'

馋奶兔 提交于 2019-12-23 05:29:28
问题 In python2 i could go from this pandas series 0 0 [a,b,c] with s.str.split(',',expand=True) into this: 0 1 2 0 a b c and now (ipython3) i cant, because lack of "expand" argument. How I can do it in other way? 回答1: You should check your environment's pandas version. According to the pandas docs, expand was recently added so it looks like you regressed your version somehow. expand : bool, default False If True, return DataFrame/MultiIndex expanding dimensionality. If False, return Series/Index.

Lift and raise a Canvas over a Canvas in tkinter

心不动则不痛 提交于 2019-12-23 02:42:32
问题 I'm creating a game, and I am using tkinter to build the GUI. In this game, I want the user to start with a window, filled by a Canvas, with an image as background, and some buttons in some sort of item windows. And this Canvas is the home Canvas of the game. The problem is that I want the user to click on a Button to land on other Canvas, who will host other things like the map or others buttons for others actions. Actually, I would like to superimpose several canvas (as in the Z-index

Tkinter activate window on Windows XP

梦想的初衷 提交于 2019-12-22 12:38:36
问题 I have a small GUI application that listens for network messages so a user can update some info and accept it. This is in a production factory environment and used for interacting with a specific piece of physical hardware (over serial in some cases). The workflow looks like this: User is interacting with another program (5250 Green Screen) They enter a certain keybinding that sends a UDP message to a Tkinter GUI The Tkinter GUI does a deiconify() User edits data, accepts (Enter) and it does

“TypeError: Can't convert 'NoneType' object to str implicitly” when var should have a value

梦想的初衷 提交于 2019-12-22 11:24:44
问题 import sys from tkinter import * def print(): print("Encoded " + message + " with " + offset) gui = Tk() gui.title("Caesar Cypher Encoder") Button(gui, text="Encode", command=encode).grid(row = 2, column = 2) Label(gui, text = "Message").grid(row = 1, column =0) Label(gui, text = "Offset").grid(row = 1, column =1) message = Entry(gui).grid(row=2, column=0) offset = Scale(gui, from_=0, to=25).grid(row=2, column=1) mainloop( ) When i run this code with an input in both the input box and a value

Python 3.4 multiprocessing does not work with py2exe

╄→гoц情女王★ 提交于 2019-12-22 08:11:24
问题 This is pretty much the same as this question, but the given solution there (calling freeze_support()) does not work for me. I have the following script called start.py that I use to build a standalone executable with py2exe (version 0.9.2.2). I also have python.exe in the same directory. import multiprocessing def main(): print('Parent') p = multiprocessing.Process(target=new_process) multiprocessing.set_executable('python.exe') p.start() p.join() def new_process(): print('Child') if __name_

Getting errors / failing tests when installing Python3.4.3 on Lubuntu 14.04

我怕爱的太早我们不能终老 提交于 2019-12-22 04:38:23
问题 I use VMplayer and my OS is Lubuntu 14.04. It comes with a pre-installed python3.4.0 but I want to install python3.4.3. I downloaded the .tar.xz file from here. I then extracted the file and followed the instructions in the README: ./configure make make test When I initially ran make test it said "3 tests failed, 3 altered execution environment and 25 skipped". I posted the question on SO here: Installing Python3.4.3: 3 tests failed, 3 altered execution environment and 25 skipped I then did