(curses) issue about inch()

Jimmy mcknight0219 at gmail.com
Sun Sep 16 12:41:08 EDT 2007


On Sep 17, 12:07 am, Steve Holden <st... at holdenweb.com> wrote:
> Jimmy wrote:
> > hi, all
> > I attempt to use the function inch() to get the character at the
> > current position, and compare it with a particular character like :
> > if screen.inch(x,y) == 'F'
> > but this method doesn't seem work, can anyone tell me the reason and
> > how to corrent it
> > thanks
>
> The reason is because something is wrong, and yo fix it by correcting
> that issue.
>
> In other words, if you could be a bit more specific about *how* it
> doesn't work (like, show us the code you are running,a nd any error
> messages or evidence of incorrect results) you will be able to get some
> help that actually helps you.
>
> Would you go to a car repair shop with faulty brakes and just tell them
> "my car isn't working"?
>
> regards
>   Steve
> --
> Steve Holden        +1 571 484 6266   +1 800 494 3119
> Holden Web LLC/Ltd          http://www.holdenweb.com
> Skype: holdenweb      http://del.icio.us/steve.holden
>
> Sorry, the dog ate my .sigline

thanks,
actually i'm writing a game like mine,the pertainign code is:

def mark():
	"""mark the bomb"""
	(row, col) = gb.scrn.getyx()
	x = gb.scrn.inch(row,col)
	if x == 'F':
		gb.scrn.addch(row,col, 'X',curses.color_pair(3))
	else:
		gb.scrn.addch(row,col, 'F',curses.color_pair(3))

	gb.scrn.move(row,col)
	gb.scrn.refresh()

the situation is x never equals 'F', even when it really is!
I checked the mannual and found the return value of inch() consists
the actual character(low 8bits)
and the attributes, so I tried the following: (x<<24)>>24,cause I
guess the int is 32bits long.
but it still doesn't work :(




More information about the Python-list mailing list