From: Ken S. <k....@co...> - 2005-02-09 03:28:52
|
Hi folks, In an app that intercepts key presses I want to control the scrolling of an HtmlWindow. The tester below moves the slider in the scroll bar but the window content doesn't move unless I click on the slider. Any hints would be appreciated. I'm running Python 2.3 on Mac OS X Thanks, Ken #!/usr/bin/python """ __version__ = "$Revision: 1.5 $" __date__ = "$Date: 2004/04/30 16:26:12 $" """ from PythonCard import model from wxPython import wx class MyBackground(model.Background): def on_initialize(self, event): self.w = self.components.HtmlWindow1 htext = '<html><body>' for i in range(50): htext = htext + "<br> line " + str(i) htext = htext + "</body></html>" self.components.HtmlWindow1.text = htext def on_UpButton_mouseClick(self, event): w = self.w curPos = w.GetScrollPos(wx.wxVERTICAL) w.SetScrollPos(wx.wxVERTICAL, curPos-13) def on_DownButton_mouseClick(self, event): w = self.w curPos = w.GetScrollPos(wx.wxVERTICAL) w.SetScrollPos(wx.wxVERTICAL, curPos+13) if __name__ == '__main__': app = model.Application(MyBackground) app.MainLoop() |
From: Alex T. <al...@tw...> - 2005-02-09 14:56:54
|
Ken Sale wrote: > Hi folks, > > In an app that intercepts key presses I want to control the scrolling > of an HtmlWindow. The tester below moves the slider in the scroll bar > but the window content doesn't move unless I click on the slider. Any > hints would be appreciated. > > I'm running Python 2.3 on Mac OS X Not directly an answer to why that doesn't work - but here's an alternative that does .... Instead of > w.SetScrollPos(wx.wxVERTICAL, curPos-13) do w.ScrollLines(-13) and w.ScrollLines(13) -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: 07/02/2005 |
From: Ken S. <k....@co...> - 2005-02-09 15:24:46
|
When I try the solution proposed below nothing moves, neither the slider of the content and clicking doesn't change anything. Still frustrated, Ken On Feb 9, 2005, at 6:56 AM, Alex Tweedly wrote: > Ken Sale wrote: > >> Hi folks, >> >> In an app that intercepts key presses I want to control the scrolling >> of an HtmlWindow. The tester below moves the slider in the scroll >> bar but the window content doesn't move unless I click on the slider. >> Any hints would be appreciated. >> >> I'm running Python 2.3 on Mac OS X > > Not directly an answer to why that doesn't work - but here's an > alternative that does .... > > Instead of > >> w.SetScrollPos(wx.wxVERTICAL, curPos-13) > > do > w.ScrollLines(-13) > and > w.ScrollLines(13) > > -- > Alex Tweedly http://www.tweedly.net > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: 07/02/2005 > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real > users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > |
From: Alex T. <al...@tw...> - 2005-02-09 15:36:56
|
Ken Sale wrote: > When I try the solution proposed below nothing moves, neither the > slider of the content and clicking doesn't change anything. Just in case I've accidentally changed something else (I did play around a bit with it), here are the complete source and resource files - definitely works for me with > PythonCard version: 0.8.1 > wxPython version: 2.5.3.1 > Python version: 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit > (Intel)] > Platform: win32 #!/usr/bin/python """ __version__ = "$Revision: 1.5 $" __date__ = "$Date: 2004/04/30 16:26:12 $" """ from PythonCard import model from wxPython import wx class MyBackground(model.Background): def on_initialize(self, event): self.w = self.components.HtmlWindow1 htext = '<html><body>' for i in range(50): htext = htext + "<br> line " + str(i) htext = htext + "</body></html>" self.components.HtmlWindow1.text = htext def on_upButton_mouseClick(self, event): w = self.w curPos = w.GetScrollPos(wx.wxVERTICAL) w.ScrollLines(-13) def on_downButton_mouseClick(self, event): w = self.w curPos = w.GetScrollPos(wx.wxVERTICAL) w.ScrollLines(13) if __name__ == '__main__': app = model.Application(MyBackground) app.MainLoop() {'application':{'type':'Application', 'name':'Template', 'backgrounds': [ {'type':'Background', 'name':'bgTemplate', 'title':'Standard Template with File->Exit menu', 'size':(400, 300), 'style':['resizeable'], 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit', 'command':'exit', }, ] }, ] }, 'components': [ {'type':'HtmlWindow', 'name':'HtmlWindow1', 'position':(10, 10), 'size':(261, 222), 'backgroundColor':(255, 255, 255), }, {'type':'Button', 'name':'downButton', 'position':(283, 68), 'label':'Down', }, {'type':'Button', 'name':'upButton', 'position':(283, 15), 'label':'Up', }, ] # end components } # end background ] # end backgrounds } } -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: 07/02/2005 |
From: Ken S. <k....@co...> - 2005-02-10 02:13:03
|
I'm using: PythonCard version: 0.8.1 wxPython version: 2.5.3.1 Python version: 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] Platform: darwin and the code from Alex definitely doesn't work here. Any suggestions for Mac OS X? On Feb 9, 2005, at 7:36 AM, Alex Tweedly wrote: > Ken Sale wrote: > >> When I try the solution proposed below nothing moves, neither the >> slider of the content and clicking doesn't change anything. > > Just in case I've accidentally changed something else (I did play > around a bit with it), here are the complete source and resource files > - definitely works for me with > >> PythonCard version: 0.8.1 >> wxPython version: 2.5.3.1 >> Python version: 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit >> (Intel)] >> Platform: win32 > > > > #!/usr/bin/python > > """ > __version__ = "$Revision: 1.5 $" > __date__ = "$Date: 2004/04/30 16:26:12 $" > """ > > from PythonCard import model > from wxPython import wx > > class MyBackground(model.Background): > > def on_initialize(self, event): > self.w = self.components.HtmlWindow1 > htext = '<html><body>' > for i in range(50): > htext = htext + "<br> line " + str(i) > htext = htext + "</body></html>" > self.components.HtmlWindow1.text = htext > def on_upButton_mouseClick(self, event): > w = self.w > curPos = w.GetScrollPos(wx.wxVERTICAL) > w.ScrollLines(-13) > def on_downButton_mouseClick(self, event): > w = self.w > curPos = w.GetScrollPos(wx.wxVERTICAL) > w.ScrollLines(13) > if __name__ == '__main__': > app = model.Application(MyBackground) > app.MainLoop() > > > > > {'application':{'type':'Application', > 'name':'Template', > 'backgrounds': [ > {'type':'Background', > 'name':'bgTemplate', > 'title':'Standard Template with File->Exit menu', > 'size':(400, 300), > 'style':['resizeable'], > > 'menubar': {'type':'MenuBar', > 'menus': [ > {'type':'Menu', > 'name':'menuFile', > 'label':'&File', > 'items': [ > {'type':'MenuItem', > 'name':'menuFileExit', > 'label':'E&xit', > 'command':'exit', > }, > ] > }, > ] > }, > 'components': [ > > {'type':'HtmlWindow', > 'name':'HtmlWindow1', > 'position':(10, 10), > 'size':(261, 222), > 'backgroundColor':(255, 255, 255), > }, > > {'type':'Button', > 'name':'downButton', > 'position':(283, 68), > 'label':'Down', > }, > > {'type':'Button', > 'name':'upButton', > 'position':(283, 15), > 'label':'Up', > }, > > ] # end components > } # end background > ] # end backgrounds > } } > > > -- > Alex Tweedly http://www.tweedly.net > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: 07/02/2005 > |
From: Kevin A. <al...@se...> - 2005-02-10 03:14:36
|
On Feb 9, 2005, at 6:12 PM, Ken Sale wrote: > I'm using: > > PythonCard version: 0.8.1 > wxPython version: 2.5.3.1 > Python version: 2.3 (#1, Sep 13 2003, 00:49:11) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] > Platform: darwin > > and the code from Alex definitely doesn't work here. > > Any suggestions for Mac OS X? > > This could be a Mac OS X bug or missing feature in wxWidgets/wxPython, so you should bring it up on the wxPython-users or wxPython-mac mailing lists. I don't think this has anything to do with the PythonCard layer. http://www.wxpython.org/maillist.php ka |