snack form question
Grant Edwards
grante at visi.com
Fri Sep 28 10:27:50 EDT 2001
More information about the Python-list mailing list
Fri Sep 28 10:27:50 EDT 2001
- Previous message (by thread): snack form question
- Next message (by thread): vb's cDate equivalent with COM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <2990527.oFCf946Emh at lunix.schabi.de>, Markus Schaber wrote: >> Is it just me, or is do all widgets added to a form end up at >> cooridnates (-1,-1)? >> >> All widgets get created with a location of (-1,-1) and there >> doesn't seem to be any way to change the widget's location on a >> form... > > It would be very helpful to tell us which widget module you > use. I'm using the snack module. It's a python wrapper for the text-mode UI library "newt" (which uses slang for low level stuff). > Also, some code snipplets that create those widgets (or a > reproducible description how you do it using an interface > designer) would be helpful. OK, here's an example: import time from snack import * screen = SnackScreen() screen.centeredWindow(40,12,"Example Code") f = Form() f.add(Label("Label Text")) f.draw() screen.refresh() time.sleep(2) screen.finish() The label containing "Label Text" appears at location (-1,-1). When a Label object is created, the position is initialized like so: static snackWidget * labelWidget(PyObject * s, PyObject * args) { char * label; snackWidget * widget; if (!PyArg_ParseTuple(args, "s", &label)) return NULL; widget = snackWidgetNew (); widget->co = newtLabel(-1, -1, label); return widget; } The call to newtLabel() creates a label widget and initializes its postition to -1,-1. In C applications that use newt, widgets that are positioned on forms by passing the x/y coordinates to newtLabel() et al when the widget is created. I can't find any methods (of either the widget or the form) that allow the position of the widget to be changed. However, if you put the widget on a Grid instead of a Form, the grid's add() method includes row/colum info that is used by the grid to control the position of the widget. For my application I can just use a Grid instead, but it seems like there's something missing... -- Grant Edwards grante Yow! Is it NOUVELLE at CUISINE when 3 olives are visi.com struggling with a scallop in a plate of SAUCE MORNAY?
- Previous message (by thread): snack form question
- Next message (by thread): vb's cDate equivalent with COM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list