-2

I want to create a program that opens in full-screen and in which the left side of the program window is a Text widget with a scrollbar on the right, such that it's width is 60% of the screen width and the right side is also a Text widget with a scrollbar and its width is 40% of the screen width, here is what I tried to do without success so far, as you can see by running this code (the blue and green colors are just for comfort):

import tkinter as tk
from tkinter.scrolledtext import *
master = tk.Tk()
w = master.winfo_screenwidth()
h = master.winfo_screenheight()
master.geometry("{}x{}".format(w,h))
main = ScrolledText(master, bg="blue", width=int(0.6*w), height=h)
sec = ScrolledText(master, bg="green", width=int(0.4*w), height=h)
main.frame.place(x=0, y=0)
sec.frame.place(x=int(0.6*w), y=0)

So first of all if you could help me implement this part correctly that would be very helpful, and then there are 3 additional widgets that I would like to add to that:

  1. A menubar on top.
  2. A Text widget in on the bottom of the window with the width of the entire screen, and height of one text line in the font specs of this text widget (this will be a sort of status bar).
  3. line numbers in the left of the left text widget (the main one). There is a post on how to create it here, but I'm not sure how to add it.
  • It doesn't look like you've done any investigation on your own or tried to use any options to `place`. – Bryan Oakley Mar 19 '20 at 16:20
  • @BryanOakley I tried many different options with place, with grid and with pack, but I just don't understand why there are always problems. It's O.K if you don't want to give me a full solution but perhaps you could suggests some directions. – Michael Novak Mar 19 '20 at 16:36
  • It would help if you showed what you tried. For exaple, place lets you specify relative widths and heights as well as relative placement. Are you saying you've tried those and they didn't work? – Bryan Oakley Mar 19 '20 at 17:32

1 Answers1

0
  1. Menubar
# Menu bar
menubar = Menu(app)
app.config(menu=menubar)

menu = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Menu", menu=menu)

menu.add_command(label="menu", command=command)

More here

  1. Width of the entire screen
    You can use .pack(side="bottom", fill="both")
DYD
  • 382
  • 2
  • 15