Re: [Tutor] Platform Independence in Python

2011-04-06 Thread Steve Willoughby

On 06-Apr-11 21:39, Ranjith Kumar wrote:

On Thu, Apr 7, 2011 at 10:04 AM, Ratna Banjara mailto:mast.ra...@gmail.com>> wrote:
In windows we should write
=>import tkinter

while in linux, we should write
=>import Tkinter


Actually, you should do the same thing on both platforms.  Are you 
running the same code on both platforms?


The correct name is "Tkinter" (capital T) for Python 2.x,
and "tkinter" (lower-case) for Python 3.x, regardless of platform.

--
Steve Willoughby / st...@alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Platform Independence in Python

2011-04-06 Thread Ranjith Kumar
Hi Ratna,
 I hope this link will help
http://www.java2s.com/Code/Python/GUI-Tk/AlarmDemo.htm

On Thu, Apr 7, 2011 at 10:04 AM, Ratna Banjara  wrote:

> Hello all,
>
> I was learning GUI in python and found dissimilarities while importing
> 'tkinter' module.
> In windows we should write
> =>import tkinter
>
> while in linux, we should write
> =>import Tkinter
>
> Difference is Capital ' T '. Means same code cannot run on both platform ,
> how can we adjust this issue?
>
>
> --
> Regards,
> http://www.rat32.com
> Ratna P Banjara
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Cheers
Ranjith,
Research Developer,
Sedin Technologies,
Chennai

http://ranjith10z.wordpress.com
http://ranjithtenz.wordpress.com
http://railsfactory.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Platform Independence in Python

2011-04-06 Thread Ratna Banjara
Hello all,

I was learning GUI in python and found dissimilarities while importing
'tkinter' module.
In windows we should write
=>import tkinter

while in linux, we should write
=>import Tkinter

Difference is Capital ' T '. Means same code cannot run on both platform ,
how can we adjust this issue?


-- 
Regards,
http://www.rat32.com
Ratna P Banjara
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RE

2011-04-06 Thread Michiel Overtoom

On 2011-04-06 11:03, JOHN KELLY wrote:


I need help.


In that case, start with http://wiki.python.org/moin/BeginnersGuide

--
"Lots of people have brilliant ideas every day, but they often
disappear in the cacophony of life that we muddle through."

- Evan Jenkins, http://arstechnica.com/author/ohrmazd/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RE

2011-04-06 Thread Steve Willoughby

On 06-Apr-11 02:03, JOHN KELLY wrote:

I need help.


Can you be a little more specific? :)

--
Steve Willoughby / st...@alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (sqlite3) Testing if a table has been created.

2011-04-06 Thread Alan Gauld

"michael scott"  wrote


> Is this really a python tutor question?  Oh, well, try this:
> http://lmgtfy.com/?q=sqlite+test+if+table+exists

My apologies, I was not aware that there were questions I could and 
could not

ask.


The only issue is whether it is relevant to the group.
Python tutor is about teaching people to program in Python.

SqlLite is in the grey area of acceprtability because although it is
available as part of the Python standard library most questions
tend to be about general SQL issues rather than Python.

In practice straighforward beginner type questions will be answered
here, more SQL specific issues will be redirected to a general SQL
site or to the specific database forum.


I can have a clearer picture of what a python tutor question is,
could someone please help me?


Mainly if its about the Python programming language or general
program design type issues it is appropriate here. If it's about
how to use the Python standard library modules (including
accessing SqLite from Python) then thats OK too. The more
you digress into non standard or non Python issues the less
appropriate it is for this list.

HTH,

Alan G.
List moderator


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (sqlite3) Testing if a table has been created.

2011-04-06 Thread Joel Goldstick
On Wed, Apr 6, 2011 at 10:38 AM, michael scott wrote:

>
>
> --
> *From:* Andre Engels 
>
> *To:* michael scott 
> *Cc:* tutor@python.org
> *Sent:* Wed, April 6, 2011 10:19:53 AM
>
> *Subject:* Re: [Tutor] (sqlite3) Testing if a table has been created.
>
> On Wed, Apr 6, 2011 at 4:06 PM, michael scott wrote:
>
>>  Is this really a python tutor question?  Oh, well, try this:
>> http://lmgtfy.com/?q=sqlite+test+if+table+exists
>>
>> --
>> Joel Goldstick
>>
>>
>> My apologies, I was not aware that there were questions I could and could
>> not ask. I understand now that this is an unnacceptible question. But could
>> you tell me why? Was it too simple in nature? Too difficult? Did I violate
>> some rule in my question formatting?  This was not homework or anything like
>> that. I went back to the tutor website to make sure I did not blatantly
>> break one of the rules. I only found this regarding participation.
>>
>
>
> I think Joel's objection is that your question is not really about Python
> at all, but about SQLite,
>
> --
> André Engels, andreeng...@gmail.com
>
>
>
> Oh I see. That makes sense.
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
My apologies.  I was not so nice.  I needed coffee!  I'm a big reader of
this group.  I think its great.  Sometimes I have answers.  And I learn a
lot.  I was just meaning to point out that its best to have a specific
python question and include the code you tried -- including the traceback so
people can help you.  And, maybe its just me, but if you can do a little
research first, it adds to a better discussion.


-- 
Joel Goldstick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Rhythmbox python plugin to capture middle click event

2011-04-06 Thread Emile van Sebille

On 4/5/2011 10:10 PM Lachlan d said...

I've been working on some python rhythmbox plugins for the past few
months and now i've decided to try writing my own.


You'll get a much better answer if this is asked of other rhythmbox 
developers.   This tutor list in more suited for those just learning to 
program in python.


You can browse at http://osdir.com/ml/rhythmbox-devel/ and subscribe at
http://mail.gnome.org/mailman/listinfo/rhythmbox-devel

HTH,

Emile




