Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 19th, 2004, 01:06 PM
bnorton916 bnorton916 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 52 bnorton916 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m
Reputation Power: 6
curses

Trying to get a simple learning program working. It works fine except I see a cursor(which I don't want). I have tried noecho and leaveok but both don't seem to make a difference.

My python is primitive but here goes:

Code:
import curses
screen = curses.initscr()
curses.noecho()

screen.box()
screen.leaveok(1)

x=4
y=4
while 1:
      screen.addch(y, x, "@")
      c = screen.getch()
      if c==ord('j'): y=y+1
      elif c==ord('k'): y=y-1
      elif c==ord('h'): x=x-1
      elif c==ord('l'): x=x+1
      elif c == ord('q'): break


Running the program just creates a box and you move around a '@' using vi keys. But the program shows a @ symbol with a blocky cursor always to the right of it.

I have googled I have read, no luck. Help.

Edit: added [CODE] tags...

Last edited by netytan : January 19th, 2004 at 06:16 PM.

Reply With Quote
  #2  
Old January 19th, 2004, 08:24 PM
oxygenthief oxygenthief is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 35 oxygenthief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Try curses.curs_set(0) to remove the cursor.

Reply With Quote
  #3  
Old January 20th, 2004, 07:18 AM
bnorton916 bnorton916 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 52 bnorton916 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m
Reputation Power: 6
Thanks

OK, I could have swore I tried that before but received an attribute error.

But it works now, so I must have had a typo, so confused.

But my sincere thanks.

Bill

Reply With Quote
  #4  
Old January 20th, 2004, 05:10 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 18 m 50 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Those of you on windows (me included) may be interested in the wCursors module...

http://flangy.com/dev/python/curses/

Basically this module seems to be a clone of Pythons core cursor module for windows

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > curses


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway