15,185 Topics

Member Avatar for
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
642
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
69
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
98
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
74
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
84
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
158
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
17K
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
815
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
840
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
200
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
109
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
258
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
202
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
58
Member Avatar for mattyd

I have read that Python does [I]not[/I] have built-in support for multi-dimensional arrays-- is this still the case or has this been developed and updated in the last few years for this language? I have researched this and seen references to multi-dimensional arrays and various work-arounds: dictionaries, lists, and various …

Member Avatar for jrcagle
0
436
Member Avatar for alba07

I am to create an old-style class with a constructor __str__, and accessor methods, such that the following code: abook = Book(author = "Amy Doe", title = "Sun rise", price = 13.50) print abook.getAuthor() print abook.getTitle() print abook.Price() print abook Output should be as follows: Amy Doe Sun Rise 13.50 …

Member Avatar for jrcagle
0
237
Member Avatar for alba07

I am supposed to design a GUI for ls, where the user could select these options from pull down menus. After the user selects options, clicking on go should run the ls. The way I am understanding this is that could either use a text widget or labels. Here is …

Member Avatar for alba07
0
80
Member Avatar for itajit

Hi Im usig SWIG with Python and facing problem in compiling the wrap file genereted by the SWIG. The error is can not open include file Python.h.And hence the object file of wrap file can not be generated, so plzzzzzzzz help me by suggesting the steps for the prob I …

Member Avatar for vegaseat
0
114
Member Avatar for caranjo

Hi, I am new to python (in fact this is my 2nd day learning it) I was given code that resembles: [code] if xyz #do abc return x else return y return[] [/code] What does the return[] do? Sorry if this is a stupid question.;)

Member Avatar for ghostdog74
0
67
Member Avatar for R.S.Chourasia

Hi, I am using SWIG to generate the wrapper for python i.e. I am tring to correlate the c++ and python2.4. I am using the windowsXP platform with Visual Studio 2005 Editor and the Turbo c++ complier. The problem is that after Generating the c++ file and the python file …

Member Avatar for bumsfeld
0
123
Member Avatar for sneekula

I know that you can do integer calculation in Python with astronomically large numbers. What is the precision limit when using floats?

Member Avatar for vegaseat
0
161
Member Avatar for sneekula

I know you can get the present time this way: [code]import time now = time.asctime(time.localtime()) print now # Mon Feb 19 10:41:32 2007 [/code]How can I make sure that 'now' does not fall on our lunchtime break, let's say 11:30AM to 12:45PM?

Member Avatar for sneekula
0
158
Member Avatar for fonzali

hi , thanks for the code , I have changed it a little bit , I have also added two buttons (+,-) I have written the code for (+) but it does not work , can you tell me what the problem is , the last lines which are commented …

Member Avatar for sneekula
0
160
Member Avatar for aot

I've been having a lot of trouble with the [inlinecode]after[/inlinecode] method. What I want to do is show a series of images at the push of a button/press of a key -- each image should appear for 500ms, then be replaced by the next image, which should go on indefinitely …

Member Avatar for Ene Uran
0
110
Member Avatar for scru

I know I've been told before to use C++ sockets...and I will if this doesn't work out, but that was before I even knew python had sockets. Now. The problem here if that my socket enabled program seems to work perfectly well on a LAN, but not over the internet …

Member Avatar for scru
0
203

The End.