Has anyone created a "sliding" panel in their GUI application?

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Has anyone created a "sliding" panel in their GUI application?

steve
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.

Best regards

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
C M
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

C M



On Wed, Jul 30, 2014 at 1:56 PM, steve <[hidden email]> wrote:
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.

Best regards

I haven't done anything like this, and I haven't seen anyone on the list do this, but you could do it probably pretty well with a wxSlider and using wxTimer to animate the movements...set the timer to fire at a short enough interval, and then update the position of the slider a little more leftward on each step.  I don't know how smooth it will look, but probably pretty good.

Try it and see.

Che

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

steve
Thanks,
I have seen the effects below in this page: http://wxpython.org/Phoenix/docs/html/ShowEffect.enumeration.html
Are these something I can use for this "sliding" effect? What are they?


Description Value
SHOW_EFFECT_NONE No effect, equivalent to normal Window.Show or Hide() call.
SHOW_EFFECT_ROLL_TO_LEFT Roll window to the left.
SHOW_EFFECT_ROLL_TO_RIGHT Roll window to the right.
SHOW_EFFECT_ROLL_TO_TOP Roll window to the top.
SHOW_EFFECT_ROLL_TO_BOTTOM Roll window to the bottom.
SHOW_EFFECT_SLIDE_TO_LEFT Slide window to the left.
SHOW_EFFECT_SLIDE_TO_RIGHT Slide window to the right.
SHOW_EFFECT_SLIDE_TO_TOP Slide window to the top.
SHOW_EFFECT_SLIDE_TO_BOTTOM Slide window to the bottom.
SHOW_EFFECT_BLEND Fade in or out effect.
SHOW_EFFECT_EXPAND Expanding or collapsing effect.
SHOW_EFFECT_MAX  


On Wednesday, July 30, 2014 9:10:27 PM UTC+3, Che M wrote:



On Wed, Jul 30, 2014 at 1:56 PM, steve <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="3zu7qgqt0awJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osloc...@...> wrote:
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.

Best regards

I haven't done anything like this, and I haven't seen anyone on the list do this, but you could do it probably pretty well with a wxSlider and using wxTimer to animate the movements...set the timer to fire at a short enough interval, and then update the position of the slider a little more leftward on each step.  I don't know how smooth it will look, but probably pretty good.

Try it and see.

Che

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
C M
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

C M



On Wed, Jul 30, 2014 at 2:13 PM, steve <[hidden email]> wrote:
Thanks,
I have seen the effects below in this page: http://wxpython.org/Phoenix/docs/html/ShowEffect.enumeration.html
Are these something I can use for this "sliding" effect? What are they?

I didn't even know about this.  1 second of Googling suggests these can be used with, at least, wxInfoBar.  My guess is they are not used generally for a slider, but I just found out about it, so I don't quite know.  If I figure out more, I'll let you know.




--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

Rufus V. Smith
In reply to this post by steve
With one click on the enumeration page you cited, there is Show(), and directly below it, ShowWithEffect()

http://wxpython.org/Phoenix/docs/html/Window.html#Window.Show

Keep Us Posted...

On 7/30/2014 2:13 PM, steve wrote:
Thanks,
I have seen the effects below in this page: http://wxpython.org/Phoenix/docs/html/ShowEffect.enumeration.html
Are these something I can use for this "sliding" effect? What are they?


Description Value
SHOW_EFFECT_NONE No effect, equivalent to normal Window.Show or Hide() call.
SHOW_EFFECT_ROLL_TO_LEFT Roll window to the left.
SHOW_EFFECT_ROLL_TO_RIGHT Roll window to the right.
SHOW_EFFECT_ROLL_TO_TOP Roll window to the top.
SHOW_EFFECT_ROLL_TO_BOTTOM Roll window to the bottom.
SHOW_EFFECT_SLIDE_TO_LEFT Slide window to the left.
SHOW_EFFECT_SLIDE_TO_RIGHT Slide window to the right.
SHOW_EFFECT_SLIDE_TO_TOP Slide window to the top.
SHOW_EFFECT_SLIDE_TO_BOTTOM Slide window to the bottom.
SHOW_EFFECT_BLEND Fade in or out effect.
SHOW_EFFECT_EXPAND Expanding or collapsing effect.
SHOW_EFFECT_MAX  


