473,769 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[PMW 1.2] Dialog controls vanish upon editing

Hi all,

I use PMW 1.2 on Python 2.3.0 on Win2k.

I've created a dialog that looks like so:

+----------------------+
Name | |
+----------------------+
+----------------------+
Caption text head | |
+----------------------+
+----------------------+
# Digits w/o sign | |
+----------------------+
+----------------------+
Caption text tail | |
+----------------------+
+--+
Is editable | |
+--+
+--------------------+-+
Parameter name | |V| Drop-down.
+--------------------+-+
I pull down the drop-down control, select an item, the drop-down closes
and - vanishes. All controls have vanished. After half a second or so the
first one reappears, but w/o its label 'Name'.

The other ones reapper if I click onto the pane where they are supposed to
be. They also reapper if I change to an other app and then come back again.
I guess this is because a window update is issued by the OS.

What do I miss?
Many thanks in advance and kind regards
Franz GEIGER
Code:

class QCWidgetNumberE ditor(_Editor):
'''
+----------------------+
Name | |
+----------------------+
+----------------------+
Caption text head | |
+----------------------+
+----------------------+
# Digits w/o sign | |
+----------------------+
+----------------------+
Caption text tail | |
+----------------------+
+--+
Is editable | |
+--+
+--------------------+-+ Drop-down. Offers only
existing
Parameter name | |V| parameters, i.e. you have to
first
+--------------------+-+ create at least one parameter.
'''

def __init__(self, parent, x, y, traits=None):
_Editor.__init_ _(self, parent)
self._pos = (x, y)
self._traits = traits
self._isEditabl e = Tkinter.IntVar( 0)
self._createAnd PackEntryFields _()
return

def traits(self):
return self._traits

def _createAndPackE ntryFields_(sel f):

w = Tkinter.Label(s elf.interior(),
pady = 20
)
w.pack(expand = 1, fill = 'both', padx = 4, pady = 4)

parent = w

# Create and pack the EntryFields.
nameId = ''
if self._traits:
nameId = self._traits.na me()
self._tkwNameId = Pmw.EntryField( parent,
labelpos = 'w',
value = nameId,
label_text = 'Name of number
control:',
validate = self._validateN ameId_,
modifiedcommand =
self._onChanged NameId_,
command = self._onNameId_
)
textDisplayed = ''
if self._traits:
textDisplayed = self._traits.te xtHead()
self._tkwTextDi splayedHead = Pmw.EntryField( parent,
labelpos = 'w',
value = textDisplayed,
label_text = 'Caption text
head:',
# validate = {'validator' :
'real',
# 'min' : 10,
'max' : 99, 'minstrict' : 0
# },
modifiedcommand =
self._onChanged TextDisplayedHe ad_
)
textDisplayed = '1'
if self._traits:
textDisplayed = str(self._trait s.numDigitsExcl Sign())
self._tkwNumDig itsExclSign = Pmw.EntryField( parent,
labelpos = 'w',
value = textDisplayed,
label_text = '# Digits w/o
sign:',
validate = {'validator' :
'integer',
'min' : 1,
'max' : 5, # 'minstrict' : 0
},
modifiedcommand =
self._onChanged NumDigits_
)
textDisplayed = ''
if self._traits:
textDisplayed = self._traits.te xtTail()
self._tkwTextDi splayedTail = Pmw.EntryField( parent,
labelpos = 'w',
value = textDisplayed,
label_text = 'Caption text
tail:',
modifiedcommand =
self._onChanged TextDisplayedTa il_
)

if self._traits:
self._isEditabl e.set(self._tra its.isEditable( ))
else:
self._isEditabl e.set(0)
tkwIsEditable = Tkinter.Checkbu tton(parent,
variable=self._ isEditable,
text='Editable on target',
command=self._o nToggleIsEditab le_
)

paramNames = Proxy.DataProxy ().parameterNam es()
self._tkwParamN ame = Pmw.ComboBox(pa rent,
labelpos = 'nw',
scrolledlist_it ems=paramNames,
label_text="Par ameter name"
)
i = 0
if self._traits:
paramName = self._traits.pa rameterName()
try: i = paramNames.inde x(paramName)
except ValueError:
pass

