ToasterBox does not behave as the inline documentation suggests

Hi,

I wanted to use ToasterBox, but my application does not behave as the inline documentation suggests.
Bellow is code demoing my problems:

  1. Even though I’m using SetPopupPositionByInt(next_popup_position) with next_popup_position cycling among 0,1,2,3 - all the ToasterBoxs appear at the same location.
  2. Changing SetPopupPauseTime
    does not produce any visible change.
    Could anyone suggest what I’m doing wrong ?

Thanks,

Ron.

#!/usr/bin/env python

-- coding: utf-8 --

import wx

import ToasterBox as TB

def generator():
i = 1
while True:
yield i
i = (i + 1) % 4

def info_message_without_interaction(msg, next_popup_position):
“”"
“”"
average_char_width = 8
x = 500
y = 50
frame = wx.Frame(parent=None)
panel = wx.Panel(frame)
tb = TB.ToasterBox(panel, TB.TB_SIMPLE, TB.DEFAULT_TB_STYLE, TB.TB_ONTIME)
tb.SetPopupPauseTime(10000)
tb.SetPopupScrollSpeed(8)
tb.SetPopupText(msg)
tb.SetPopupSize((x,y))
tb.SetPopupPositionByInt(next_popup_position)
tb.SetPopupTextColor(wx.GREEN)
tb.SetPopupBackgroundColor(wx.BLUE)
tb.Play()

if name == ‘main’:

app = wx.App(redirect=False)
popup_position = generator()
for i in range(5):
    next_popup_position = popup_position.next()
    msg = str(next_popup_position)
    info_message_without_interaction(msg, next_popup_position)

Barak, Ron wrote:

Hi,

I wanted to use ToasterBox, but my
application does not behave as the inline documentation suggests.

Bellow is code demoing my problems:

  1. Even though I’m using SetPopupPositionByInt(next_popup_position)
    with next_popup_position cycling among
    0,1,2,3 - all the ToasterBoxs appear at the same location.
  2. Changing SetPopupPauseTime
    does not produce any visible change.
    Could anyone suggest what I’m
    doing wrong ?

Thanks,

Ron.

#!/usr/bin/env
python

-- coding: utf-8 --

import wx

import
ToasterBox as TB

def
generator():

i = 1

while True:

    yield i

    i = (i + 1) % 4

def
info_message_without_interaction(msg, next_popup_position):

"""

"""

average_char_width = 8

x = 500

y = 50

frame = wx.Frame(parent=None)

panel = wx.Panel(frame)

tb = TB.ToasterBox(panel, TB.TB_SIMPLE, TB.DEFAULT_TB_STYLE,

TB.TB_ONTIME)

tb.SetPopupPauseTime(10000)

tb.SetPopupScrollSpeed(8)

tb.SetPopupText(msg)

tb.SetPopupSize((x,y))

tb.SetPopupPositionByInt(next_popup_position)

tb.SetPopupTextColor(wx.GREEN)

tb.SetPopupBackgroundColor(wx.BLUE)

tb.Play()

if
name == ‘main’:

app

= wx.App(redirect=False)

popup_position = generator()

for i in range(5):

    next_popup_position = popup_position.next()

    msg = str(next_popup_position)

    info_message_without_interaction(msg, next_popup_position)

It has to be said that I find the abstraction layer between ToasterBox
and ToasterBoxWindow quite confusing.

Just about everything that the latter does it replicated in the former.
:frowning:

Thus, when reading the code, you never really know if your looking at
(say) ToasterBox::SetPopupPositionByInt() or
ToasterBoxWindow::SetPopupPositionByInt(). They both look almost
identical too. :frowning:

JOOI: What happens if you change:

tb.SetPopupPositionByInt(next_popup_position)

to:

tb._tb.SetPopupPositionByInt(next_popup_position)

-R

Hi Ron,

Hi,

