[wxPython] (no subject)

Just wondering if there is a way to display tiff's without making them
into bitmaps, if so how
thanks for all the help
Matt

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

Just wondering if there is a way to display tiff's without making them
into bitmaps, if so how
thanks for all the help
Matt

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

Just wondering if there is a way to display tiff's without making them
into bitmaps, if so how

All images have to become a wxBitmap (not a .bmp) before being displayed, as
that is the wrapper class around whatever the platform's displayable image
abstraction is. This should work:

    wxInitAllImageHandlers()
    ...

    bmp = wxImage(tiff_file_name).ConvertToBitmap()

or perhaps

    bmp = wxImage(tiff_file_name,wxBITMAP_TYPE_TIF).ConvertToBitmap()

or even

    bmp = wxBitmap(tiff_file_name, wxBITMAP_TYPE_TIF)

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

I sent somehting to the list bout a week ago asking if it is possible to
thread images. I tweaked it a little bit but I still can not get them to
stayed displayed. Here is a toned down version of my app.
Nte it displays tiffs right now. Go to files and replace the names of
them. To see that this works without the threads just comment out the
thread start in display pcture and ten uncomment out the cal to
display() in displaypicture. Also add a break at the end of display().

from wxPython.wx import *
import thread
import time
ID_ABOUT = 101
ID_EXIT = 102

class MyFrame(wxFrame):
    def __init__(self, parent, ID, title, xSize, ySize):
        wxFrame.__init__(self, parent, ID, title,
                         wxDefaultPosition, wxSize(xSize, ySize))

        menu = wxMenu()
        menu.Append(ID_EXIT, "E&xit", "Terminate the program")
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File");
        self.SetMenuBar(menuBar)
        EVT_MENU(self, ID_EXIT, self.TimeToQuit)
        p1 = makePanel(self)
        delete = FALSE
        cool = true
        
    def TimeToQuit(self, event):
        self.Close(true)

···

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

class makePanel(wxPanel):
    def __init__(self, parent):
        wxPanel.__init__(self, parent, -1)
        self.parent = parent
        self.SetAutoLayout(true)
        self.panelA = picturePanel(self)
        self.panelD = filePanel(self)
        self.lock = thread.allocate_lock()

class picturePanel:
   def __init__(self, parent):
        p1 = wxScrolledWindow(parent, -1, wxPyDefaultPosition, (490, 350),
wxSIMPLE_BORDER)
        self.p1 = p1
        self.p1.parent = parent
        self.p1.drawn = false
        self.p1.draw = 0
        wxInitAllImageHandlers()
        r = wxBitmap('c:\\blank.bmp', wxBITMAP_TYPE_BMP)
        self.p1.newPic = wxStaticBitmap(self.p1, 900, r, wxPoint(0, 0),
wxSize(700, 900))
        thread.start_new_thread(self.display, ())
        self.p1.path = ''
        
   def DisplayPicture(self, path):
       self.p1.path= path
       self.p1.draw = 1
       #self.display()
       #thread.start_new_thread(self.display, ())

   def display(self):
       while(1):
           path = self.p1.path
           if(self.p1.draw == 1):
               print time.time()
               self.p1.parent.lock.acquire(1)
               if (path == TRUE):
                   self.p1.newPic.Destroy()
                   self.p1.path=NULL
                   self.p1.drawn = false
               else:
                   wxSetCursor(wxHOURGLASS_CURSOR)
                   if self.p1.drawn == true:
                       self.p1.newPic.Destroy()
                   r = wxBitmap(path, wxBITMAP_TYPE_TIF)
                   self.p1.Show(false)
                   self.p1.newPic = wxStaticBitmap(self.p1, 900, r,
wxPoint(10, 10), wxSize(700, 900))
                   self.p1.Show(TRUE)
                   self.p1.drawn=true
                   wxSetCursor(wxSTANDARD_CURSOR)
               self.p1.draw = 0
               self.p1.parent.lock.release()
               print time.time()
               
   def ReturnPath(self):
       return self.p1.path

   def setdraw(self):
       self.p1.draw = 1

