15,190 Topics
![]() | |
Hello, it is me once more. I am using Python 2.3, and I must use Zelle's graphics class (and I must agree with many of you. Tkinter is much better). We have been tasked with creating a Graphical Scientific Calculator. In addition to the normal operators, it must contain the … | |
Hey I'm coding Tron which is basically a two player snake game, I'm a noob when it come to pygame and python and need help with the collision logic and would love it if you could help me. (the comments are just ideas I had for the loops for the … | |
I'm knida new to Python and I made a program that works the way I want by renaming files in bulk, however it will only work in the current folder and will not go into sub directories. i already have import os from os import rename, listdir is there any … | |
![]() | I know this should not be difficult, probably I've been too lazy to figure it out. When I execute the python script below, I get this message: <bound method Forces.Sums of <__main__.Forces instance at 0x7fcecfb56a28>>. What is wrong? import numpy class Forces: """ Forces between particles""" def __init__(self, l1, l2): … |
Hi, i have been making a maze game in pygame. I have made every level and have them all in different folders so i can find them easily. I have been trying to make a menu for the game where you are able to pick any level and play it. … | |
A list of class objects mimics a C array of structures. The snippet explores how to setup the list, and sort the list according to a selected attribute. Then we use a format string to display the sorted list. Take a look at how to search the list. All in … | |
As the title suggests, I'm attempting to build a first-person view game. I could do this on my own, but the way I'm thinking of doing it is completely impractical (involves coordinates and thousands of if statement for every possible view, which like I said is impossible). I can pretty … | |
I am struggling to get the following code to work in Python 3. from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d.art3d import Poly3DCollection import matplotlib.pyplot as plt fig = plt.figure() ax = Axes3D(fig) x = [0,1,1,0] y = [0,0,1,1] z = [0,1,0,1] #verts = [zip(x, y,z)] verts = list(zip(x, y, z)) ax.add_collection3d(Poly3DCollection(verts)) … | |
Hi, this is a maze I have been working on. As you can see everything is just flat colors. I was wanting to make it so i can add more detail like having it so i could have a picture of some tree textures as the walls to my maze … | |
Write and test a program that prints out the multiplication table for the numbers 1 to 9. Sample run:(should look close to this) 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 2 2 4 6 8 10 12 14 … | |
| |
I tried to install pyHook, but all I seem to get when I try to run my program in the python shell to test it is this. ImportError: No module named pyHook I keep trying, and I have PyWin32, so I tried to install it like that by typing into … | |
Hi, at the end of the maze you see a red square. I was trying to make it say "you win , would you like to play again y or n". i have tried using def mes and gameover = false but nothing seems to work. would help a lot … | |
I have a simple pygame code that doesn't seem to be functioning correctly, check it out: import pygame, time active = True screen_size = (1052, 700) pygame.init() DISPLAY = pygame.display.set_mode(screen_size) firstimg = pygame.image.load('firstimage.png') secondimg = pygame.image.load('secondimage.png') clock = pygame.time.Clock() def WHITESCREEN: DISPLAY.fill(255, 255, 255) def DisplayFirstImg(): DISPLAY.blit(firstimg, (1, 1)) def … | |
So this is more work onto the project I've been working on with the browser and search database stuff, so here goes. I'm attempting to have a large amount of .txt documents stored on an ftp server, and then allow these files to be downloaded, edited, and so on so … | |
Hi, **Python script** from xml.dom import minidom doc = minidom.parse("wind7.xml") Ts = doc.getElementsByTagName("TimeStep") for Ts in TimeStep: Part = TimeStep.getElementsByTagName("Particle")[0] for Part in Particle: Pcid = Particle.getAttribute("Nr") Lat = Particle.getAttribute("x") Long = Particle.getAttribute("y") print("Pcid:%s,Lat:%s,Long:%s" % (Nr,x.firstChild.data,y.firstChild.data)) I have written this python script to extract XY data, but am getting lot … | |
I'm attempting to write a simple search engine (which you might know if you read my previous question) that runs off of tags combined in a list. Currently it's just in a basic ASCII output, with things like print functions and the like. def main(): active = True done = … | |
This snippets contains a python program to find a shortest solution to the problem of the farmer who whishes to cross a river. The boat can only contain two things, including the rower. The farmer comes with a wolf, a duck and a bag of corn, and he can't leave … | |
Hi everyone, I wanna ask about `Bytes` from `ifconfig eth0`. Like us know, menu's from `ifconfig eth0` is... **eth0 Link encap:Ethernet HWaddr 00:0F:20:CF:8B:42** **inet addr:217.149.127.10 Bcast:217.149.127.63 Mask:255.255.255.192** **UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1** **RX packets:2472694671 errors:1 dropped:0 overruns:0 frame:0** **TX packets:44641779 errors:0 dropped:0 overruns:0 carrier:0** **collisions:0 txqueuelen:1000** **RX bytes:1761467179 (1679.7 … | |
I'm creating a program that allows you to do a whole ton of stuff, basically just built to make my life a little easier on my pc. However, the idea I had was that I could have a form of 'settings bar' where I could edit the settings (duh) of … | |
Hi, I am trying to plot live data reading them from a txt file. The interesting thing is that it works fine without the animate function and I am not sure what is going on when I introduce this function. The code is appended below. from datetime import datetime import … | |
I'm currently reading a huge Python book. I've just written my first Python code (from this book). It's [CODE]import sys print(sys.platform) print(2 ** 100) x = 'spam!' print(x*8) [/CODE] It works fine and I get the results I want. The only problem I have right now is running it off … | |
Hi there! I am having trouble figuring out what is wrong with my code also I'm kinda new to Python. I'm trying to get variables to one class to another class then return it back. Here is my code: from tkinter import * from tkinter import ttk class Logic: def … | |
HELP! I've been working on this assignment for a while and can't get it to work. It's supposed to pull contact info from a text file, and then return it. Every time I try to run it , it returns "no entry found" no matter what. HELP! #Declare constants lastname … | |
Hi all, I want to write a program in python to capture memory and cpu readings of a process which is running on linux server and save the readings in a tabular format to any .doc or .csv file. Got to know that 'top' command would give the cpu and … | |
I have inputs in the form like below Data: 01 18 01 23 45 67 89 AB CD EF FE DC BA 98 76 54 32 10 01 23 45 67 89 AB CD EF 02 18 67 89 AB CD EF FE DC BA 98 76 54 32 10 … | |
I'm using selenium with firefox to load a webpage. The page uses ajax to load new content on clicking the Display More Results button. However when I try to find this button and simulate a click, it gives the following Stacktrace error. Can anyone tell me what I'm doing wrong … | |
Okay so I'm writing a code for a game and the way its currently programmed is the main menu is contained within a large function that references another function, and so on. Not too complicated. But (as you'll see with the code below) I have all the essential variables set … | |
Recently I started using my first attempt at Python multithreading. The purpose of the code is to run multiple WHILE loops at the same time, one of which searches for the change of a variable to TRUE caused by input picked up by the other. However, when i ran the … | |
Hi, I want to write a python program for connect to remote server (using ssh) and execute the command and return back with output. Here is my code: import sys import os from subprocess import Popen, PIPE, STDOUT from time import sleep from os import waitpid, execv, read, write #Ports … |
The End.