I wanted to use ToasterBox, but
my application does not behave as the inline

documentation suggests.

Bellow is code demoing my
problems:

Even though I’m using
SetPopupPositionByInt(next_popup_position) with

next_popup_position cycling
among 0,1,2,3 - all the ToasterBoxs appear at

the same location.

Changing SetPopupPauseTime does
not produce any visible change.

Could anyone suggest what I’m
doing wrong ?

Nothing with the code itself, it’s
the approach: when you call multiple times ToasterBox, it just stacks more and
more ToasterBox windows on top of each other (like the MSN Messenger popups),
so the call to SetPopupPosition does nothing unless you call it before showing
the first ToasterBox.

Next, the call to SetPopupPauseTime
does nothing because you are not calling MainLoop() on the wx.App, which is
something you always need to do. Try the following modified script to see if
changing SetPopupPauseTime does something or not.

import wx

from wx.lib.agw import toasterbox as
TB

def generator():

i = 1

while True:

    yield i

    i = (i + 1) % 4

def
info_message_without_interaction(frame, msg, next_popup_position):

"""

"""

average_char_width = 8

x = 500

y = 50

tb = TB.ToasterBox(panel,

TB.TB_SIMPLE, TB.DEFAULT_TB_STYLE, TB.TB_ONTIME)

tb.SetPopupPauseTime(10000)

tb.SetPopupScrollSpeed(8)

tb.SetPopupText(msg)

tb.SetPopupSize((x,y))

tb.SetPopupPositionByInt(next_popup_position)

tb.SetPopupTextColor(wx.GREEN)

tb.SetPopupBackgroundColor(wx.BLUE)

tb.Play()

if name == ‘main’:

app = wx.App(redirect=False)

frame = wx.Frame(parent=None)

panel = wx.Panel(frame)

popup_position = generator()

for i in range(5):

    next_popup_position =

popup_position.next()

    msg =

str(next_popup_position)

info_message_without_interaction(frame, msg, next_popup_position)

    wx.MilliSleep(200)

    wx.SafeYield()

app.MainLoop()

Andrea.

···

On Mon, Feb 2, 2009 at 12:53 PM, Barak, Ron wrote:


Andrea
Gavana
(gavana@kpo.kz)

Reservoir
Engineer

KPDL

Cardinal Place

80, Victoria Street

SW1E 5JL London

Direct Tel: +44 (0) 20
717 08936

Mobile Tel: +44 (0) 77
487 70534

Fax: +44 (0) 20 717
08900

Web: http://xoomer.alice.it/infinity77/index.html

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, please advise us immediately if you are not the named addressee or the person responsible for delivering the message to the named addressee. The contents should not be disclosed to any other person nor copies taken. Unless expressly stated, any views, whether express or implied, are the sender’s personal views, do not necessarily reflect the views of KPO or any of its directors and are not approved by KPO Group and this email is not an offer, solicitation, recommendation or agreement of any kind.

Hi Andrea,

It seems something is different between my environment and yours.

Your code (somewhat changed to run on my machine (see below)) produces the same results as mine does, namely, all ToasterBoxes appear at the same location (one above the other).

And, BTW, the ToasterBoxes background is blue, but the foreground text is black (and not tb.SetPopupTextColor(wx.GREEN))

Thanks,

Ron.

#!/usr/bin/env python

import wx

import ToasterBox as TB
#from wx.lib.agw import toasterbox as TB

def generator():
i = 1
while True:
yield i
i = (i + 1) % 4

def info_message_without_interaction(frame, msg, next_popup_position):
“”"
“”"
average_char_width = 8
x = 500
y = 50
tb = TB.ToasterBox(panel, TB.TB_SIMPLE, TB.DEFAULT_TB_STYLE, TB.TB_ONTIME)
tb.SetPopupPauseTime(10000)
tb.SetPopupScrollSpeed(8)
tb.SetPopupText(msg)
tb.SetPopupSize((x,y))
tb.SetPopupPositionByInt(next_popup_position)
tb.SetPopupTextColor(wx.GREEN)
tb.SetPopupBackgroundColor(wx.BLUE)
tb.Play()

