Digest for wxpython-users@googlegroups.com - 12 Messages in 7 Topics

That was the very first tutorial I read. It doesn’t cover working with
alpha in wx.

···

wxpython-users+noreply@googlegroups.com

Today’s Topic Summary

Group: http://groups.google.com/group/wxpython-users/topics

  • Two problems
    with wx.ListCtrl, style=wx.LC_ICON [2 Updates]
  • wxImage from
    PNG with an alpha channel (try #2 with code) [2 Updates]
  • Background
    Image [2 Updates]
  • Medical Expert
    System GUI | Anchoring widgets [1 Update]
  • Combo Box, how
    to reset but not clear all contents [3 Updates]
  • Making buttons
    not take focus [1 Update]
  • Window menu on
    mac behaves weirdly [1 Update]
    Topic:
    Two
    problems with wx.ListCtrl, style=wx.LC_ICON

Paolo Crosetto
May 18 08:17AM -0700 ^

Dear all,

I am developing an application for a laboratory experiment on human

behaviour in eocnomics.

I am using the Icon ListCtrl (horizontally aligned) to display the

number of players that are in a given situation.

Visually, I have a matrix with a cell for each possible situation. In

the upper part of the matrix, I wanted to display the number of

subject that fall into that category as a list of ‘user icons’ with a

number.

See the screenshot here to visualize what I mean:

[http://dl.dropbox.com/u/1118370/wx.ListCtrl_IconList.png](http://dl.dropbox.com/u/1118370/wx.ListCtrl_IconList.png)

The wx.ListCtrl works through the creation of a wx.ImageList that

gets asigend to the ListCtrl

I have two problems with this otherwise very handy solution:

  1. I am not succeedng in disabling (greying-out) the ListCtrl. Or,

better said: when calling wx.ListCtrl.Enabled I get ‘False’; but,

nonetheless (and as you can see) the icons are still in full colour

and are not greyed-out. I see that wx.ImageList has no function

Disable(), and that might be the reason. In any case: how do I disable

a wx.ListCtrl which has been assigned a wx.ImageList?

  1. As you can see in the screenshot, There is a space below the row of

icons. It is as if the list needs two rows for the icons, or as if it

keeps space for not-shown labels. I would like to get rid of this

extra space. Is there any way to do it?

Thanks,

P

To unsubscribe, send email to
or visit
Paolo Crosetto
May 18 08:26AM -0700 ^

I forgot: for completeness, here is the code creating the list

def refreshplaylist(self, play_in_cell):

self.list.DeleteAllItems()

PlayIcons = {1: ‘pl1_small.png’, 2: ‘pl2_small.png’, 3:

‘pl3_small.png’, 4: ‘pl4_small.png’}

self.il = wx.ImageList(22,22, True)

for name in play_in_cell:

self.bmp = wx.Bitmap(PlayIcons[name], wx.BITMAP_TYPE_PNG)

self.il_max = self.il.AddWithColourMask(self.bmp,‘black’)

self.list.AssignImageList(self.il, wx.IMAGE_LIST_NORMAL)

for x in range(len(play_in_cell)):

self.img = x % (self.il_max+1)

self.list.InsertImageItem(x, self.img)

self.list.SetItemPosition(x, (2+(x-1)*26,2))

the list is a child of a class Matrix, that subclasses wx.Panel; when

I call Matrix.Disable() it disables all children, included the

ListCtrl; but it seems unable to Disable the ImageList assigned to the

ListCtrl.

Thanks again,

Paoo

To unsubscribe, send email to
or visit
Topic:
wxImage
from PNG with an alpha channel (try #2 with code)

Ray Pasco
May 18 07:07AM -0700 ^

Thanks, but I still haven’t found examples or a tutorial to show how

alpha is handled and manipulated using wx.

To unsubscribe, send email to
or visit
Mike Driscoll
May 18 07:59AM -0700 ^

Thanks, but I still haven’t found examples or a tutorial to show
how

alpha is handled and manipulated using wx.

See http://wiki.wxpython.org/index.cgi/WorkingWithImages

Also download the wxPython Demo. In the “Using Images” section, there

is an Alpha Drawing demo and an ImageAlpha demo. There’s probably some

others there too.


Mike Driscoll

Blog: http://blog.pythonlibrary.org

To unsubscribe, send email to
or visit
Topic:
Background
Image

“Brendan Simon (eTRIX)”
May 18 12:20PM +1000 ^

On 11/05/10 4:27 AM, Mike Driscoll wrote:

I created a tutorial on how to put an image on the background of a

panel. It might help you figure out how to do it in your
application:

http://www.blog.pythonlibrary.org/2010/03/18/wxpython-putting-a-background-image-on-a-panel/

The example at the website above works great for Panels, but does not

seem to work for Dialogs.

The OnEraseBackground() method is definitely being called when objects

are drawn or the window resized, but the background image isn’t drawn

(just get the standard grey background colour).

Any idea why, and how to solve this ??

Thanks, Brendan.

To unsubscribe, send email to
or visit
Mike Driscoll
May 18 07:34AM -0700 ^

On May 17, 9:20 pm, “Brendan Simon (eTRIX)”

(just get the standard grey background colour).

Any idea why, and how to solve this ??

Thanks, Brendan.

Probably the quickest way would be to put a panel in the dialog.

Dialogs don’t behave the same way as panels, after all. Robin will

probably know another workaround.


Mike Driscoll

Blog: http://blog.pythonlibrary.org

To unsubscribe, send email to
or visit
Topic:
Medical
Expert System GUI | Anchoring widgets

“Dr.James”
May 18 02:49AM -0700 ^

Dear Robin, Steve and Karsten, sorry for the delay in replying. We

have disrupted internet here due to heavy rains.

Robin, thanks for the good idea, lot of widgets dont come into use in

a single session, so creating them on the fly would solve the

problem.

Steve, thank you for suggesting wx.aui - my friend Herald who is

developing the GUI is experimenting with it and it looks advanced.

We have a few more doubts - 1) is there a sizer that arranges items

into rows by itself. For eg.if we have 10 items in a horizontal

boxsizer it just fits the screen, and when we add two more it goes out

of screen, is it possible that those new items be added below (in a

new row)? This is important because when we use splitter window and

some one resizes the window, the widgets remain in their exact

position, leaving the expanded space empty.

  1. Our expert system currently works under CLI - Command line

interface and we plan to integrate this facility in GUI too.(Some

doctors may find it easy to type y/n or 1,2,3 options.) So is there an

easy way to integrate shell prompt like interface into GUI?

What if there’s no answer available to that ? I suppose the

doctor is free to answer another question ?

Yes, he is free to pursue any diagnosis he wants. If no answer is

available, the system reasons but will have less certainty.

There’s rarely a “definite” diagnosis to be head. But I

suppose you don’t mean scientifically definite but rather

definite in a rules-related computational sense.

Yes, we cannot have diagnosis as “definite” until we do a biopsy etc,

but here i mean diagnosis in the sense we use it in GP - most probable

hypothesis to work on.

What GNUmed would like to do (at which point we’d want to

move further discussion to a more appropriate list such as

gnumed-devel which I CCed):

Sure, we can do that or have a separate group for this project.

Currently we are two of us who are working on GUI, and it will help a

lot to have help from more experienced developers. I think we should

begin by building a standalone application that can interact with

expert system, and once we do that we can integrate this into GNUmed.

Does GNUmed have integrated workflow like feature? For eg. a nurse

might take vitals and weight and enter into the system, and by the

time the patient comes in front of physician, his basic demographics

and vitals are already present. If yes, we can further expand this

into a workflow where the physician assistant interacts with the

patient, collecting symptoms based on questions asked by expert

system, feeds them, and by the time the patient arrives to the

physician a detailed history taking is almost done, leaving

examination and investigations for the doctor. This can save time in

busy centers.

entry and be told:

  • why the expert system thought this should be considered
  • what else should be investigated to increase diagnostic certainty

This is exactly what an expert system does - we want to emulate an

expert doctors thinking, and certainly want to give reasons for each

and every decision the system made.

database) with known guidelines for the health conditions

known to exist in the patient. IOW, monitor management of

care.

Since we want the expert system to formulate the management, it will

adhere to the guidelines. However the doctor is free to add/omit the

drugs so yes, this is a good idea - we may have to track multiple

instances.

OTOH, they would be willing to answer a few questions from

the expert system if it helps them detect cases of rare

diseases (“- consider Winiwarther-Burger syndrome”).

Well, Dr.Karsten - the situation here (in third world countries) is

pretty grim - you would be astonished to know about the disastrous

system here. Many people here suffer because of lack of information.

For eg. http://www.hifa2015.org/about/why-hifa2015-is-needed/

Thats only the tip of an iceberg. The only way we can help them is a)