On Wednesday, July 30, 2014 9:10:27 PM UTC+3, Che M wrote:



On Wed, Jul 30, 2014 at 1:56 PM, steve <<a moz-do-not-send="true" href="javascript:" target="_blank" gdf-obfuscated-mailto="3zu7qgqt0awJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osloc...@...> wrote:
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.

Best regards

I haven't done anything like this, and I haven't seen anyone on the list do this, but you could do it probably pretty well with a wxSlider and using wxTimer to animate the movements...set the timer to fire at a short enough interval, and then update the position of the slider a little more leftward on each step.  I don't know how smooth it will look, but probably pretty good.

Try it and see.

Che
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

Nathan McCorkle
In reply to this post by steve
I think it should be possible to use those... you'd have a panel with your widgets that you want to slide out, this would need to be created before you call Show() on your Frame. Also before the Frame.Show() you'd need to set yourSlideoutPanel.Show(False)

When you click your 'Slide out' button, then call yourSlideoutPanel.ShowWithEffect(wx.SHOW_EFFECT_SLIDE_TO_LEFT)  (it might be wx.Window.SHOW_EFFECT_SLIDE_TO_LEFT)


I think... :)

I'm doing something similar except not using the ShowWithEffect call, also I'm calling myPanel.Layout() afterwards so the sizer knows how to resize properly for the item that was previously hidden. Since you want an animation essentially, I'm not sure how this will work out!

On Wednesday, July 30, 2014 11:13:01 AM UTC-7, steve wrote:
Thanks,
I have seen the effects below in this page: <a href="http://www.google.com/url?q=http%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2FShowEffect.enumeration.html&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNHOmms4uNejZsdiK4HJ-fvADeR-FQ" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2FShowEffect.enumeration.html\46sa\75D\46sntz\0751\46usg\75AFQjCNHOmms4uNejZsdiK4HJ-fvADeR-FQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2FShowEffect.enumeration.html\46sa\75D\46sntz\0751\46usg\75AFQjCNHOmms4uNejZsdiK4HJ-fvADeR-FQ';return true;">http://wxpython.org/Phoenix/docs/html/ShowEffect.enumeration.html
Are these something I can use for this "sliding" effect? What are they?


Description Value
SHOW_EFFECT_NONE No effect, equivalent to normal <a href="http://wxpython.org/Phoenix/docs/html/Window.html#Window.Show" title="Window.Show" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2FWindow.html%23Window.Show\46sa\75D\46sntz\0751\46usg\75AFQjCNF6SwD7WObREySzasx3IN1N2DrNmg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2FWindow.html%23Window.Show\46sa\75D\46sntz\0751\46usg\75AFQjCNF6SwD7WObREySzasx3IN1N2DrNmg';return true;">Window.Show or Hide() call.
SHOW_EFFECT_ROLL_TO_LEFT Roll window to the left.
SHOW_EFFECT_ROLL_TO_RIGHT Roll window to the right.
SHOW_EFFECT_ROLL_TO_TOP Roll window to the top.
SHOW_EFFECT_ROLL_TO_BOTTOM Roll window to the bottom.
SHOW_EFFECT_SLIDE_TO_LEFT Slide window to the left.
SHOW_EFFECT_SLIDE_TO_RIGHT Slide window to the right.
SHOW_EFFECT_SLIDE_TO_TOP Slide window to the top.
SHOW_EFFECT_SLIDE_TO_BOTTOM Slide window to the bottom.
SHOW_EFFECT_BLEND Fade in or out effect.
SHOW_EFFECT_EXPAND Expanding or collapsing effect.
SHOW_EFFECT_MAX  


On Wednesday, July 30, 2014 9:10:27 PM UTC+3, Che M wrote:



On Wed, Jul 30, 2014 at 1:56 PM, steve <[hidden email]> wrote:
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.

Best regards