class filePanel:
   def __init__(self, parent):

        p4 = wxWindow(parent, -1, (0, 370), (495,300), wxSIMPLE_BORDER)

#p4.SetConstraints(Layoutf('t%b45#1;l=l10#1;b=b20#1;r%r39#1',(parent,)))
        self.p4 = p4
        self.p4.parent = parent
        self.p4.files = ['C:\\b.tiff', 'C:\\d.tiff', 'c:\\out.tiff',
'c:\\out1.tiff', 'c:\\out10.tiff']
        self.p4.list = wxListBox(self.p4, 5,(0, 0), (490, 300),
self.p4.files, wxLB_SINGLE)
        EVT_LISTBOX(self.p4.list, 5, self.OnItem)
        
   #------------------------ EVENTS --------------------------#
        
   #--- When you click on an item ---#
        
   def OnItem(self, event):
        self.p4.clickeditem = self.p4.list.GetSelection()

self.p4.parent.panelA.DisplayPicture(self.p4.files[self.p4.clickeditem])

class MyApp(wxApp):
    def OnInit(self):
        frame = MyFrame(NULL, -1, "Hello from wxPython", 500, 800)
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

app = MyApp(0)
app.MainLoop()

Thanks for all the help
Matt

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

I sent somehting to the list bout a week ago asking if it is possible to
thread images. I tweaked it a little bit but I still can not get them to
stayed displayed. Here is a toned down version of my app.
Nte it displays tiffs right now. Go to files and replace the names of
them. To see that this works without the threads just comment out the
thread start in display pcture and ten uncomment out the cal to
display() in displaypicture. Also add a break at the end of display().

I'm not sure what you were after with display(). Did you really want the
thread to loop forever creating and destroying wxStaticBitmaps? I doubt it.
Anyway I've rewritten your sample to show how the image can be created on an
alternate thread and also how it can interact with the GUI thread so the
image is diaplayed.

Everyone should take a look at the DoDraw method even if you have no
interest in images and threads. It shows how to optimize your EVT_PAINT
handlers by only drawing the visible part of the wxScrolledWindow and only
the subset that actually needs updating if there is an UpdateRegion.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

from wxPython.wx import *

USE_THREAD = 1

if USE_THREAD:
    import thread

import time
ID_ABOUT = 101
ID_EXIT = 102

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

class MyFrame(wxFrame):
    def __init__(self, parent, ID, title, xSize, ySize):
        wxFrame.__init__(self, parent, ID, title,
                         size=(xSize, ySize),

style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)

        menu = wxMenu()
        menu.Append(ID_EXIT, "E&xit", "Terminate the program")
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File");
        self.SetMenuBar(menuBar)
        EVT_MENU(self, ID_EXIT, self.TimeToQuit)
        ###EVT_CLOSE(self, self.OnClose)

        if USE_THREAD:
            self.lock = thread.allocate_lock()
        else:
            self.lock = None

        top = wxSplitterWindow(self, -1)
        pp = picturePanel(top, self.lock)
        fp = filePanel(top, pp)
        top.SplitHorizontally(pp, fp, ySize/2)

    def TimeToQuit(self, event):
        self.Close(true)

    def OnClose(self, evt):
        if USE_THREAD:
            if self.lock.locked():
                self.lock.release()
        self.Destroy()

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

