Wiki Page: "AnotherTutorial" changes

Not every colour is recognized.
(wxPython 2.6.2.1, Windows XP)
The same applies for wx.Button (interactivebutton.py).

Can someone try it on linux or newer wxPython Version?

===

# randomcolours.py

import wx
from random import randrange
from wxPython.lib.colourdb import getColourList

You should import this from wx.lib.colourdb. Also, you need to import
and call updateColourDB, this is the function that actually loads the
new colours into the colour DB.

thanks, this works.

2) wx.Bell() works? (I didn't heared any sound)

Yes, it works for me. It tells the system to play the sound that is
configured in the Control Panel for "Default Beep". If you have that
set to play nothing then wx.Bell will do nothing.

thanks for clarification.

3) ledctrl Window grows smaller after update the first time.

The delayed size effect is probably happening because the client size of
the frame hasn't been adjusted yet at the time you call
self.OnTimer(None) and it will then be one full second before the ctrl
is updated again so it is very noticable. But there is an easy
workaround, just make that first call to self.OnTimer with wx.CallAfter.
That way the frame will be shown and size adjusted by the time the
ledctrl's value is set the first time.

Cool, works also now as expected.

4) double point doesn't work; a bug?

I assume you mean the colon (':') ?

yes, the colon.

The ledctrl doesn't support it.
I'm not sure whw, it probably could without too much work if anybody is
interested in submitting a patch for the C++ code.

I leave spaces instead of the colon in the meantime.

5) Drag and Drop Sample doesn't work:

That's because the DnD is initiated on a EVT_LIST_ITEM_RIGHT_CLICK
event, and that doesn't happen until the mouse button is released, so
there is no drag operation in progress at the time DoDragDrop is called,
so it returns immediately. The sample should be changed to use
EVT_LIST_BEGIN_DRAG or similar.

ah, also corrected now.

6) SingleApp:

c:/Python24/pythonw.exe -u "C:/drpython/drpython_franz/saved/wxpy_sources/AnotherTutorial/SingleApp.py"
Traceback (most recent call last):
  File "C:/drpython/drpython_franz/saved/wxpy_sources/AnotherTutorial/SingleApp.py", line 35, in ?
    frame = SingleApp(None, -1, "SingleApp")
  File "C:/drpython/drpython_franz/saved/wxpy_sources/AnotherTutorial/SingleApp.py", line 12, in __init__
    instance.Create(self.name,'')
  File "c:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_misc.py", line 1118, in Create
calling destructor
Could not delete lock file
[Errno 2] No such file or directory: 'C:\\Dokumente und Einstellungen\\Besitzer.FRANZ/SingleApp-Besitzer'
C:\Dokumente und Einstellungen\Besitzer.FRANZ/SingleApp-Besitzer
    self.notify()
wx._core.PyAssertionError: C++ assertion "!m_impl" failed in ..\..\src\msw\snglinst.cpp(110): calling
wxSingleInstanceChecker::Create() twice?

This sample has several problems. First, the code is calling both the
constructor, and the Create method, but the constructor used already
calls Create itself. Second, the SingleInstanceChecker instance needs
to be held for the life of the app, so a reference to is needs to be
saves. Third, the frame's ID can't be -4 as that is not a legal value.
Fourth, there is no need to delete the lockfile as
wx.SingleInstanceChecker will do that itself when it is destroyed. here
is a simpler version:

import wx

class SingleAppFrame(wx.Frame):
    def __init__(self,parent,id,title):
        wx.Frame.__init__(self,parent,-1, title, size = ( 300, 300))
        self.Centre()

class SingleApp(wx.App):
    def OnInit(self):
        self.name = "SingleApp-%s" % (wx.GetUserId())
        self.instance = wx.SingleInstanceChecker(self.name)
        if self.instance.IsAnotherRunning():
            wx.MessageBox("Another instance is running", "ERROR")
            return False
        frame = SingleAppFrame(None, -1, "SingleApp")
        frame.Show()
        return True

app = SingleApp(redirect=False)
app.MainLoop()

Cool, thanks for the info and the last corrected sample.
I update the wiki again.

ยทยทยท

On Mon, 03 Apr 2006 12:10:03 -0700, Robin Dunn <robin@alldunn.com> wrote:

--
Franz Steinhaeusler