15,175 Topics
| |
I am working on a python version of the game Lingo. Here are the rules: [I]"Suppose the secret word is bones. Suppose you guess the word books. The computer will mark your guess as [b][o](o)k[s], where [b], [o], and [s] are letters that are in the correct position in the … | |
Hi, I'm trying to add new information, with several if loops, to a new file with append.() but I'm not sure that this works. The new file will also include some data from the f_file, that is why the if loops are there. [CODE]f=open('filename', 'r') new=open('filename', 'w') for data in … | |
HI This is sathya seelan.. I want to develop a simple web application using python... it has to be like a mail interface msgs needed to be stored and login details should be stored in database pls help me with a code snippet | |
I want to draw like this [url]http://ompldr.org/vYjN1ZQ[/url] by using the example : [url]http://code.activestate.com/recipes/410158-fractal-tree/[/url] or anything the algorithm is [code] def Calculator(Total): numpyArray = numpy.zeros((Total, 2)) for i in range(1, Total+1): #if i == Total+1 or i == 1: numpyArray[i-1, 0] = ((2 * i) - 1) numpyArray[i-1, 1] = (Total … | |
I need to create this game in Python but I'm really confused on how to write the code! The game Accordion is played with a deck of 52 cards. Beginning with one card, cards are laid out in a row to the right. As each card is played, its compared … | |
Hey, I am confused how to display an image in the same window. This is my code for removing a certain color(removing green) from a picture, saving it and then it displays into a different window. [B][U]I need it in same window and to be below the original image.[/U][/B] any … | |
I need to do a for loop that helps me rotate an image. Design a function that uses nested for loops to rotate an image 90 degrees clockwise. Could you guys help me Im lost..... :-/ | |
I need to read in a list from a text file, put that list in a list, read in the amount of credits the students earned as an int, and than add 16 credits to the list. Here is my code so far: [CODE]myList2 = [] myList = [] myFile … | |
I know this forum isn't to give away the answers, but could someone maybe help me get started? My biggest problem is figuring out where to start. Even the pseudo code doesn't help me very much. I don't know how to use an excel file in a program either. I … | |
I have this code below where I have to make it a function. I'm confused. I tried [CODE] def drawLine(img): .... .... .... [/CODE] Do I set the location of the picture as my variable? and then calling it? How would I call my parameter when I want to check … | |
Hi, I have this problem where I have to make a function that takes one parameter and draws two vertical lines, one is a red line from (50,0) to (50,300) and one made up of randomly colored pixels(150,50)to (150,250). I didn't define my function yet but for some reason my … | |
Hello everyone, :) I have exercise for class that I can't complete, I don't understand why my loops aren't working The question--- Write code that will print a multiplication table for 10 positive integers across the columns and 10 positive integers down the rows. Prompt the user for the starting … | |
import MontyLingua theTagger = MontyLingua.MontyLingua() String = "when was tom born?" #tokenized the String tokenizedString = theTagger.tokenize(String) chunkedString=theTagger.chunk(tokenizedString) #error coming here #Tag the tokenized String tagString = theTagger.tag_tokenized(tokenizedString) print tagString #A more simple way to tag the String tagString = theTagger.jist(String) can anyubody help me why error is occuring there … | |
Hi all, I have been trying to economize some code. I am trying to nested three notebooks into each other and that looks something like this: [CODE] #!/usr/bin/env python import os import sys import datetime import numpy as np from readmonifile import MonitorFile from sortmonifile import sort import wx class … | |
Hey, So I am a very experienced PHP programmer and completely new to python, I was wondering if someone could assist me with this program I am trying to make, The idea is simple The program has 10 different fortune quotes, the user needs to be able to tell the … | |
[CODE]# a very simple Tkinter editor to show file read/write dialog from tkinter import * from tkinter.filedialog import * class App(object): def __init__(self, master): frame = Frame(master) frame.pack() self.text = Text() self.text.pack() menu = Menu(master) root.config(menu=menu) # file menu filemenu = Menu(menu, tearoff=0) menu.add_cascade(label="File", menu=filemenu) filemenu.add_command(label="New") filemenu.add_command(label="Open", command=self.file_open) filemenu.add_command(label="Save", command=self.file_save) … | |
What does xrange do in python?? And how do I implement a similar function in Python3?? | |
Hi , I am trying to save the output of "help('tkinter')" in a text file. But i get error. I want to know if there is a Way to get the output of help file redirected to a file , or save in a variable. By the way , the … | |
How come unittest.TestCase doesn't exist for me? [CODE] Traceback (most recent call last): File "D:\My Projects\TAGEngine\TAGEngine\trunk\unittest.py", line 1, in <module> import unittest File "D:\My Projects\TAGEngine\TAGEngine\trunk\unittest.py", line 4, in <module> class CheckStructureAcceptance(unittest.TestCase): AttributeError: 'module' object has no attribute 'TestCase' [/CODE] | |
How would I go about detecting keystrokes on the keyboard? | |
This is similar to earlier posts in DaniWeb by vegaseat, but it demonstrates getkey with withdrawn tkinter, restart inside object by re-calling it's __init__ method. | |
Hi all, I'm fairly new to python and I'm stuck with a problem. What I'm trying to do is write a recursive function that takes a list of integers and returns true if the list contains a single pair of integers whose sum is negative, and false otherwise. For example: … | |
[CODE]from tkinter import * def handler(event): print("Clicked at", event.x, event.y) class Application(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.grid() for r in range(6): self.master.rowconfigure(r, weight=100) #Creating custom buttons self.master.columnconfigure(0, weight=100) Button(master, text="Red",command=self.colorit).grid(row=6,column=0,sticky=E+W) self.master.columnconfigure(1, weight=100) Button(master, text="Blue").grid(row=6,column=1,sticky=E+W) self.master.columnconfigure(2, weight=100) Button(master, text="Green").grid(row=6,column=2,sticky=E+W) self.master.columnconfigure(3, weight=100) Button(master, text="Black").grid(row=6,column=3,sticky=E+W) self.master.columnconfigure(4, weight=100) Button(master, text="Open", command=self.hanlderf).grid(row=6,column=4,sticky=E+W) Frame1 = … | |
hello I'm trying to create program to check for the user password"only numbers" if it's correct then go to the next step. if not just type Invalid password the password should be store in another file which is "password.txt" this is my code but I couldn't make the program check … | |
Hello I can't understand OOP in python I am looking to good tutorial , i am looking to good tutorial , about OOP in python from zero Thank you | |
Hi all, I'm new to python. I am developing a text to speech application using python. So, I'm using a package named "pyTTS" version 3, compatible with python 2.5. Using an existing example, I wrote the following orders: [CODE] import pyTTS tts = pyTTS.Create() [/CODE] [B]Before this, I've installed the … | |
I am trying to write a program that collects gas receipt information. I only want it to ask one time for how many receipts there are and then I want it go ask the loop of questions. How do I do this? I'm guessing I can't declare multiple variables in … | |
Hi I keep on getting data altered when I receive it example: [CODE] SAM:~ SamarthAgarwal$ telnet 192.168.1.39 8888 Trying 192.168.1.39... Connected to 192.168.1.39. Escape character is '^]'. --Welcome To HACKNET-- Username: Admin Password: pass --INCORRECT IDENTIFICATION--Connection closed by foreign host. SAM:~ SamarthAgarwal$ [/CODE] the data on the server side: [CODE] … | |
This snippet defines a decorator to automate attributes setting in class instances at creation time. It can be seen as a gadget feature but it can also be handy especially for fast class prototyping. | |
I've created an image with PIL, and I'm trying to get it show on a Tkinter GUI, but I get a blank window. Any ideas? [CODE]import Tkinter import Image, ImageTk, ImageDraw #create an image image = Image.new('RGBA', (100, 100)) i = 0 draw = ImageDraw.Draw(image) ## draw some lines for … |
The End.