try:
self._tkwParamN ame.selectitem( Proxy.DataProxy ().parameterNam es()[i])
except IndexError: pass

entries = (self._tkwNameI d,
self._tkwTextDi splayedHead,
self._tkwNumDig itsExclSign,
self._tkwTextDi splayedTail,
tkwIsEditable,
self._tkwParamN ame
)

for entry in entries:
entry.pack(fill ='x', expand=1, padx=10, pady=5)
Pmw.alignlabels (entries)

self._tkwNameId .component('ent ry').focus_set( )

return

def _execute_(self, event):
if event == 'OK':
nameId = self._tkwNameId .getvalue()
textDisplayedHe ad = self._tkwTextDi splayedHead.get value()
numDigits = int(self._tkwNu mDigitsExclSign .getvalue())
textDisplayedTa il = self._tkwTextDi splayedTail.get value()
isEditable = self._isEditabl e.get()
paramName = self._tkwParamN ame.get()
if nameId and numDigits > 0 and paramName:
param = Proxy.DataProxy ().parameters(p aramName)
self._traits = QCWidgetTraits. QCWidgetNumberT raits(nameId,
self._pos[0],
self._pos[1],

textDisplayedHe ad,
numDigits,

textDisplayedTa il,
isEditable,
paramName
)

self.deactivate ()
return

def _onChangedTextD isplayedHead_(s elf):
text = self._tkwTextDi splayedHead.get value()
return

def _onChangedNameI d_(self):
return

def _onChangedNumDi gits_(self):
text = self._tkwNumDig itsExclSign.get value()
return

def _onChangedTextD isplayedTail_(s elf):
text = self._tkwTextDi splayedTail.get value()
return

def _onToggleIsEdit able_(self):
return

def _onNameId_(self ):
return

def _validateFunNam e_(self, text):
return 1 # 2DO

def _validateNameId _(self, text):
if Proxy.DataProxy ().parameterExi sts(text):
return -1
return 1


Jul 18 '05 #1
2 1548
F. GEIGER wrote:
Hi all,

I use PMW 1.2 on Python 2.3.0 on Win2k.

I've created a dialog that looks like so:

+----------------------+
Name | |
+----------------------+
+----------------------+
Caption text head | |
+----------------------+
+----------------------+
# Digits w/o sign | |
+----------------------+
+----------------------+
Caption text tail | |
+----------------------+
+--+
Is editable | |
+--+
+--------------------+-+
Parameter name | |V| Drop-down.
+--------------------+-+
I pull down the drop-down control, select an item, the drop-down closes
and - vanishes. All controls have vanished. After half a second or so the
first one reappears, but w/o its label 'Name'.

The other ones reapper if I click onto the pane where they are supposed to
be. They also reapper if I change to an other app and then come back
again. I guess this is because a window update is issued by the OS.

What do I miss?
I would guess that
def _validateNameId _(self, text):
if Proxy.DataProxy ().parameterExi sts(text):
return -1
return 1


is either awfully slow and/or throws an exception.

You could easily verify this assumption with

(a)
def _validateNameId _(self, text):
return 1

and
(b)
def _validateNameId _(self, text):
try:
if Proxy.DataProxy ().parameterExi sts(text):
return -1
return 1
except: # generally a bad idea
print >> sys.stderr, "something went wrong"
return 1
Peter
Jul 18 '05 #2
Thanks Peter,

but this method doesn't seem to be the reason. I placed a "return 1" as the
first statement in its body. No change for the better.

Kind regards
Franz GEIGER

"Peter Otten" <__*******@web. de> schrieb im Newsbeitrag
news:bl******** *****@news.t-online.com...
F. GEIGER wrote:
Hi all,

I use PMW 1.2 on Python 2.3.0 on Win2k.

I've created a dialog that looks like so:

+----------------------+
Name | |
+----------------------+
+----------------------+
Caption text head | |
+----------------------+
+----------------------+
# Digits w/o sign | |
+----------------------+
+----------------------+
Caption text tail | |
+----------------------+
+--+
Is editable | |
+--+
+--------------------+-+
Parameter name | |V| Drop-down.
+--------------------+-+
I pull down the drop-down control, select an item, the drop-down closes
and - vanishes. All controls have vanished. After half a second or so the first one reappears, but w/o its label 'Name'.

The other ones reapper if I click onto the pane where they are supposed to be. They also reapper if I change to an other app and then come back
again. I guess this is because a window update is issued by the OS.

What do I miss?


I would guess that
def _validateNameId _(self, text):
if Proxy.DataProxy ().parameterExi sts(text):
return -1
return 1


is either awfully slow and/or throws an exception.

You could easily verify this assumption with

(a)
def _validateNameId _(self, text):
return 1

and
(b)
def _validateNameId _(self, text):
try:
if Proxy.DataProxy ().parameterExi sts(text):
return -1
return 1
except: # generally a bad idea
print >> sys.stderr, "something went wrong"
return 1
Peter

Jul 18 '05 #3

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

Similar topics

4
2479
by: F. GEIGER | last post by:
Hi again, I'd like to rename a page of a notebook. Deleting the page and adding a new one is not really an option, because the page is filled with other controls already. So I looked into Pmw.Notebook. There are quite a few lists and dicts which were to be changed and I wasn't successful in the first try. However, if nobody has ever done this, I'd have to rebuild the whole page after deleting/adding. I really hope there's an other way...
0
3077
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in the context of a main window. The problem does not occur on HPUX or Linux. The following simple example code illustrates the problem and the work around I've come up with; However, I'd like, very much, to get rid of the kludgy work around....
1
1819
by: Greg | last post by:
I'm trying to create a megawidget for file selection that contains a Label, EntryField, and Browse Button (that will open a tkFileDialog). The label positioning won't cooperate however, could anyone help with this? Here's what I want: labelpos='w': ---------------------- ------------ Filename: |c:\directory\file | |Browse... | ---------------------- ------------
1
2112
by: stewart | last post by:
I'm writing an app that requires a 3-level optionMenu display. Basically I'm showing the contents of a 3-dimensional matrix. You choose the first level in the first optionMenu, the 2nd level in the next level, and the 3rd level in the last optionMenu. Let's call them Continent,country,state. continentList = countryList = ,,] stateList = ,,],] When I open the window, all is well. I can display the following as default
0
2588
by: David Vaughan | last post by:
py2exe and Pmw problem ---------------------- I was really surprised not to find some faq setting out what to do to get py2exe working for a program using Pmw. I'm haemorrhaging time here, and I'm now just after step-by-step guidance on using py2exe and Pmw together. I wasn't expecting this to take hours... I've used py2exe succesfully on non-gui programs, and the Python program
10
2756
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a preview DIV) 2. when users close the dialog, the application receives the URL to the selected graphic. 3. the modal dialog lets the users upload a new graphic if the dialog does not present them with one they are already happy with. 4. upon uploading...
0
2359
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo widget, but for some reason the text is invisible on cygwin). After I close the Toplevel widget, all of the menus in my app behave as though they have no contents to them, i..e I can press on the File menu button, and see it depress, but the Exit...
0
765
by: nisyna | last post by:
I have a Pmw.ScrolledCanvas that shows some informations taken from an xml file that i have to dowload every time i open my application. But dowloading the files takes some time and I need to give some feedback to the users (now i wait about 3/4 seconds and than the main windows get opened but in the meantime I have no feedback). How can i show another window that says: "wait some seconds while I perform some operations"? I like the solution...
2
2134
by: Gord | last post by:
Is it possible to get a table type grid to appear on a custom dialog form? Basically, get the same thing as when you open a table in Datasheet view and can edit the individual columns. I'd like to make a custom dialog (free floating without the tab) with some textual instructions and then have a few records displayed (probably from a query) in a little table that looks and acts something like a table opened in Datasheet view. The...
0
9423
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
10210
Oralloy
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...
0
8869
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...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
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...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
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.