I haven't done anything like this, and I haven't seen anyone on the list do this, but you could do it probably pretty well with a wxSlider and using wxTimer to animate the movements...set the timer to fire at a short enough interval, and then update the position of the slider a little more leftward on each step.  I don't know how smooth it will look, but probably pretty good.

Try it and see.

Che

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

Nathan McCorkle
In reply to this post by steve
My first thought is to use a SplitterWindow, when you click your button start a timer that programmatically sets the increases the sash position in some increment, and stops when the sash reaches a certain point.

To get the X size of the panel you sliding/showing I'd think this should work (assuming you are sliding the right-side to the left):
rightPanel.GetBestSize()[0]

On Wednesday, July 30, 2014 10:56:30 AM UTC-7, steve wrote:
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.

Best regards

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

steve
Hello Nathan,

I took your advice and written the code below. Whenever user changes cell value on grid on left panel, the right panel slides from right to left and becomes visible. If user changes any cell value, then the right panel disappears with a left to right slide effect.
Problem is: when right panel is sliding from right to left, it appears on the upper left corner of the left panel in the beginning.
And after 1st appearance, right panel doesn't appear with a slide effect anymore, althoug it always disappears with a slide effect. Please try and see, what is wrong here?

import wx
import wx.grid as gridlib

########################################################################
class LeftPanel(wx.Panel):
    """"""

    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)

        grid = gridlib.Grid(self)
        grid.CreateGrid(2,2)
        grid.Bind(gridlib.EVT_GRID_CELL_CHANGE, self.on_cell_change)
        self.parent = parent

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(grid, 0, wx.EXPAND)
        self.SetSizer(sizer)

    def on_cell_change(self, event):
        grid = event.GetEventObject()
        rightpanel = grid.GetParent().GetParent().rightP

        sizer = grid.GetParent().GetParent().sizer

        rightpanel_width = rightpanel.GetSize()[0]
        print "rightpanel_width: ", rightpanel_width

        if rightpanel_width > 20:
            rightpanel.HideWithEffect(wx.SHOW_EFFECT_SLIDE_TO_RIGHT, timeout=300)
            rightpanel.SetSize((0,0))
        else:
            rightpanel.ShowWithEffect(wx.SHOW_EFFECT_SLIDE_TO_LEFT, timeout=900)
        self.parent.Layout()
        self.parent.Refresh()
        event.Skip()


########################################################################
class RightPanel(wx.Panel):
    """"""

    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)
        txt = wx.TextCtrl(self)


class MyForm(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Tutorial")


        self.leftP = LeftPanel(self)
        self.rightP = RightPanel(self)
        self.leftP.SetMaxSize((200,200))

        # split the window



        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.leftP, 1, wx.EXPAND)
        self.sizer.Add(self.rightP, 1, wx.EXPAND)
        self.SetSizer(self.sizer)
        self.rightP.Hide()


# Run the program
if __name__ == "__main__":
    app = wx.App(False)
    import wx.lib.inspection
    wx.lib.inspection.InspectionTool().Show()
    frame = MyForm()
    frame.Show()
    app.MainLoop()






On Wednesday, July 30, 2014 10:17:18 PM UTC+3, Nathan McCorkle wrote:
My first thought is to use a SplitterWindow, when you click your button start a timer that programmatically sets the increases the sash position in some increment, and stops when the sash reaches a certain point.

To get the X size of the panel you sliding/showing I'd think this should work (assuming you are sliding the right-side to the left):
rightPanel.GetBestSize()[0]

On Wednesday, July 30, 2014 10:56:30 AM UTC-7, steve wrote:
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.

Best regards

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

Andrea Gavana
In reply to this post by steve
Hi,


On 30 July 2014 19:56, steve wrote:
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.



You might take some inspiration at how wx.lib.agw.framemanager does something like this, especially in the SlideIn and SlideOut methods. It's not as perfect and smooth as Visual Studio, but then I'm not a MS developer :-) 

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://www.infinity77.net

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

    if mention_platform_and_version() and include_sample_app():
        send_message(email)
    else:
        install_malware()
        erase_hard_drives()
# ------------------------------------------------------------- #

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

steve
Will do and get back to you.

