![]() Photo = PhotoImage(file='4 Dry Out Logo.png') Self.Btn = Button(master, text="Water Damage Equipment", command=self.MenuWin, bg="navy", fg="white", font=("Roboto")).pack() Self.titleLabel = Label(master, text="4 Dry Out e-Rental", bg="blue", fg="white", font=("Arial Black", 20)) At least this is my plan - if any of you have a nicer solution please share it with me - my original idea was to use the canvas widget to make a custom widget for the Print Dialog - but further I don't know how to deal with printers in Python.Img=PhotoImage(file='4 Dry Out Logo.png') ![]() I'll detect the operating system used and call the appropriate code (taken from IDLE windows and linux versions) to handle printing. I do have a workaround for this: I will simply copy the IDLE source code from the printing session. I want to be able to run this clone on Linux too and I was hoping to find a cross-platform widget for printing, similar to the open file dialog which is available as a widget. I am a little bit frustrated - I got stuck several days ago on this matter - I hope a Tkinter/Python guru can give me a solution or a hint on how to smoothly resize the text widget along with the root window without the interference of the annoying border.Ģ) Second problem is related to the Print Dialog. PixelX=root.winfo_width()-yscrollbar.winfo_width() H=int(round(LB.winfo_height()/LB)), int(round(LB.winfo_width()/LB)) Yscrollbar=Scrollbar(root, orient=VERTICAL, command=LB.yview) LB=Text(root, width=16, height=5, font=dFont) from Tkinter import *ĭFont=tkFont.Font(family="Arial", size=30) I simplified the problem as much as possible - this is not the notepad clone, but a minimal Tkinter application that is still able to reproduce the problem. The effect is noticeable even for small fonts - but for a large sized fond it becomes very visible. The remained border, after the root window resize, has a thickness, for example on the vertical side, less than the number of pixels in the current font height (text widget). What happens is that the root window can be resized with a finer resolution while the text widget is resized in steps equal with font size in pixels (on horizontal and vertical). This is normal to happen (although undesired). ![]() For certain root window sizes there is a thick border between the root window margins and the text widget. The ratio is determined for the current set font of the text widget. In the callback function I take the pixel/character ratio (both horizontal and vertical) for the text widget, and based on this information I compute roughly the new size of the text widget by considering the new root window size (both horizontal and vertical). Now, I came with something (see the code below) in which I define a callback function called whenever the resize event of the root window takes place. This is an undesirable behavior - I expect/want the text to resize along with the root. If I resize the root window at a greater size, the text widget stays at the initial size. I am pretty close to completing it - I added about 90% functionality to the application - but I face two problems:ġ) The text widget has a default fixed size (80x25 chars I believe). As a part of the learning process I am building a Notepad clone in order to become familiar with Tkinter widgets.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |