15,185 Topics

Member Avatar for
Member Avatar for canadian_girl

[CODE]red_ratio=int(factor/red_average(pic)) for pixel in pic: red=media.get_red(pixel) if red*red_ratio>=255: new_red=255 elif red*red_ratio<255: new_red=red*red_ratio media.set_red(pixel,new_red)[/CODE] ''Adjust the pixels of that Picture so that the average red value of the Picture is the same as the integer value provided.''' i cant figure out why scale_red gives me 0 instead of 100

Member Avatar for slate
0
155
Member Avatar for JasonQiao

ONE '''you are given two file names: fin: the input file, and fout:the output file. The argument maxlen is an integer > 2, indicating the maximum length of each line in the output file. the function will read the fin as a text file line by line, and depending on …

0
89
Member Avatar for xleon

from Tkinter import * import sys Root=Tk() RTitle=Root.title("Windows") RWidth=Root.winfo_screenwidth() RHeight=Root.winfo_screenheight() Root.geometry("%dx%d")%(RWidth,RHeight)) mainloop() Hello. When I run this code the window takes up the entire screen(win7).but remains below the bottom of the window portion of the taskbar. Even if the screen size is changed automatically carry out this.According to the height …

Member Avatar for xleon
0
10K
Member Avatar for G-nerd