On Wednesday, July 30, 2014 11:19:38 PM UTC+3, Infinity77 wrote:
Hi,


On 30 July 2014 19:56, steve wrote:
Hi,

I'd like to know if it is possible to create a panel which is displayed with a sliding effect. I mean, the panel isn't visible by default, but hidden on the right side of the main window. When user clicks a specific button (such as "show right side panel"), it appears form right to left, with a sliding effect. When user clicks "hide right side panel" burron, this panel will slide from left to right and be hidden again in the right side of the main window. I hope I made myself clear.



You might take some inspiration at how wx.lib.agw.framemanager does something like this, especially in the SlideIn and SlideOut methods. It's not as perfect and smooth as Visual Studio, but then I'm not a MS developer :-) 

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
<a href="http://www.infinity77.net" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.infinity77.net\46sa\75D\46sntz\0751\46usg\75AFQjCNFLl2aX0VPdzDUDkqfDsCRgyedp5A';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.infinity77.net\46sa\75D\46sntz\0751\46usg\75AFQjCNFLl2aX0VPdzDUDkqfDsCRgyedp5A';return true;">http://www.infinity77.net

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

    if mention_platform_and_version() and include_sample_app():
        send_message(email)
    else:
        install_malware()
        erase_hard_drives()
# ------------------------------------------------------------- #

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

werner-3
Hi,

What about Andrea's FoldPanelBar - check out the wxPython demo for it.

Werner

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

steve

Hi,

I have succesfully created the "sliding effect". I used wx.InfoBar widget. It gives me what I want, but when the grid appears from right to left, it doesn't consume the whole window area,
In the code below, when user presses "Show Bar" button, a grid appears sliding from right to left, but the grid doesn't consume the whole window area, instead there is some empty space in the right side of the grid, I couldn't manage to make the grid expand to whole area no matter what I tried (I want the "Show Bar" and "Hide Bar" buttons be visible when the grid appears, but I want the grid to consume all space below them) could you please help:



The code is:

import wx
import wx.grid as gridlib
import datetime


class MainPanel(wx.Panel):
    """"""

    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent, style=wx.BORDER_SUNKEN)


        self.mainSizer = wx.BoxSizer(wx.VERTICAL)

        self.smBtn = wx.Button(self, -1, "Show Bar")
        self.dmBtn = wx.Button(self, -1, "Hide Bar")

        self.button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.button_sizer.Add(self.smBtn, 0)
        self.button_sizer.Add(self.dmBtn, 0)

        self.Bind(wx.EVT_BUTTON, self.OnShowMessage, self.smBtn)
        self.Bind(wx.EVT_BUTTON, self.OnDismiss, self.dmBtn)



        self.side_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.side_grid = SideGrid(self)
        self.testBtn = wx.Button(self, -1, "test button")
        self.side_sizer.Add(self.testBtn, 1)
        self.side_sizer.Add(self.side_grid, 1)

        self.mainSizer.Add(self.button_sizer, 0)
        self.mainSizer.Add(self.side_sizer, 0)

        self.SetSizer(self.mainSizer)


    def OnShowMessage(self, evt):
        self.testBtn.Hide()
        self.side_sizer.Detach(self.testBtn)
        self.side_grid.ShowMessage("abc")

        self.side_grid.Refresh()
        self.side_sizer.Layout()

        self.Refresh()



    def OnDismiss(self, evt):
        self.side_grid.Dismiss()
        self.side_sizer.Add(self.testBtn, 1)
        self.testBtn.Show(True)