empowering doctors b) health education to people. We see Naimath

expert system, as a solution to both. The patient can feed symptoms in

their own language (eg. diarhoea) and get info about the treatment in

their own language (eg. ORS etc) which will not only clear

misconceptions but also provide timely care. There are plenty more

things to say, but the point is my first target for naimath is to be

solid in these conditions. Ofcourse, we will want to gradually add

more and more knowledge to diagnose rare disorders. (This reminds me

that we also have to discuss the GUI for teaching the system and

inputing knowledge).

controlled vocabs alone cannot ever capture the whole (or

even true) story. Which I tend to agree with from the last

10 years of community medical care.

I would beg to differ here, the symptoms can vary in many ways, but

since we NEED to have them formalized (for the sake of expert system),

i see no problem in solving the research thing.

I will look forward to your reply and we shall move this discussion to

a new place.

Thank you!

–Dr.Inayath

To unsubscribe, send email to
or visit
Topic:
Combo
Box, how to reset but not clear all contents

User1101
May 17 05:24PM -0700 ^

I have a bunch of combo box that users select from a static set of

choices. When they press the clear button on the frame, I want to

reset all the combo boxes back to the default… but I do not want to

clear all the static choices from the box! I know it sounds incredibly

simple, but I can’t seem to figure out how to do this.

