Re: how to use tkinter widget in django
On 10/26/2010 7:17 AM, jimgardener wrote:
> is it possible to use the sliderlike Scale widget from tkinter in
> django?I am coding a web app where I need to get a numerical value
> entered by the user.I thought ,instead of asking the user to enter a
> value in a textfield ,I would provide a slider which he can move
> between the minimum and maximum values.
> Originally I designed the model and form like this
>
> class MyModel(django.models.Model):
> user_enrty=models.IntegerField()
>
> class MyModelForm(django.forms.ModelForm):
> class Meta:
> model=MyModel
>
> In tkinter ,I can create a scale widget like
> master = Tk()
> w = Scale(master, from_=0, to=100)
> w.pack()
> and get the current position using w.get()
>
> How can I use this in django?Can I directly put the tkinter widget in
> my model like ,
> class MyModel(django.models.Model):
> user_enrty=tkinter.Scale(...)
>
Unfortunately you cannot do this. Tkinter assumes direct control of the
desktop, whereas Django is a web system that must use HTML (or similar)
to deliver markup to the user's desktop using HTTP. Tkinter just isn't a
web technology.
regards
Steve
--
DjangoCon US 2010 September 7-9 http://djangocon.us/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home