473,591 Members | 2,871 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

curses : unexpected behaviour with pad

Hi,
I'm writing some widgets in curses.
Actually I'm trying to write a combobox. To do so, I need to create a pad
inside a panel, so that I can hide/show it.

I can't do it.

I can create a normal pad, but if I try to create it using "subpad" from a
window I get
_curses_panel.e rror: curses function returned NULL
, if the pad is greater than the window. But aren't pad supposed to be
greater than windows ?

If I create a pad and I try to attach it to a panel, with
panel.new_panel (pad)
I get again
_curses_panel.e rror: curses function returned NULL

I need to have a pad to show/hide.
Am I doing something wrong ?

Here comes what I do

########
import curses
from curses import panel

def main(stdscr):
pad = curses.newpad(1 00, 100)
pad.bkgd('x',0)
pad.refresh( 0,0, 5,5, 15,15)
pad.getch()

def main_1(stdscr):
win=curses.neww in(0,0)
pad=win.subpad( 100,100) #<--- error
my_pan=panel.ne w_panel(win)
pad.bkgd('x',0)
pad.refresh( 0,0, 5,5, 15,15)
panel.update_pa nels()
curses.doupdate ()
pad.getch()

def main_2(stscr):
pad = curses.newpad(1 00, 100)
a_panel= panel.new_panel (pad) #<--- error
pad.bkgd('x',0)
pad.refresh( 0,0, 5,5, 15,15)

panel.update_pa nels()
curses.doupdate ()
pad.getch()

if __name__=='__ma in__':
curses.wrapper( main)
#curses.wrapper (main_1)
#curses.wrapper (main_2)
########

Thank you,
Riccardo

--
-=Riccardo Galli=-
_,e.
s~ ``
~@. ideralis Programs
.. ol
`**~ http://www.sideralis.net
Jul 18 '05 #1
1 3287
> def main_1(stdscr):
win=curses.neww in(0,0)
pad=win.subpad( 100,100) #<--- error
I found that the behaviour of curses silently considers
subpad of a WINDOW object as also a WINDOW instead of PAD,
whether you uses subpad or subwin. try:

win=curses.newp ad(0,0)
pad=win.subpad( 100,100)
def main_2(stscr):
pad = curses.newpad(1 00, 100)
a_panel= panel.new_panel (pad) #<--- error


Panel does not support PAD. you must use WINDOW. this should
works:

pad = curses.newwin(1 00, 100)
a_panel= panel.new_panel (pad)

--
Best regards,
dody mailto:do**@pos taccesslite.com












Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1830
by: AK | last post by:
Hi, I have a medium sized app that I'm transferring to use curses. What happens is very very strange.. I am at my wits' ends. I worked with it all day yesterday and couldn't figure it out. Today morning I thought about it and still nothing. I hope that some curses expert can figure out what's wrong from my description. I'm very new to curses so I am not sure I know which details are crucial, so please answer me if you need more...
0
392
by: AK | last post by:
Hi, I have a medium sized app that I'm transferring to use curses. What happens is very very strange.. I am at my wits' ends. I worked with it all day yesterday and couldn't figure it out. Today morning I thought about it and still nothing. I hope that some curses expert can figure out what's wrong from my description. I'm very new to curses so I am not sure I know which details are crucial, so please answer me if you need more...
2
2162
by: Gerhard Esterhuizen | last post by:
Hi, I am observing unexpected behaviour, in the form of a corrupted class member access, from a simple C++ program that accesses an attribute declared in a virtual base class via a chain of virtual method calls. To further complicate (or perhaps simplify) matters, some compilers (GCC and MingW) produce the expected behaviour, while others (MSVS 7.1) do not. I can only offer two explanations for my observations: 1. The Microsoft...
1
9136
by: Nick ! | last post by:
Chris Share <usenet at caesium.me.ukwrote: http://web.cs.mun.ca/~rod/ncurses/ncurses.html#xterm says "The ncurses library does not catch signal, because it cannot in general know how you want the screen re-painted". First, is this really true? When I make my xterms smaller they clip what is displayed--is that a function of curses or the xterm? Second, if true, it explains /what/ is going on--stdscr, only--, but isn't really...
0
7870
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,...
0
8362
jinu1996
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...
1
7992
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8225
tracyyun
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...
0
6639
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5732
isladogs
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...
0
3850
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...
1
1465
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.