class picturePanel(wxScrolledWindow):
    imageReadyEvent = wxNewEventType()
    scrollUnit = 10

    def __init__(self, parent, lock):
        wxScrolledWindow.__init__(self, parent, -1, style=wxSIMPLE_BORDER)
        self.lock = lock
        self.imgpath = None
        self.img = None
        self.img_width = 0
        self.img_height = 0
        self.paintNeeded = false
        EVT_PAINT(self, self.OnPaint)
        EVT_IDLE(self, self.CheckPaintNeeded)
        self.Connect(-1, -1, self.imageReadyEvent, self.OnImageReady)

    def DisplayImage(self, path):
        self.imgpath = path
        self.bs = wxBusyCursor()
        if USE_THREAD:
            thread.start_new_thread(self.LoadImage, (path,))
        else:
            self.LoadImage(path)

    def LoadImage(self, path):
        if USE_THREAD: self.lock.acquire()
        # Load the image. I assume that since you want to use
        # threads that you use really big images ordo this some
        # other way that takes a long time???
        self.img = wxImage(path, wxBITMAP_TYPE_ANY)
        if USE_THREAD: self.lock.release()

        # let the main thread know it's ready
        event = wxCommandEvent(self.imageReadyEvent)
        event.SetEventObject(self)
        wxPostEvent(self, event)

    def OnImageReady(self, evt):
        if hasattr(self, "bs"): del self.bs
        if USE_THREAD: self.lock.acquire()
        self.img_width = w = self.img.GetWidth()
        self.img_height = h = self.img.GetHeight()
        if USE_THREAD: self.lock.release()
        self.Clear()
        su = self.scrollUnit
        self.SetScrollbars(su, su, w/su, h/su, 0, 0)
        self.Refresh()

    def OnPaint(self, evt):
        dc = wxPaintDC(self)
        if self.img is None:
            return
        self.DoPaint(dc, self.GetUpdateRegion())

    def CheckPaintNeeded(self, evt): # idle handler
        if self.paintNeeded:
            dc = wxClientDC(self)
            self.DoPaint(dc)

    def DoPaint(self, dc, rgn=None):
        if USE_THREAD and self.lock.locked(): # try again later
            self.paintNeeded = true
            return

        self.PrepareDC(dc)

        # if it fits in the window, we can optimize
        w, h = self.GetSize()
        if self.img_width <= w and self.img_height <= h:
            if USE_THREAD: self.lock.acquire()
            dc.DrawBitmap(wxBitmapFromImage(self.img), 0, 0)
            self.paintNeeded = false
            if USE_THREAD: self.lock.release()
            return

        # otherwise figure out which part needs to be displayed
        # and only draw that part.
        x, y = self.GetViewStart()
        x = x * self.scrollUnit
        y = y * self.scrollUnit
        ww, wh = self.GetSize()
        if rgn:
            rect = rgn.GetBox()
            x = x + rect.x
            y = y + rect.y
            ww, wh = rect.width, rect.height
        w = min(ww, self.img_width - x)
        h = min(wh, self.img_height - y)

        if USE_THREAD: self.lock.acquire()
        img = self.img.GetSubImage(wxRect(x, y, w, h))
        dc.DrawBitmap(wxBitmapFromImage(img), x, y)
        self.paintNeeded = false
        if USE_THREAD: self.lock.release()

    def ReturnPath(self):
        return self.imgpath

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

class filePanel(wxListBox):
    def __init__(self, parent, pp):
        wxListBox.__init__(self, parent, -1, style=wxSIMPLE_BORDER)
        self.pp = pp
        self.files = ['copy.bmp', '12h.gif', 'image.gif',
                      'splash.gif', 'image.png', '13d.tif',
                      'bigimage.jpg', 'reallybigimage.jpg']
        for file in self.files:
            self.Append(file)
        EVT_LISTBOX(self, self.GetId(), self.OnItem)

    def OnItem(self, event):
        clickeditem = self.GetSelection()
        self.pp.DisplayImage(self.files[clickeditem])

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

class MyApp(wxApp):
    def OnInit(self):
        wxInitAllImageHandlers()
        frame = MyFrame(NULL, -1, "Hello from wxPython", 500, 800)
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

app = MyApp(0)
app.MainLoop()

Here it goes I am tring to convert wxImag, because I want to scale the
image, into a wxBitmap. After looking at the api i understood all I would
have to do is
pic = wxImage('image', wx_BITMAP_TYPE_WHATEVER).Scale(300, 300)
image = wxBitmap(pic,-1)

This seems right according to the api and when I do this it says that a
string or unicode is expected. I do not understand.
Thank you Robin ofr all your help and sorry for all the questions
Matt

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

pic = wxImage('image', wx_BITMAP_TYPE_WHATEVER).Scale(300, 300)
image = wxBitmap(pic,-1)