Hi, I need some assistance trying to delete elements in list. Your task is to write a function, called bawdlerize(<sent>, <word>), which removes an unsavory word, <word>, from a sentence, <sent>. Use the "del" operator on lists for this function. Example: s = ["now", "is", "the", "time", "for", "all", "good", …

Member Avatar for slate
0
278
Member Avatar for TrustyTony

Here some experiments to pretty print polynomials with help of vegaseat's tip of wx.lib.fancytext.

Member Avatar for Gribouillis
1
750
Member Avatar for Daocsm

im creating a 2d side scroller in my class, and i have a image list out of a sprite sheet. and when the player goes forward the images show up fine, but i cant seem to get each image to flip when the player turns around and goes back, any …

0
56
Member Avatar for marf

Ok I have narrowed the problem down, and I'm hoping somebody knows the solution. Basically I have a pyGTK application, using widgets and all of that. I have stripped all of the gtk objects out except the gtk.main() initializer. I basically want to start a threading process, and still have …

Member Avatar for snakerdlk
0
314
Member Avatar for henryford

Am I able to read or write to a file with this code or what is stumping me. The following is what I am suppose to do. Calculate each employee’s pay, and write it out to a sequential file. Be sure to include file I/O error handling logic. Include only …

Member Avatar for slate
0
171
Member Avatar for ekkanh

Hi I am fairly new to python. I want to do a seating reservation program containing 32 seats so the users can reserve seats and unreserve seats. I know I need a class that sort of contains the seats, but I dont know how to make it.... I have made …

Member Avatar for slate
0
7K
Member Avatar for jrp370

i have this code to simulated a walk going either forwards or backwards amd i need to modify it so that it can go either up, down, left or right. only problem is im stuck can you offer any advice? thanks [code] import random filename="walk1.txt" def randWalk(n): steps = 0 …

Member Avatar for group256
0
95
Member Avatar for ljjfb

Hello, all professionals, I used subprocess.Popen to launch a process, right now I am planning to shut it down after a given time. Can I use subprocess.kill() to fulfill that? (I do not know how to do that cuz every time I will receive a error message.) [CODE] import subprocess …

Member Avatar for ljjfb
0
16K
Member Avatar for king_koder

I tried to generate permutations by using itertools module but its not working. [CODE=python] >>>print(permutations([1,2,3],3)) <itertools.permutations object at 0xa917c5c> [/CODE] Why is it so? and how do I make it work properly?

Member Avatar for slate
0
193
Member Avatar for hnnh_km

hi so i need to write a rock paper scissors game. when played in the command prompt it should look something like this user input is in [B]bold[/B] press q at any time to quit please choose rock(r), paper(p) or scissors(s): [B]r[/B] computer chose paper. you lose! your score: 0 …

Member Avatar for woooee
0
140
Member Avatar for johnwoods87

Hi I'm new to python, I need a little help, i need to write a function that's has a radius parameter and retunes the circumference of the circle. anyone that's able to help ? sorry its not a lot of info to go on.

Member Avatar for catintp
0
122
Member Avatar for nejger

hello, can someone help me to do the graphic part of my program from latin letters to arabic numbers and visesersa? You write in the number/letters and then you push the arabic button or the latin botton and then it transelate.... Also i need a latin calculator which can + …

Member Avatar for openn0llan
0
68
Member Avatar for pythonbegin

Hi All Hope you all are ok. I have a query on calculating frequency distribution. I have seven different files like the one I have attached which contains items as below in example. I want to know total how many times each pair occurs combining all these files. ex 208015_at …

Member Avatar for TrustyTony
0
189
Member Avatar for yeticannotski

Following the Python3 Tutorial for non-programmers I took on the exercise of creating "quit" and "lock/log out" options for a very simple program, as follows (comments in the code are pretty dumb and obvious, but they are notes for mydumbself): [CODE]#!/usr/bin/python3 # Filename: lockunlock.py password = str() logged = 2 …

Member Avatar for yeticannotski
0
183
Member Avatar for king_koder

How do I sort a list in Python alphabetically? The code that is used for Python 2 doesn't seem to work: [CODE=python] mylist.sort() [/CODE] Since the file I'm working with has all text in the same case, case doesn't matter here. Please help. Thanks.

Member Avatar for king_koder
0
225
Member Avatar for evertron

I am using a sample from my book for testing a car class. I get this error and I am not sure why. I am only giving one argument that I can tell. Here is my error code: Traceback (most recent call last): File "G:\Python_Stuff\car.py", line 79, in <module> myCar.getVIN('V81FDX') …

Member Avatar for evertron
0
91
Member Avatar for convoluted

Hi all. I'm having a bit of trouble implementing the basics of a multi panel GUI. Basically I need a GUI that will act as an in-dash display for a car. The home screen will offer the user the ability to chose a selection of buttons. For example, the 'settings' …

Member Avatar for convoluted
0
286
Member Avatar for Memphis_212

The following def is my assignment .. the problem is the accumulator pattern gets me very lost. I don't know how to write it.. I have asked my instructor for help and he refers me to the sad sad book we have been given. I DO NOT WANT THIS QUESTION …

Member Avatar for TrustyTony
0
1K
Member Avatar for WolfShield

Hello everyone, I was wondering, if I wanted to make my code a little smaller in one file, is it possible for me to import another file I made? E.G. (Very simple e.g. just for helping understand what I mean) Let's say I made a program that the user types …

Member Avatar for TrustyTony
0
1K
Member Avatar for mbartz

I am trying to Subclass ElementTree with an abstract method. I have read in several forums that ElementTree is actually both a module and a class. I have been unable to get the subclassing to work. [CODE]from abc import ABCMeta, abstractmethod from xml.etree.ElementTree import ElementTree, Element, tostring class A(ElementTree): __metaclass__ …

Member Avatar for Gribouillis
0
218
Member Avatar for king_koder

Since I am a Python beginner, I was thinking about studying,and possibly working on some real-world software written in Python. So could you guys suggest some simple open source projects that I could use to study and, if possible, get involved with in development. Thanks.

Member Avatar for SgtMe
0
155
Member Avatar for LoveMyPadres

I am trying to implement virtual LEDs on a Python window. I turn the LED "on" by drawing a green oval. I then use root.after() to schedule another call that turns the LED "off" by drawing a dark green oval. I use a 250ms delay. There are 4 active LEDs …

Member Avatar for LoveMyPadres
0
2K
Member Avatar for henryford

I am writing a program for python and need to create a loop that appends pay, hours, and wages to one list called lstEmp,and be able to exit the loop once you type in DONE. I am stuck please help. [CODE]def Input(): try: name=raw_input("Enter your first and last name: ") …

Member Avatar for TrustyTony
0
135
Member Avatar for Babduberance

Hi am a noob working with Apache, mod_wsgi and python. Below is some sample code on the internet that will return "Hello World!" when i go to my local server: [url]www.localhost.com/py[/url] note: I do have WSGIScriptAlias /py "C:/Users/user/site/handler.py" in my httpd.conf [CODE] def application(environ, start_response): status = '200 OK' output …

Member Avatar for Babduberance
0
182
Member Avatar for Bluerain

# I'm trying to extract the url's from the below text, without the added html tags. Is there anyway I can get just parts starting with ( [url]http://)[/url] and ending with (")? # <a href="http://www.gumtree.sg/?ChangeLocation=Y" rel="nofollow">Singapore</a>, <a href="http://www.gumtree.com.au/?ChangeLocation=Y" rel="nofollow">Australia</a>, <a href="http://www.gumtree.co.nz/?ChangeLocation=Y" rel="nofollow">New Zealand</a>, <a href="http://www.gumtree.com" rel="nofollow">England</a>, <a href="http://edinburgh.gumtree.com" rel="nofollow">Scotland</a>, <a …

Member Avatar for aml25
0
168
Member Avatar for cleve23

How can i highlight the whole line in Styledtextctrl in wxpython????I have been researching on it but i still could not get what i want. I want to highlight a whole line of sentence on the line position that i want. Can anyone help me on this???? Please........... Thanks :D

Member Avatar for deonis
0
89
Member Avatar for Syphilis

Ahoy Sailors! So I've been developing a networking application using Twisted. This can be divided into two parts. The Host and the Guest. I normally make and test such on my main Ubuntu Linux computer, Now the time has come to compile it for Windows. But straight out of left …

0
62

The End.