wxPython TextCtrl - weird scrolling behavior

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • abcd

    #1

    wxPython TextCtrl - weird scrolling behavior

    I have a TextCtrl which is set to be multi-line. I have a function
    say, updateText(msg) , which takes some string and appends it to the
    text control...

    txtControl.Appe ndText(msg)

    .....however, if the text that I am appending would cause the scroll
    bars to appear/or scroll since the text is long the textcontrol appears
    to be blank, until you click on the scroll bar...then the text appears.
    Any ideas? is this is a sizer problem or a TextCtrl issue??

    thanks

  • John Salerno

    #2
    Re: wxPython TextCtrl - weird scrolling behavior

    abcd wrote:
    I have a TextCtrl which is set to be multi-line. I have a function
    say, updateText(msg) , which takes some string and appends it to the
    text control...
    >
    txtControl.Appe ndText(msg)
    >
    ....however, if the text that I am appending would cause the scroll
    bars to appear/or scroll since the text is long the textcontrol appears
    to be blank, until you click on the scroll bar...then the text appears.
    Any ideas? is this is a sizer problem or a TextCtrl issue??
    >
    thanks
    >
    Don't know for sure, but you can try calling the Refresh() method on the
    text control and see if that fixes it.

    Comment

    • abcd

      #3
      Re: wxPython TextCtrl - weird scrolling behavior

      On Oct 30, 2:52 pm, John Salerno <johnj...@NOSPA Mgmail.comwrote :
      Don't know for sure, but you can try calling the Refresh() method on
      the
      text control and see if that fixes it.
      Didn't make a difference. Not sure what the problem is, I am wondering
      if it is a layout issue since that is my weak spot with wxPython.

      sizerTextPanel =
      wx.StaticBoxSiz er(self.sizerTe xtPanel_staticb ox, wx.HORIZONTAL)
      sizerTextPanel .Add(self.textP ane, 1, wx.ALL|wx.EXPAN D, 2)
      self.textPanel. SetAutoLayout(T rue)
      self.textPanel. SetSizer(sizerT extPanel )
      sizerTextPanel .Fit(self.textP anel)
      sizerTextPanel .SetSizeHints(s elf.textPanel)
      sizerMainPanel. Add(self.textPa nel, 3, wx.ALL|wx.EXPAN D, 0)


      not sure if that means anything to anyone :)

      Comment

      • John Salerno

        #4
        Re: wxPython TextCtrl - weird scrolling behavior

        abcd wrote:
        sizerMainPanel. Add(self.textPa nel, 3, wx.ALL|wx.EXPAN D, 0)
        Your best bet may be to post to wxPython-users@lists.wxw idgets.org

        But one question that comes to mind is, do you not add sizerTextPanel to
        sizerMainPanel? I think all sub-sizers should be added to the main
        sizer, unless there's some weird reason I don't know of.

        If you post to the wxPython mailing list, you might want to include more
        of your code so we can see the bigger picture.

        Comment

        • abcd

          #5
          Re: wxPython TextCtrl - weird scrolling behavior

          But one question that comes to mind is, do you not add sizerTextPanel to
          sizerMainPanel? I think all sub-sizers should be added to the main
          sizer, unless there's some weird reason I don't know of.
          well i set the sizer on the textPanel and then I add the textPanel to
          sizerMainPanel

          Comment

          • John Salerno

            #6
            Re: wxPython TextCtrl - weird scrolling behavior

            abcd wrote:
            >But one question that comes to mind is, do you not add sizerTextPanel to
            >sizerMainPanel ? I think all sub-sizers should be added to the main
            >sizer, unless there's some weird reason I don't know of.
            >
            well i set the sizer on the textPanel and then I add the textPanel to
            sizerMainPanel
            >
            Ah, I see. Seems like it may be a sizer issue, since you are adding a
            bunch of things together. I noticed that one object you refer to is
            self.textPane, is that supposed to be self.textPanel?

            Comment

            • abcd

              #7
              Re: wxPython TextCtrl - weird scrolling behavior

              On Oct 30, 3:47 pm, John Salerno <johnj...@NOSPA Mgmail.comwrote :
              >I noticed that one object you refer to is
              self.textPane, is that supposed to be self.textPanel?
              no, self.textPane is the actual wx.TextCtrl.

              I used a GUI Builder to the layout stuff...perhaps that's my problem :)

              is there a good site to refer to for how to use sizers? i am
              essentially creating a chat window (textPane is the history of the
              chat, then a textCtrl below it for typing a new message and a button
              next to the input field and buttons below the input field).

              Comment

              • John Salerno

                #8
                Re: wxPython TextCtrl - weird scrolling behavior

                abcd wrote:
                On Oct 30, 3:47 pm, John Salerno <johnj...@NOSPA Mgmail.comwrote :
                >I noticed that one object you refer to is
                >self.textPan e, is that supposed to be self.textPanel?
                >
                no, self.textPane is the actual wx.TextCtrl.
                >
                I used a GUI Builder to the layout stuff...perhaps that's my problem :)
                >
                is there a good site to refer to for how to use sizers? i am
                essentially creating a chat window (textPane is the history of the
                chat, then a textCtrl below it for typing a new message and a button
                next to the input field and buttons below the input field).
                >
                After I watched the screencasts for how Dabo uses sizers, I really
                understood them a lot better. I've never used Dabo itself for GUI
                design, but the screencast, though it shows them in terms of that
                program, still gives a great visual presentation of how sizers work in
                general and I suggest you take a look at that:




                P.S. I suggest you post the full code to the wxPython mailing list. I'll
                take a look at it to see if anything strikes me, but also you will have
                a ton of other (more experienced) people looking at it too, and I
                guarantee they will spot your problem.

                Comment

                • Ed Leafe

                  #9
                  Re: wxPython TextCtrl - weird scrolling behavior

                  On Oct 31, 2006, at 3:22 PM, John Salerno wrote:
                  After I watched the screencasts for how Dabo uses sizers, I really
                  understood them a lot better. I've never used Dabo itself for GUI
                  design, but the screencast, though it shows them in terms of that
                  program, still gives a great visual presentation of how sizers work in
                  general and I suggest you take a look at that:
                  >

                  http://leafe.com/screencasts/sizers2.html
                  Thanks for the good feedback. It took me a while to wrap my brain
                  around sizers when I first started using them; now I hate working
                  without them!

                  Also, I wanted to mention that our visual Class Designer has another
                  helpful feature: you can right-click control to bring up a context
                  menu. One of the choices is 'Edit Sizer Settings...', which brings up
                  a dialog with all the relevant settings in one place. As you change
                  them in the dialog, the design surface updates so that you can see
                  the effect of your changes before you commit them. If you don't like
                  your changes, click 'Cancel' and things return to the way they were
                  before you started.

                  -- Ed Leafe
                  -- http://leafe.com
                  -- http://dabodev.com


                  Comment

                  • abcd

                    #10
                    Re: wxPython TextCtrl - weird scrolling behavior

                    thanks for the feedback, I am watching the screencasts, which are
                    helping already. I think I will try out the Dabo GUI tool since it
                    uses wxPython...and see if I can get the code I need from it.

                    thanks

                    Comment

                    • Peter Decker

                      #11
                      Re: wxPython TextCtrl - weird scrolling behavior

                      On 1 Nov 2006 04:54:32 -0800, abcd <codecraig@gmai l.comwrote:
                      thanks for the feedback, I am watching the screencasts, which are
                      helping already. I think I will try out the Dabo GUI tool since it
                      uses wxPython...and see if I can get the code I need from it.
                      I think you'll be very impressed. Those guys are creating an excellent
                      tool, and I've found that I can create pretty complicated UIs in a
                      very, very short time with the Class Designer.

                      --

                      # p.d.

                      Comment

                      Working...