I am using pythoncard 0.7.2 for windows.
I am trying to use the same code for a large number of buttons so
started out by using
def on_mouseDown(se lf,event):
but then I need to display the button that I pressed but you can only
have an absolute component name like:
self.component. Button1.label = "clicked"
How can I identify the button pressed and still use the same procedure
to update the clicked button? I tried self.component. label =
"clicked" with out the reference to the actual button used?
Any ideas, especially snippets of code if you have to start using
self.components .data etc.
A second question occurres: Is it possible to create a component at
run time? If so how would you start.
Thanks
"Python... the way C++ programming should be :)" 2 2081
In article <37************ **************@ posting.google. com>, Adrian Smith: I am using pythoncard 0.7.2 for windows.
I am trying to use the same code for a large number of buttons so started out by using def on_mouseDown(se lf,event):
but then I need to display the button that I pressed but you can only have an absolute component name like: self.component. Button1.label = "clicked"
How can I identify the button pressed and still use the same procedure to update the clicked button? I tried self.component. label = "clicked" with out the reference to the actual button used?
Any ideas, especially snippets of code if you have to start using self.components .data etc.
I have a pythoncard app where I want to know which of a (large)
number of checkboxes gets clicked. I do something like:
def on_mouseClick(s elf, event):
name = event.target.na me
if name in self.availabili ty.times:
button = getattr(self.co mponents, name)
avail = self.availabili ty.avail[name]
#print dir(button)
if button.checked:
if button.backgrou ndColor == AVAIL:
self.availabili ty.avail[name] = 1
else:
self.availabili ty.avail[name] = 0
button.backgrou ndColor = (255, 255, 255)
else:
if self.availabili ty.avail[name]:
button.backgrou ndColor = AVAIL
else:
button.backgrou ndColor = UNAVAIL
Notice my comment #print dir(button) I use those quite often
when doing pythoncard just to see what it is that I have a
handle on, and what I can do with it.
A second question occurres: Is it possible to create a component at run time? If so how would you start. Thanks
I am pretty sure that the pythoncard resource editor is written in
pythoncard, so I would say "yes" and "read the pythoncard source code".
Lee Harr wrote: In article <37************ **************@ posting.google. com>, Adrian Smith:
I am using pythoncard 0.7.2 for windows.
I am trying to use the same code for a large number of buttons so started out by using def on_mouseDown(se lf,event):
but then I need to display the button that I pressed but you can only have an absolute component name like: self.component. Button1.label = "clicked"
How can I identify the button pressed and still use the same procedure to update the clicked button? I tried self.component. label = "clicked" with out the reference to the actual button used?
Any ideas, especially snippets of code if you have to start using self.componen ts.data etc.
I have a pythoncard app where I want to know which of a (large) number of checkboxes gets clicked. I do something like:
def on_mouseClick(s elf, event): name = event.target.na me if name in self.availabili ty.times: button = getattr(self.co mponents, name) avail = self.availabili ty.avail[name] #print dir(button) if button.checked: if button.backgrou ndColor == AVAIL: self.availabili ty.avail[name] = 1 else: self.availabili ty.avail[name] = 0 button.backgrou ndColor = (255, 255, 255) else: if self.availabili ty.avail[name]: button.backgrou ndColor = AVAIL else: button.backgrou ndColor = UNAVAIL
Notice my comment #print dir(button) I use those quite often when doing pythoncard just to see what it is that I have a handle on, and what I can do with it.
A second question occurres: Is it possible to create a component at run time? If so how would you start. Thanks
I am pretty sure that the pythoncard resource editor is written in pythoncard, so I would say "yes" and "read the pythoncard source code".
If in doubt, run your application with the shell (-s on the command
line) and have a look. Its a great tool and by far the best way to find
out what is going on 'under the hood'. With the message watcher (-m) and
the namespace viewer (-n) as well you have a full run time inspection
environment.
Yes, you can add components at run time, look at the example on the
documentation page
( http://pythoncard.sourceforge.net/text/addmethod.txt) and the dbBrowser
sample application.
As a final observation, PythonCard comes with its own logging module
(similar to the standard module in 2.3) and can be used instead of
'print' statements for a more persistent record of what your application
is doing. See log.py in the PythonCard distribution for information.
Regards,
Andy
--
--------------------------------------------------------------------------------
From the desk of Andrew J Todd esq - http://www.halfcooked.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Oriana |
last post by:
Hi!
I was wondering if anyone can give me any light in this...I've
written a PythonCard application and I'm trying to create a Windows
executable but when I run my setup I get a bunch of errors...
My setup looks like this:
from distutils.core import setup
import py2exe
|
by: PipedreamerGrey |
last post by:
I'm trying to create a standalone version (.exe) of PythonCard's Custdb
sample using Py2Exe version 0.5.0. Everytime I attempt to compile the
program, I get an error during compilation. This is the exact code I'm
using in the setup file:
from distutils.core import setup
import py2exe
setup( name = "custdb",
console = ,
data_files = ) ]
|
by: fiddlehead |
last post by:
Hello.
I'd to use gauge component in the code below. I want to show
Queue.quantity in gauge (during running thread, every time when it
changed). I don't know which event i must use. I find some info about
Time event for gauge but don't understand how it works. Any
suggestions?
#---gauge.rcrc.py---
|
by: DarkBlue |
last post by:
Is it possible to create pythoncard textField components
dynamically during run time ?
Something on the lines of
pseudo code :
def make_textfield(length,topleftposx,topleftposy):
doit
|
by: Tequila |
last post by:
I'm having some trouble starting PythonCard on my PC.
I've downloaded and ran python-2.5.msi to install Python on my
machine. And PythonCard-0.8.2.win32.exe to install PythonCard.
When I try to run the program I get the following error:
======================================
C:\Python25\Lib\site-packages\PythonCard\tools
\codeEditor>codeEditor.py
Traceback (most recent call last):
| |
by: king kikapu |
last post by:
Hi to all folks here,
i downloaded and "playing" with PythonCard and i just want to share my
thoughts so maybe we can discuss a little about it.
I was used to wxGlade before and i think PythonCard is even better.
I like the separate implementation of GUI and Code that PythonCard
provides, i also like the "binding system" so you can bind functions
to events and have them executed at runtime.
I also like that it does not force you to use...
|
by: Kevin Walzer |
last post by:
I'm curious to know what others think of these two frameworks for
building wxPython apps.
PythonCard has been around longer, but its development seems to have
slowed. The last release, 0.8.2, has been out for quite awhile now.
Dabo is newer and seems to have gathered a lot of buzz.
Anyone try both? What's your preference and why? Is one more robust than
the other?
|
by: Michal Lipinski |
last post by:
Hi
its my first post. I have a problem, I want to user eval() function in
a for loop to set labels to staticText so i done something like this:
dzien=self.components.Calendar.GetDate().GetDay()
for i in range(1,8):
act=dzien+i -1
eval( 'self.components.d' + str(i) + '.text = "'+ str(act) + '"')
|
by: John Henry |
last post by:
For serveral years, I have been looking for a way to migrate away from
desktop GUI/client-server programming onto the browser based network
computing model of programming. Unfortunately, up until recently,
browser based programs are very limited - due to the limitation of
HTML itself. Eventhough PythonCard hasn't keep up with the latest
widgets in wxpython, the programs so created still works a lot better
- until now.
If you look at...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |