sneekula 969 Nearly a Posting Maven

I just happen to have it handy:

# convert all .tif file in a directory to .gif files
# needs Python Image Library (PIL) free from:
# http://www.pythonware.com/products/pil/index.htm

import os
from PIL import Image

# give the directory the TIF files are in
path = 'C:/temp/test/'
# make it the working directory
os.chdir(path)

for file in os.listdir(path):
    # assumes '.tif' is lower case
    if file.endswith('.tif'):
        img = Image.open(file)
        # change name *.tif to *.gif
        gif_file = file[:-4]+'.gif'
        img.save(gif_file)
        # indicate progress
        print( "%s converted and saved to %s" % (file, gif_file) )
sneekula 969 Nearly a Posting Maven

Actually, Portable Python comes also with IDLE that will use the portable version.

sneekula 969 Nearly a Posting Maven

I got curious, so I timed the 'just Python' and 'module re' approaches:

# timing characer count by type
# compare 'module re' and 'just Python' approches

import timeit
import re

def count_char1(text):
    """
    count upper case char, lower case char, digits and spaces in a text
    """
    regexes = [ re.compile(x) for x in
        (r"[^A-Z]+", r"[^a-z]+", r"[^0-9]+", r"[^\ ]+")]
    counts = [len(s) for s in (r.sub("", text) for r in regexes)]
    return tuple(counts)

def count_char2(text):
    """
    count upper case char, lower case char, digits and spaces in a text
    """    
    upper = lower = digit = space = 0
    for c in text:
        if c.isupper():
            upper += 1
        elif c.islower():
            lower += 1
        elif c.isdigit():
            digit += 1
        elif c.isspace():
            space += 1
    return (upper, lower, digit, space)


text = """
There is one rule for the industrialist and that is: 
Make the best quality of goods possible at the lowest 
cost possible, paying the highest wages possible.

Henry Ford 1924
"""

# for longer text uncomment line below
#text = text*10

stmt = 'count_char1(text)'
t = timeit.Timer(stmt, setup="from __main__ import count_char1, text")
#  doing 10000 passes * 100 gives the time in microseconds/pass
elapsed = (100 * t.timeit(number=10000))
print( "Function %s takes %0.3f micro-seconds/pass" % (stmt, elapsed) )

stmt = 'count_char2(text)'
t = timeit.Timer(stmt, setup="from __main__ import count_char2, text")
#  doing 10000 passes * 100 gives the time in microseconds/pass
elapsed = (100 * t.timeit(number=10000))
print( "Function %s takes %0.3f micro-seconds/pass" % (stmt, elapsed) )