I've been able to get actions working correctly in my other plugin.
(http://launchpad.net/rb-fileorganizer) but that uses buttons and a
gui i built rather than mouse clicks.

What i'm trying to create is a plugin that will perform and action
every time the middle mouse button is clicked in rhythmbox. I haven't
been able to find any solid information about doing this on the net.

The plugin will load but i don't think anything in capture_click is correct.
Any help getting this to just print the test message in the console
would be greatly appreciated!

Here's my code that i've written up so far:

class middleclick(rb.Plugin):

def __init__(self):
rb.Plugin.__init__(self)

# Rhythmbox standard Activate method
def activate(self, shell):
self.shell = shell
self.capture_click(shell)

# Rhythmbox standard Deactivate method
def deactivate(self, shell):
self.shell = None

# Run test_plugin for middle click
def capture_click(self, shell):
self.action = gtk.Action('MiddleClick', _('Middle Click'),
_('Action on Middle Click'), gtk.gdk.BUTTON_PRESS_MASK)
self.action.connect('activate', self.test_plugin, shell)
self.action_group = gtk.ActionGroup('OnClickActions')
self.action_group.add_action(self.action)
uim = shell.get_ui_manager()
uim.insert_action_group(self.action_group, 0)
uim.ensure_update()

def test_plugin(self, shell):
if event.button == 2:
print 'THIS IS AN EVENT'
else
print 'WRONG EVENT'
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (sqlite3) Testing if a table has been created.

2011-04-06 Thread michael scott


 



From: Andre Engels 
To: michael scott 
Cc: tutor@python.org
Sent: Wed, April 6, 2011 10:19:53 AM
Subject: Re: [Tutor] (sqlite3) Testing if a table has been created.

On Wed, Apr 6, 2011 at 4:06 PM, michael scott  wrote:

Is this really a python tutor question?  Oh, well, try this: 
http://lmgtfy.com/?q=sqlite+test+if+table+exists
>
>-- 
>Joel Goldstick
>
>
>My apologies, I was not aware that there were questions I could and could not 
>ask. I understand now that this is an unnacceptible question. But could you 
>tell 
>me why? Was it too simple in nature? Too difficult? Did I violate some rule in 
>my question formatting?  This was not homework or anything like that. I went 
>back to the tutor website to make sure I did not blatantly break one of the 
>rules. I only found this regarding participation.
>


I think Joel's objection is that your question is not really about Python at 
all, but about SQLite,

-- 
André Engels, andreeng...@gmail.com



Oh I see. That makes sense. 
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (sqlite3) Testing if a table has been created.

2011-04-06 Thread Andre Engels
On Wed, Apr 6, 2011 at 4:06 PM, michael scott  wrote:

>  Is this really a python tutor question?  Oh, well, try this:
> http://lmgtfy.com/?q=sqlite+test+if+table+exists
>
> --
> Joel Goldstick
>
>
> My apologies, I was not aware that there were questions I could and could
> not ask. I understand now that this is an unnacceptible question. But could
> you tell me why? Was it too simple in nature? Too difficult? Did I violate
> some rule in my question formatting?  This was not homework or anything like
> that. I went back to the tutor website to make sure I did not blatantly
> break one of the rules. I only found this regarding participation.
>


I think Joel's objection is that your question is not really about Python at
all, but about SQLite,

-- 
André Engels, andreeng...@gmail.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (sqlite3) Testing if a table has been created.

2011-04-06 Thread michael scott




From: Joel Goldstick 
To: michael scott 
Cc: tutor@python.org
Sent: Wed, April 6, 2011 8:30:17 AM
Subject: Re: [Tutor] (sqlite3) Testing if a table has been created.



On Tue, Apr 5, 2011 at 9:59 PM, michael scott  wrote:

Hello guys,
>
>Since sqlite gives an error if you try to create a table that's already there, 
>how do I test if a table is already present?
>
>
>for example in
>
>def database(info):
>import sqlite3
>
>connection = sqlite3.connect("test.db")
>cursor = connection.cursor()
>if table not in test.db: #with this being my test that I'm not sure how to 
>implement
>cursor.execute(""" CREATE TABLE stuff (id INTEGER PRIMARY KEY, name 
>TEXT)""")
>cursor.execute("""INSERT INTO stuff VALUES (null, ?)""",(info))
>cursor.commit()
>cursor.close()
>connection.close()
>
>
>How would  I properly test  if table not in test.db: ? Is it something as 
>simple 
>as having a method of cursor check it for me, or should I just create my table 
>in the beginning of my code(outside of this function) and leave it out of the 
>function all together, so I can just have my function focusing on inserting 
>data?
>
>Uhm, in the immediate example I'm using, this is a function, thats inside of a 
>function used by a tkinter button, a save button if you will. So I want it to 
>save whatever is in the entry widget to the database. Keeping this in mind, am 
>I 
>going about it the wrong way? Should I be trying to save a different way?
>
>
>
>
>
>
>
>What is it about you... that intrigues me so?
>
>
>___
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>http://mail.python.org/mailman/listinfo/tutor
>
>
Is this really a python tutor question?  Oh, well, try this: 
http://lmgtfy.com/?q=sqlite+test+if+table+exists


-- 
Joel Goldstick





My apologies, I was not aware that there were questions I could and could not 
ask. I understand now that this is an unnacceptible question. But could you 
tell 
me why? Was it too simple in nature? Too difficult? Did I violate some rule in 
my question formatting?  This was not homework or anything like that. I went 
back to the tutor website to make sure I did not blatantly break one of the 
rules. I only found this regarding participation.



About Tutor  English (USA)  
This list is for folks who want to ask questions regarding how to learn 
computer 
programming with the Python language. 


Python (http://www.python.org/)  is a programming language which many feel is a 
good first language,  because it makes it easy to express the fundamental 
concepts of  programming such as data structures and algorithms with a syntax 
which  many find easy to read and write. 


Folks interested in learning about programming with Python are  encouraged to 
join, as are folks interested in helping others learn.   While the list is 
called tutor, anyone, whether novice or expert, can  answer questions. 


If individuals wish to start off-line conversations about a  particular concept 
and become one-on-one tutor/tutee, that's fine.  If  either party wants to 
summarize what they learned for others to benefit,  that's fine too. 


There is a searchable interface to archived Tutor messages on Activestate's web 
site and another one at Gmane. 


There are many on-line resources that can help you get started with Python. See 
the Beginners Guide for a list of some good ones.
To see the collection of prior postings to the list,  visit the Tutor   
  
Archives.  



So that I can avoid posting questions that don't belong on the tutor list, or 
so 
I can have a clearer picture of what a python tutor question is, could someone 
please help me?___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Showing/hiding widgets in Tkinter

2011-04-06 Thread Peter Otten
The Green Tea Leaf wrote:

> > which implies that tk does not store the placement information
> > automatically. Assuming that Python's Tkinter behaves the same way you 
can
> > write
> >
> > def toggle():
> >if mylabel.visible:
> >mylabel.pi = mylabel.place_info()
> >mylabel.place_forget()
> >else:
> >mylabel.place(mylabel.pi)
> >mylabel.visible = not mylabel.visible
> 
> Unfortunately, it doesn't work. I can see the label flashing when I
> press the button but it's not visible unless I press the button again.

I don't understand that sentence. If you press the button the label should 
disappear. When you press it again it should become visible again.

I added some noise to your initial script and saved the placement state:

import sys
import Tkinter as tk

def toggle():
if mylabel.visible:
btnToggle["text"] = "Show Example"
print "Now you don't"
mylabel.place_forget()
else:
mylabel.place(mylabel.pi)
print "Now you see it"
btnToggle["text"] = "Hide Example"
mylabel.visible = not mylabel.visible

root = tk.Tk()

print "TkVersion", tk.TkVersion
print "TclVersion", tk.TclVersion
print "Python version", sys.version_info

mylabel = tk.Label(text="Example")
mylabel.visible = True
mylabel.place(x=20, y=50)
mylabel.pi = mylabel.place_info()

btnToggle = tk.Button(text="Hide Example", command=toggle)
btnToggle.place(x=70, y=150)

root.mainloop()

That does what it's expected to do over here.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (sqlite3) Testing if a table has been created.

2011-04-06 Thread Joel Goldstick
On Tue, Apr 5, 2011 at 9:59 PM, michael scott  wrote:

> Hello guys,
>
> Since sqlite gives an error if you try to create a table that's already
> there, how do I test if a table is already present?
>
>
> for example in
>
> def database(info):
> import sqlite3
>
> connection = sqlite3.connect("test.db")
> cursor = connection.cursor()
> if table not in test.db: #with this being my test that I'm not sure how
> to implement
> cursor.execute(""" CREATE TABLE stuff (id INTEGER PRIMARY KEY, name
> TEXT)""")
> cursor.execute("""INSERT INTO stuff VALUES (null, ?)""",(info))
> cursor.commit()
> cursor.close()
> connection.close()
>
>
> How would I properly test  if table not in test.db: ? Is it something as
> simple as having a method of cursor check it for me, or should I just create
> my table in the beginning of my code(outside of this function) and leave it
> out of the function all together, so I can just have my function focusing on
> inserting data?
>
> Uhm, in the immediate example I'm using, this is a function, thats inside
> of a function used by a tkinter button, a save button if you will. So I want
> it to save whatever is in the entry widget to the database. Keeping this in
> mind, am I going about it the wrong way? Should I be trying to save a
> different way?
>
>
>
>
>
>
> 
> What is it about you... that intrigues me so?
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
Is this really a python tutor question?  Oh, well, try this:
http://lmgtfy.com/?q=sqlite+test+if+table+exists


-- 
Joel Goldstick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Showing/hiding widgets in Tkinter

2011-04-06 Thread The Green Tea Leaf
>> According to the documentation I've read I should be able to use
>> 'place()' after having used 'place_forget()' to show the label at the
>> same place.
>
> Where did you read that? I only found
>
> """
> If the configuration of a window has been retrieved with place info, that
> configuration can be restored later by first using place forget to erase any
> existing information for the window and then invoking place configure with
> the saved information.
> """
>
> at http://www.tcl.tk/man/tcl8.5/TkCmd/place.htm

The docs I've found are rather sketchy on almost everything, but I -
perhaps wrongly - interpreted the text at
http://books.google.com/books?id=JnR9hQA3SncC&lpg=PA445&ots=Jb1TEw-42A&dq=tkinter%20place_forget&pg=PA445#v=onepage&q=place_forget&f=false
to mean that I would be able to do this.

An alternative way of interpreting this (and other texts) is that I
should be able to show it again by using the place command with the
same parameters ... but that doesn't work either.

> which implies that tk does not store the placement information
> automatically. Assuming that Python's Tkinter behaves the same way you can
> write
>
> def toggle():
>    if mylabel.visible:
>        mylabel.pi = mylabel.place_info()
>        mylabel.place_forget()
>    else:
>        mylabel.place(mylabel.pi)
>    mylabel.visible = not mylabel.visible

Unfortunately, it doesn't work. I can see the label flashing when I
press the button but it's not visible unless I press the button again.

-- 
The Green Tea Leaf   thegreenteal...@gmail.com   thegreentealeaf.blogspot.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] GUI IDLE for UBUNTU 10

2011-04-06 Thread Andrés Chandía


Sorry, the command is Crtl+F9, not only F9

On Wed, April 6, 2011 12:43,
"Andrés Chandía" wrote:
  Actually
the default text editor in Ubuntu, "gedit" has a plugin named Python console, 
that
you can activate at "edit > preferences" menu, then at the menu "view >
inferior subwindow" (F9) you can activate it, maybe the menu names are not 
exact, because
I'm translating from catalan.

Good luck!

On Wed, April 6, 2011 11:34,
Ratna Banjara wrote:
  As i know python comes as default in ubuntu and can be accessed
from terminal.
But i found difficulty to write programs in editor and run from terminal.
I need GUI
Before this i used to run in windows with python IDLE which makes easy to
write python codes and run using Run command or pressing F5.
 
Now i want to ask if
there is python GUI IDLE equivalent in Ubuntu. Please help.
-- 
Regards,
Ratna
P Banjara


   


___
   
andrés chandía

P No imprima innecesariamente. ¡Cuide el medio
ambiente!  


___
andrés
chandía

P No imprima
innecesariamente. ¡Cuide el medio ambiente!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] GUI IDLE for UBUNTU 10

