background preloader

Pythoncard

Facebook Twitter

Cookbook. Pit Libs. The wxPython tutorial. This is wxPython tutorial.

The wxPython tutorial

In this tutorial, you will learn the basics of GUI programming in wxPython. The tutorial is suitable for beginners and intermediate programmers. Table of contents wxPython wxPython is a cross platform toolkit for creating desktop GUI applications. E-book. WxPython and Threads. If you use GUIs in Python much, then you know that sometimes you need to execute some long running process every now and then.

wxPython and Threads

Of course, if you do that as you would with a command line program, then you’ll be in for a surprise. In most cases, you’ll end up blocking your GUI’s event loop and the user will see your program freeze. What can you do to get around just mishaps? Start the task in another thread or process of course! In this article, we’ll look at how to do this with wxPython and Python’s threading module. wxPython’s Threadsafe Methods In the wxPython world, there are three related “threadsafe” methods. Robin Dunn also pointed out that the Python Global Interpreter Lock (GIL) will prevent more than one thread to be executing Python bytecodes at the same time, which may limit how many CPU cores are utilized by your program. WxPython, Threading, wx.CallAfter and PubSub We’ll be using Python’s time module to fake our long running process.

Anyway, let’s see how this works. Downloads. GitHub - benallard/pythoncard: javacard framework in python. PythonCard download. Pycrust tutorial. Building GUI Applications with PythonCard and PyCrust. Building GUI Applications with PythonCard and PyCrust Pages: 1, 2, 3, 4 We said the GUI development process is opaque and we probably need to explain that one first.

Building GUI Applications with PythonCard and PyCrust

What we mean is simply that it can be difficult to figure out what is going on inside the various widgets that make up a graphical interface. Python has wonderful runtime introspection capabilities and for most non-GUI applications it is a relatively simple matter to load modules into the Python shell, type a few commands, and look at the resulting state of any object. But the event-driven nature of GUI applications makes it difficult to do this, resulting in objects and actions that are opaque.

We thought it would be nice if you could inspect the state of any graphical object just as easily. Because PyCrust is written in Python using the wxPython toolkit, it can be embedded in any wxPython application without conflicting with the application's event loop. The shell frame is created as a wxPython MiniFrame. PythonCard Walk-through No. 1. This document is designed to help people who are interested in learning and using PythonCard but who are not professional programmers and who do not have deep Python scripting skills to learn their way around the environment and to understand how PythonCard applications get built.

PythonCard Walk-through No. 1

Before You Read This Document It will be helpful if, before you attempt to follow along with this document, you are sure you've done the following: While it is not necessary for the purposes of this document that you understand how to program in Python, you should know that all of the real heavy lifting in PythonCard is done using Python programming. So if you haven't yet learned Python, you can still follow the basics of this walk-through. But you won't be able to do much in the way of PythonCard development without at least a basic understanding of and comfort level with Python programming. Some Basic Preparation. Pythoncard mail list. RE: Catching Key Presses Kevin Altis <altis <at> semi-retired.com> 2003-05-19 17:24:27 GMT > From: Phil Edwards > > I'm sure I'm going to find that this is remarkably easy, but...

pythoncard mail list

> > I'm trying to add some code to a PythonCard app to make it respond to > function key presses, e.g do thing #1 if the user presses F4, thing #2 > if she presses F5, etc, etc. > > I can see keyDown, keyPress and keyUp events firing in the message > watcher when I press random keys, but only when one of the components on > the panel has focus. > > Is there a way to make the panel itself respond to key press events, > regardless of which component currently has the focus? There are a couple of issues. One, no events are currently bound to the underlying wxPanel, so you would have to do that manually. There's something like that in the slideshow sample. (Continue reading) PythonCard / Mailing Lists. PythonCardTricks. A start of a small collection of very useful to know tidbits, which you can find yourself by reading a lot of sample code and component code... or by looking here.

PythonCardTricks

How do I pass an argument to a child window? When you create a child window, you are not able to pass arguments via the model.ChildWindow() method, and you can't call the child's init method either. But, you can pass arguments to a child window, here's how. You have a class, Foo, that creates a child window Bar when Button1 is clicked. Toggle line numbers 1 from PythonCard import model, dialog 2 import bar 3 import dao 4 class Foo(model.Background): 5 6 def on_initialize(self, event): 7 self.databaseName = 'mydb.db' 8 9 def on_Button1_mouseClick(self, event): 10 self.childWin = model.ChildWindow(self, bar.Bar) Now, the trick is to pass the database name to bar.Bar so that Bar can access the database on initialization...

And in Bar - ...wait, how did that work? Time for a brief explanation of the event queue in PythonCard.