This seems right according to the api and when I do this it says that a
string or unicode is expected. I do not understand.

Looks like it got left out of the docs. You want to use this:

    image = wxBitmapFromImage(pic, -1)

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Well that is what I was afraid of, but the thing is I want to not use that
function because it butchers the image. I was tring to find away to Scale
a wxBitmap then without using the convert to bitmap function, or is this
not possible.

thanks
Matt

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

Well that is what I was afraid of, but the thing is I want to not use that
function because it butchers the image. I was tring to find away to Scale
a wxBitmap then

wxBitmapFromImage is just the name of the Python wrapper for the C++
wxBitmap(const wxImage& img, int depth = -1) constructor, which is what you
where trying to use in your sample, so what's the problem? How is it
butchering the image? Does this work any differently?:

    img = wxImage(filename).Rescale(300, 300)
    bmp = wxBitmapFromImage(img)

(Rescale modifies the image in place instead of creating a new one.)

without using the convert to bitmap function, or is this
not possible.

wxBitmap is the class that wraps the platform specific
to-be-used-on-the-display-bitmap, and wxImage is for general platform
independent image manipulation, conversion, etc. So in order to be
displayed you always have to convert to a wxBitmap. One interesting thing
to note is that for all image types except .bmp and .xpm wxBitmap actually
uses a wxImage internally to load the image file and then uses the
conversion functions to create the wxBitmap.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

I was wondering if anyone could look at this and come up with an idea of
why tab traversal is not working with there. I thought that wxPython
takes care fo tab traversal but this sample program does not work.
thanks for the help
Matt

from wxPython.wx import *
from wxPython.lib.layoutf import Layoutf
from wxPython.lib.buttons import *
from wxPython.lib.dialogs import wxMultipleChoiceDialog
ID_EXIT = 102
import time

class MyFrame(wxFrame):
    def __init__(self, parent, ID, title, xSize, ySize):
        wxFrame.__init__(self, parent, ID, title,
                         wxDefaultPosition, wxSize(xSize, ySize))

        menu = wxMenu()
        menu.Append(ID_EXIT, "E&xit", "Terminate the program")
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File");
        self.SetMenuBar(menuBar)
        EVT_MENU(self, ID_EXIT, self.TimeToQuit)
        self.SetAutoLayout(true)
        self.panelB = infoPanel(self)
        #self.panelB.p2.patientName.SetFocus()
        self.panelB.p2.SetFocus()
        
    def TimeToQuit(self, event):
        self.Close(true)

class infoPanel:
   def __init__(self, parent):

        p2 = wxWindow(parent, -1, wxPyDefaultPosition, wxPyDefaultSize,
wxSIMPLE_BORDER)

