15,185 Topics
| |
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? | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
: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 … | |
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 … | |
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 … | |
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 … | |
[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- … | |
How can I best find out how many times a word appears in a text? | |
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. … | |
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 … | |
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 … | |
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 … | |
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 … | |
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.;) | |
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 … | |
I know that you can do integer calculation in Python with astronomically large numbers. What is the precision limit when using floats? | |
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? | |
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 … | |
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 … | |
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 … |
The End.