1

I am trying to create a frame in my window using Tkinter Bootstrap - I can't see it appearing, although the text does show up. From what I can see from the demo, the frame should be a slightly lighter colour. Am I doing this right?

import ttkbootstrap as ttk
from ttkbootstrap.constants import *


def createWin():
    Window = ttk.Window(themename="vapor")
    Window.geometry('1000x500+120+250')
    Window.title("Win")

    frame = ttk.Frame(Window, height = 900, width = 100)
    
    frame.columnconfigure(0, weight=1)
    frame.columnconfigure(0, weight = 4)
    
    frame.pack()
    label = ttk.Label(frame, text="Hi!").grid(column = 2, row = 1)
    
    Window.mainloop()


Window = createWin()
    

This is my output: Code Output

Thanks for any help!

JRiggles
  • 4,847
  • 1
  • 12
  • 27
  • What if you try `frame.pack(expand=True, fill='both')`? That should cause your frame to fill the available space. – JRiggles Nov 28 '22 at 14:20
  • I gave that a try! The 'hi' text moved across to the right corner. Am I right in thinking that a frame would typically have a slightly different colour, or is that a misinterpretation on my part? – beccaroonie Nov 28 '22 at 16:10
  • `Frame` widgets are typically transparent (or, more accurately, the same color as the default background) unless you specify otherwise via a `Style()` call. [See here](https://9to5answer.com/setting-background-color-of-a-tkinter-ttk-frame) for details. – JRiggles Nov 28 '22 at 16:16
  • Using a paint program to show the RGB of the image you post, I get (25, 8, 49) which matches the `bg` color ("#190831") for the theme `vapor`. The color around the window may cause you to see a *relative* darker or lighter color. – acw1668 Nov 29 '22 at 06:25

0 Answers0