p2.SetConstraints(Layoutf('t%b5#1;l=l10#1;b%b98#1;r%r95#1',(parent,)))
        p2.SetBackgroundColour(wxColour(228, 237, 243))
        self.p2 = p2
        self.p2.parent = parent
        p2.SetWindowStyle(wxTAB_TRAVERSAL )

        wxStaticText(p2, -1, "Patient Name:", wxPoint(15, 22), wxSize(75,
22))
        self.p2.patientName = wxTextCtrl(p2, 10, "", wxPoint(100,20),
wxSize(300,22), wxTE_PROCESS_ENTER)
        
        wxStaticText(p2, -1, "Account #", wxPoint(15, 53), wxSize(75, 22))
        p2.accountNumber = wxTextCtrl(p2, 20, "", wxPoint(100, 50) ,
wxSize(120, 22), (wxTE_PROCESS_ENTER))
        hosList=['Northside', 'Eastside', 'Southside', 'Westside']

        wxStaticText(p2, -1, "Hospitial:", wxPoint(15, 83), wxSize(50,
22))
        p2.whatHospitial = wxChoice(p2, 60, (100, 80), (175, 20), hosList)
            
        wxStaticText(p2, -1, "MRN:", wxPoint(233, 53), wxSize(75, 22))
        p2.mrnNumber = wxTextCtrl(p2, 30, "", wxPoint(280, 50),
wxSize(120, 22), wxTE_PROCESS_ENTER|wxTE_PROCESS_ENTER )

        p2.clear = wxButton(p2, 190, 'Clear All', (240,112))
        p2.clear.SetConstraints(Layoutf('l%r40#1;r%r60#1',(p2,)))
        p2.clear.SetToolTipString("Clear Fields")
        
        p2.patFindBtn = wxButton(p2, 110, 'Find', (325,112))
        p2.patFindBtn.SetConstraints(Layoutf('l%r40#1;r%r60#1',(p2,)))
        p2.patFindBtn.SetToolTipString("Find a Patient")

        wxStaticText(p2, -1, "Document Description:", wxPoint(15, 175),
wxSize(75, 30), wxTE_PROCESS_ENTER)
        p2.t = wxTextCtrl(p2, 70, "", wxPoint(100, 175), wxSize(300, 22),
wxTE_PROCESS_ENTER)

        list=['T Sheet', 'Face Sheet', 'Lab Report', 'MRI', 'XRay']
        wxStaticText(p2, -1, "Document:", wxPoint(15, 145), wxSize(75,
20))
        p2.sheetType = wxChoice(p2, 150, (101, 145), (175, 20),
                 list)

        wxStaticText(p2, -1, "Date:", wxPoint(290, 148), wxSize(30, 22),
wxTE_PROCESS_ENTER)
        p2.time = wxTextCtrl(p2, 499, "", wxPoint(330, 145), wxSize(70,
22), wxTE_PROCESS_ENTER)

class MyApp(wxApp):
    def OnInit(self):
        frame = MyFrame(NULL, -1, "Vertisoft", 500, 500)
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

app = MyApp(0)
app.MainLoop()

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

Okay so I guess I should not have thrown code out there and just asked
someone to fix it, sorry. I guess my question is if I have a function
call from my class that set up my frame to another class that sets up a
wxWindow and on the wxWindow I have wxTextCtrl what do I need to do to get
tab traversal to work on that panel. I have tried set focus and set
keybard input all of those. I was just wondering if there is a couple of
commands that woudl make tab traversal work?
Thanks
Matt

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

I am using the lastest version of linux(Redhat 7.1) and have the latest
version of
everything and I was wondering if someone could tell me why some commands
are acting differnet when running linux
1. I follow the suggetion earlier and took out all of the process enter
but under lenox tab traversal is not working, but under windows it is.
(Down below is sample code if you wish to look)
2. When I make a wxBitmap in a thread it throws an exception and gives me
a Xlib: unexpected async reply (sequence 0xc0a)!, and I have no clu what
this means nor do I get this error when running under windows(sample code
below)
3. When making a wxStaticBitmap if you just put the the size in init of
it then it shinks the picture down to this size, however when running
under linux it does nothing to it.

If anyone has any ideas why this is happening tI would love to know. I am
running Redhat 7.1 and again have all the newest versions of everything on
my machine.

Thanks alot

Matt

Sample Code
Tab Not working
from wxPython.wx import *
from wxPython.lib.layoutf import Layoutf
from wxPython.lib.buttons import *
from wxPython.lib.dialogs import wxMultipleChoiceDialog
ID_EXIT = 102
import time

class MyFrame(wxFrame):
    def __init__(self, parent, ID, title, xSize, ySize):
        wxFrame.__init__(self, parent, ID, title,
                         wxDefaultPosition, wxSize(xSize, ySize))

        menu = wxMenu()
        menu.Append(ID_EXIT, "E&xit", "Terminate the program")
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File");
        self.SetMenuBar(menuBar)
        EVT_MENU(self, ID_EXIT, self.TimeToQuit)
        self.SetAutoLayout(true)
        self.panelB = infoPanel(self)
        self.panelB.p2.SetFocus()
        
    def TimeToQuit(self, event):
        self.Close(true)

class infoPanel:
   def __init__(self, parent):

        p2 = wxWindow(parent, -1, wxPyDefaultPosition, wxPyDefaultSize,
wxSIMPLE_BORDER)

