RSS Forums RSS
Please support our Python advertiser: Programming Forums
Views: 903 | Replies: 0
Reply
Join Date: Jun 2006
Location: Croatia
Posts: 12
Reputation: Gigs_ is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Gigs_ Gigs_ is offline Offline
Newbie Poster

tkinter find

  #1  
Mar 31st, 2007
I want to make find in my text editor like in mozilla firefox on the bottom of my gui

this is only for learning.
  1. class MyClass(Frame):
  2. def onFind(self, target=None):
  3. if target == None:
  4. target = tkSimpleDialog.askstring('Find!', 'Search for string!')
  5. if target:
  6. where = self.text.search(target, INSERT, END)
  7. if where:
  8. pastit = where + ('+%dc' % len(target))
  9. self.text.tag_remove(SEL, '1.0', END)
  10. self.text.tag_add(SEL, where, pastit)
  11. self.text.mark_set(INSERT, pastit)
  12. self.text.see(INSERT)
  13. self.text.focus()
  14.  
  15. def findToolbar(self):
  16. frm = Frame(self.master)
  17. frm.pack(side=BOTTOM, expand=YES, fill=X)
  18. Button(frm, text='Quit!').pack(side=LEFT)
  19. e = Entry(frm)
  20. e.pack(side=LEFT)
  21. e.focus_set()
  22. target = e.get()
  23. b = Button(frm, text='find', command=lambda: self.onFind(target))
  24. b.pack(side=LEFT)
How to make when I open find toolbar that i dont have possibiliti to open the toolbar again when first is opened.
It seems that I cant get text from Entry, my target is empty
Last edited by Gigs_ : Mar 31st, 2007 at 8:43 am.
Gigs_ has spoken!
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 11:14 am.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC