15,406 Topics

Member Avatar for
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
847
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
202
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
112
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
262
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
207
Member Avatar for sneekula
Member Avatar for vegaseat
0
118
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
60
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
441
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
240
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
84
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
116
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
70
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
127
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
165
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
161
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
161
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
115
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
207
Member Avatar for saintlysav

I have a complicated problem at hand, and im open to any suggestions for solving it. Im working with a program called Psi which is written in C and has the GUI in Tcl/tk. A guy working on this earlier added 2 functions to get and set some properties of …

Member Avatar for saintlysav
0
116
Member Avatar for Matt Tacular

I have an image being displayed in a Tkinter window. I need a way to add letters to the image in certain spots depending on what is done by the user. Example: if button 1 is pressed, the peoples names appear over their heads, but I can't just switch the …

Member Avatar for mawe
0
3K
Member Avatar for Acolyte

Hello, I have a simple script with 2 buttons positioned vertically within a sizer on a panel. A button-click event attached to the top button changes the height of the top button. However, even though the height of the top button changes, the height of the bottom button does not …

Member Avatar for Acolyte
0
89
Member Avatar for chris99

I am trying to follow the tutorial on making the whack-a-monkey game, but it keeps giving me this error message: [QUOTE] Traceback (most recent call last): File "C:/Documents and Settings/Christopher/My Documents/pygame/examples/examples/monkeystuff.py", line 128, in -toplevel- chimp = Chimp() File "C:/Documents and Settings/Christopher/My Documents/pygame/examples/examples/monkeystuff.py", line 66, in __init__ screen = pygame.display.get_suface() …

Member Avatar for bumsfeld
0
284
Member Avatar for muddpigeon

hey there, i have a piece of coursework to be handed in tomorow and i am struggling to get this new bit of code that has been issued right. i have to write the pseudocode for an atm machine and one of the procedures is to validate a pin number. …

Member Avatar for muddpigeon
0
84
Member Avatar for aot

Hi, I'm a noob Python/Tkinter user, and I'm finding that gathering information on the two is not as easy as I'd like... hopefully you guys will be able to help. My first question: I was just wondering if there's a way to tell Python, "take all the files in X …

Member Avatar for mawe
0
100
Member Avatar for scru

Hi. SInce you guys were so helpful the last time around, I decided to ask a less pressing, but more casual questions. My friends and I want to build a private p2p client (connects to our computers through this client to share files and do messaging), just for the heck …

Member Avatar for scru
0
113
Member Avatar for kharri5

Hello, I have a program written up that is trying to use buttons to turn on and off the radiobuttons themselves. IF the user clicks on the radiobutton itself, then it should have no affect. This simulates a sort of UI touch screen affect, with the radiobuttons themselves looking like …

0
61
Member Avatar for jrcagle

I'm re-creating the classic PacMan for the fun of it and needed a way to translate back and forth between directions and dx, dy for a sprite. Here was a fun solution that avoided cumbersome if...elif...elif...elif... chains. Any thoughts on readability, efficiency? Specifically, if this gets called by 4 monsters …

Member Avatar for jrcagle
0
97
Member Avatar for sneekula
Member Avatar for sneekula

This could be a cooking recipe, but in my case it is a chemical recipe. Here is a typical generic chemical recipe: 23 g chemicalA is dissolved in 250 ml methanol. The solution is cooled to 0 - 5 degC and 18 ml compoundB is added dropwise over 60 minutes. …

Member Avatar for jbennet
0
212
Member Avatar for chris99

[CODE] def classCreate(self): self.classChoose = Toplevel(root) self.classChoose.title('Choose your Class') self.classChoose.geometry('300x200+300+400') self.labelChoose = Label(self.classChoose, text="Select the class you wish to be") self.labelChoose.grid(row=0) self.listClass = Listbox(self.classChoose, height=4) self.listClass.grid(row=1) self.listClass.insert(END,"Warrior") self.listClass.insert(END,"Brute") self.confirm = Button(self.classChoose, text="Confirm", command=self.confirm) self.confirm.grid(row=2) def confirm(self): fileClass = open('ClassData.txt','r') for line in fileClass: classInfo=line.split(',') print "Name is:", self.Name print "This …

Member Avatar for chris99
0
99
Member Avatar for danizzil14

Ok, all I want ot know is how to close a script on command, lie type 3 to exit, what modules do i need to import and what is the command, I have everything else sorted out... EDIT: The close command will go in a if statement, which is in …

Member Avatar for ghostdog74
0
166
Member Avatar for mattyd

I am at the end of a build and am putting some minor touches on and testing; one area I suppose I took for granted (and have honestly not seen a need yet to fully deal with) is the Tkinter buttons. The buttons perform fine overall as to their function; …

Member Avatar for mattyd
0
18K
Member Avatar for sneekula

Is there a way to preselect/highlight a listbox item with the Tkinter GUI toolkit at the startup of the program without clicking the mouse on it?

