14,946 Topics

Member Avatar for
Member Avatar for aot

Here's something that I've wished for a number of times so far: the ability to create a function (taking X) that creates X variables, even if they are all initialized to the same value. For example, [inlinecode]f(3)[/inlinecode] would assign [inlinecode]var1 = 0[/inlinecode], [inlinecode]var2 = 0[/inlinecode], and [inlinecode]var3 = 0[/inlinecode]. My …

Member Avatar for aot
0
130
Member Avatar for saintlysav

I recently made a python module which calls functions from a c program. I used SWIG to generate the wrapper code from an interface file, and compiled the module into a dll which i can import in python and call functions from. While some of the functions are working fine, …

0
81
Member Avatar for AikoYamamato

Basically I'm trying to take a Template String and store it in a variable for later use. I'm new with Python and programming languages in general so I'm finding difficulty in doing this. This is the code I'm using to generate the string: [code]from string import Template s = Template('$who …

Member Avatar for AikoYamamato
0
174
Member Avatar for fonzali

hi all , I like to write a program which I input the dates and amounts of say 10 checks , and print out the total amount of checks and number of days thet are apart from each other on another entry widget . the code I have done sofar …

Member Avatar for fonzali
0
227
Member Avatar for R.S.Chourasia

Hello everyone, I am new to python and I want to register and unregister the variables from a session (As we do in PHP using session_register() and session_unregister() function),So that i do not need to transfer them in the URL of my site. Can anybody tell me how can i …

0
93
Member Avatar for woonie

Hi, I've a CGI form script. I'm testing it to see if it's possible to grab the headers sent by the client's computer when the form is submitted. Here's my code: # start code import httplib conn = httplib.HTTPConnection("www.somesite.org") conn.request("POST", "/scripts/test.py") r1 = conn.getresponse() header = r1.getheader('user_header') conn.close print header …

0
47
Member Avatar for Suplexx

I'm somewhat new to Python and want to clear a few things up regarding running scripts. Alright, so here's what I want to do: I want to run a script inside of a script, and then have the first "parent" script continue running normally. I have tried using both execfile() …

Member Avatar for vegaseat
0
129
Member Avatar for Logi.

Hi, Im having trouble with the piece of code below, i want to have the image change every time you press the button. This code is from a larger project but this is the bit that i cant get to work. Any ideas? [code=python]import Tkinter import random import Image, ImageTk …

Member Avatar for vegaseat
0
1K
Member Avatar for higherGround574

Hi, I'm working on a OOP school project, and I'm trying to add a web interface to it; however, my experience working with html forms is limited. Anyways, I'm trying to set up a user login, where the user enters some info onto a form. I want to pull the …

0
68
Member Avatar for aloishis89

I am very new to python and am learning it just for fun. I am attempting to use it for a small application that shuffles a string list. I need to get a list of about 50 last names in a random order. I tried doing [code] items = [thing1, …

Member Avatar for aloishis89
0
158
Member Avatar for pyguy25

This is a modified program from the word count program that I posted about. I am trying to calculate the average word length in a sentence. Here is my code so far: [code] def main(): print "This program will calculate the average word length in a sentence" print s = …

Member Avatar for ghostdog74
0
11K
Member Avatar for Lardmeister

I have for instance this function I wrote and want to assure that the argument is a number when I call the function. [code]def hypotenuse(n): "return the length of the hypotenuse of an isosceles triangle" return (n*n + n*n)**0.5 sides = 3.7 print hypotenuse(sides) [/code]Any ideas how to do this?

Member Avatar for jrcagle
0
639
Member Avatar for trihaitran

Hi I'm writing a programme that looks up data from 3 different Chinese dictionaries and then formats and displays them in html using the default browser of the system. So far it works well, but it could be better. The issue I have here is that I want each character …

0
68
Member Avatar for the_python

im making this game that is called PyTanks. If you want to know more about it please visit [URL]http://pythongaming.py.funpic.org/pythonmadegames.html[/URL] ... Anyway, I ran across this problem, how do you delet or remove a letter from a string. Lets say that my string is- string = "open sesame" I want to …

Member Avatar for jrcagle
0
5K
Member Avatar for pinder

Hi, I need to grab a specific information in the /proc/cpuinfo (MODEL NAME) and print it on the screen in python. How do I do that. Thx for helping this newbie

Member Avatar for pinder
0
97
Member Avatar for R.S.Chourasia

Hi, I am making a site in which I have to run an sql query on the oracle database. I have to take the condition for query from the selected entries in dropdown list i.e. the condition is based on the entris in the dropdown list entries. I am using …

0
73
Member Avatar for aot

I want to have radiobuttons with text that is displayed underneath the actual buttons. Is there a way to do this (within the contents of the Radiobutton widget, that is, not resorting to labels)? I know this question is ridiculously simple, but I haven't been able to find anything in …

Member Avatar for jrcagle
0
82
Member Avatar for Lardmeister

I don't seem to be able to save a number to a data file: [code]a = 123.44 f = open("data1.dat", "w") f.write(a) f.close() [/code] I get this message: [code]Traceback (most recent call last): File "<string>", line 204, in run_nodebug File "C:\Python25\ZLM\int2file.py", line 4, in <module> f.write(a) TypeError: argument 1 must …

Member Avatar for mawe
0
1K
Member Avatar for jrcagle

Hi all, My class uses Python 2.4.3/2.4.4, pygame 1.7.1, and a livewires wrapper on top of that, running on WinXP on Dell machines. Frequently ... perhaps once per day per 2 students more or less? ... a student will attempt to open a file and IDLE will suddenly quit and …

Member Avatar for vegaseat
0
148
Member Avatar for scru

sigh... I need a way to make an image as a background for a window, and still be able to put buttons and other controls on top of it. I even tried using wxPython's wxPanel, but it proved a real pain because I found the documentation very sparce...:sad: (google didn't …

Member Avatar for vegaseat
0
2K
Member Avatar for aot

Thanks to mawe and Jeff for answering my first question. Next question: is there a way to get Tkinter to display the window without a title bar? I'm an experimental psychologist, and I don't want my participants to easily be able to exit my experiments... so hints on disabling alt-tab …

Member Avatar for scru
0
16K
Member Avatar for chris99

How do I do this? In JustBasic I simply read from a text file and coverted the letter it found into an image that it loaded. I want it to load the image I need with this class: [CODE]def load_image(name, colorkey=None): """When this statement is accessed, coupled with the name …

Member Avatar for vegaseat
0
813
Member Avatar for jrcagle

So this isn't a Python question exactly, but the code is in Python, so there it is. I have a mostly-working version of pacman -- currently, one monster v. pacman -- that includes the usual features: eat the power-up, chase the blue or flashing ghosts, get points. When a ghost …

Member Avatar for G-Do
0
2K
Member Avatar for wandie

:sad: Please could some please help me out here . I have an array. I want to count how my 'a' appear and the a must have its quotes 'a' [code][(' ', ' ', [('a', 'Scott'), ('9', 'vth')]), (' ', ' ', [('a', 'Jenny'), ('9', 'vth')])][/code] Like this one has …

Member Avatar for wandie
0
838
Member Avatar for mouigher

I saw this was in a earlier post, but I need some addition help with it. I need help please to write this [URL="http://www.daniweb.com/techtalkforums/thread39939.html#"]program[/URL]. Numerologists claim to be able to determine a person's character traits based on the "numeric value" of a name. The value of a name is determined …

Member Avatar for mawe
0
197
Member Avatar for jwintersmith

I recently discovered that Python list assignment does not work quite the way I expected it to, as illustrated below: >>> a = [1,2,3] >>> b = a >>> b.append(4) >>> b [1, 2, 3, 4] >>> a [1, 2, 3, 4] >>> I was expecting this to create a …

Member Avatar for vegaseat
0
107
Member Avatar for Blujacker

i have problem with this code: [CODE] def __init__(self,parent): data = [(1,2), (2,3), (3,5), (4,6), (5,8), (6,8), (10,10)] self.okno=wx.Frame(None,title="Graf",id=-1) sizer=wx.BoxSizer(wx.HORIZONTAL) ram=wx.Panel(self.okno) client = plot.PlotCanvas(ram) line = plot.PolyLine(data, legend='', colour='pink', width=1) gc = plot.PlotGraphics([line], 'Line Graph', 'X Axis', 'Y Axis') client.Draw(gc, xAxis= (0,15), yAxis= (0,15)) sizer.Add(ram,1,0,wx.ALL) self.okno.SetSizer(sizer) self.okno.Layout() self.okno.Show(True)[/CODE] why plot …

Member Avatar for vegaseat
0
257
Member Avatar for Blujacker

[code] from Tkinter import* Label(text=u'\u2208').pack() mainloop() [/code] i am trying to do that same in Wx, but i always get UnicodeError: [code] import wx okno = wx.App(0) frame=wx.Frame(None) wx.StaticBox(frame,label=u'\u2208') frame.Show(True) okno.MainLoop() [/code] and the eror is: [code] Traceback (most recent call last): File "C:\Documents and Settings\Blu\Plocha\aa.py", line 4, in -toplevel- …

Member Avatar for Blujacker
0
199
Member Avatar for sneekula
Member Avatar for vegaseat
0
115
Member Avatar for Matt Tacular

Hi everyone, for the past few months, I've been writing a text based version of the risk boardgame for my grade 12 programming isu(i plan for it to be windows based by the time I'm done). But I come across the occasional bug which is hard to find and fix. …

0
57

The End.