class SideGrid(wx.InfoBar):
    def __init__(self, parent, *args, **kwargs):

        wx.InfoBar.__init__(self, parent)

        self.my_grid = gridlib.Grid(self, -1, name="My Grid")
        self.SetShowHideEffects(wx.SHOW_EFFECT_SLIDE_TO_LEFT, wx.SHOW_EFFECT_SLIDE_TO_RIGHT)

        self.num_of_rows = 12*10
        self.my_grid.CreateGrid(self.num_of_rows, 3)
        self.my_grid.SetDefaultCellAlignment(wx. ALIGN_CENTRE , wx. ALIGN_CENTRE )
        self.my_grid.HideRowLabels()
        self.my_grid.SetColLabelValue(0, "COLA")
        self.my_grid.SetColLabelValue(1, "COLB")
        self.my_grid.SetColLabelValue(2, "COLC")

        current = datetime.datetime(2014,8,1)
        for month_ix in xrange(self.num_of_rows):
            new_month = current.month%12 + 1
            new_year = current.year + current.month // 12
            current = current.replace(month=new_month, year=new_year)
            self.my_grid.SetCellValue(month_ix, 0, current.strftime("%Y %b"))

        for row in xrange(0,12*10):
            for col in xrange(1,3):
                self.my_grid.SetCellValue(row, col, "80")

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.my_grid)
        self.SetSizerAndFit(self.sizer)

class MyForm(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Sliding grid")

        self.main_panel = MainPanel(self)

if __name__ == "__main__":
    app = wx.App(False)
    import wx.lib.inspection
    wx.lib.inspection.InspectionTool().Show()
    frame = MyForm()
    frame.Show()
    app.MainLoop()


















On Thursday, July 31, 2014 2:03:06 PM UTC+3, werner wrote:
Hi,

What about Andrea's FoldPanelBar - check out the wxPython demo for it.

Werner

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

Nathan McCorkle
Is this what you want?


import wx
import wx.grid as gridlib
import datetime

class MainPanel(wx.Panel):

    """"""

    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent, style=wx.BORDER_SUNKEN)

        self.mainSizer = wx.BoxSizer(wx.VERTICAL)

        self.smBtn = wx.Button(self, -1, "Show Bar")
        self.dmBtn = wx.Button(self, -1, "Hide Bar")

        self.button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.button_sizer.Add(self.smBtn, 0)
        self.button_sizer.Add(self.dmBtn, 0)

        self.Bind(wx.EVT_BUTTON, self.OnShowMessage, self.smBtn)
        self.Bind(wx.EVT_BUTTON, self.OnDismiss, self.dmBtn)


        self.side_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.side_grid = SideGrid(self)
        self.side_grid.Show(False)
        self.testBtn = wx.Button(self, -1, "test button")


        self.side_sizer.Add(self.testBtn, 0)
        self.side_sizer.Add(self.side_grid, 1, wx.EXPAND)

        self.mainSizer.Add(self.button_sizer, 0)
        self.mainSizer.Add(self.side_sizer, 1, wx.EXPAND)

        self.SetSizer(self.mainSizer)

    def OnShowMessage(self, evt):
        self.testBtn.Hide()
        #self.side_sizer.Detach(self.testBtn)
        #self.test
        self.side_grid.ShowMessage("abc")

        self.side_grid.Refresh()
        self.side_sizer.Layout()
        #self.mainSizer.Layout()

        self.Refresh()


    def OnDismiss(self, evt):
        self.side_grid.Dismiss()
        #self.side_sizer.Add(self.testBtn, 1)
        self.testBtn.Show(True)


class SideGrid(wx.InfoBar):
    def __init__(self, parent, *args, **kwargs):

        wx.InfoBar.__init__(self, parent)

        self.my_grid = gridlib.Grid(self, -1, name="My Grid")
        self.SetShowHideEffects(wx.SHOW_EFFECT_SLIDE_TO_LEFT, wx.SHOW_EFFECT_SLIDE_TO_RIGHT)

        self.num_of_rows = 12*10
        self.my_grid.CreateGrid(self.num_of_rows, 3)
        self.my_grid.SetDefaultCellAlignment(wx. ALIGN_CENTRE , wx. ALIGN_CENTRE )
        self.my_grid.HideRowLabels()
        self.my_grid.SetColLabelValue(0, "COLA")
        self.my_grid.SetColLabelValue(1, "COLB")
        self.my_grid.SetColLabelValue(2, "COLC")

        current = datetime.datetime(2014,8,1)
        for month_ix in xrange(self.num_of_rows):
            new_month = current.month%12 + 1
            new_year = current.year + current.month // 12
            current = current.replace(month=new_month, year=new_year)
            self.my_grid.SetCellValue(month_ix, 0, current.strftime("%Y %b"))

        for row in xrange(0,12*10):
            for col in xrange(1,3):
                self.my_grid.SetCellValue(row, col, "80")

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.my_grid, 1, wx.EXPAND)
        self.SetSizerAndFit(self.sizer)