"""
my …
Gribouillis commented: good idea +2
mn_kthompson commented: Damn fine analysis +2
sneekula 969 Nearly a Posting Maven

I would like to learn regular expressions. I have no Idea what it is (I always see people here using). Can someone explain a litle and suggest good tutorial?

Didn't mean to deviate the thread, so keep your first focus on the thread, then you can answer my question

There is also:
http://www.amk.ca/python/howto/regex/

sneekula 969 Nearly a Posting Maven

Without the __init__() class constructor this class would behave strange:

class DoesNothing():
    print 'I have been initialized'
sneekula 969 Nearly a Posting Maven

Installing python 2.5.4 over version 2.5.2 should not bother any third party modules like wxPython. Version 2.5.4 is simply a bug upgrade within the 2.5 series. Don't uninstal version 2.5.2, the new version will simply overwrite it.

sneekula 969 Nearly a Posting Maven

Wow, the Fatso patrol! Would it lower the cost of healthcare?

Of course Japan has a lot of rather crowded puplic transport, too many fat folks would just make it worse.

The last flight I took, the guy next to me was so fat that he literally overflowed into my seat. Maybe the airlines should charge by the pound.

sneekula 969 Nearly a Posting Maven

Very interesting indeed!

sneekula 969 Nearly a Posting Maven

I thought CO2 was good for the growth of plants. We need more CO2 to encourage the growth of plants that are used for food and materials of construction. Again, Google is on the leading edge!

sneekula 969 Nearly a Posting Maven
sneekula 969 Nearly a Posting Maven

If you are just interested to extract the text of a PDF formatted page, then take a close look at:
http://code.activestate.com/recipes/511465/

sneekula 969 Nearly a Posting Maven

You may want to look at "Starting Python" right here:
http://www.daniweb.com/forums/thread20774.html

sneekula 969 Nearly a Posting Maven

It acts like container.catalog_object has been used as the variable name for a string somewhere in your code.

books = container.getBookTitleToCatalog()

for book in books:
    params=urlencode({'code':book.id})
    container.catalog_object(book, 
        '/APP_New/app-home/app-information/Publications/showBookDetails?%s'%params)
sneekula 969 Nearly a Posting Maven

You might get further if class Thing inherits class FuncObj.

sneekula 969 Nearly a Posting Maven

Here is an example how to use lambda to pass arguments in Tkinter's button command:

import Tkinter as tk

def getCond(par):
    firstCond = par
    #conditions.remove(firstCond)
    print firstCond
    #print conditions


root = tk.Tk()

firstCond = ''

condNames = ['1', '2', '3', '4',  '5', '6']
for item in condNames:
    # use lambda to pass arguments to command-function
    tk.Button(root, text=str(item), command=lambda i=item: getCond(i)).pack()

root.mainloop()

Also, create your function before you call it.

ABMorley commented: Perfect answer +0
sneekula 969 Nearly a Posting Maven

re Q1:
In this case you want to make sure that guess will be an integer, even if the user enters a floating point number.

Actually with Python30 the int() becomes very important, since input() now returns a string.

re Q5:
This shows you the danger of using global. When you change x=2 in the function, than the x outside the function will also change.

sneekula 969 Nearly a Posting Maven

If you want the window to stay open and allow for a graceful exit procedure, you need to set up a simple event loop at the end of the program:

# a simple pygame example
# creates a white circle on a black background
# the event loop makes exit from the program easier

import pygame

pygame.init()

# create a 300 x 300 display window
win = pygame.display.set_mode((300, 300))

white = (255, 255, 255)
center = (100, 100)
radius = 20
pygame.draw.circle(win, white, center, radius)

# this puts the circle on the display window
pygame.display.flip()

# event loop and exit conditions (windows x click)
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            raise SystemExit
sneekula 969 Nearly a Posting Maven

Re: Why does it make another file with the ending ".Pyc" at the end?

When you saved your class module as awclassPet.py, then Python will also create a compiled bytecode version of this file the first time it is used by an application. The precompiled file awclassPet.pyc will speed things up on reuse. Also notice that module file names are case sensitive.

The variable names you create in main() are local to the function, so you can use the same variable names you use in your class.

You can test your module out with this arrangement:

class Pet:
    def __init__(self,name, an_type, age):
        self.name =  name
        self.an_type = an_type
        self.age = age

    def set_name(self, name):
        self.name = name

    def set_an_type(self, an_type):
        self.an_type = an_type

    def set_age(self, age):
        self.age = age

    def get_name(self):
        return self.name

    def get_an_type(self):
        return self.an_type

    def get_age(self):
        return self.age


# allows you to test the module
# will not be used when the module is imported
if __name__ == '__main__':

    name = "Oscar"
    an_type = "cat"
    age = 13
    
    animals = Pet(name, an_type, age)

    print animals.get_name()
    print animals.get_an_type()
    print animals.get_age()
    print
    
    animals.set_name("Ruby")
    animals.set_an_type("cow")
    animals.set_age(17)
    
    print animals.get_name()
    print animals.get_an_type()
    print animals.get_age()

Tests okay!

I would suggest you write and run your code on an IDE made for Python code, something like IDLE or DrPython. Otherwise your output window will be set to the OS command window colors.

sneekula 969 Nearly a Posting Maven

ok so, just practising here sorry for useless console app but why not use {} to separate blocks.

number = 2
guess = 2

if number == guess:
print ('yep its identicle')

when i run that it says indentation error, but when i do

number = 2
guess = 2

if number == guess: {
print ('yep its identicle') }

is indentation the preferred and standard method when writing python code?

There are many code editors out there that cater to Python and do the proper indentation for you after you type a statement with a colon.

sneekula 969 Nearly a Posting Maven

There is a small introduction at:
http://www.daniweb.com/forums/post764519-155.html

sneekula 969 Nearly a Posting Maven

If the word you enter is 'xp11' then it will do that.

BTW you don't have to subtract one from wordsize, randrange() work like range().

Give it a test:

import random

#word = raw_input("Enter a word: ")
word = "consumer"
wordsize = len(word)
for k in range(10):
    randomnumber = random.randrange(0, wordsize)
    print word[randomnumber]
sneekula 969 Nearly a Posting Maven

The wx.RichTextCtrl() widget allows the user to create formatted text with color, size, font, bullets, images and more:

# experiment with wxPython's
# wx.RichTextCtrl(parent, id, value, pos, size, style=wx.RE_MULTILINE, 
#    validator, name)
# allows you to create formatted text with color, size, font, images ...
# snee

import wx
import wx.richtext

class MyFrame(wx.Frame):
    def __init__(self, parent, mytitle, mysize):
        wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle, size=mysize)
        self.SetBackgroundColour("white")
        
        self.rich = wx.richtext.RichTextCtrl(self, wx.ID_ANY, value="")
        self.rich.WriteText("Default is black text.\n")
        self.rich.BeginBold()
        self.rich.WriteText("Write this text in bold")
        self.rich.BeginTextColour('red')
        self.rich.WriteText(" and this text in bold and red.\n")
        self.rich.EndTextColour()
        self.rich.EndBold()
        
        self.rich.BeginFontSize(30)
        self.rich.WriteText("This text has point size 30\n")
        self.rich.EndFontSize()
        
        font = wx.Font(16, wx.SCRIPT, wx.NORMAL, wx.LIGHT)
        self.rich.BeginFont(font)
        self.rich.WriteText("This text has a different font\n")
        self.rich.EndFont()
        self.rich.Newline()
        # indent the next items 100 units (tenths of a millimeter)
        self.rich.BeginLeftIndent(100) 
        
        # insert an image you have in the work directory
        # or give the full path, can be .bmp .gif .png .jpg
        image_file = "Duck2.jpg"
        image= wx.Image(image_file, wx.BITMAP_TYPE_ANY)
        # wx.BITMAP_TYPE_ANY   tries to autodetect the format
        self.rich.WriteImage(image)
        self.rich.Newline()
        self.rich.EndLeftIndent()
        

app = wx.App()
mytitle = 'testing wx.RichTextCtrl'
width = 560
height = 400
# create the MyFrame instance and show the frame
MyFrame(None, mytitle, (width, height)).Show()
app.MainLoop()
sneekula 969 Nearly a Posting Maven

My father owns a lot of tobacco stock, please don't quit smoking!

~s.o.s~ commented: Haha, nice one. +26
sneekula 969 Nearly a Posting Maven

p = re.compile(r'(href="(.*?)")')

will do the trick

sneekula 969 Nearly a Posting Maven

To represent a floating point number in a formatted form for print, you have to store the result as a string in your list:

# representing print formatted floats in a list

list_floats = [1/3.0, 1/6.0, 3.124567, 5.01]

print list_floats

"""
my output (note the typical float representation problem) -->
[0.33333333333333331, 0.16666666666666666, 3.1245669999999999, 5.0099999999999998]
"""

# create a new list of floats using round()
list_floats2 = []
for n in list_floats:
    list_floats2.append(round(n, 5))

print list_floats2

"""
my output (notice we are still dealing with floats) -->
[0.33333000000000002, 0.16667000000000001, 3.1245699999999998, 5.0099999999999998]
"""

# to make round() stick for your print
# you have to store the result as a string
list_floats3 = []
for n in list_floats:
    list_floats3.append(str(round(n, 5)))

print list_floats3

"""
my output -->
['0.33333', '0.16667', '3.12457', '5.01']
"""

# or ...
list_floats4 = []
for n in list_floats:
    list_floats4.append("%0.5f" % n)

print list_floats4

"""
my output -->
['0.33333', '0.16667', '3.12457', '5.01000']
"""

The behaviour of a floating point number you notice here is typical of many computer languages.

sneekula 969 Nearly a Posting Maven

Please use code tags for your code.

You are getting close, but you need to find if the score is a new minimum or maximum each time through the loop. Something like this:

infile = open("test_scores.dat", "r")
mylist = infile.readlines()
infile.close()

# remove the header, first item in the list
del mylist[0]

max_score = 0
min_score = 100
for line in mylist:
    # split each line into a list at space/whitespace and unpack
    last_name, first_name, ID, score = line.split()
    # for testing only
    print last_name, first_name, ID, score
    # create integer scores
    if score.isdigit():
        score = int(score)
        # check if it is a new max
        if score > max_score:
            max_score = score
        # check if it is a new min
        elif score < min_score:
            min_score = score

Then just print out the max_score and min_score results.

Please study the code and the comments!

sneekula 969 Nearly a Posting Maven

Please use code tags around your code.
Something like this will do the summation:

sum = 0
n = 1
while n < 101 :
    sum += n
    print n, sum
    n = n+1

Note that sum += n is the same as sum = sum + n

Proper code tags are
[code=python]
your Python code here

[/code]

sneekula 969 Nearly a Posting Maven

Since I don't have any of the many versions of Linux, I can not test wx.Clipboard. I think it would be easier to store your text in a file for use across programs.

If you use a wx.TextCtrl, can you highlight, rightclick and copy/cut and paste from the popup menu? That would use the clipboard.

sneekula 969 Nearly a Posting Maven

wx.TextCtrl has a wx.TE_RICH style, but it works under Windows only!

sneekula 969 Nearly a Posting Maven

Some very basic errors there. You failed to declare the instance of your class. One recommended way to avoid that is to start your class names with a capital letter and your instance name with lower case.

As your game gets larger, you may want to interest yourself in a thing called debugging.

sneekula 969 Nearly a Posting Maven

Get one of the many Python Learning Books they usually have plenty of exercises.

sneekula 969 Nearly a Posting Maven

Okay, I used the BOA constructor IDE to create two files. One file Frame1.py contains the meat:

#Boa:Frame:Frame1
# saved as Frame1.py

import wx
# user added
# Dialog1.py was separately created with New
import Dialog1

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1PANEL1, 
] = [wx.NewId() for _init_ctrls in range(3)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(331, 157), size=wx.Size(400, 489),
              style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
        self.SetClientSize(wx.Size(392, 455))

        self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self,
              pos=wx.Point(56, 72), size=wx.Size(200, 100),
              style=wx.TAB_TRAVERSAL)

        self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label='button1',
              name='button1', parent=self.panel1, pos=wx.Point(56, 32),
              size=wx.Size(75, 23), style=0)
        self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
              id=wxID_FRAME1BUTTON1)

    def __init__(self, parent):
        self._init_ctrls(parent)

    def OnButton1Button(self, event):
        # user added
        dlg = Dialog1.Dialog1(self)
        dlg.ShowModal()
        dlg.Destroy()
        
        event.Skip()


# added this via Edit/Add module runner
# much easier to test things this way
if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = create(None)
    frame.Show()

    app.MainLoop()

Then I created a separate file called Dialog1.py that I can import into the Frame.py:

#Boa:Dialog:Dialog1
# saved as Dialog1.py

import wx

def create(parent):
    return Dialog1(parent)

[wxID_DIALOG1] = [wx.NewId() for _init_ctrls in range(1)]

class Dialog1(wx.Dialog):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self, id=wxID_DIALOG1, name='', parent=prnt,
              pos=wx.Point(339, 154), size=wx.Size(400, 489),
              style=wx.DEFAULT_DIALOG_STYLE, title='Dialog1')
        self.SetClientSize(wx.Size(392, 455))
        self.SetBackgroundColour(wx.Colour(255, 255, 0))

    def __init__(self, parent):
        self._init_ctrls(parent)

The whole thing works just fine. When in doubt, do some simple stuff to test things out.

sneekula 969 Nearly a Posting Maven

I do coding for my science projects.

sneekula 969 Nearly a Posting Maven

Wow, Grim is pretty good at answering tough questions.

sneekula 969 Nearly a Posting Maven

Also remember that the searched list weights has to be sorted for bisect to work!

sneekula 969 Nearly a Posting Maven

If your file is not too large, you can go as simple as this:

newuser = "hamster201"

fin = open("MyUserFile.txt", "r")
text = fin.read()
fin.close()

if newuser in text:
    print "this username already used"
sneekula 969 Nearly a Posting Maven

Give it a little test to familiarize yourself with dictionaries:

cards = {'rank' : (2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King', 'Ace'),
        'color' : ('Spade', 'Club', 'Diamond', 'Heart')}

for card in cards:
    print card
    print cards[card]

"""
my output --->
color
('Spade', 'Club', 'Diamond', 'Heart')
rank
(2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King', 'Ace')
"""
sneekula 969 Nearly a Posting Maven

wxPython supplies a progressbar called wx.Gauge(). Here is a short test code:

# a templet with wx.Frame, wx.Panel, wx.Slider and wx.Gauge
# wx.Gauge(parent, id, range, pos, size, style)
# (on Windows XP the slider responds to the mouse-wheel)
# sorry, but the gauge markers come only in green ar this time
# wx.Slider(parent, id, value, minValue, maxValue, pos, size, style)

import wx
import time

class MyPanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, wx.ID_ANY)
        self.SetBackgroundColour("white")

        # initial value = 50, minvalue = 0, maxvalue = 100
        self.slider = wx.Slider(self, wx.ID_ANY, value=50, minValue=0,
            maxValue=100, pos=(10, 10), size=(390, 50),
            style=wx.SL_HORIZONTAL|wx.SL_AUTOTICKS|wx.SL_LABELS)

        # range set to 0 to 100, default style is wx.GA_HORIZONTAL
        # other style option is wx.GA_VERTICAL
        self.gauge1 = wx.Gauge(self, wx.ID_ANY, range=100, pos=(10, 70),
            size=(390, 25), style=wx.GA_HORIZONTAL)
        self.gauge2 = wx.Gauge(self, wx.ID_ANY, range=100, pos=(375, 100),
            size=(25, 155), style=wx.GA_VERTICAL)

        # set gauges to initial slider position
        self.pos1 = self.slider.GetValue()
        self.gauge1.SetValue(self.pos1)
        self.gauge2.SetValue(self.pos1)

        s1 = "the gauge is bound to the slider,"
        s2 = "just click and drag the pointer"
        self.label1 = wx.StaticText(self, wx.ID_ANY, s1+s2, pos=(10, 100))
        self.label2 = wx.StaticText(self, wx.ID_ANY,
            "the gauge can use a timer loop" , pos=(10, 140))
        self.button = wx.Button(self, wx.ID_ANY, "Press to start timer",
            pos=(10, 170))

        # respond to changes in slider position ...
        self.slider.Bind(wx.EVT_SLIDER, self.sliderUpdate)
        # respond to the click of the button
        self.button.Bind(wx.EVT_BUTTON, self.button1Click)

    def sliderUpdate(self, event):
        # get the slider position
        self.pos1 = self.slider.GetValue()
        # set the gauge positions
        self.gauge1.SetValue(self.pos1)
        self.gauge2.SetValue(self.pos1)

    def button1Click(self, event):
        for k in range(101):
            # move the progress bar/gauge
            self.gauge1.SetValue(k)
            self.gauge2.SetValue(k)
            # move the slider …
sneekula 969 Nearly a Posting Maven

Can you give us your whole error message?

sneekula 969 Nearly a Posting Maven

Great!! Thanks! One more question. Is there a way to use this, but make the 1 1 standard, and be able to pass an argument over? So, I type subprocess.py, it runs with 1 1, but if I want to do it with 2 2, I could tpye that on a command line and parse it over.

One word of caution, don't use filenames for your source code that match import module names. Python's PYTHONPATH will look in your working folder first, import it's own source code and you are in the BS house.

sneekula 969 Nearly a Posting Maven

I would rewrite your code like this:

import os
import zipfile
import datetime

today = datetime.date.today()
yesterday = (today + datetime.timedelta(days=-1))

zfilename = "c:\\crunchtime\\CT" + yesterday.strftime('%m%d%y') +".zip"
# test it
print zfilename

tFile = zipfile.ZipFile(zfilename, "w")
directory = "c:\\crunchtime"
files = os.listdir(directory)
for file in files:
    if os.path.isfile(file):
        fullpath = os.path.join(directory, file)
        tFile.write(fullpath)
sneekula 969 Nearly a Posting Maven

This code example uses the wx.lib.scrolledpanel.ScrolledPanel() widget to show off wxPython's list of colours by name, #RRGGBB hexstring, and then a small panel of the actual colour:

# show the colours in wxPython's wx.lib.colourdb
# use a wx.lib.scrolledpanel.ScrolledPanel and wx.GridSizer

import wx
import wx.lib.scrolledpanel
import wx.lib.colourdb

class MyScrolledPanel(wx.lib.scrolledpanel.ScrolledPanel):
    def __init__(self, parent):
        # make the scrolled panel larger than its parent
        wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent, wx.ID_ANY,
            size=(600, 450), style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
        # scroll bars won't appear until required
        # default is SetupScrolling(scroll_x=True, scroll_y=True)
        self.SetupScrolling()
        self.SetBackgroundColour("white")

        wx.lib.colourdb.updateColourDB()
        # create a list of all the colours in the colour data base
        #colours = wx.lib.colourdb.getColourList()
        colours = wx.lib.colourdb.getColourInfoList()

        # main sizer
        vsizer = wx.BoxSizer(wx.VERTICAL)

        # wx.GridSizer(rows, cols, vgap, hgap)
        gsizer = wx.GridSizer(len(colours), 3, 2, 2)

        n = 1
        for line in colours:
            #print line,  # eg. line = ('SNOW', 255, 250, 250)
            hexstr = "#%02X%02X%02X" % tuple(line[1:])
            s = "%3d  %s" % (n, line[0])
            t = wx.StaticText(self, wx.ID_ANY, s)
            gsizer.Add(t, 0, wx.ALL, border=2)
            t = wx.StaticText(self, wx.ID_ANY, hexstr)
            gsizer.Add(t, 0, wx.ALL, border=2)
            p = wx.Panel(self, wx.ID_ANY)
            p.SetBackgroundColour(hexstr)
            gsizer.Add(p, 0, wx.ALL|wx.EXPAND, border=2)
            n += 1

        # now add the whole thing to the main sizer and set it
        vsizer.Add(gsizer, 0, wx.ALL|wx.EXPAND, 10)
        self.SetSizer(vsizer)


app = wx.App(0)
# create a frame, no parent, default ID, title, size
caption = "all the colours in wx.lib.colourdb"
frame = wx.Frame(None, wx.ID_ANY, caption, size=(600, 450))
MyScrolledPanel(frame)
frame.Show(True)
app.MainLoop()
sneekula 969 Nearly a Posting Maven

The wx.ToggleButton() widget changes its value between True and False each time it is clicked:

# testing wxPython's
# wx.ToggleButton(parent, id, label, pos, size, style)

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, mytitle, mysize):
        wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle, size=mysize)
        # use panel so single button behaves
        panel = wx.Panel(self, wx.ID_ANY)

        self.tbtn = wx.ToggleButton(panel, 1, 'Toggle Off', (20, 25))
        # bind mouse event to an action
        self.tbtn.Bind(wx.EVT_TOGGLEBUTTON, self.onToggle)

    def onToggle(self, event):
        #print self.tbtn.GetValue()  # test True or False
        if self.tbtn.GetValue():
            self.tbtn.SetLabel('Toggle On')
        else:
            self.tbtn.SetLabel('Toggle Off')
        pass


app = wx.App(0)
# create a MyFrame instance and then show the frame
MyFrame(None, 'test the wx.ToggleButton', (300, 100)).Show()
app.MainLoop()
sneekula 969 Nearly a Posting Maven

Pirate Meeting Fun:
http://www.eonline.com/uberblog/b29981_yo-ho_yo-ho_some_booty_pirate_day.html

Got to leave! Got to run over to Arrrrrrrrrrrrrrby's for one of those great sandwiches.

sneekula 969 Nearly a Posting Maven

This will show you one way to do this:
http://www.daniweb.com/forums/post694993-77.html

sneekula 969 Nearly a Posting Maven

Using wx.StaticBitmap() to show an image. Here we position the image in the center of the frame. Actually, the center of the panel that fills the frame:

# show a .jpg .png ,gif .bmp image using a wx.StaticBitmap()
# wx.StaticBitmap(parent, id, label, pos, size, style)
# calculate pos so image is in center

import wx

class ImagePanel(wx.Panel):
    """ create a panel with a wx.StaticBitmap """
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, wx.ID_ANY)

        # pick an image file you have in the working folder
        # (can be a .jpg .png ,gif or .bmp image file)
        image_file = 'chemist.gif'
        bmp = wx.Bitmap(image_file)
        # get the width and height of the image
        wi, hi = bmp.GetSize()
        # get the width and height of the frame
        wf, hf = parent.GetSize()
        # calculate position so image is centered
        px = wf/2 - wi/2
        # 15 is estimated height of frame's title bar
        py = hf/2 - hi/2 - 15
        # show the static bitmap
        wx.StaticBitmap(self, wx.ID_ANY, bmp, pos=(px, py))

        # optionally show some image information
        info = "%s  %dx%d" % (image_file, bmp.GetWidth(), bmp.GetHeight())
        # the parent is the frame
        parent.SetTitle(info)


app = wx.App(redirect=False)  # stderr/stdout --> console
# create window/frame
frame = wx.Frame(None, wx.ID_ANY, size = (640, 480))
# create the panel instance
ImagePanel(frame)
# show the frame
frame.Show(True)
# start the GUI event loop
app.MainLoop()
sneekula 969 Nearly a Posting Maven

If Chrome makes it's competition improve their product, it has succeeded!

sneekula 969 Nearly a Posting Maven

God will punish smokers not for what they are doing to themselves, but for what they are doing to others.

sneekula 969 Nearly a Posting Maven

Has anyone tried Google Chrome yet? It's Google's web browser they released today for the first time as a public beta. Still quite buggy but it's looking pretty nice. If you try it lets hear what you think.

It's free, how can it be buggy? Buggy software is only written by folks who want to make money on the many upgrades! :)

sneekula 969 Nearly a Posting Maven

Python25 has sqlite3 builtin, so you could use that.