[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Python GUI with Tkinter – 10 – Creating a Toolbar
by
Tags:
Comments
26 responses to “Python GUI with Tkinter – 10 – Creating a Toolbar”
-
And up comes the toolbar …
-
can anybody see why mine is not working?
using pycharm community edition 2017.2.3from tkinter import *
def doNothing():
print("oK Doing nothing")root = Tk()
menu = Menu(root)
root.config(menu=menu)subMenu = Menu(menu)
menu.add_cascade(label="File", menu=subMenu)
subMenu.add_command(label='New Project…', command=doNothing)
subMenu.add_command(label='New…', command=doNothing)
subMenu.add_separator()
subMenu.add_command(label='Exit…', command=doNothing)editMenu = Menu(menu)
menu.add_cascade(label='Edit', menu=editMenu)
editMenu.add_command(label="Redo", command=doNothing)toolbar = Frame(root, bg="blue")
insertButt = Button(toolbar, text="Insert Image", command=doNothing)
insertButt.pack(side=LEFT, padx=2, pady=2)
printButt = Button(toolbar, text="Print", command=doNothing)
printButt.pack(side=LEFT, padx=2, pady=2)toolbar.pack(side=TOP, fill=X)
root.mainloop()
-
Does anyone know what "expand" is doing?
for example: Frame(root, bg="blue").pack(expand=1) -
Macos is a pain, because the menu stays on the top line of the main screen,while the toolbar travels with your window.
-
where is your forum.where can i find the source code!!
this is pissing me off coz i am as lazy as you.i guess a bit more!! -
Where is this forum of which you speak (with the source code)?
-
print("thaks….")
-
why can't i find the code for gui on github???
-
Thank you man, I am learning program in Python
-
Are menus and toolbars usually created in the class of the main program gui or in their own class or like in this video without using a class? FYI — I'm a noob and learning.
-
your videos are amazing and the comments you make from time to time as well hahaha 😀
-
that menu thing like how to make menu is confusion cuz the reference of menu come many times
-
I've been having problem with "pack"… the tool bar is not showing… help please
-
thanks
-
from tkinter import *
def doNothing():
print("Ok, ok I won't!")root = Tk()
# * Main menu * #
menu = Menu(root, tearoff = False)
root.config(menu = menu)subMenu = Menu(menu, tearoff = False)
menu.add_cascade(label = "File", menu = subMenu)
subMenu.add_command(label = "New project", command = doNothing)
subMenu.add_command(label = "New…", command = doNothing)
subMenu.add_separator()
subMenu.add_command(label = "Exit", command = root.destroy)
editMenu = Menu(menu, tearoff = False)
menu.add_cascade(label = "Edit", menu = editMenu)
editMenu.add_command(label = "Redo", command = doNothing)
# * Toolbar * #
toolbar = Frame(root, bg = "blue")
insertButt = Button(toolbar,
text = "Insert image",
command = doNothing).pack(side = LEFT, padx = 2, pady = 2)printButt = Button(toolbar,
text = "Print",
command = doNothing).pack(side = LEFT, padx = 2, pady = 2)toolbar.pack(side = TOP, fill = X)
root.mainloop()
-
How do you get columnspan for .grid function to expand all the way across the X axis? I only ask because apparently Tkinter doesn't like mixing .grid and .pack.
-
how do you get it to fill x and y axis
-
thanks for the tutorials bucky, i've already managed to create my own little text editor which can actually function.
-
THANK YOU! But how do i add image to my buttons in toolbar?
-
Hmm! I have been noticing, your videos got degraded from 1080p to 720p. 1080p was so better, clear and crisp.
-
How would I be able to place the toolbar with '.grid()' ?? and still have it 'fill=X'?
-
lol nice. insert butt(on), pack it in… 3:50
I'm right there with you, buddy. I get bored doing code (ie: last night I got lazy and named all of my Assertion commands "ass")
Keeps things light-hearted.Good video by the way. I've never made a gui before so this is fun.
-
Just a little FYI, for anybody that gets tired to the root window small dimensions.
root = Tk()
root.geometry("500×300") whatever values you'd like. -
Thanks Bucky for good, useful stuff.
-
Good stuff +thenewboston. As always, your videos are entertaining and educational. Here is a small token of my appreciation: $5 via +ChangeTip
-
Not just cooking lessons that's full of double entendres.
Leave a Reply