class MyForm(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Sliding grid")
        self.main_panel = MainPanel(self)

if __name__ == "__main__":
    app = wx.App(False)
    #mport wx.lib.inspection
    #wx.lib.inspection.InspectionTool().Show()
    frame = MyForm()
    frame.Show()
    app.MainLoop()

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

steve
Yes thank you,
Do you also know how to change grid columns' sizes, so that the grid will completely cover the panel when it appears? In your code above there is white space on the right side of the grid.

On Tuesday, August 5, 2014 12:18:48 AM UTC+3, Nathan McCorkle wrote:
Is this what you want?


import wx
import wx.grid as gridlib
import datetime

class MainPanel(wx.Panel):

    """"""

    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent, style=wx.BORDER_SUNKEN)

        self.mainSizer = wx.BoxSizer(wx.VERTICAL)

        self.smBtn = wx.Button(self, -1, "Show Bar")
        self.dmBtn = wx.Button(self, -1, "Hide Bar")

        self.button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.button_sizer.Add(self.smBtn, 0)
        self.button_sizer.Add(self.dmBtn, 0)

        self.Bind(wx.EVT_BUTTON, self.OnShowMessage, self.smBtn)
        self.Bind(wx.EVT_BUTTON, self.OnDismiss, self.dmBtn)


        self.side_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.side_grid = SideGrid(self)
        self.side_grid.Show(False)
        self.testBtn = wx.Button(self, -1, "test button")


        self.side_sizer.Add(self.testBtn, 0)
        self.side_sizer.Add(self.side_grid, 1, wx.EXPAND)

        self.mainSizer.Add(self.button_sizer, 0)
        self.mainSizer.Add(self.side_sizer, 1, wx.EXPAND)

        self.SetSizer(self.mainSizer)

    def OnShowMessage(self, evt):
        self.testBtn.Hide()
        #self.side_sizer.Detach(self.testBtn)
        #self.test
        self.side_grid.ShowMessage("abc")

        self.side_grid.Refresh()
        self.side_sizer.Layout()
        #self.mainSizer.Layout()

        self.Refresh()


    def OnDismiss(self, evt):
        self.side_grid.Dismiss()
        #self.side_sizer.Add(self.testBtn, 1)
        self.testBtn.Show(True)


class SideGrid(wx.InfoBar):
    def __init__(self, parent, *args, **kwargs):

        wx.InfoBar.__init__(self, parent)

        self.my_grid = gridlib.Grid(self, -1, name="My Grid")
        self.SetShowHideEffects(wx.SHOW_EFFECT_SLIDE_TO_LEFT, wx.SHOW_EFFECT_SLIDE_TO_RIGHT)

        self.num_of_rows = 12*10
        self.my_grid.CreateGrid(self.num_of_rows, 3)
        self.my_grid.SetDefaultCellAlignment(wx. ALIGN_CENTRE , wx. ALIGN_CENTRE )
        self.my_grid.HideRowLabels()
        self.my_grid.SetColLabelValue(0, "COLA")
        self.my_grid.SetColLabelValue(1, "COLB")
        self.my_grid.SetColLabelValue(2, "COLC")

        current = datetime.datetime(2014,8,1)
        for month_ix in xrange(self.num_of_rows):
            new_month = current.month%12 + 1
            new_year = current.year + current.month // 12
            current = current.replace(month=new_month, year=new_year)
            self.my_grid.SetCellValue(month_ix, 0, current.strftime("%Y %b"))

        for row in xrange(0,12*10):
            for col in xrange(1,3):
                self.my_grid.SetCellValue(row, col, "80")

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.my_grid, 1, wx.EXPAND)
        self.SetSizerAndFit(self.sizer)

