PythonCard timer/thread tutorial

2008-12-24 Thread Sponge Nebson
Hello all,

This is my first post. Nice to meet you all! Could one of you walk me
through this code?

   def myThread(*argtuple):

A little thread we've added

print myThread: entered
q = argtuple[0]
print myThread: starting loop
x = 10
while True:
time.sleep(10) # time unit is seconds
print myThread x=%d % x
q.put(str(x)) # stick something on message queue
wx.WakeUpIdle() # triggers 'idle' handlers
x += 10

It is from David McNab and Alex Tweedly's tutorial on timers and
threads, which can be found here:

 http://pythoncard.sourceforge.net/timers-threads.html

Among my questions are:
 A little thread we've added seems to be an isolated string. It
does not seem to be doing anything there, almost like a comment. Why
is it there?

What is argtuple for? how does it work?

What is the queue for?

Thanks!

-Ben
--
http://mail.python.org/mailman/listinfo/python-list


Re: Easy-to-use Python GUI

2008-12-24 Thread Sponge Nebson
On Dec 24, 3:47 pm, Joel Koltner zapwiredashgro...@yahoo.com
wrote:
 Is there an easy-to-use, function-based cross-platform GUI toolkit for
 Python out there that's a little more sophisticated than EasyGui?  EasyGui
 looks good, but it's a little more restrictive than what I'd like to have, yet
 I'm (stubbornly :-) ) resistant to stepping up to a full service GUI toolkit
 such as pyGTK or wxPython where it's all about event loops and callbacks and
 you need to start planning how the GUI affects the overall program flow rather
 than just using a forms (or Wizard)-type approach where you put up a few
 dialogs, users fill in some variables, and your program just sits around
 waiting until OK or Cancel is clicked.

 One approach that I like comes from SAX BASIC/WinWrap, which is more or less a
 clone of Microsoft's Visual BASIC for Applications, but they (apparently)
 wanted everything to still be human-readable, so they have a simple GUI
 (form) builder that generates code that looks like this:

 ---

  Begin Dialog UserDialog 850,497,Export Control ' %GRID:10,7,1,1

   GroupBox 20,7,360,217,Drill File Generation,.GroupBox1
   CheckBox 40,35,130,14,Output drill file(s),.genDrill
   Text 40,63,270,28,Identify via layers as any that contain this text in
 their names:,.Text
   TextBox 40,98,220,21,.viaLayerName
   Text 40,140,100,14,Output method:,.Text8
   DropListBox 160,140,180,21,DrillStyle(),.drillStyle
   Text 40,175,130,28,Select drill table units:,.Text2
   ListBox 200,175,120,28,unitNames(),.unitName

   OKButton 310,469,90,21
   CancelButton 410,469,90,21

  End Dialog

 ' GUI builder generates or modifies everything above, but can also be edited
 by hand
 ' You write the following code...

  Dim dlg As UserDialog

  dlg.genDrill = 1
  ReDim DrillStyle(1)
  DrillStyle(0) = All Via Layers In One File
  DrillStyle(1) = One File Per Via Layer
  dlg.drillStyle = 1

  func=Dialog(dlg)

 ---

 This is pretty darned easy for me understand and modify either by hand or with
 the GUI builder.  Still, it's quite powerful, since it supports all the common
 GUI elements (text, group boxes, checkboxes, drop-down lists, text boxes,
 buttons, etc.).  This is about the level of sophistication I'm looking for.

 Anything like this for Python?

 Thanks,
 ---Joel



You may want to try PythonCard. It is a GUI toolkit that runs on
wxPython, but it is much easier to use.

Visit
http://pythoncard.sourceforge.net/
and check out all the samples and screenshots.

You may also want to listen to this podcast:
http://libsyn.com/media/awaretek/Python411_070509_GUItoolkits.mp3
It discusses python GUI toolkits in general.

You should also listen to:
http://media.libsyn.com/media/awaretek/Python411_060730_PythonCard.mp3
which discusses PythonCard in detail.

The python podcast collection can be found at:
http://www.awaretek.com/python/

I just started out with PythonCard and I'm picking it up really fast.
Hope this helps!

-Sponge
--
http://mail.python.org/mailman/listinfo/python-list