472,328 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

How to place menu on the bottom

#!/usr/bin/env python

import sys
import os

from tkinter import *

def callback(self):
#int this snippet, all menu entries use the same callback...
print("callback")
class DemoMenu():
def __init__(self):
self.dataTemp = ""
self.createWidgets()

def createWidgets(self): # create application GUI
self.rootWin = Tk()
self.rootWin.minsize(width=800, height=600)
self.rootWin.maxsize(width=800, height=600)
self.rootWin.title = ("JoeQ Menu test...")

self.mainFrame = Frame(self.rootWin)

self.createMenu()

def createMenu(self): # create menu
menuFrame = Frame(self.rootWin)
menuFrame.pack(side=BOTTOM, fill=X)

menuBar = Menu(menuFrame, tearoff=1)

filemenu = Menu(menuBar, tearoff=0)
filemenu.add_command(label="Open...", command=callback)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=callback)

menuBar.add_cascade(label="File", menu=filemenu)

self.rootWin.config(menu=menuBar)

return menuBar

def start(self):
self.rootWin.mainloop()
if __name__ == '__main__':
demomenu = DemoMenu()
demomenu.start()
################################################## ####
I want to place the menu on the bottom (menuFrame.pack(side=BOTTOM,
fill=X)). But it does not work. Why?
Aug 30 '08 #1
3 1345
qx******@yahoo.cn wrote:
self.rootWin.config(menu=menuBar)
I want to place the menu on the bottom (menuFrame.pack(side=BOTTOM,
fill=X)). But it does not work. Why?
menubars that are configured via the window menu option are rendered by
the underlying window system.

to create a stand-alone menu bar, create a frame and pack or grid it
where you want it, then add Menubutton widgets to it, and attach your
pulldown menus to those buttons.

the following wrapper supports both menu styles; look at the "else"
clauses in the various "if use_native_menus" statements for code samples:

http://svn.effbot.org/public/stuff/s...nter/tkMenu.py

</F>

Aug 30 '08 #2
On Aug 30, 6:04*pm, Fredrik Lundh <fred...@pythonware.comwrote:
qxyue...@yahoo.cn wrote:
* * * * self.rootWin.config(menu=menuBar)
I want to place the menu on the bottom (menuFrame.pack(side=BOTTOM,
fill=X)). But it does not work. Why?

menubars that are configured via the window menu option are rendered by
the underlying window system.

to create a stand-alone menu bar, create a frame and pack or grid it
where you want it, then add Menubutton widgets to it, and attach your
pulldown menus to those buttons.

the following wrapper supports both menu styles; look at the "else"
clauses in the various "if use_native_menus" statements for code samples:

http://svn.effbot.org/public/stuff/s...nter/tkMenu.py

</F>
step1: I first create a widget "menuFrame" which is belong to the
rootWin
....menuFrame = Frame(self.rootWin)
step2: then I put the widget to the bottom of the rootWin
....menuFrame.pack(side=BOTTOM, fill=X)
step3: I create a menu belong to the menuFrame.
....menuBar = Menu(menuFrame, tearoff=1)
since menuFrame should be placed to the bottom, so does the menuBar in
my opinion. What the problem is?
Aug 30 '08 #3
qx******@yahoo.cn wrote:
What the problem is?
the menu is drawn by the window system when you use the "menu" option,
not by Tkinter.

</F>

Aug 30 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Veerle | last post by:
Hi, I have a menu at my page. This menu is at the top of my page and at the bottom of my page. The html for this menu is the same for the top...
2
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net...
0
by: Garmt de Vries-Uiterweerd | last post by:
X-posted to opera.page-authoring, because this is a bit Opera-specific for the moment. F'up to ciwas. I am playing around with dedicated...
1
by: Edward | last post by:
I created a simple CSS layout (code and example below) for bloggin/writing but ran into five issues that I need help with: 1. How do I get rid of...
2
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the...
0
by: mjohnson0321 | last post by:
I am trying to incorporate a CSS drop-down menu into a site (suckerfish menu). The menu gets lost behind the content below it, but only on one of...
1
by: CKich30 | last post by:
When viewing my page (siuehockey.net) in Firefox, it's setup how I want it to look. When i viewed it using IE, the menu at the top runs into the...
7
by: milestogofromhere | last post by:
It is late so this is probably something really obvious but I am not seeing it. Can someone please help? Here is the page in question: html -...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.