Hi.
I'm writing a program that is dependent on the curses library and
functions for python, and I'm a little puzzled by the way characters
are handled. The basics of the program are that a character is taken
from input and put into a certain position within a list (There's more
to it than that, but I think it's irrelevant). The problem is, when a
character is taken via the <window>.getch( ) function, what comes back
is an int corresponding to it's value ('a' = 97, 'b'=98, etc.). Now,
what I need to store is the character representation of this function -
it's not enough to simply have the 97/98 in the list, I need the 'a',
'b', etc.
Does anyone know of a solution to this, ideally in the form of a
built-in function that takes these numbers and returns the proper
character value? Obviously, str(<value>) doesn't work, as it just
returns '<value>'. I've read as many docs as I could lay my hands down,
and while the ord() function is useful for going the other way
(character to int), I need the reverse.
If there's any other information you need in relation to this problem,
I'll post it, of course.
Thanks in advance. 3 1385 st************@ gmail.com wrote: Hi.
I'm writing a program that is dependent on the curses library and functions for python, and I'm a little puzzled by the way characters are handled. The basics of the program are that a character is taken from input and put into a certain position within a list (There's more to it than that, but I think it's irrelevant). The problem is, when a character is taken via the <window>.getch( ) function, what comes back is an int corresponding to it's value ('a' = 97, 'b'=98, etc.). Now, what I need to store is the character representation of this function - it's not enough to simply have the 97/98 in the list, I need the 'a', 'b', etc.
Does anyone know of a solution to this, ideally in the form of a built-in function that takes these numbers and returns the proper character value? Obviously, str(<value>) doesn't work, as it just returns '<value>'. I've read as many docs as I could lay my hands down, and while the ord() function is useful for going the other way (character to int), I need the reverse.
chr(97)
'a' If there's any other information you need in relation to this problem, I'll post it, of course.
Thanks in advance.
Alle 10:46, domenica 09 aprile 2006, st************@ gmail.com ha scritto: Does anyone know of a solution to this
I still learning python, but probably some documentation is the basis of
learning, rather than ask at the list.
I suggest to see at http://docs.python.org/ for actual and growing python
functions and/or builtins.
F This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian Alexander |
last post by:
Hello;
I am trying to determine all of the cell attributes active on a given
cell of a curses window. I start by getting a value that contains the
attribute and character at the specified location ...
cellValue = windowHandle.inch(y, x)
Now, I have to pull out the attributes (MSB) ...
|
by: Brian |
last post by:
Hello;
I'm writing a program with curses in python and having a bit of trouble
understanding how to use unittest. So far, I have used testing
successfully -- as long as the report goes to stdout (or does unittest
write to stderr?)
The curses part of the program seems to affect unittest's writing of the
report. The screen is not what the report expects, so a lot of
information is in the wrong place after the program exits. (I actually...
|
by: Magnus Lie Hetland |
last post by:
I'm playing around with curses, and have had some problems with
that... For example, I can't make colours work in Python, although
several other curses-based programs use colours on my box. (ncurses, I
suppose -- and some maybe slang?) Does Python use ncurses now -- or?
But the colours aren't that important. More important is my inability
to get latin 1 characters to work in Textpad objects. (I can't get the
page up/down and backspace...
|
by: Peter |
last post by:
Last November I posted a message asking for advice on using simple
screen handling techniques under Windows. Since then I have been
occupied with family / job /Christmas /living and trying to
understand curses under linux (it works, seems very complex, sure I'm
missing something ...). Only now am I returning to my original query.
One reply (in fact the only reply - thanks Tim Golden) suggested I
look at...
|
by: M.Senthil Kumar |
last post by:
hai all,
I need a help from you. I 'm working in a project using "curses.h" in
Linux using 'C'. I have some doughts regarding menus and line.
1. I used to draw box in window using ACS_HLINE,ACS_VLINE. But what
happened is, the line is not a straight line. Instead of that it look
continus hypen ( - ) for HLINE and continuous ( | ) for VLINE.
I'm using curses version : 5.3.20030118 came along with RedHat 9.0 .
Please tellme how to draw...
| |
by: Daniele C. |
last post by:
As soon as my sourceforge.net project gets approved, I am going to
build a ncurses port to win32 bindable to sockets, e.g. allowing
VT100/ANSI terminals and the creation of simple terminal servers using
the ncurses API for the UI. I plan to initially support only a subset
of the ncurses lib, leaving the lib open to expansion/completion.
Please stop me if I am going to reinvent the wheel, and tell me if
there are any libraries of this...
|
by: Gasten |
last post by:
Hello.
The last weeks I've been coding a roguelike (you know, like nethack) in
python using the nCurses library. Some week ago I ran into a problem:
When I made the object for messagebar-output, I found a bug that I
can't figure out (believe me; I've tried everything and asked for help
several times on the IRC-channel).
The updateMsg() and iMsg() takes a list of message-lines as argument
(or process a string to a list), and it'll output...
|
by: 7stud |
last post by:
I can't see to get any y, x coordinates to work with curses. Here is
an example:
import curses
def my_program(screen):
while True:
ch = screen.getch()
if ch == ord("q"):
break
|
by: Jimmy |
last post by:
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
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |