15,181 Topics
| |
*Hello. I am not new to the wonderful site - Just lost login credentials* I am resuming work via Python and must make some installs into my Lib. I am having trouble with this - I have not used Python in 2-3 years. Many syntax errors. This is from install … | |
Server #!/usr/bin/python3 import socket from time import ctime HOST = '' PORT = 21567 BUFSIZ = 1024 ADDR = (HOST, PORT) udpSerSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udpSerSock.bind(ADDR) while(True): print('waiting for message...') data, addr = udpSerSock.recvfrom(BUFSIZ) udpSerSock.sendto(data, addr) print('...received from and returned to:', addr) udpSerSock.close() #END# Client #!/usr/bin/python3 import socket HOST = … | |
building my first cgi website, here is my problem. The code below works but when the condition is met it outputs both pages on the same screen however when the condition is not met it only outputs the Else: statement like its supposed too. I can't figure out why it … | |
| Is there some place where I can get a list of the "named" colors (i.e., goldenrod) available in wxpython? I'm using osx 10.6.8. Thank you. |
from visual import * sec = arrow(color = color.cyan, pos = vector(0,0,0), axis = vector(0,3,0)) minu = arrow(color = color.red, pos = vector(0,0,0), axis = vector(0,2,0)) hr = arrow(color = color.magenta, pos = vector(0,0,0), axis = vector(1,0,0)) angle = 0 angle2 = 0 while True: rate(1000) angle = angle - … | |
| I am trying to learn wxpython, but having trouble laying out two buttons that I want to be centered in a horizontal panel. I can get the buttons on the panel, but they are not centered. What I'm trying to do is create a Frame that contains an upper panel … |
I found this question on the internet, > Create a text file with name filename and about size bytes. The file should contain > an incrementing number on each line starting with 0. (ie) 0, 1, 2, 3, .... as many are required to make the file size > just … | |
So I have been working on a directory and have not really been able to get it off the ground. As a matter of fact none at all. import H:\Python Helpful Programs\DivisibleBy.py (also: everything is in the same folder) I have also tried just DivisibleBy.py and some others. The error … | |
return the first count multiples of number in desc order in a list. e.g call with input (3,2) returns [6,3] call with input(5,3) returns [15,10, 5] plz help me with this how can i do it using map()?? | |
In this line -> `tcpSerSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)` what is the first 'socket' after the '=' sign, is that refering to a socket class making tcpSerSock an object or just to a module called socket? After reading the documentation I see that socket.accept returns a connection and an address pair, … | |
I wrote a code which fills numbers into the file and when the file exceeds the size given, it stops adding data. But whenever i run the code there is an indefinite run in the data and the size of file just goes off the chart! Please help!! def create_file_numbers(filename, … | |
I'm using python3 on Windows, got a problem with ZEO , when i start a ZEO server (python runzeo.py -a localhost:9000 -f database.fs) on server appears : ------ 2014-01-15T16:24:17 INFO ZEO.runzeo (4080) opening storage '1' using FileStorage ------ 2014-01-15T16:24:18 WARNING ZODB.FileStorage Ignoring index for C:\Documents and Settings\calarasanu\Desktop\Licenta\DBase\Test\zeo\database.fs ------ 2014-01-15T16:24:18 INFO … | |
I have a generator function, i've filled in the function if there are no more_seqs. But I feel trouble if there are more sequences. I need to generate 1 tuple at a time. if the function call is generate_zip(range(5),range(3),range(4),range(5)) then the tuple generated should be (0,0,0,0) (1,1,1,1) n so on … | |
I have a list say word = ["engine","ant","aeiou"] I need to sort the list according to the number of vowels in the list elements. And this sort must change the input as well. I tried writing the code, by using zip() and a few ops i'm getting the required answer … | |
class Point: def __main__(self, x=0, y=0): self.x = x self.y = y def distance_from origin(self): return ((x ** 2) + (y ** 2)) ** 0.5 def distance_between_points(a, b): return distance_from_origin(a) - distance_from_origin(b) I get a global variable error when I try to run the function at the bottom. | |
from random import randint from tkinter import * import time screen = Tk() widthOfScreen = screen.winfo_screenwidth() #Get the width of the screen heightOfScreen = screen.winfo_screenheight() #Get the height of the screen screen.geometry("%dx%d+0+0" % (widthOfScreen, heightOfScreen)) def spammer(): count = 0 for count in range(0,1000): Button(screen, text = count, font = … | |
Dear friends, I need help understanding my error with urllib. I wrote the following code to check the availability of updates for a software I wrote try: datasource = urllib.urlopen("URL to FILE.txt") while 1: line = datasource.readline() if line == "": break if (line.find("<") > -1) : LastVersion="Error" else: LastVersion=line … | |
I have a path I trying to hook up to marathon (an automation testing tool) to locate a folder on an SVN but I keep getting a name error here is the module code def LookUpPathPrefix(pathToFind): from marathon.playback import * inFile = open("paths.txt", "r") mountPointName = "start" while (mountPointName): mountPointName … | |
Hello everyone! I got this question in a book.. I thought of doing it using map() or using loops return the first count multiples of number in desc order in a list. e.g call with input (3,2) returns [6,3] call with input(5,3) returns [15,10, 5] but the hint along with … | |
in web2py table when i m renaming field causes data to be lost and then i m not able to recover data for that table is their any solution that my data should be recover after field change in database | |
Hi, I'm newbie in Python Programming. I created the below code. I want to optimize it, but dont know where to start. I am sure, I can do the same with less lines of code. Please advise on best practices and ways on how to optimize it. import math def … | |
Hi, I am wondering if there is any easy way to up the frame rate of a pygame program. For example locking the frame rate? I don't know. Thanks in advance! 26BM | |
Hi, the following is the code for my a2 computing project. Essentially what I have tried to do is set up two basic structures of GUIS and then inherit them into other classes so I can add components to the basic structure. However, when I create a MainMenu object, only … | |
Hi, I built a Polygon() class that originally only was initialized with veriticies: Polygon(verts=(1,2,3,4) But as the code evolved, I added a few @classmethods to construct the Polygon from other inputs. For example: Polygon.from_center(center=(1,2), length=5) Now my problem is that I'm trying to find the canonical way to choose which … | |
Assume that there are n tyres that could be used by car, tricycle and bicycle. Write a program to accept n tyres and generate all the combinations (i.e. the number) of car(s), tricycle(s) and bicycle(s) that could exhaust the n tyres. Ensure that all the objects have fair share where … | |
In the following program how does the line `r.size = 150, 100` actually set the values using this line -> `size = property(getSize, setSize)`? property has two arguments, getSize & setSize, it seems to me that would only allow it so get one value and set one value. #!/usr/bin/python3 class … | |
I know python is an interpreted language but is there a way to compile your code? What if you write a program in python 3 and the user has python 2.x, or worse yet, doesn't have python at all. How can you create an executable via compiling or any other … | |
Hi i was wondering if anyone could help me, im wanting to when you click in a certain area it changes the background image thanks import Tkinter as tk from Tkinter import* import urllib import base64 def click(event): if event.x > 100 and event.x < 430: if event.y > 100 … | |
I'm trying to write a recursive functionthat receives a parameter n and returns the multiple of 5. Example: if we have 5 as the argument, the print out will be : 5 10 15 20 25 My code: def MultiplyRecursive(r): if r == 1: return 5 else: return MultiplyRecursive(r-1) + … | |
class MemberCounter: members = 0 def init(self): MemberCounter.members += 1 # m1 = MemberCounter() # m1.init() # MemberCounter.members -> 1 # m2 = MemberCounter() # m2.init() # MemberCounter.members -> 2 # m1.members -> 2 #m2.members -> 2 # m1.members = 'Two' # m1.members -> 'Two' # m2.members -> 2 In … |
The End.