Mageia Bugzilla – Attachment 9873 Details for
Bug 22103
python, python3 new security issue CVE-2017-1000158
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Hello World script for tkinter with python 3
newbie.py (text/plain), 1.21 KB, created by
Len Lawrence
on 2017-12-31 23:49:48 CET
(
hide
)
Description:
Hello World script for tkinter with python 3
Filename:
MIME Type:
Creator:
Len Lawrence
Created:
2017-12-31 23:49:48 CET
Size:
1.21 KB
patch
obsolete
>#!/bin/env python3 ># Import everything from the tkinter module (or as needed?) >from tkinter import * > ># define a gui class for the whole application. >class Application( Frame ): > # callback for hi_there button > def say_hi( self ): > print( "Good morning QA." ) > > # organize the widgets > def createWidgets( self ): > self.hi_there = Button( self ) > self.hi_there["text"] = "Hello", > self.hi_there["command"] = self.say_hi > > self.hi_there.pack( {"side": "left"} ) > > self.QUIT = Button( self ) > self.QUIT["text"] = "quit" > self.QUIT["fg"] = "red" > self.QUIT["command"] = self.quit > > self.QUIT.pack( {"side": "left"} ) > > # constructor > def __init__( self, master=None ): > Frame.__init__( self, master ) > self.pack( ) > self.createWidgets( ) > ># create the root window >root = Tk( ) ># build the gui >app = Application( master=root ) ># start the event loop >app.mainloop( ) ># The following also works, combining the two commands: ># Only useful if the gui object handle is not required. ># Application( master=root ).mainloop( ) ># falls through to here on exit from the gui ># kill the application by removing the root window >root.destroy( )
#!/bin/env python3 # Import everything from the tkinter module (or as needed?) from tkinter import * # define a gui class for the whole application. class Application( Frame ): # callback for hi_there button def say_hi( self ): print( "Good morning QA." ) # organize the widgets def createWidgets( self ): self.hi_there = Button( self ) self.hi_there["text"] = "Hello", self.hi_there["command"] = self.say_hi self.hi_there.pack( {"side": "left"} ) self.QUIT = Button( self ) self.QUIT["text"] = "quit" self.QUIT["fg"] = "red" self.QUIT["command"] = self.quit self.QUIT.pack( {"side": "left"} ) # constructor def __init__( self, master=None ): Frame.__init__( self, master ) self.pack( ) self.createWidgets( ) # create the root window root = Tk( ) # build the gui app = Application( master=root ) # start the event loop app.mainloop( ) # The following also works, combining the two commands: # Only useful if the gui object handle is not required. # Application( master=root ).mainloop( ) # falls through to here on exit from the gui # kill the application by removing the root window root.destroy( )
View Attachment As Raw
Actions:
View
Attachments on
bug 22103
:
9871
|
9872
| 9873