1

I'm using justpy to make a small scale management system, its a framework for developing web apps in python without css/html/js. The menu displays itself but none of the buttons work.The following is the code I have so far:

import justpy as jp
class LoginPage(jp.WebPage):
 def __init__(self):
 super().__init__()
 form_div = jp.Div(classes='w-64 mx-auto mt-10', a=self)
 self.username_input = jp.Input(placeholder='Username', classes='w-full mb-2 p-2', a=form_div)
 self.password_input = jp.Input(placeholder='Password', type='password', classes='w-full mb-2 p-2', a=form_div)
 self.login_button = jp.Button(text='Login', classes='w-full bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded', a=form_div)
class MenuPage(jp.BaseWebPage):
 def __init__(self):
 super().__init__()
 self.menu = jp.Div(classes='flex justify-around p-4 bg-blue-500 text-white', a=self)
 self.login_button = jp.Button(text='LOGIN', classes='p-2 hover:bg-blue-700', a=self.menu, click=self.go_to_login)
 self.home_button = jp.Button(text='HOME', classes='p-2 hover:bg-blue-700', a=self.menu)
 self.forums_button = jp.Button(text='FORUMS', classes='p-2 hover:bg-blue-700', a=self.menu)
 self.help_button = jp.Button(text='HELP', classes='p-2 hover:bg-blue-700', a=self.menu)
 
 def go_to_login(self, msg):
 self.delete() # Remove the menu from the page
 a = LoginPage()
 a.show() # Add the login page to the page
jp.justpy(MenuPage)

I'm trying to create a dashboard with the menu options HOME, LOGIN, FORUMS, HELP. I have implemented the logic of the login button but can't get it to work. I can't get the LOGIN button to work, I tried making two different classes, one for the menu and the other for the login but still no luck. Open to all solutions

asked Sep 13, 2023 at 19:04

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.