473,398 Members | 2,212 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,398 software developers and data experts.

what is wrong with this program?

Ali
The following program is supposed to show a menu but it isnt showing
the drop down menus. It only shows the File and Help thing.

from Tkinter import *

def callback:
print "Alhumdulillah

root = Tk()

#create menu

m = Menu(root)
root.config(menu=m)

filemenu = add_cascade(label="File", menu="filemenu")
filemenu.add_command(label="New", command=callback)
filemenu.add_separator()
filemenu.add_command(label="Quit", command=callback)

helpmenu = Menu(m)
m.add_cascade(label="Help", menu="helpmenu")
helpmenu.add_command(label="About", command=callback)

root.mainloop()

please help me fix it
Jul 18 '05 #1
3 1408
Ali wrote:
The following program is supposed to show a menu but it isnt showing
the drop down menus. It only shows the File and Help thing.


The code you posted doesn't even run. Copy and paste the *exact code*
that you used, and maybe we can help.
Greg
Jul 18 '05 #2

"Ali" <al**********@hotmail.com> wrote in message
news:8f**************************@posting.google.c om...
The following program is supposed to show a menu but it isnt showing
the drop down menus. It only shows the File and Help thing.

from Tkinter import *

def callback:
print "Alhumdulillah

root = Tk()

#create menu

m = Menu(root)
root.config(menu=m)

filemenu = add_cascade(label="File", menu="filemenu")
filemenu.add_command(label="New", command=callback)
filemenu.add_separator()
filemenu.add_command(label="Quit", command=callback)

helpmenu = Menu(m)
m.add_cascade(label="Help", menu="helpmenu")
helpmenu.add_command(label="About", command=callback)

root.mainloop()

please help me fix it


Here is a working version, just compare to above should be quite
self explanitory, more help can be found on www.pythonware.com

---

from Tkinter import *

def callback():
print "Alhumdulillah"

root = Tk()

#create menu

m = Menu(root)

filemenu = Menu(m)
filemenu.add_command(label="New", command=callback)
filemenu.add_separator()
filemenu.add_command(label="Quit", command=callback)
m.add_cascade(label="File", menu=filemenu)

helpmenu = Menu(m)
helpmenu.add_command(label="About", command=callback)
m.add_cascade(label="Help", menu=helpmenu)

root.config(menu=m)
root.mainloop()

---

Hope this helps.

Adonis
Jul 18 '05 #3
Ali
Thank you
Jul 18 '05 #4

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

Similar topics

137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
5
by: titan0111 | last post by:
#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;
1
by: Qiangning Hong | last post by:
I decide to seperate my data collection routine from my data analysis and storage program to a seperate process, so I try to use the new subprocess model in Python 2.4. The main program spawns...
46
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
3
by: belton180 | last post by:
CODE]../* Program function: Simulate the stack using a stack limit of 10. Display a menu for the the following. Create a stack Insert an item in the stack Pop an item from the stack ...
20
by: Daniel.C | last post by:
Hello. I just copied this code from my book with no modification : #include <stdio.h> /* count characters in input; 1st version */ main() { long nc; nc = 0;
12
by: broli | last post by:
#include<stdio.h> #include<stdlib.h> struct point { double x, y, z;
4
by: hirsh.dan | last post by:
i have a functions that writes information to a file. inside that function i have a line in which i call another function. if this line is executed, nothing is written to the file, but if i remark...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.