Python-Livecode Cheat Sheet Page 4

ADVERTISEMENT

Array Processing
These examples show how array values can be manipulated.
# Split / combine
// Split / combine
var = "a,b,c".split(",")
put
"a,b,c"
into
tVar
var[1] is "b"
split
tVar
by
","
','.join(var)
tVar[2]
is
"b"
var == "a,b,c"
combine
tVar
with
","
tVar
is
"a,b,c"
# Iteration
for key in array:
// Iteration
# do something with array[key]
repeat
for each key
tKey
in
tArray
-- Do something with tArray[tKey]
# Length
end repeat
len(array)
repeat
for each element
tElement
in
tArray
end repeat
// Length
the
number
of elements in
tArray
User Input / Notification
These examples show how to pop up information dialogs, or prompts for user input.
dlg = wx.TextEntryDialog(None, "What is
ask
"What is your name?"
your name?", defaultValue=default_value)
put
it
into
tName
dlg.ShowModal()
name = dlg.GetValue()
answer
"Something"
dlg.Destroy()
dlg = wx.MessageDialog(None,
"Something", caption, wx.OK)
result = dlg.ShowModal()
dlg.Destroy()

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 4