15,185 Topics

Member Avatar for
Member Avatar for vegaseat

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 …

Member Avatar for Gribouillis
2
124K
Member Avatar for Nether_1

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 …

Member Avatar for rproffitt
0
312
Member Avatar for toll_booth

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)) …

Member Avatar for DerSoldi
0
2K
Member Avatar for rhys1619

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 …

Member Avatar for DerSoldi
0
298
Member Avatar for Nik_1

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 …

Member Avatar for makaijohn9
0
5K
Member Avatar for RMartins
Member Avatar for pythonBasic
0
719
Member Avatar for Pyscript.exe

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 …

Member Avatar for Pyscript.exe
0
4K
Member Avatar for rhys1619

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 …

Member Avatar for Gribouillis
0
1K
Member Avatar for Nether_1

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 …

0
161
Member Avatar for Nether_1

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 …

Member Avatar for Gribouillis
0
418
Member Avatar for Ketaki_2

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 …

Member Avatar for tinstaafl
0
468
Member Avatar for Nether_1

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 = …

Member Avatar for Gribouillis
0
357
Member Avatar for Gribouillis

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 …

Member Avatar for Gribouillis
0
2K
Member Avatar for Arzak

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 …

Member Avatar for Arzak
0
2K
Member Avatar for Nether_1

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 …

Member Avatar for Gribouillis
0
790
Member Avatar for ktush

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 …

Member Avatar for tinstaafl
0
463
Member Avatar for Tenck

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 …

Member Avatar for rproffitt
0
2K
Member Avatar for Regan_1

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 …

Member Avatar for Regan_1
0
339
Member Avatar for Kayla_1

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 …

Member Avatar for woooee
0
915
Member Avatar for mailtosarach

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 …

Member Avatar for Gribouillis
0
309
Member Avatar for Mayukh_1

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 …

Member Avatar for Gribouillis
0
340
Member Avatar for mridul.ahuja

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 …

0
398
Member Avatar for Nether_1

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 …

Member Avatar for Gribouillis
0
368
Member Avatar for Nether_1

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 …

Member Avatar for Gribouillis
0
3K
Member Avatar for mswamy

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 …

Member Avatar for mswamy
0
23K
Member Avatar for Aries_Child

Assignment Overview1 This assignment focuses on the design, implementation and testing of a Python program which uses file processing, lists and strings to solve the problem described below. Program Specifications: The New York Times newspaper has published “best seller” lists since 1942. Book sales are tracked nationwide, leading to a …

Member Avatar for jacks009
0
587
Member Avatar for Nether_1

Recently I started coding a simple Game Engine in Python, but for some reason I couldn't remember how to get Pygame to recognize you clicked on a certain area. No sample code (sorry) but I was wondering if anybody knew how to make it so Pygame will recognize that the …

Member Avatar for rproffitt
0
178
Member Avatar for Johnrednex

I'm using the BullionVault API to view my orders. I use the requests from the official documentation https://www.bullionvault.com/help/xml_api.html and python language. My issue is **the request response is the HTML DOM of the BullionVault login page**. Here is my code: login_page_url = "https://or.bullionvault.fr/secure/login.do" login_page_url2 = "https://live.bullionvault.com/secure/j_security_check" payload2 = {'j_username': 'myusername', …

Member Avatar for Johnrednex
0
1K
Member Avatar for zero_1

Hi, can anyone explain to make script `downstream kbps` and `upstream kbps` ? It's totally Different method from ubuntu, because my `Os System` still window 7. Every second `downstream` and `upstream` must change... Thanks Before... Noted: Python2.7

Member Avatar for zero_1
0
829
Member Avatar for dier02

How do you catch incorrect entries? Instead of yes or no the user enters something else? def weather(): import sys raining=input('Is it raining? ').lower() if raining == 'yes': ask =(input('Do you have an umbrella? ')).lower() if raining=='no': print('Go outside 1') sys.exit(0) if ask == 'yes': print('Go outside 2') sys.exit(0) while …

Member Avatar for jnneson
0
392

The End.