if name == ‘main’:

app = wx.App(redirect=False)
frame = wx.Frame(parent=None)
panel = wx.Panel(frame)

popup_position = generator()
for i in range(5):
    next_popup_position = popup_position.next()
    msg = str(next_popup_position)
    info_message_without_interaction(frame, msg, next_popup_position)
    wx.MilliSleep(200)
    wx.SafeYield()
app.MainLoop()
···

From: Gavana, Andrea [mailto:gavana@kpo.kz]
Sent: Monday, February 02, 2009 16:07
To:
wxpython-users@lists.wxwidgets.org
Subject: RE: [wxpython-users] ToasterBox does not behave as the inlinedocumentation suggests

Hi Ron,

On Mon, Feb 2, 2009 at 12:53 PM, Barak, Ron wrote:

Hi,

I wanted to use ToasterBox, but my application does not behave as the inline

documentation suggests.

Bellow is code demoing my problems:

Even though I’m using SetPopupPositionByInt(next_popup_position) with

next_popup_position cycling among 0,1,2,3 - all the ToasterBoxs appear at

the same location.

Changing SetPopupPauseTime does not produce any visible change.

Could anyone suggest what I’m doing wrong ?

Nothing with the code itself, it’s the approach: when you call multiple times ToasterBox, it just stacks more and more ToasterBox windows on top of each other (like the MSN Messenger popups), so the call to SetPopupPosition does nothing unless you call it before showing the first ToasterBox.

Next, the call to SetPopupPauseTime does nothing because you are not calling MainLoop() on the wx.App, which is something you always need to do. Try the following modified script to see if changing SetPopupPauseTime does something or not.

import wx

from wx.lib.agw import toasterbox as TB

def generator():

  i = 1
  while True:
      yield i
      i = (i + 1) % 4

def info_message_without_interaction(frame, msg, next_popup_position):

  """
  """
  average_char_width = 8
x = 500
  y = 50
  tb = TB.ToasterBox(panel, TB.TB_SIMPLE, TB.DEFAULT_TB_STYLE, TB.TB_ONTIME)
  tb.SetPopupPauseTime(10000)
  tb.SetPopupScrollSpeed(8)
  tb.SetPopupText(msg)
  tb.SetPopupSize((x,y))
  tb.SetPopupPositionByInt(next_popup_position)
  tb.SetPopupTextColor(wx.GREEN)
  tb.SetPopupBackgroundColor(wx.BLUE)
  tb.Play()

if name == ‘main’:

  app = wx.App(redirect=False)
  frame = wx.Frame(parent=None)
  panel = wx.Panel(frame)
  popup_position = generator()
  for i in range(5):
      next_popup_position = popup_position.next()
      msg = str(next_popup_position)
      info_message_without_interaction(frame, msg, next_popup_position)
      wx.MilliSleep(200)
      wx.SafeYield()
  app.MainLoop()

Andrea.


** Andrea Gavana**
(gavana@kpo.kz)

  • Reservoir Engineer*

KPDL

Cardinal Place

80, Victoria Street

SW1E 5JL London

Direct Tel: +44 (0) 20 717 08936

Mobile Tel: +44 (0) 77 487 70534

Fax: +44 (0) 20 717 08900

Web:
http://xoomer.alice.it/infinity77/index.html

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, please advise us immediately if you are not the named addressee or the person responsible for delivering the message to the named addressee. The contents should not be disclosed to any other person nor copies taken. Unless expressly stated, any views, whether express or implied, are the sender’s personal views, do not necessarily reflect the views of KPO or any of its directors and are not approved by KPO Group and this email is not an offer, solicitation, recommendation or agreement of any kind.