Trying to fill two quarters of the screen with two thumbnails

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

Trying to fill two quarters of the screen with two thumbnails

Marcos del Amo
I've been trying to insert two Thubmnailctrl under a Multisplitter, I have managed to put them in there, but I can't manage to make them ocuppy the full space. On thumbnailctrl.py I've seen that the maximum size has been capped at 350x280:

def SetThumbSize(self, width, height, border=6):
"""
Sets the thumbnail size as width, height and border.

:param `width`: the desired thumbnail width;
:param `height`: the desired thumbnail height;
:param `border`: the spacing between thumbnails.
"""

if width > 350 or height > 280:
return

self._tWidth = width
self._tHeight = height
self._tBorder = border
self.SetScrollRate((self._tWidth + self._tBorder)/4,
(self._tHeight + self._tBorder)/4)
self.SetSizeHints(self._tWidth + self._tBorder*2 + 16,
self._tHeight + self._tBorder*2 + 8)

But on the other hand on the demo under ThumbnailCtrl, it uses an Splitter to create a Thumbnailctrl as big as you want, so I don't know if I'm doing something wrong (maybe with Sizers) or is some feature from Splitter (totally diferent than multisplitter) that allows the Thumbnailctrl to occupy it's full space.

Thumbnailctrl + Splitter Demo:

import wx
import os

import sys

try:
dirName = os.path.dirname(os.path.abspath(__file__))
except:
dirName = os.path.dirname(os.path.abspath(sys.argv[0]))

sys.path.append(os.path.split(dirName)[0])

try:
from agw import thumbnailctrl as TC
except ImportError: # if it's not there locally, try the wxPython lib.
import wx.lib.agw.thumbnailctrl as TC


class MainFrame(wx.Frame):
def __init__(self, redirect=False, filename=None):
wx.Frame.__init__(self, None, title="Elephant")

# self.SetMenuBar(self.CreateMenuBar())

splitter = wx.SplitterWindow(self, -1, style=wx.CLIP_CHILDREN | wx.SP_3D | wx.WANTS_CHARS | wx.SP_LIVE_UPDATE)
self.panel = wx.Panel(splitter, -1)

sizer = wx.BoxSizer(wx.HORIZONTAL)
scroll = TC.ThumbnailCtrl(splitter, -1, imagehandler=TC.NativeImageHandler)

scroll.ShowFileNames()
if os.path.isdir("../bitmaps"):
scroll.ShowDir(os.path.normpath(os.getcwd() + "/../bitmaps"))
else:
scroll.ShowDir(os.getcwd())

self.TC = scroll


splitter.SplitVertically(scroll, self.panel, 180)

splitter.SetMinimumPaneSize(140)
self.SetMinSize((700, 590))
self.CenterOnScreen()

# ----------------------------------------------------------------------


if __name__ == '__main__':
app = wx.App()
MainFrame().Show()
app.MainLoop()

My attempt at a Multisplitter with two thumbnails (and when that works a third panel with text and stuff):

import wx
import os
import cv2
import ctypes
from PIL import Image
from wx.lib.splitter import MultiSplitterWindow

try:
from agw import thumbnailctrl as TC
except ImportError: # if it's not there locally, try the wxPython lib.
import wx.lib.agw.thumbnailctrl as TC


########################################################################

class SamplePane(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)

self.thumbnail11 = TC.ThumbnailCtrl(self, imagehandler=TC.NativeImageHandler, thumboutline=4)
self.thumbnail11.EnableDragging(True)
# self.thumbnail11.SetThumbSize(350, screensize[0] / 15, 25) # For images -> Max values 350,280

# ################VID################ #

topmostSizer = wx.BoxSizer(wx.VERTICAL)

topmostSizer.Add(self.thumbnail11, proportion=0, flag=wx.EXPAND)

self.SetSizer(topmostSizer)
self.MaxSize
# topmostSizer.Fit(self)


class MainFrame(wx.Frame):
""""""

def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, title="Elephant")

splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
# t1Sizer = wx.BoxSizer(wx.VERTICAL)
# self.thumbnail11 = TC.ThumbnailCtrl(splitter, imagehandler=TC.NativeImageHandler, thumboutline=4)
panel = SamplePane(splitter)
splitter.AppendWindow(panel)
panel2 = SamplePane(splitter)
splitter.AppendWindow(panel2)
# t1Sizer.Add(panel, proportion=0, flag=wx.EXPAND)


self.Show()


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

As you can si there are two thumbnails and they expand left to right, but they are capped at a maximum height.

Thanks a lot for the help!

--
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.