class MyForm(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Sliding grid")
        self.main_panel = MainPanel(self)

if __name__ == "__main__":
    app = wx.App(False)
    #mport wx.lib.inspection
    #wx.lib.inspection.InspectionTool().Show()
    frame = MyForm()
    frame.Show()
    app.MainLoop()

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Has anyone created a "sliding" panel in their GUI application?

Nathan McCorkle
No idea, I saw that, but also saw I could drag the last column to be wider manually, so there must be a way to automatically do the same.

On Monday, August 4, 2014 2:39:36 PM UTC-7, steve wrote:
Yes thank you,
Do you also know how to change grid columns' sizes, so that the grid will completely cover the panel when it appears? In your code above there is white space on the right side of the grid.

On Tuesday, August 5, 2014 12:18:48 AM UTC+3, Nathan McCorkle wrote:
Is this what you want?


import wx
import wx.grid as gridlib
import datetime

class MainPanel(wx.Panel):

    """"""

    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent, style=wx.BORDER_SUNKEN)

        self.mainSizer = wx.BoxSizer(wx.VERTICAL)

        self.smBtn = wx.Button(self, -1, "Show Bar")
        self.dmBtn = wx.Button(self, -1, "Hide Bar")

        self.button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.button_sizer.Add(self.smBtn, 0)
        self.button_sizer.Add(self.dmBtn, 0)

        self.Bind(wx.EVT_BUTTON, self.OnShowMessage, self.smBtn)
        self.Bind(wx.EVT_BUTTON, self.OnDismiss, self.dmBtn)


        self.side_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.side_grid = SideGrid(self)
        self.side_grid.Show(False)
        self.testBtn = wx.Button(self, -1, "test button")


        self.side_sizer.Add(self.testBtn, 0)
        self.side_sizer.Add(self.side_grid, 1, wx.EXPAND)

        self.mainSizer.Add(self.button_sizer, 0)
        self.mainSizer.Add(self.side_sizer, 1, wx.EXPAND)

        self.SetSizer(self.mainSizer)

    def OnShowMessage(self, evt):
        self.testBtn.Hide()
        #self.side_sizer.Detach(self.testBtn)
        #self.test
        self.side_grid.ShowMessage("abc")

        self.side_grid.Refresh()
        self.side_sizer.Layout()
        #self.mainSizer.Layout()

        self.Refresh()


    def OnDismiss(self, evt):
        self.side_grid.Dismiss()
        #self.side_sizer.Add(self.testBtn, 1)
        self.testBtn.Show(True)


class SideGrid(wx.InfoBar):
    def __init__(self, parent, *args, **kwargs):

        wx.InfoBar.__init__(self, parent)

        self.my_grid = gridlib.Grid(self, -1, name="My Grid")
        self.SetShowHideEffects(wx.SHOW_EFFECT_SLIDE_TO_LEFT, wx.SHOW_EFFECT_SLIDE_TO_RIGHT)

        self.num_of_rows = 12*10
        self.my_grid.CreateGrid(self.num_of_rows, 3)
        self.my_grid.SetDefaultCellAlignment(wx. ALIGN_CENTRE , wx. ALIGN_CENTRE )
        self.my_grid.HideRowLabels()
        self.my_grid.SetColLabelValue(0, "COLA")
        self.my_grid.SetColLabelValue(1, "COLB")
        self.my_grid.SetColLabelValue(2, "COLC")

        current = datetime.datetime(2014,8,1)
        for month_ix in xrange(self.num_of_rows):
            new_month = current.month%12 + 1
            new_year = current.year + current.month // 12
            current = current.replace(month=new_month, year=new_year)
            self.my_grid.SetCellValue(month_ix, 0, current.strftime("%Y %b"))

        for row in xrange(0,12*10):
            for col in xrange(1,3):
                self.my_grid.SetCellValue(row, col, "80")

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.my_grid, 1, wx.EXPAND)
        self.SetSizerAndFit(self.sizer)

class MyForm(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Sliding grid")
        self.main_panel = MainPanel(self)

if __name__ == "__main__":
    app = wx.App(False)
    #mport wx.lib.inspection
    #wx.lib.inspection.InspectionTool().Show()
    frame = MyForm()
    frame.Show()
    app.MainLoop()

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.