15,185 Topics
| |
[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 | |
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 … | |
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 … | |
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", … | |
Here some experiments to pretty print polynomials with help of vegaseat's tip of wx.lib.fancytext. | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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? | |
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 … | |
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. | |
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 + … | |
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 … | |
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 … | |
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. | |
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') … | |
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' … | |
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 … | |
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 … | |
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__ … | |
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. | |
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 … | |
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: ") … | |
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 … | |
# 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 … | |
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 | |
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 … |
The End.