p2.SetConstraints(Layoutf('t%b5#1;l=l10#1;b%b98#1;r%r95#1',(parent,)))
        p2.SetBackgroundColour(wxColour(228, 237, 243))
        self.p2 = p2
        self.p2.parent = parent
        p2.SetWindowStyle(wxTAB_TRAVERSAL )

        wxStaticText(p2, -1, "Patient Name:", wxPoint(15, 22), wxSize(75,
22))
        self.p2.patientName = wxTextCtrl(p2, 10, "", wxPoint(100,20),
wxSize(300,22))
        
        wxStaticText(p2, -1, "Account #", wxPoint(15, 53), wxSize(75, 22))
        p2.accountNumber = wxTextCtrl(p2, 20, "", wxPoint(100, 50) ,
wxSize(120, 22))
        hosList=['Northside', 'Eastside', 'Southside', 'Westside']

        wxStaticText(p2, -1, "Hospitial:", wxPoint(15, 83), wxSize(50,
22))
        p2.whatHospitial = wxChoice(p2, 60, (100, 80), (175, 20), hosList)
            
        wxStaticText(p2, -1, "MRN:", wxPoint(233, 53), wxSize(75, 22))
        p2.mrnNumber = wxTextCtrl(p2, 30, "", wxPoint(280, 50),
wxSize(120, 22))

        wxStaticText(p2, -1, "Document Description:", wxPoint(15, 175),
wxSize(75, 30))
        p2.t = wxTextCtrl(p2, 70, "", wxPoint(100, 175), wxSize(300, 22))

        list=['T Sheet', 'Face Sheet', 'Lab Report', 'MRI', 'XRay']
        wxStaticText(p2, -1, "Document:", wxPoint(15, 145), wxSize(75,
20))
        p2.sheetType = wxChoice(p2, 150, (101, 145), (175, 20),
                 list)

        wxStaticText(p2, -1, "Date:", wxPoint(290, 148), wxSize(30, 22))
        p2.time = wxTextCtrl(p2, 499, "", wxPoint(330, 145), wxSize(70,
22))

class MyApp(wxApp):
    def OnInit(self):
        frame = MyFrame(NULL, -1, "Vertisoft", 500, 500)
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

app = MyApp(0)
app.MainLoop()

This is an exaple of wxBitmap throwing an error when made inside of a
thread and also wxStaticBitmap not proforming the consitantly over each
operating system

from wxPython.wx import *
import thread
import time
ID_ABOUT = 101
ID_EXIT = 102

class MyFrame(wxFrame):
    def __init__(self, parent, ID, title, xSize, ySize):
        wxFrame.__init__(self, parent, ID, title,
                         wxDefaultPosition, wxSize(xSize, ySize))

        menu = wxMenu()
        menu.Append(ID_EXIT, "E&xit", "Terminate the program")
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File");
        self.SetMenuBar(menuBar)
        EVT_MENU(self, ID_EXIT, self.TimeToQuit)
        p1 = makePanel(self)
        delete = FALSE
        cool = true
        
    def TimeToQuit(self, event):
        self.Close(true)

···

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

class makePanel(wxPanel):
    def __init__(self, parent):
        wxPanel.__init__(self, parent, -1)
        self.parent = parent
        self.SetAutoLayout(true)
        self.panelA = picturePanel(self)
        self.panelD = filePanel(self)

class picturePanel:
   def __init__(self, parent):
        p1 = wxScrolledWindow(parent, -1, wxPyDefaultPosition, (490, 350),
wxSIMPLE_BORDER)
        self.p1 = p1
        self.p1.parent = parent
        self.p1.drawn = false
        self.p1.draw = 0
        wxInitAllImageHandlers()
        self.p1.r = ''
        self.p1.done = true
        self.p1.finished = true
        self.p1.path = ''
        self.p1.lastnumber = 0
        self.p1.nextpic = ''
        self.p1.lastpic = ''
        self.p1.lasttitle = ''
        self.p1.nexttitle = ''
        self.p1.nowtitle = ''
        
   def DisplayPicture(self, path):
       self.p1.path= path
       self.p1.draw = 1
       self.display()
