Lazy Buttons: Demonstrates using a class with Tkinter : Button « Tkinker « Python Tutorial

Python Tutorial
1. Introduction
2. Data Type
3. Statement
4. Operator
5. String
6. Tuple
7. List
8. Dictionary
9. Collections
10. Function
11. Class
12. File
13. Buildin Function
14. Buildin Module
15. Database
16. Regular Expressions
17. Thread
18. Tkinker
19. wxPython
20. XML
21. Network
22. CGI Web
23. Windows
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorial
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Python Tutorial » Tkinker » Button 
18. 4. 14. Lazy Buttons: Demonstrates using a class with Tkinter
Lazy Buttons: Demonstrates using a class with Tkinter
from Tkinter import *

class Application(Frame):
    def __init__(self, master):
        Frame.__init__(self, master)
        self.grid()
        self.create_widgets()

    def create_widgets(self):
        self.bttn1 = Button(self, text = "A")
        self.bttn1.grid()

        self.bttn2 = Button(self)
        self.bttn2.grid()      
        self.bttn2.configure(text = "B")

        self.bttn3 = Button(self)
        self.bttn3.grid()
        self.bttn3["text""C"

root = Tk()
root.title("Lazy Buttons")
root.geometry("200x85")
app = Application(root)
root.mainloop()
18. 4. Button
18. 4. 1. Button Widget DemoButton Widget Demo
18. 4. 2. Label and Button Widget DemoLabel and Button Widget Demo
18. 4. 3. Button text and commandButton text and command
18. 4. 4. Add button to frameAdd button to frame
18. 4. 5. Config a button for its cursor background, font and borderConfig a button for its cursor background, font and border
18. 4. 6. Button action: sys.exitButton action: sys.exit
18. 4. 7. Set button properties in its constructorSet button properties in its constructor
18. 4. 8. Set button backgroundSet button background
18. 4. 9. Set text for button with configure functionSet text for button with configure function
18. 4. 10. Set button properties using list syntax
18. 4. 11. Bind mouse action to buttonBind mouse action to button
18. 4. 12. Change control backgroundChange control background
18. 4. 13. Mouse in/out action
18. 4. 14. Lazy Buttons: Demonstrates using a class with TkinterLazy Buttons: Demonstrates using a class with Tkinter
18. 4. 15. An Application with a ButtonAn Application with a Button
18. 4. 16. To add button handling functionality to your applicationTo add button handling functionality to your application
18. 4. 17. Button graphicsButton graphics
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.