
Comment what these codes do
import sys
# importing QtCore to use Qurl
from PyQt5.QtCore import *
# importing Widgets
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.browser = QWebEngineView()
self.browser.setUrl(QUrl('http://google.com'))
self.setCentralWidget(self.browser)
self.showMaximized()
navbar = QToolBar()
self.addToolBar(navbar)
back_btn = QAction('Back', self)
back_btn.triggered.connect(self.browser.back)
navbar.addAction(back_btn)
forward_btn = QAction('forward', self)
forward_btn.triggered.connect(self.browser.forward)
navbar.addAction(forward_btn)
reload_btn = QAction('Reload', self)
reload_btn.triggered.connect(self.browser.reload)
navbar.addAction(reload_btn)
home_btn = QAction('Home', self)
home_btn.triggered.connect(self.navigate_home)
navbar.addAction(home_btn)
self.url_bar = QLineEdit()
navbar.addWidget(self.url_bar)
self.url_bar.returnPressed.connect(self.navigate_to_url)
navbar.addWidget(self.url_bar)
self.browser.urlChanged.connect(self.update_url)
def navigate_home(self):
self.browser.setUrl(QUrl('http://google.com'))
def navigate_to_url(self):
url = self.url_bar.text()
self.browser.setUrl(QUrl(url))
def update_url(self, q):
self.url_bar.setText(q.toString())
app = QApplication(sys.argv)
QApplication.setApplicationName('lolol')
window = MainWindow()
app.exec_()

Step by stepSolved in 2 steps