## What this does is it displays tiffs, where it is messing up is when I
##use a thread to try to make the next image in the background and that
##is when I encounter an error.

   def display(self):
       self.p1.current = self.p1.parent.panelD.getcurrent()
       path = self.p1.path
       if(self.p1.draw == 1):
           if (path == TRUE):
               self.p1.newPic.Destroy()
               self.p1.path=NULL
               self.p1.drawn = false
           else:
               wxSetCursor(wxHOURGLASS_CURSOR)
               if self.p1.drawn == true:
                   self.p1.newPic.Destroy()
               while(self.p1.done == false or self.p1.finished == false):
                   pass
               if(self.p1.current == self.p1.lastnumber -1):
                   self.p1.nextpic = self.p1.r
                   if(self.p1.lasttitle == path):
                       self.p1.r = self.p1.lastpic
                   else:
                       print 'this anit equaling'
                       self.p1.r = wxBitmap(path, wxBITMAP_TYPE_TIF)
                   if(self.p1.current != 0 ):
                       self.p1.nexttitle = self.p1.nowtitle
                       self.p1.nowtitle = path
                       thread.start_new_thread(self.makelast, ())
               elif(self.p1.current == self.p1.lastnumber +1):
                   self.p1.lastpic = self.p1.r
                   if(self.p1.nexttitle != path):
                       print 'does not equal'
                       self.p1.r = wxBitmap(path, wxBITMAP_TYPE_TIF)
                   else:
                       self.p1.r = self.p1.nextpic
                   if(len(self.p1.parent.panelD.getfile())-1 != self.p1.current):
                       thread.start_new_thread(self.makenext, ())
                       self.p1.lasttitle = self.p1.nowtitle
                       self.p1.nowtitle = path
               else:
                   self.p1.r = wxBitmap(path, wxBITMAP_TYPE_TIF)
                   if(self.p1.current != 0 ):
                       thread.start_new_thread(self.makenext, ())
                   if(len(self.p1.parent.panelD.getfile()) != self.p1.current):
                       thread.start_new_thread(self.makelast, ())
                   
               r = wxBitmap(path, wxBITMAP_TYPE_TIF)
               self.p1.Show(false)
         ##### On the wxSize on Windows it scales the picture down
         #### to this size on linux it does what appears to be
               #### doing nothing
               self.p1.newPic = wxStaticBitmap(self.p1, 900, r, wxPoint(10, 10), wxSize(430, 320))
               self.p1.Show(TRUE)
               self.p1.drawn=true
               wxSetCursor(wxSTANDARD_CURSOR)
           self.p1.draw = 0
           self.p1.lastnumber = self.p1.current

   def makenext(self):
       self.p1.done = false
       file = self.p1.parent.panelD.getfile()
       if(len(file) <= self.p1.current):
           return
       pic = file[self.p1.current +1]
       ########Chokes on the next line
       self.p1.nextpic = wxBitmap(pic, wxBITMAP_TYPE_TIF)
       self.p1.nexttitle = pic
       self.p1.done = true

   def makelast(self):
       self.p1.finished = false
       file = self.p1.parent.panelD.getfile()
       pic = file[self.p1.current-1]
        ######### chokes on this line--v
       self.p1.lastpic = wxBitmap(pic, wxBITMAP_TYPE_TIF)
       self.p1.lasttitle = pic
       self.p1.finished = true

class filePanel:
   def __init__(self, parent):

        p4 = wxWindow(parent, -1, (0, 370), (495,300), wxSIMPLE_BORDER)
        self.p4 = p4
        self.p4.parent = parent
#######
####### REPLACE IMAGES HERE
######
        self.p4.files = ['i993156230m0000.tiff', 'i993156234m0002.tiff',
'i993227445m0004.tiff',
       'i993156236m0003.tiff', 'i993227448m0005.tiff',
'i993156237m0004.tiff',
       'i993227448m0006.tiff', 'i993156239m0005.tiff']
        self.p4.list = wxListBox(self.p4, 5,(0, 0), (490, 300),
self.p4.files, wxLB_SINGLE)
        EVT_LISTBOX(self.p4.list, 5, self.OnItem)
        self.p4.clickeditem = 0
   #------------------------ EVENTS --------------------------#
        
   #--- When you click on an item ---#
        
   def OnItem(self, event):
        self.p4.clickeditem = self.p4.list.GetSelection()

