font: font family to be used to display the text on python alarm clock window.text: text to be displayed on the button.options: (These are the ones discussed above).relx, rely or relheight, relwidth: Height and width as a floating point number between 0.0 and 1.0, representing a fraction (in decimal) of the height and width of the parent window.īutton widget: This is used to add a button to the alarm clock window.height, width: height and width in pixels.x, y: horizontal and vertical starting points in pixels.anchor: to change the position of (0,0) coordinate to any other corner/side of the window.The default for this is (0, 0) or the north west corner of the window. Place() method: This Tkinter geometry manager method allows the user to give a starting position to a widget according to the coordinates on a cartesian plane. Label widget: This widget is used to display static text on the window of any font, or color. The positional arguments it takes are in the form (height, width) and the default values are (True, True) but you can also change these to either False or 0 to set a fixed size to the window. Resizable() method: Values entered in this method decide whether the user can or cannot resize the window once it appears. Geometry() method: With this method, you can set the dimensions of the alarm clock window. Title() method: This method gives a title to the window. While setting a master GUI window (alarm clock window), it is essential to use: Submit_btn = Button(root, text='Submit', bg='CadetBlue4', command=lambda: alarm_clock(hour.get(), minute.get(), second.get())) OptionMenu(root, second, *seconds).place(x=160, y=100) OptionMenu(root, minute, *minutes).place(x=100, y=100) ![]() Label(root, text='Hour', font=("Book Antiqua", 11), wraplength=root.winfo_width()).place(x=50, y=70) Label(root, text='When do you want to wake up?\n(Enter in 24-hour format)', font=("Comic Sans MS", 13), wraplength=root.winfo_width()).place(x=0, y=0) # Creating and placing all the components of the window Creating the main GUI window and placing all its components: # Setting the main screen Importing the libraries: # Importing all the necessary modulesįirst of all, we will import all the necessary modules that we will require to create this python project. Let’s take a closer and deeper look at all the steps: 1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |