Fredrik Lundh | 3 May 15:12 2008

Re: Listbox selection persistence

leegold wrote:

> But the x does not seem to persist outside of the
> def selected() block. I want the final last button
> press to persist so I can use those indexes for
> further processing. What am I missing here?

variables that are assigned inside a function are made local by default; 
to treat them otherwise, you need to flag them as global.

see your favourite Python tutorial for details.

</F>
Snakey | 5 May 09:14 2008
Picon

how to get all the text from a text widget?


I created a text widget to allow my users to enter some lines of text.  Now I
need to dump all the text contents into a string variable.  How can i do
that?
--

-- 
View this message in context: http://www.nabble.com/how-to-get-all-the-text-from-a-text-widget--tp17053954p17053954.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
Snakey | 7 May 11:10 2008
Picon

how to import a module that is not in the work dir?


I have written some functions in "my_functions.py".  

I need to use these functions in another program main.py.

But, "my_functions.py" cannot reside in my local work folder.  It resides in
a shared directory somewhere else eg. in X:\shared\my_functions.py

How can I import my_functions.py into main.py?

Will this work: ?

import X:\shared\my_functions.py

--

-- 
View this message in context: http://www.nabble.com/how-to-import-a-module-that-is-not-in-the-work-dir--tp17100345p17100345.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
Guilherme Polo | 15 May 01:41 2008
Picon

Re: how to get all the text from a text widget?

Snakey <darr_low <at> yahoo.com> writes:

> 
> 
> I created a text widget to allow my users to enter some lines of text.  Now I
> need to dump all the text contents into a string variable.  How can i do
> that?

Supposing you have no tags, you could do:

text.get('1.0', 'end') # text is your text widget

The first parameter is the index1 specifying where to start looking for text,
and the other parameter is the index2, where to stop looking for text (one
before it). Lines are numbered from 1 and columns from 0, that is why I used
'1.0' (which is accepted as an index), and 'end' is an special index which
indicates the end of the text.
Snakey | 15 May 02:12 2008
Picon

Re: how to get all the text from a text widget?


Hi Polo,

Thanks for the tip!

Guilherme Polo wrote:
> 
> Snakey <darr_low <at> yahoo.com> writes:
> 
>> 
>> 
>> I created a text widget to allow my users to enter some lines of text. 
>> Now I
>> need to dump all the text contents into a string variable.  How can i do
>> that?
> 
> Supposing you have no tags, you could do:
> 
> text.get('1.0', 'end') # text is your text widget
> 
> The first parameter is the index1 specifying where to start looking for
> text,
> and the other parameter is the index2, where to stop looking for text (one
> before it). Lines are numbered from 1 and columns from 0, that is why I
> used
> '1.0' (which is accepted as an index), and 'end' is an special index which
> indicates the end of the text.
> 
> 
> _______________________________________________
(Continue reading)

Guilherme Polo | 15 May 02:17 2008
Picon

[ANN] Ttk wrapper 0.0.9

Hello,

Over the last weeks I've been doing a ttk wrapper as part of my GSoC
project and now I feel that I can announce it in hope some people
start using it.

What is Ttk ?

  This wrapper provides classes to allow using the Tk themed widget
set, which has been included in Tk 8.5 but can be used with earlier
versions if you have Tile installed. Ttk is based on a revised and
enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style
engine.

  Its basic idea is to separate, to the extent possible, the code
implementing a widget's behavior from the code implementing its
appearance.
  Widget class bindings are primarily responsible for maintaining the
widget state and invoking callbacks, all aspects of the widgets
appearance lies at Themes.

Wrapper status

  I expect all the Ttk functionality to be available through this
wrapper, but I have said this some days ago as well and found out some
examples which failed to work and then I corrected the code. I guess I
will only be 100% sure of this after people start using it and
reporting problems, if there is some interest on this I can create a
project at code.google.com to serve this purpose.
  The wrapper comes with some samples and documentation too, which can
(Continue reading)

Marco | 21 May 12:49 2008
Picon

tkinter "monitor" and root.mainloop()

Hi all,

I am quite new to tkinter programming, and i have a question.

I am writing a "monitor": basically it reads a file on the filesystem
and reports it in a graphical way using python and tkinter.

Now the file, over time, changes, so once called root.mainloop() i'd
need to reread the file, update the objects in memory and redraw the
tkinter main window.

How can I achieve that? Ideas? Suggestions? Is my approach wrong?

Thanks,

marco
Guilherme Polo | 21 May 14:01 2008
Picon

Re: tkinter "monitor" and root.mainloop()

2008/5/21 Marco <gaedol <at> gmail.com>:
> Hi all,
>
> I am quite new to tkinter programming, and i have a question.
>
> I am writing a "monitor": basically it reads a file on the filesystem
> and reports it in a graphical way using python and tkinter.
>
> Now the file, over time, changes, so once called root.mainloop() i'd
> need to reread the file, update the objects in memory and redraw the
> tkinter main window.
>
> How can I achieve that? Ideas? Suggestions? Is my approach wrong?

You could check from time to time using after(ms, callback). After
your callback is called, you have to re-eschedule the check, using
after(ms, callback) again.

If you don't want to depend on tcl for this, you could use inotify
(pyinotify) if you are using Linux.

>
> Thanks,
>
> marco
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss <at> python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
(Continue reading)

Cameron Laird | 22 May 00:59 2008
Picon

Re: tkinter "monitor" and root.mainloop()

On Wed, May 21, 2008 at 12:49:22PM +0200, Marco wrote:
			.
			.
			.
> I am quite new to tkinter programming, and i have a question.
> 
> I am writing a "monitor": basically it reads a file on the filesystem
> and reports it in a graphical way using python and tkinter.
> 
> Now the file, over time, changes, so once called root.mainloop() i'd
> need to reread the file, update the objects in memory and redraw the
> tkinter main window.
> 
> How can I achieve that? Ideas? Suggestions? Is my approach wrong?
			.
			.
			.
Poll with after().  Fredrik's references, among others,
explain this.  I'll be tied up for a day; if you don't
work out the details on your own, I'll return to explain.
Peter Milliken | 23 May 01:10 2008
Picon

Re: tkinter "monitor" and root.mainloop()

in the time module, look at a function called sleep - arguments are 1 second intervals from memory i.e. something like this:

import time

while True:
  <check file for changes and take appropriate action>

  time.sleep(5)          -- delay for 5 seconds before resuming loop




On Thu, May 22, 2008 at 8:59 AM, Cameron Laird <Cameron <at> phaseit.net> wrote:
On Wed, May 21, 2008 at 12:49:22PM +0200, Marco wrote:
                       .
                       .
                       .
> I am quite new to tkinter programming, and i have a question.
>
> I am writing a "monitor": basically it reads a file on the filesystem
> and reports it in a graphical way using python and tkinter.
>
> Now the file, over time, changes, so once called root.mainloop() i'd
> need to reread the file, update the objects in memory and redraw the
> tkinter main window.
>
> How can I achieve that? Ideas? Suggestions? Is my approach wrong?
                       .
                       .
                       .
Poll with after().  Fredrik's references, among others,
explain this.  I'll be tied up for a day; if you don't
work out the details on your own, I'll return to explain.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Gmane