Seite 1 von 1

[ListCtrl] Vertikale Scrollbar bei Images

Verfasst: Dienstag 12. September 2006, 17:18
von tse
Hi,

wenn ich folgenden Code benutze, dann erhalte ich eine ListCtrl mit vier Elementen, deren Anordnung immer ans Fenster angepasst wird. Wenn das ganze nicht passt, wird eine horizontale Scrollbar eingefügt. Wie erreiche ich es jetzt, dass wx eine vertikale Scrollbar einfügt und alles immer nur in einer Spalte anzeigt? :?

gruß,
david

Code: Alles auswählen

self.control = wx.ListCtrl(self, style = wx.LC_ICON)

imlist = wx.ImageList(60, 60)

imlist.Add(wx.Bitmap("map.bmp"))

self.control.AssignImageList(imlist, 0)
     
self.control.InsertImageStringItem(0, "ein Text", 0)
self.control.InsertImageStringItem(1, "ein Text", 0)
self.control.InsertImageStringItem(2, "ein Text", 0)
self.control.InsertImageStringItem(3, "ein Text", 0)

Verfasst: Dienstag 12. September 2006, 19:22
von HWK
Genau das macht es bei mir (unter Windows ME). Ein horizontaler Scrollbar wird nur eingefügt, wenn das Fenster zu schmal, ein vertikaler, wenn es zu flach wird. Möglicherweise liegt es am Betriebssystem oder am Rest des Programms, wenn es bei Dir anders ist. Mein komplettes Testprogramm:

Code: Alles auswählen

import wx

class DemoFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'Test', size=(600, 400))
        self.control = wx.ListCtrl(self, style = wx.LC_ICON)

        imlist = wx.ImageList(60, 60)

        imlist.Add(wx.Bitmap('map.bmp'))

        self.control.AssignImageList(imlist, 0)
              
        self.control.InsertImageStringItem(0, 'ein Text', 0)
        self.control.InsertImageStringItem(1, 'ein Text', 0)
        self.control.InsertImageStringItem(2, 'ein Text', 0)
        self.control.InsertImageStringItem(3, 'ein Text', 0)

app = wx.PySimpleApp()
frame = DemoFrame()
frame.Show()
app.MainLoop()
MfG
HWK

Verfasst: Dienstag 12. September 2006, 20:04
von tse
Hmm, ich hab's jetzt auch noch einmal unter WinXP probiert und da hab ich auch keine horizontale Scrollbar, naja, muss mal also mit leben.

Danke für den Tipp,
gruß,
david

Verfasst: Dienstag 12. September 2006, 20:35
von DatenMetzgerX
Also unter Gnome funktioniert es einwandfrei