To unsubscribe, send email to
or visit
Cody Precord
May 17 10:03PM -0500 ^

Hi,

reset all the combo boxes back to the default… but I do not want
to

clear all the static choices from the box! I know it sounds
incredibly

simple, but I can’t seem to figure out how to do this.

If you mean you want to set them back to the initial selections then

just call the ComboBox’s SetSelection method to return the selection

back to whatever you initialized them to. (i.e if you didn’t set an

initial selection then ‘mycomobox.SetSelection(0)’.)

Also see SetStringSelection if you want to set the selection based

upon a string the control as opposed to an index.

Cody

To unsubscribe, send email to
or visit
C M
May 18 01:51AM -0400 ^

just call the ComboBox’s SetSelection method to return the
selection

back to whatever you initialized them to. (i.e if you didn’t set an

initial selection then ‘mycomobox.SetSelection(0)’.)

If any ComboBoxes start off blank, you’ll want to call

mycombobox.SetSelection(-1).

Btw, you can do this in a loop, either by collecting your comboboxes

yourself into a list, or if they are on a common parent you can do

something like:

for object in parent.GetChildren():

if type(object) == wx._controls.ComboBox:

object.SetSelection(-1)

Che

To unsubscribe, send email to
or visit
Topic:
Making
buttons not take focus

cool-RR
May 18 01:00AM +0200 ^

idle event.

Robin Dunn

Still not able to click the button with the mouse.

The class looks like this:

class FocuslessWindowMixin(wx.Window):

def init(self, *args, **kwargs):

self.Bind(wx.EVT_SET_FOCUS, self.on_set_focus, self)

def on_set_focus(self, event):

wx.CallAfter(self.Navigate)

event.Skip()

(My FocuslessBitmapButton inherits from this, and both of the
__init__

functions are called.)

Any clue?

Ram.

To unsubscribe, send email to
or visit
Topic:
Window
menu on mac behaves weirdly

cool-RR
May 18 12:55AM +0200 ^

to disable the items on the menu instead.

Robin Dunn

Okay, thanks.

Ram.

To unsubscribe, send email to
or visit

To unsubscribe, send email to
or visit
paolo.crosetto@gmail.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

paolo.crosetto@gmail.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

raoulpalma@yahoo.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

kyosohma@gmail.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

brendan.simon@etrix.com.auwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

kyosohma@gmail.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

james.dr.22@gmail.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

kevinsemailaddie@yahoo.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

codyprecord@gmail.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

cmpython@gmail.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

cool-rr@cool-rr.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

cool-rr@cool-rr.comwxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

wxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

http://groups.google.com/group/wxPython-users?hl=en

Well, that's weird...on my screen, http://wiki.wxpython.org/index.cgi/WorkingWithImages
has examples where it shows how to copy alpha channels, set the alpha
channel and set gradients with the alpha. Yes, it uses PIL, but that's
a valid way to work with them too.

···

On May 18, 1:26 pm, Ray Pasco <pas...@verizon.net> wrote:

That was the very first tutorial I read. It doesn't cover working with alpha in wx.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en