2011-04-06 Thread Andrés Chandía


Actually the default text editor in Ubuntu, "gedit" has a plugin named Python
console, that you can activate at "edit > preferences" menu, then at the menu
"view > inferior subwindow" (F9) you can activate it, maybe the menu names are
not exact, because I'm translating from catalan.

Good luck!

On Wed,
April 6, 2011 11:34, Ratna Banjara wrote:
  As i know python
comes as default in ubuntu and can be accessed from terminal.
But i found difficulty to
write programs in editor and run from terminal. I need GUI
Before this i used to run in
windows with python IDLE which makes easy to write python codes and run using 
Run command or
pressing F5.
 
Now i want to ask if there is python GUI IDLE equivalent in Ubuntu.
Please help.
-- 
Regards,
Ratna P Banjara


   


___
andrés
chandía

P No imprima
innecesariamente. ¡Cuide el medio ambiente!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] GUI IDLE for UBUNTU 10

2011-04-06 Thread Corey Richardson
On 04/06/2011 05:34 AM, Ratna Banjara wrote:
> Before this i used to run in windows with python IDLE which makes easy to
> write python codes and run using Run command or pressing F5.
> 
> Now i want to ask if there is python GUI IDLE equivalent in Ubuntu. Please
> help.

At the terminal, sudo apt-get install idle.