Member Avatar for sneekula
0
1K
Member Avatar for scru

Hi. I've just registered, but I'm not exactly new to here (i've been lurking as a guest). I'm trying to make a countdown timer based on a class that I created, which accepts hours, minutes, and seconds as parameters and counts them down to zero, will displaying them in a …

Member Avatar for scru
0
828
Member Avatar for mattyd

I am searching for the syntax that will allow me to arrange widget buttons in a Tkinter GUI in a specific manner; currently I have three (3) buttons that are stacked[I] vertically[/I] on top of one another. I wish to arrange the buttons so that they form a row of …

Member Avatar for mattyd
0
3K
Member Avatar for mattyd

[U][B]I have two questions regarding Tkinter GUIs[/B][/U]:[LIST=1] [*]I have three buttons in a GUI; at times it seems that the buttons "stick". By this I mean when the mouse is clicked on one it may activate or it [I]may not[/I]. They all work correctly in regards to there function(s) but …

Member Avatar for mattyd
0
189
Member Avatar for chris99

I have the commands all ok, but even though the syntax is correct, the pic won't display. Here's the zip.

Member Avatar for Ene Uran
0
142
Member Avatar for AussieCannon

Hello, I am very new to python (a few days) and am wondering how i should go about generating random gridpoints and comparing them to ones inputted by the user. I am completely lost on how i can get the input of the x and y coordinates from the user …

Member Avatar for vegaseat
0
444
Member Avatar for vijay.neo

Hi All, Basically I (myself Vijay) am a C/C++ developer as i want to implement generic data type in C. i was searching in the google. then i come across similar kind of implementation in the python develoer chain. i was going through some of the mailing chain in [python-dev] …

Member Avatar for vegaseat
0
84
Member Avatar for defience

I'm still new to python and need some help writing a program. I need to write one that runs a *.exe and then checks some timings in it. There are 3 numbers ranging from 0<1000 that are hidden in the *.exe(app.exe). If the script runs the app.exe and then runs …

Member Avatar for vegaseat
0
158
Member Avatar for defience

I'm new to Python and this was written and posted by someone else on another site as a tutorial for a word unscrambler. I thought it was well written and liked the explanations but I tried to use it but keep getting an error message: line 27, in <module> letters …

Member Avatar for defience
0
127
Member Avatar for Shark7

I need to calcualte the scalar product given two lists of numbers... [code]v1=input("Insert the first vector: ") v2=input("Insert the second vector: ") for i in range(len(v1)): v3=v1[i]*v2[i] print v3 [/code] this code will multiplie all the numbers in list v1 and the numbers in list v2 but the result doesn't …

Member Avatar for Shark7
0
355
Member Avatar for vivekr

Is it possible to merge together python and javascript.. I am looking forward to fetching the contents of a webpage, parse them and use them in a webpage from javascript. I am a beginner in javascript and i couldn't find any means to fetch the contents(The webpage's entire source code) …

Member Avatar for bumsfeld
0
69
Member Avatar for Matt Tacular

First of all, let me exaplain that I only really know python. I thought I would give c++ a try and since then (about two days ago), I have read a few tutorials and have made a guess number game. I thought I would be able to rewrite one of …

Member Avatar for Matt Tacular
0
241
Member Avatar for chris99

What am I doing wrong, I've done it before! [CODE]class Main: def __init__(self, master): self.master = master self.master.title('Role Playing Form V1.0') self.master.geometry('300x250+350+450') self.master.mainloop() self.cmdCreate = Button(self.master, text='Create Character', command=self.create) self.cmdCreate.grid(row=0) def create(self): pass root = Tk() main=Main(root)[/CODE] the button doesn't appear!

Member Avatar for bumsfeld
0
140
Member Avatar for fonzali

hi everybody , I am new to python and interested in graphics . I like somebody to walk me thru monthly calendar using tkinter . I have already printed 07 calendar using python but I am stuck when it comes to use it with tkinter . it is no homework …

Member Avatar for vegaseat
0
4K
Member Avatar for Jergosh

I'm working on an IM client in Python and my idea was to make it fully modular. It seemed to me that the obvious approach is to make all plugins derive from a Plugin class (with ProtocolPlugin, UIPlugin subclasses) and to be loaded on program startup by yet another object, …

Member Avatar for woooee
0
98
Member Avatar for bumsfeld

Decided to start my own thread rather than hijack thread "Sorting" I followed ghostdog74 advice and used module re to extract numeric strings: [php]import re data_raw = """[20] [ 35+ ] age = 40 (84) 100kg $245 """ # use regex module re to extract numeric string data_list = re.findall(r"\d+",data_raw) …

Member Avatar for bumsfeld
0
1K
Member Avatar for sneekula

I keep reading threads here, some use the Tkinter GUI toolkit and others use the wxPython GUI toolkit. Why would one use one or the other?

Member Avatar for sneekula
0
1K

The End.