Splitter demo.py (16K) Download Attachment
Multisplitter.py (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Trying to fill two quarters of the screen with two thumbnails

Tim Roberts
Marcos del Amo wrote:
> I've been trying to insert two Thubmnailctrl under a Multisplitter, I
> have managed to put them in there, but I can't manage to make them
> ocuppy the full space. On thumbnailctrl.py I've seen that the maximum
> size has been capped at 350x280:

Right.  You're trying to the thumbnail control for something it wasn't
designed to do.  If you want a full-sized image, then why don't you use
a full-sized image control?

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
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: Trying to fill two quarters of the screen with two thumbnails

Marcos del Amo
Sorry I ddn't explain myself correctly, I want the surface of the thumbnail to be full screen, but the thumbs themselves could be any size, in the Thumbnailctrl + Splitter Demo I have two parts, the left one is a halfscreen thumbnailctrl (which I can resize however I see fit) and the right side I have another halfscreen completely different. I can resize the thumbnailctrl to occupy all of the screen, the thumbs themselves would remain unchanged only differently spread.

I want to do the same but with a Multisplitter, I don't want the thumbs themselves to be full screen, only the place where they "appear".
I hope I have explained myself better this time.

Thanks for the reply Tim, in the past I've read your answers and they've been a great help, I hope this thread would help some others as well

Libre de virus. www.avast.com

2017-05-17 18:59 GMT+02:00 Tim Roberts <[hidden email]>:
Marcos del Amo wrote:
> I've been trying to insert two Thubmnailctrl under a Multisplitter, I
> have managed to put them in there, but I can't manage to make them
> ocuppy the full space. On thumbnailctrl.py I've seen that the maximum
> size has been capped at 350x280:

Right.  You're trying to the thumbnail control for something it wasn't
designed to do.  If you want a full-sized image, then why don't you use
a full-sized image control?

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/FfEx9QHLuyY/unsubscribe.
To unsubscribe from this group and all its topics, 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: Trying to fill two quarters of the screen with two thumbnails

Tim Roberts
Marcos del Amo wrote:

>
> Sorry I ddn't explain myself correctly, I want the surface of the
> thumbnail to be full screen, but the thumbs themselves could be any
> size, in the Thumbnailctrl + Splitter Demo I have two parts, the left
> one is a halfscreen thumbnailctrl (which I can resize however I see
> fit) and the right side I have another halfscreen completely
> different. I can resize the thumbnailctrl to occupy all of the screen,
> the thumbs themselves would remain unchanged only differently spread.
>
> I want to do the same but with a Multisplitter, I don't want the
> thumbs themselves to be full screen, only the place where they "appear".
> I hope I have explained myself better this time.

I should have read more closely.  I'm still confused as to what you
want, and I'm dubious that your current design is the right way to do
it, but the solution to your immediate problem is simple:

        topmostSizer = wx.BoxSizer(wx.HORIZONTAL)
        topmostSizer.Add(self.thumbnail11, proportion=0, flag=wx.ALL |
wx.EXPAND)

By setting "proportion" to 0, you are telling the box sizer not to allow
the thumbnail control to grow in width.  Thus, even though the splitter
region is growing, the control cannot.  Change that to 1 and you should
be off to the next problem.

Such as, if you're using a multisplitter already, why are you adding yet
another vertical splitter into the right-most pane?

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
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: Trying to fill two quarters of the screen with two thumbnails

Marcos del Amo
Thanks a lot Tim, I always miss the simplest things (I even recreated thumbnailctrl to disable that size restriction, which helped in a way). The splitter on the right and left pane was only for testing purposses. Thanks again!

El miércoles, 17 de mayo de 2017, 20:23:59 (UTC+2), Tim Roberts escribió:
Marcos del Amo wrote:

>
> Sorry I ddn't explain myself correctly, I want the surface of the
> thumbnail to be full screen, but the thumbs themselves could be any
> size, in the Thumbnailctrl + Splitter Demo I have two parts, the left
> one is a halfscreen thumbnailctrl (which I can resize however I see
> fit) and the right side I have another halfscreen completely
> different. I can resize the thumbnailctrl to occupy all of the screen,
> the thumbs themselves would remain unchanged only differently spread.
>
> I want to do the same but with a Multisplitter, I don't want the
> thumbs themselves to be full screen, only the place where they "appear".
> I hope I have explained myself better this time.

I should have read more closely.  I'm still confused as to what you
want, and I'm dubious that your current design is the right way to do
it, but the solution to your immediate problem is simple:

        topmostSizer = wx.BoxSizer(wx.HORIZONTAL)
        topmostSizer.Add(self.thumbnail11, proportion=0, flag=wx.ALL |
wx.EXPAND)

By setting "proportion" to 0, you are telling the box sizer not to allow
the thumbnail control to grow in width.  Thus, even though the splitter
region is growing, the control cannot.  Change that to 1 and you should
be off to the next problem.

Such as, if you're using a multisplitter already, why are you adding yet
another vertical splitter into the right-most pane?

--
Tim Roberts, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IZ9NNoWrBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ti...@...
Providenza & Boekelheide, Inc.

--
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.