When you need software, search in Synaptic (Package Manager) or google
first, it's usually very accessible!
-- 
Corey Richardson
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Showing/hiding widgets in Tkinter

2011-04-06 Thread Peter Otten
The Green Tea Leaf wrote:

> Hi all,
> 
> I'm trying to learn a bit about how to show/hide objects using the
> available layout managers and have no problems using Pack or Grid but
> when I try to use Place then I'm missing something
> 
> My test code looks like this
> 
> from Tkinter import *
> 
> def toggle():
> if mylabel.visible:
> mylabel.place_forget()
> else:
> mylabel.place()
> mylabel.visible = not mylabel.visible
> 
> root = Tk()
> 
> mylabel = Label(text="Example")
> mylabel.visible = True
> mylabel.place(x=20,y=50)
> 
> btnToggle = Button(text="Toggle nr two",command=toggle)
> btnToggle.place(x=70,y=150)
> 
> root.mainloop()
> 
> According to the documentation I've read I should be able to use
> 'place()' after having used 'place_forget()' to show the label at the
> same place.

Where did you read that? I only found

"""
If the configuration of a window has been retrieved with place info, that 
configuration can be restored later by first using place forget to erase any 
existing information for the window and then invoking place configure with 
the saved information.
"""

at http://www.tcl.tk/man/tcl8.5/TkCmd/place.htm

