15,194 Topics
![]() | |
Hi so i created a function that asks users to input their grades for a course and theoretically it should post all of the results and then the grade for the course. I have so far been able to create a function that asks the user for their information and … | |
I want to make a simple editor using wxPython. Complete code is already available in wxPython tutorial page ([url]http://wiki.wxpython.org/WxHowtoSmallEditor[/url]). However, in addition I want to add "print" menu which will print the contents of editor (i.e., whatever written in editor). I will appreciate if someone please show me. Thanks, Akand | |
I'm just trying to come thru with a passing grade at this point because there was no instruction. I can't even get the program that was given to me to work, even though I copied it verbatim from the text. Please help me figure out what the error is so … | |
Hi everyone, I am going through a self-paced class for Python beginners and have ran into a dictionary problem that I can't figure out. I'm creating a set of words from user input. Then send those words to a dictionary that adds a key for when the word is first … | |
I have been trying to no avail to load a ui file and insert it into a tabWidget as a new tab. I commented out a try that I thought would work, I was wrong. I have tried several different ways but I always seem to get the same error. … | |
I may have phrased the title wrong but it is what I mean. I am not looking for multiple windows at once, I am writing a script that opens a tkinter window asking for information etc etc etc and it all saves into a database after the last window. Right … | |
Implement a function punctuation() that takes no parameters, inputs a string from the user, and prints all of the punctuation characters appearing in the string, in order from left to right. My coding I have so far is: def punctuation(): a = raw_input("Please enter a string:") check = ['!', ',', … | |
Iam using [color=#FF0040]import paketlogic2[/color] in my project when i hosted that project in webserver i got the following error [color=#FF4000]Couldn't connect to PacketLogic: cannot import name PLv11[/color] why? | |
Hi, I have many files made by a software. I want to extract some data from those files, and when I open the file with textedit, I see that what i need is on the first line. i have many of these files, and when I run the script, it … | |
Hi. I want to draw something like graph in 3D. I wrote this for its points (vertices):[CODE]import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np fig = plt.figure() ax = Axes3D(fig) ax.scatter([3,4,4,4,3,2,2,2], [3,3,3,4,4,4,5,5], [3,3,2,2,2,2,2,1],s=150, c='r') ax.set_xlim3d(1, 5) ax.set_ylim3d(1, 5) ax.set_zlim3d(1, 5) plt.show()[/CODE] , but I don't know … | |
In my phpcode [CODE=php] <?php $out = array(); $execute='./test.py'; $name = "?key=1234&path=host"; exec ("$execute $name", $out); foreach ($out as $value) { echo "$value<br />\n"; } ?>[/CODE] In test.py file i want to get the value corresponding to path that is host In test.py [CODE] #!c:/Python27/python.exe -u import django import cgi, … | |
I'm at a point with this program that I need to do a lot of work with strings. This would be so much simpler to do in Python, however I don't want the entire program written in Python. How could I use functions from a Python script in C++? | |
This program allows one to use many different sorting algorithms to sort an iterable. [code=python] from time import* from random import* #GNOME SORT def gnome_sort(lst): pos = 1 while pos < len(lst): if lst[pos] >= lst[pos-1]: pos = pos+1 else: temp = lst[pos] lst[pos] = lst[pos-1] lst[pos-1] = temp if … | |
I coded a simple tic-tac-toe "from scratch" (haven't included a GUI or anything of that sophistication). I would like to know about any improvements that can be made to this game. Thank you. [code=python] import random board_lst = [] class board: def __init__(self, rows, columns): self.rows = rows self.columns = … | |
So far, my simple numerical analysis program has differentiation, integration, first-order ODEs and Taylor Series. What else can I add to this? [code=python] from math import* """Single-variable calculus.""" #DIFFERENTIATION def gen_differentiation(f,x,h): #finds the first derivative of any mathematical function return (f(x+h)-f(x))/(h) def special_differentiation(f,x): #finds the first derivative of specific functions … | |
I am executing python file through php code in my local host [CODE=php]<?php $out = array(); $execute='C:\wamp\bin\apache\Apache2.2.11\cgi-bin\test.py'; exec ("$execute", $out); foreach ($out as $value) { echo "$value<br />\n"; } ?>[/CODE] test.py [CODE=python] #!/usr/bin/python import cgi, cgitb, os, sys cgitb.enable(); # formats errors in HTML print "helloworld"[/CODE] it correctly working in … | |
Am teaching it to my self but i have found many problems. i need your help because i want to build a dictionary for my local language. the words i already havee them and i only need the codes forlinking to the database and extraction from the database | |
This is a facial recognition system. Supports one face so far. This is an example ported from C++ to python. To see the original and to obtain the dll used visit [URL="http://www.kyb.mpg.de/bs/people/kienzle/facedemo/facedemo.htm"]this site.[/URL] I do not take credit of the dll, only the ported python code. The comments in the … ![]() | |
I am passing the given query [url]http://localhost:8080/show?key=1234&path=host[/url] in my python script i want to take the 'path' only how can i get it? i use [CODE] def get(self): data = self.request.get('path') [/CODE] but it not working | |
Hi I have a problem with installation of numpy ! I followed the instructions from the page of scipy and tried sudo apt-get install python-numpy python-scipy too. It shows this message: [CODE]blago@blago-laptop:~$ python Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" … | |
Hey guys can you help me convert this code into java... i started a little... [CODE] def minEditDistR(target, source): """ Minimum edit distance. Straight from the recurrence. """ i = len(target); j = len(source) if i == 0: return j elif j == 0: return i return(min(minEditDistR(target[:i-1],source)+1, minEditDistR(target, source[:j-1])+1, minEditDistR(target[:i-1], … | |
For my project, as others before have noted, I have to create a hashtable using chaining. I rewrote my Get and Put functions, but I do not know how to change the Locate Function. Here is the code [CODE]def hash_function( val, n ): """Compute a hash of the val string … | |
am adding a GUI into a python database and i was wondering if there is any way for text to be already in an entry box when it appears. The window is for adding movies to the database so i would like the following, please enter the movies title: [Title … | |
[code] # nth_prime.py def nth_prime(n): primes = [2] test_int = 1 while len(primes) < n: test_int += 2 for p in primes: if test_int % p is 0: break else: if p is primes[len(primes)]: primes.add(test_int) return primes[n - 1] while True: try: num = int(input("Enter a number:\n")) print(nth_prime(num)) except ValueError: … | |
Hey guys can you help me convert this code into java... i started a little... [CODE] def minEditDistR(target, source): """ Minimum edit distance. Straight from the recurrence. """ i = len(target); j = len(source) if i == 0: return j elif j == 0: return i … | |
Hi! The following Tkinter buttons should call [I]opt_def[/I] with [I]opt[/I] as 1 or 2 depending on which button is pressed (see code). [CODE]from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() self.opt1 = Button(frame, text="Opt1", command=self.opt_def(1)) self.opt1.pack(side=TOP) self.opt2 = Button(frame, text="Opt2", command=self.opt_def(2)) self.opt2.pack(side=BOTTOM) def opt_def(self, opt): … | |
Chances are this is a dumb question, but hey, I don't have anywhere else to go. I wrote a basic hangingman game on my pc desktop using a paint event to draw the hangman. Unfortunately, this code doesn't seem to run the same on my new apple computer. It comes … | |
I've put together a code to make a periodic table with jpeg bitmap buttons, and here's the code: [code] element_list = ["H.jpg","He.jpg","Li.jpg"] for i in range(len(element_list)): image_id = int(i+1) image_current = wx.Image("/Applications/PeriodicTable/ButtonBitMap/%s" % element_list[i], wx.BITMAP_TYPE_ANY).ConvertToBitmap() current = wx.BitmapButton(self,id=image_id,bitmap=image_current,style=wx.BORDER_NONE) main.Add(current,1) [/CODE] I've done the id, because for some reason, I can't … | |
Hi, I'm going through Zelle's Python Book, and for the graphics chapter, I have some problems (using pycharm): I type in from graphics import * win=Graphwin() and it shows me a window when I run it, with a background triangle and says 'centered text' in the middle - and no … | |
Hello people, I have an assignment to do and I have no idea how to do it. First: I have to modify this program to prompt the use for a word and display how many times that word appeared in the input file. When the user hits RETURN, the program … | |
How to modify the hash table implementation to use chaining instead of open addressing? [CODE]class HashTable( object ): """A data structure that contains a collection of values where each value is located by a hashable key. No two values may have the same key, but more than one key may … | |
I am trying to optimize some code I have written. I do not wish to add 0 to my list if it is already set to zero. So it only needs to be changed if the letters or words do not match. Here is the working code (You will also … | |
I need to write a program that implements this algorithm. create a hash table. for each word in words.txt sort the letters in word and use that as a key enter the(key, word) pair into the hash table prompt the user for a string while the string s not empty … | |
I need to modify this code to promt the user for a word and display how many times the word appeared in the input file. class HashTable( object ): """A data structure that contains a collection of values where each value is located by a hashable key. No two values … | |
I am currently working on my first serious GUI application in python using Tkinter. I currently have a toplevel window that opens from the root window. when i envoke the window from the root i can see all 7 of my other widgets, but the widget: btncancel = Tkinter.Button(addboard, text … | |
Hi, I was pondering this earlier and wasn't sure if it was possible. Say, for example you had 2 objects; [B]spam[/B] and [B]eggs[/B], and you wanted to create a function to change attributes - e.g. colour. So spam.colour = 'Blue' and eggs.colour = 'Green'. How would you change that attribute … | |
Hi All i have downloaded following code from web that inputs sound samples and displays spectrum, i want to print frequencies present in each second in the spectrum.i.e when ever the spectrum is displayed i want to print those frequencies as well on the console. Below is the code i … | |
hello friends i have just completed the python reading from book called "how to think like a computer scientist Python" ..Now i want to dive for Django framework for web development is that book(how to think....)is enough or should i polish my python skills first.....Please note that i have no … | |
I was told that there are four python string delimiters but I can only think of three, ', ", & """. What is that last one? I searched google but with no luck. | |
hi friends i am a beginner in python programming. I have written code to download 16 pdf files. I am getting the pdf file but I am unable to open the file it is showing error. please help me. [CODE]import re,urllib url="http://www.ncbi.nlm.nih.gov/books/NBK16" id1=[30,24,25,28,22,23,14,33,21,29,16,27,18,20,17,26] j=1; for i in id1: address= url+str(i)+'/pdf/ch'+str(j)+'.pdf' … | |
Trying to call the gcd from the constructor but I keep getting either a global error or gcd is not defined error. Any suggestions? The program is supposed to reduce fractions immediately. So I got rid of the add. [CODE]class Fraction: def __init__(self,m,n): self.num = m self.den = n gcd() … | |
Hi All i have downloaded following code from web that inputs sound samples and displays spectrum, i want to print frequencies present in each second in the spectrum.i.e when ever the spectrum is displayed i want to print those frequencies as well on the console. Below is the code i … | |
Hello python experts! I have a simple script that sends an email with no problem, in order to interface with vb6 I'm tried to modify the entire code into COM service...but I'm having trouble with this error..global name 'MIMEMultipart' is not defined which is on the send_email method. any help … | |
Hi, I am a new user and I want to show you my Python library. [B][I][U][COLOR="Red"]pypol[/COLOR][/U][/I][/B] pypol is a Python library that allows you to manipulate monomials, polynomials and algebraic fractions. An example: [CODE]>>> import pypol >>> a = pypol.polynomial('3xy - 3a^2 + 2b') >>> a - 3a² + 3xy … | |
Hei, I tried to find "dynamic programming" algorithms in Python. If anyone has examples of what it means a dynamic programming, it's would be nice. (Please not post Wikipedia links). Google -> c++, java and other, not Python. Thanks! | |
hi, i'm new to python. i want to read from a text file (as attached) and i want to plot a scatterplot. i want to plot lane as X-axis, EyVt and EyHt as Y-axis. i have a sample code but i need help on how to get python start reading … | |
Hi, I'm new to Python and having difficulty opening my .py file (ex1.py). In the command prompt I cd to the folder containing the file and when I try to open it nothing happens. The prompt just gives me a new line. It looks like this... 1. I open the … | |
I have this IRC bot that I am hard coding from scratch just for kicks. In it I pasted all of my functions to a separate file so that it saves spaces on my eyes when I code the mainframe. So on my imports I have: [code] import socket, re, … | |
Hi, I'm a relative newb to Python and I'm starting my first major project - a logarithmic graphing system. I'm using tkinter for the GUI part of the design, but I've run into a problem. Basically, I want my graph (a tk canvas) to appear in the same (root) window … | |
Hello dears. I am using python 2.6 in Ubuntu 10.10. I need an interface that make me able to trace my project. for example portable python ver 1.1 has this ability. please intruduse me an interface that be compatible with my os. Thanks. |
The End.