473,395 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 1389
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 menu and for the bottom menu, I only gave them a...
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 "main" The code is below: Thanks in advance...
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 but could work at...
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 styling for the projection media type.. Currently the...
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 the right-margin red line on the last three...
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 sub-catagories all appear to the right as they...
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 the drop downs (News). The error occurs on all 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 "Cougar Hockey/cougarhockey.net" at the top left....
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 - http://www.itsyourplate.com/index2.php css -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.