self.p4.parent.panelA.DisplayPicture(self.p4.files[self.p4.clickeditem])

   def getcurrent(self):
       return self.p4.clickeditem

   def getfile(self):
       return self.p4.files
    
class MyApp(wxApp):
    def OnInit(self):
        frame = MyFrame(NULL, -1, "Hello from wxPython", 500, 800)
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

app = MyApp(0)
app.MainLoop()

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

everything and I was wondering if someone could tell me why some commands
are acting differnet when running linux
1. I follow the suggetion earlier and took out all of the process enter
but under lenox tab traversal is not working, but under windows it is.
(Down below is sample code if you wish to look)

Try changing infoPanel.p2 to be a wxPanel instead of a wxWindow. Much of
the tab traversal logix is implemented in wxPanel.

2. When I make a wxBitmap in a thread it throws an exception and gives me
a Xlib: unexpected async reply (sequence 0xc0a)!, and I have no clu what
this means nor do I get this error when running under windows(sample code
below)

It is an X-Windows error message, which is why you will not get it on
MS-Windows. It is not safe to do GUI related object creation or method
calls from other than the main thread, especially on X.

3. When making a wxStaticBitmap if you just put the the size in init of
it then it shinks the picture down to this size, however when running
under linux it does nothing to it.

My guess is that it is differences in the native controls. You can't
eliminiate all of the platform differences in a library like this and still
use native controls.

If you really need to do this then put your bitmap in a wxImage first, use
its Rescale method and then convert back to a wxBitmap to put into the
wxStaticBitmap.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

I was wondering if anyone knows how to install wxPython without the GUI
showing up. I just want it to run without showing the user anything.
Thanks
Matt

Matt McClain "To hell with georgia"
mcclain@cc.gatech.edu

Matthew Forrester McClain wrote:

I was wondering if anyone knows how to install wxPython without the GUI
showing up. I just want it to run without showing the user anything.

The installer program will accept these parameters:

/SP-
Disables the This will install... Do you wish to continue? prompt at the beginning of Setup. Of course, this will have no effect if the DisableStartupPrompt [Setup] section directive was set to yes.

/SILENT, /VERYSILENT
Instructs Setup to be silent or very silent. When Setup is silent the wizard and the background window are not displayed but the installation progress window is. When a setup is very silent this installation progress window is not displayed. Everything else is normal so for example error messages during installation are displayed and the startup prompt is (if you haven't disabled it with DisableStartupPrompt or the

'/SP-' command line option explained above)
If a restart is necessary and the '/NORESTART' command isn't used (see below) and Setup is silent, it will display a Reboot now? messagebox. If it's very silent it will reboot without asking.

/NORESTART
Instructs Setup not to reboot even if it's necessary.

/LOADINF="filename"
Instructs Setup to load the settings from the specified file after having checked the command line. This file can be prepared using the

'/SAVEINF=' command as explained below.
Don't forget to use quotes if the filename contains spaces.

/SAVEINF="filename"
Instructs Setup to save installation settings to the specified file.
  Don't forget to use quotes if the filename contains spaces.

/DIR="x:\dirname"
Overrides the default directory name displayed on the Select Destination Directory wizard page. A fully qualified pathname must be specified. If the [Setup] section directive DisableDirPage was set to yes, this command line parameter is ignored.

/GROUP="folder name"
Overrides the default folder name displayed on the Select Start Menu Folder wizard page. If the [Setup] section directive DisableProgramGroupPage was set to yes, this command line parameter is ignored.

/NOICONS
Instructs Setup to initially disable the Don't create any icons check box on the Select Start Menu Folder wizard page.
/COMPONENTS="comma separated list of component names"
Overrides the default components settings. Using this command line parameter causes Setup to automatically select a custom type.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!