mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
*** empty log message ***
This commit is contained in:
parent
d2c7f32a74
commit
277ecc063e
@ -48,11 +48,11 @@ class FloaterWidget(Pmw.MegaWidget):
|
||||
INITOPT = Pmw.INITOPT
|
||||
optiondefs = (
|
||||
# Appearance
|
||||
('width', FLOATER_WIDTH, INITOPT),
|
||||
('height', FLOATER_HEIGHT, INITOPT),
|
||||
('relief', SUNKEN, self.setRelief),
|
||||
('borderwidth', 2, self.setBorderwidth),
|
||||
('background', 'white', self.setBackground),
|
||||
('width', FLOATER_WIDTH, INITOPT),
|
||||
('height', FLOATER_HEIGHT, INITOPT),
|
||||
('relief', RAISED, self.setRelief),
|
||||
('borderwidth', 2, self.setBorderwidth),
|
||||
('background', 'SystemButtonFace', self.setBackground),
|
||||
# Behavior
|
||||
# Initial value of floater, use self.set to change value
|
||||
('value', 0.0, INITOPT),
|
||||
@ -141,6 +141,7 @@ class FloaterWidget(Pmw.MegaWidget):
|
||||
def mouseDown(self,event):
|
||||
""" Begin mouse interaction """
|
||||
# Exectute user redefinable callback function (if any)
|
||||
self['relief'] = SUNKEN
|
||||
if self['preCallback']:
|
||||
apply(self['preCallback'], self['callbackData'])
|
||||
self.velocitySF = 0.0
|
||||
@ -181,6 +182,7 @@ class FloaterWidget(Pmw.MegaWidget):
|
||||
# Execute user redefinable callback function (if any)
|
||||
if self['postCallback']:
|
||||
apply(self['postCallback'], self['callbackData'])
|
||||
self['relief'] = RAISED
|
||||
|
||||
def setNumDigits(self):
|
||||
"""
|
||||
|
@ -268,3 +268,37 @@ if __name__ == '__main__':
|
||||
d2.pack(expand = 1, fill = X)
|
||||
d3.pack(expand = 1, fill = X)
|
||||
d4.pack(expand = 1, fill = X)
|
||||
|
||||
|
||||
|
||||
class PopupSliderWidget(Pmw.MegaToplevel):
|
||||
def __init__(self, parent = None, **kw):
|
||||
optiondefs = (
|
||||
('width', 150, None),
|
||||
('height', 30, None),
|
||||
('xoffset', 0, None), # pixels
|
||||
('yoffset', 1, None), # pixels
|
||||
)
|
||||
self.defineoptions(kw, optiondefs)
|
||||
Pmw.MegaToplevel.__init__(self, parent)
|
||||
self.withdraw()
|
||||
self.overrideredirect(1)
|
||||
self.interior()['relief'] = RAISED
|
||||
self.interior()['borderwidth'] = 3
|
||||
self.b = Button(self.interior(), text = 'hello')
|
||||
self.b['command'] = self.withdraw
|
||||
self.b.pack()
|
||||
self.initialiseoptions(PopupSliderWidget)
|
||||
def showPopup(self, widget):
|
||||
x = widget.winfo_rootx() + widget.winfo_width() - self['width']
|
||||
y = widget.winfo_rooty() + widget.winfo_height()
|
||||
Pmw.setgeometryanddeiconify(self, '%dx%d+%d+%d' %
|
||||
(self['width'], self['height'],x,y))
|
||||
"""
|
||||
pw = PopupSliderWidget()
|
||||
tl = Toplevel()
|
||||
b = Button(tl, text = 'hello')
|
||||
b.pack(expand = 1, fill = X)
|
||||
b.bind('<ButtonPress-1>', lambda event, s = b: pw.showPopup(b))
|
||||
#b.bind('<ButtonRelease-1>', lambda event: pw.withdraw())
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user