- 4 Java onlyarrow_forwarddo it fastarrow_forwardimport bridges.base.ColorGrid;import bridges.base.Color;public class Scene {/* Creates a Scene with a maximum capacity of Marks andwith a background color.maxMarks: the maximum capacity of MarksbackgroundColor: the background color of this Scene*/public Scene(int maxMarks, Color backgroundColor) {}// returns true if the Scene has no room for additional Marksprivate boolean isFull() {return false;}/* Adds a Mark to this Scene. When drawn, the Markwill appear on top of the background and previously added Marksm: the Mark to add*/public void addMark(Mark m) {if (isFull()) throw new IllegalStateException("No room to add more Marks");}/*Helper method: deletes the Mark at an index.If no Marks have been previously deleted, the methoddeletes the ith Mark that was added (0 based).i: the index*/protected void deleteMark(int i) {}/*Deletes all Marks from this Scene thathave a given Colorc: the Color*/public void deleteMarksByColor(Color c) {}/* draws the Marks in this Scene over a background…arrow_forward
- . Protected variables coth Task 1.1: Base Animai Create Animal Class with 3 protected attributes: • name - String • type-String • nocturnal - boolean • 4 public void Methods: • printInfo-should print: " is a(n) ." • printSleepInfo-should print: "s sleep during day." or "s sleep during night." • printRoam - should print: " walks around." • printFeed method - will implement in subclasses ● Subclass Owl: Constructor takes in name as argument and sets the attributes: • Type should be "Owl", nocturnal should be true and name is given as the argument ia printFeed method: • Should print "You give some mice." Overriding roam method: • Should print " flies around." Subclass Monkey: • Similar constructor: • Type should be "Monkey", nocturnal should be false and name is given as the argument printFeed method: Should print "You give some bananas." Create another public method called printClimb: Should print " climbs a tree!" Overriding roam method of owl as owls fly Animal printInfo():void…arrow_forwardZybooks SDEV 255 2.1.1 Objects Define a method named orderOfAppearance() that takes the name of a role as an argument and returns that role's order of appearance. If the role is not found, the method returns 0. Ex: orderOfAppearance("Elizabeth Swann") returns 3. Hint: A method may access the object's properties using the keyword this. Ex: this.title accesses the object's title property. // Code will be tested with different roles and movieslet movie = { title: "Pirates of the Caribbean: At World's End", director: "Gore Verbinski", composer: "Hans Zimmer", roles: [ // Roles are stored in order of appearance "Jack Sparrow", "Will Turner", "Elizabeth Swann", "Hector Barbossa" ], orderOfAppearance: function(role) { }}; There is a Lord of the rings test that tests orderOfAppearance for "Saruman" but it is not shown. Heres my current code i tried if(role!==this.orderOfAppearance[role]) return "3"; else return…arrow_forwardWrite the LCSMatrix.java: import java.util.*; // Your code here // - Import any required additional packages // - Declare any desired classes to be used by LCSMatrix public class LCSMatrix { private int rowCount; private int columnCount; // // Your code here // public LCSMatrix(String str1, String str2) { this.rowCount = (int) str1.length(); this.columnCount = (int) str2.length(); // Your code here } // Your code here, if needed // Returns the number of columns in the matrix, which also equals the length // of the second string passed to the constructor. public int getColumnCount() { return columnCount; } // Returns the matrix entry at the specified row and column indices, or 0 if // either index is out of bounds. public int getEntry(int rowIndex, int columnIndex) { // Your code here (remove placeholder line below) return 0; } // Returns the number of rows in the matrix, which also equals the length // of the first string passed to the constructor.…arrow_forward
- 1 Java onlyarrow_forwardPython please. Starter code: from player import Playerdef does_player_1_win(p1_hand, p2_hand):#given both player-hands, does player 1 win? -- return True or Falsedef main():# Create players# Have the players play repeatedly until one wins enough timesmain() #you might need something hereclass Player: # player for Rock, Paper, Scissors# ADD constructor, init PRIVATE attributes# ADD method to get randomly-generated "hand" for player# ADD method to increment number of wins for player# ADD method to reset wins to 0# ADD getters & setters for attributesarrow_forwardfrom collections import namedtuple #----------------------------------------------------------------------- class Person(): # Stores info about a single person # Created when an Individual (INDI) GEDCOM record is processed. #------------------------------------------------------------------- def __init__(self,ref): # Initializes a new Person object, storing the string (ref) by # which it can be referenced. self._id = ref self._asSpouse = [] # use a list to handle multiple families self._asChild = None def addName(self, names): # Extracts name parts from a list of names and stores them self._given = names[0] self._surname = names[1] self._suffix = names[2] def addIsSpouse(self, famRef): # Adds the string (famRef) indicating family in which this person # is a spouse, to list of any other such families self._asSpouse.append(famRef) def addIsChild(self,…arrow_forward
- python: class Student:def __init__(self, first, last, gpa):self.first = first # first nameself.last = last # last nameself.gpa = gpa # grade point average def get_gpa(self):return self.gpa def get_last(self):return self.last class Course:def __init__(self):self.roster = [] # list of Student objects def add_student(self, student):self.roster.append(student) def course_size(self):return len(self.roster) # Type your code here if __name__ == "__main__":course = Course()course.add_student(Student('Henry', 'Nguyen', 3.5))course.add_student(Student('Brenda', 'Stern', 2.0))course.add_student(Student('Lynda', 'Robison', 3.2))course.add_student(Student('Sonya', 'King', 3.9)) student = course.find_student_highest_gpa()print('Top student:', student.first, student.last, '( GPA:', student.gpa,')')arrow_forwardJAVA PPROGRAM ASAP Please Modify this program ASAP BECAUSE IT IS MY LAB ASSIGNMENT so it passes all the test cases. It does not pass the test cases when I upload it to Hypergrade. Because RIGHT NOW IT PASSES 0 OUT OF 1 TEST CASES. I have provided the failed the test cases and the inputs as a screenshot. The program must pass the test case when uploaded to Hypergrade. import java.util.Scanner;// creating class WordCounterpublic class WordCounter{ public static void main(String[] args) { // creating a scanner object Scanner sc = new Scanner(System.in); // if while loop is true while (true) { // then enter a string System.out.print("Please enter a string or type QUIT to exit:\n"); // Taking string as user input String str = sc.nextLine(); // if user enters quit then ignore the case if (str.equalsIgnoreCase("QUIT")) { break; } // Counting the…arrow_forward22arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





