I’m working on the documentation for my program. This is a child window that will be triggered by a button push on the parent window of the program. As written it works fine.
The problem comes when I realized I was working on a wide screen. How will this work on a standard sized computer, not good. So do I limit the size of the window to fit standard size screen, can do this, not best. What about dynamic sizing. What is the best way to handle this?
I can’t figure out how to change the icon on the child window. I know how to do it with the parent window. I can change the label on the parent window as well as on the child window.
Thanks as always for your time and help.
import tkinter as tk text = ' Alarm Buddy Documentation and Instructions\n' \ 'Why was this software written?\nThe short answer is, Kyla, my long time significant other, had to have emergency gallbladder surgery. I realized how much she kept track of for me. Now, I was expected to keep thing on track and on time. This keeping track of everything that had to be done and at what time it had to be done was harder for me as I am a major stroke survivor. I got through this life event and Kyla is doing very well. If I had multiple alarms I could set them as reminders. Less to worry about knowing everything was being done and on time.\n\n' \ 'Since working on this project Kyla and I noticed that it had a few other groups that might find this useful, such as elderly that are starting to get forgetful or overwhelmed with keeping it all done on time as needed, medication comes to mind. Home caregivers, veterans, college students, stroke survivors, busy parents (pick up children) and the elderly.\n\n' \ '"Alarm Buddy" is free. Free for private use, free for public use, share website with others. Commercial users contact us by the "Comments or Feedback" button. There is no charge for Commercial use. Not for resale or subscription service.\n\n' \ 'Known uses:\nStandard Alarm including daily, Monday through Friday, Every day, Repeat alarms. Each alarm can have a name or reason for the alarm (encouraged) and alarm sound.\n\n' \ 'Alarm Examples:\nFeed the pet, check pets water, take medication, eating reminder, water the plants, walk the dog, take out the trash, reminder to watch a TV show or play an online tournament, check blood sugar, time for class, pick up the children, clean the cat litter box, pool maintaining and standard alarm clock.\n\n' \ 'Sections of Alarm Buddy:\n\nAlarm Time:\n' \ 'There are two sliders to set hours and minutes. There is an AM button and a PM button. One, AM or PM must be set for each alarm time, set is the button in down position.\n\n' \ "Alarm Days:\n" \ 'There are buttons for \'Monday\', \'Tuesday\', \'Wednesday\', \'Thursday\', \'Friday\', \'Saturday\' and \'Sunday\' for days of the week. All buttons can be cleared using the \'Clear\' button found further down the row at the end.\n' \ 'Next, come the \'Repeat\' button. It is used to repeat whatever buttons are pushed in down position.\n' \ 'Then there are two groups of buttons \'Monday through Friday\' and \'Every Day\'. \'Every Day\' selects Monday through Sunday, while \'Monday through Friday\' select Monday through Friday days. To select Monday through Saturday you need to also push the \'Saturday\' button.\n' \ 'Finally, there is the \'Clear\' button. It clears the selected alarm buttons. *Note, it does not clear the sliders as they maybe set correctly.\n\n' \ 'Alarm Controls:\n\'Name or Reason for Alarm\' is not required, but encouraged. There is an entry places for the \'Name or Reason for Alarm\'. The reason for naming your alarms is to help when it\'s time to delete an alarm, the \'Name or Reason for Alarm\' is right there. However, the main reason for \'Name or Reason for Alarm\' aid in remembering what needs to be done when the alarm sounds.\n' \ 'Two large buttons, one green \'Set Alarm\' and the other red \'Stop Alarm\'. Between, \'Set Alarm\' and \'Stop Alarm\' is an alarm set indicator. It only appears after an alarm is set and remains lit as long as an alarm is set. This also acts like an indicator by blinking as a silent alarm.\n' \ '\'Alarm Sound\' and entry is next. This is for selecting alarm sound for this alarm. Every alarm can have a different alarm sound. There is a space between Alarm and the number, no comma (example - Alarm 2 ). The possible alarm setting are:\n \ ALARM NAME ALARM SETTINGS\n' \ ' Alarm Clock Buzzer... Default Alarm,\n' \ ' Rapid Alarm Buzzer... Alarm 1,\n' \ ' Rapid High tone Buzzer... Alarm 2,\n' \ ' General Alarm... Alarm 3,\n' \ ' Emergency Alarm... Alarm 4,\n' \ ' Quiet Tones Alarm... Alarm 5,\n' \ ' Air Raid Siren... Alarm 6,\n' \ ' Fast Medium Tone... Alarm 7,\n' \ ' Dog Barking... Alarm 8,\n' \ ' Two Tone Alarm... Alarm 9,\n' \ ' Police Siren... Alarm 10,\n' \ ' Roster Crowing... Alarm 11,\n' \ ' Medium Tone Alarm... Alarm 12,\n' \ ' Alarm Indicator light flashing... Silent Alarm.\n\n' \ 'The \'Test Alarm\' is to test the alarm you selected. The alarm can be turned off with the red \'Stop Alarm\' button.\n\n' \ 'Five-Hour Timer:\n' \ 'First a slider for hours with a range of one to four hours. Next, a slider for minutes with a range of one to sixty minutes, giving ' \ 'a five-hour range. This is very useful if an event has to happen every few hours such as medication or tend to a patient.\n' \ '\'Repeat Timer\' and a \'Clear Repeat\' button. \'Clear Repeat\' button clears only \'Five Hour Timer\'s \'Repeat Timer\'. Not the \'Alarm Days\' \'Repeat\' button.\n' \ 'Each alarm can and should have a name or reason for the alarm and alarm sound.\n\n' \ 'Information\n' \ 'First is a button asking you for a donation. I\'m an elderly 72 year old veteran and major stroke survivor of 27 years. This software was written to help anyone with a need for it.\n' \ 'View Instructions is next. You are reading it. There are a few instructions and \'Alarm Codes\'. Nice to have them handy.\n' \ 'Comments and Feedback is a very important button. It gives you a voice about \'Alarm Buddy\'. This allows for ideas that might improve the program to get to the right person, me. Any bugs or problems you are having should be reported here, as these are most helpful.\n' \ '\'Current Alarm Time\' window will show the day of alarm, time set for, AM/PM and \'Alarm Name\' if known. Blank until an alarm is set.\n' \ 'The final button \'Edit Alarms\'. This is where you look at what alarms are set, for peace of mind. You can also delete alarms that are not needed or entered incorrectly. Once deleted they are gone, no recovery possible.\n\n' \ '***Important Note***\n' \ 'If the Alarm Buddy is turned off, Alarm Buddy remembers the alarms. Turn it back on as soon as possible. Alasm Buddy will discard any one time alarms that have expired.' class About(tk.Toplevel): def __init__(self, parent): super().__init__(parent) self.frame = tk.Frame(self) self.label = tk.Label(self, text='Alarm Buddy') self.text = tk.Text(self, width=150, height=35, bg='#D5DCE1', wrap='word') self.text.insert('1.0', text) self.button = tk.Button(self, text="Close", command=self.destroy) self.label.grid(row=1, column=0) self.text.grid(row=1, column=0,padx=30, pady=10) self.button.grid(row=0, column=0, ipadx=2, ipady=2) self.frame.grid(row=1, column=0) class App(tk.Tk): def __init__(self): super().__init__() self.btn = tk.Button(self, text="Open new window", command=self.open_window) self.btn.pack(padx=50, pady=20) def open_window(self): about = About(self) about.grab_set() if __name__ == "__main__": app = App() app.title('Dog House Programming') app.mainloop()