FAQ
Hello - I've enjoyed using the framework so far, but have run in to a frustration with my window not being redrawn. From a basic framework perspective, here's how I have things set up. class My_Window( Window ) def __init__(self, **kwds):
Window.__init__(self, **kwds) self._main_frame = Frame( #frame attributes ) self._sub_frame = None self.place( _main_frame ) def set_sub_frame( self, sub_frame ): if None <> self._sub_frame: self._main_frame.remove( self._sub_frame ) self._main_frame.place( sub_frame ) self._sub_frame = sub_frame #end My_Window class class My_App( Application ) def __init___( self ): Application.__init__(self) def open_app( self ): self._main_window = My_Window( #window attributes ) # I create other buttons and things on the GUI that will activate # actions in this main application self._main_window.show() def button_is_pressed( self ): new_frame = Frame( # frame attributes ) self._main_window.set_sub_frame( new_frame ) #end My_App class my_app = My_App( ) my_app.run( ) #end code When I give a new sub frame (or any other GUI object) in to the main frame, all of the text of both objects are drawn in the main window. If I hide the window and bring it back to the front, it'll be re-drawn, but I can't seem to find where to do that programmatically. Is there something that I'm missing in setting up the application/window? This is really basic code that shows the main points (or at least what I believe to be the main points for interacting with PyGUI). Please let me know if there's more clarification needed. Thanks for your time. jason
____________________________________________________________
The New &#34;Skinny&#34; Fruit
How This Strange 62-Cent African Fruit Is Making Americans Skinny.
http://thirdpartyoffers.juno.com/TGL3131/4f6decbd5129a2ea95b5st05duc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pygui/attachments/20120324/bbd1440a/attachment.html>

Search Discussions

  • Greg Ewing at Mar 25, 2012 at 3:56 am

    jkamph at juno.com wrote:

    When I give a new sub frame (or any other GUI object) in to the main
    frame, all of the text of both objects are drawn in the main window. If
    I hide the window and bring it back to the front, it'll be re-drawn, but
    I can't seem to find where to do that programmatically. Is there
    something that I'm missing in setting up the application/window?
    Are you talking about user-defined views (derived from View) or
    built-in components (buttons, labels, text fields, etc)?

    To refresh a user-defined view, you call its invalidate() or
    invalidate_rect() method. You shouldn't need to explicitly tell
    built-in objects to refresh, they should do it themselves
    automatically whenever needed.

    Do you have something that isn't refreshing when you think it
    should? Can you post a complete example?

    --
    Greg
  • Jkamph at Mar 27, 2012 at 5:46 am
    Greg - Thanks for the response. Initially, I had everything subclassed (MyApp( Application ) creating MyWindow( Window ) containing a provided Frame containing a MyFrame( Frame ) containing a provided Grid. As an experiment, I changed things so that each class just creates one of the built-in object and provides a method for retrieving the built in Window/Frame. I left MyApp as a subclass of Application so that I would still have someone able to handle button events. However, I'm still seeing the same behavior when I scroll through the list, namely, not having anything removed from the display when something new is supposed to be drawn on it. I feel as though I'm completely missing something fundamental. With this sort of setup, when I click to scroll down, am I expected to have an overridden method that will be invoked? At what level will one of my object be called first? What am I expected to do with that call? I've tried creating a draw method (that is invoked when I try to scroll), but I'm at a bit of a loss as to what I'm supposed to do with the provided canvas and rectangle. Any help or pointing to the pertinent documentation is appreciated. Thanks in advance. jason

    ---------- Original Message ----------
    From: Greg Ewing <greg.ewing at canterbury.ac.nz>
    To: "jkamph at juno.com" <jkamph at juno.com>
    Cc: pygui at python.org
    Subject: Re: [Pygui] Windows not being refreshed
    Date: Sun, 25 Mar 2012 16:56:59 +1300

    jkamph at juno.com wrote:
    When I give a new sub frame (or any other GUI object) in to the main
    frame, all of the text of both objects are drawn in the main window. If
    I hide the window and bring it back to the front, it'll be re-drawn, but
    I can't seem to find where to do that programmatically. Is there
    something that I'm missing in setting up the application/window?
    Are you talking about user-defined views (derived from View) or
    built-in components (buttons, labels, text fields, etc)?

    To refresh a user-defined view, you call its invalidate() or
    invalidate_rect() method. You shouldn't need to explicitly tell
    built-in objects to refresh, they should do it themselves
    automatically whenever needed.

    Do you have something that isn't refreshing when you think it
    should? Can you post a complete example?

    --
    Greg
    ____________________________________________________________
    53 Year Old Mom Looks 33
    The Stunning Results of Her Wrinkle Trick Has Botox Doctors Worried
    http://thirdpartyoffers.juno.com/TGL3131/4f7154841dc2a2fcfcecst06duc
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120327/6b383388/attachment.html>
  • Greg Ewing at Mar 27, 2012 at 9:52 am

    jkamph at juno.com wrote:

    Initially, I had everything subclassed (MyApp( Application ) creating
    MyWindow( Window ) containing a provided Frame containing a MyFrame(
    Frame ) containing a provided Grid. As an experiment, I changed things
    so that each class just creates one of the built-in object and provides
    a method for retrieving the built in Window/Frame.
    Sorry, but I can't make any sense of that. Can you send me
    some code? I'm still not getting a clear idea of what you're
    doing.

    --
    Greg
  • Jkamph at Mar 29, 2012 at 11:13 am
    Greg - Sorry for the delay in getting back to you. Here are some images of my GUI before scrolling and after. You can seen the "blurring" that's occurring after attempting to scroll. I've also included some of my source code that is related to the GUI. This won't be workable code for you since I pulled out a bunch of the things not directly related to the GUI. If there are more questions or clarifications needed, please let me know. Thanks for your help. jason

    ---------- Original Message ----------
    From: Greg Ewing <greg.ewing at canterbury.ac.nz>
    To: "jkamph at juno.com" <jkamph at juno.com>
    Cc: pygui at python.org
    Subject: Re: [Pygui] Windows not being refreshed
    Date: Tue, 27 Mar 2012 22:52:52 +1300

    jkamph at juno.com wrote:
    Initially, I had everything subclassed (MyApp( Application ) creating
    MyWindow( Window ) containing a provided Frame containing a MyFrame(
    Frame ) containing a provided Grid. As an experiment, I changed things
    so that each class just creates one of the built-in object and provides
    a method for retrieving the built in Window/Frame.
    Sorry, but I can't make any sense of that. Can you send me
    some code? I'm still not getting a clear idea of what you're
    doing.

    --
    Greg
    ____________________________________________________________
    53 Year Old Mom Looks 33
    The Stunning Results of Her Wrinkle Trick Has Botox Doctors Worried
    http://thirdpartyoffers.juno.com/TGL3131/4f744421d501e30d9c93st04duc
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120329/cc174059/attachment-0001.html>
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: player_frame.py
    Type: application/octet-stream
    Size: 1867 bytes
    Desc: player_frame.py
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120329/cc174059/attachment-0004.obj>
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: main_application.py
    Type: application/octet-stream
    Size: 868 bytes
    Desc: main_application.py
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120329/cc174059/attachment-0005.obj>
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: obscure_main_gui.py
    Type: application/octet-stream
    Size: 6217 bytes
    Desc: obscure_main_gui.py
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120329/cc174059/attachment-0006.obj>
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: obscure_reference_main.py
    Type: application/octet-stream
    Size: 3015 bytes
    Desc: obscure_reference_main.py
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120329/cc174059/attachment-0007.obj>
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: pre_scroll.JPG
    Type: image/jpeg
    Size: 35691 bytes
    Desc: pre_scroll.JPG
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120329/cc174059/attachment-0002.jpe>
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: post_scroll.JPG
    Type: image/jpeg
    Size: 43790 bytes
    Desc: post_scroll.JPG
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120329/cc174059/attachment-0003.jpe>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppygui @
categoriespython
postedMar 24, '12 at 3:47p
activeMar 29, '12 at 11:13a
posts5
users2
websitecosc.canterbury.ac.nz...

2 users in discussion

Jkamph: 3 posts Greg Ewing: 2 posts

People

Translate

site design / logo © 2019 Grokbase