which implies that tk does not store the placement information 
automatically. Assuming that Python's Tkinter behaves the same way you can 
write

def toggle():
if mylabel.visible:
mylabel.pi = mylabel.place_info()
mylabel.place_forget()
else:
mylabel.place(mylabel.pi)
mylabel.visible = not mylabel.visible

> What happens is on the first click the label disappears, but when I
> click again it stays invisible (and yes, the else statement is
> executed). If I change the else-statement to
> 'mylabel.place(x=70,y=150)'
> 
> Any idea what I'm missing?



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] GUI IDLE for UBUNTU 10

2011-04-06 Thread Ratna Banjara
As i know python comes as default in ubuntu and can be accessed from
terminal.
But i found difficulty to write programs in editor and run from terminal. I
need GUI
Before this i used to run in windows with python IDLE which makes easy to
write python codes and run using Run command or pressing F5.

Now i want to ask if there is python GUI IDLE equivalent in Ubuntu. Please
help.
-- 
Regards,
Ratna P Banjara
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Showing/hiding widgets in Tkinter

2011-04-06 Thread The Green Tea Leaf
Hi all,

I'm trying to learn a bit about how to show/hide objects using the
available layout managers and have no problems using Pack or Grid but
when I try to use Place then I'm missing something

My test code looks like this

from Tkinter import *

def toggle():
if mylabel.visible:
mylabel.place_forget()
else:
mylabel.place()
mylabel.visible = not mylabel.visible

root = Tk()

mylabel = Label(text="Example")
mylabel.visible = True
mylabel.place(x=20,y=50)

btnToggle = Button(text="Toggle nr two",command=toggle)
btnToggle.place(x=70,y=150)

root.mainloop()

According to the documentation I've read I should be able to use
'place()' after having used 'place_forget()' to show the label at the
same place.

What happens is on the first click the label disappears, but when I
click again it stays invisible (and yes, the else statement is
executed). If I change the else-statement to
'mylabel.place(x=70,y=150)'

Any idea what I'm missing?

-- 
The Green Tea Leaf   thegreenteal...@gmail.com   thegreentealeaf.blogspot.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor