Best Python code snippet using tox_python
output_visual.py
Source: output_visual.py
...88 self.down_prob.set("0%")89 base_ctx.update()90 self.down_label.place(x=down_pos[0] + 25, y=down_pos[1] + 25)91 self.up_label.place(x=up_pos[0] + 25, y=up_pos[1] + 25)92 def render_frame(self, state_frame, render_frame, prob):93 render_frame = np.copy(render_frame)94 # Update rendered probabilities95 percent_prob = prob * 10096 self.up_prob.set(f'{"{0:.2f}".format(percent_prob[0])}%')97 self.down_prob.set(f'{"{0:.2f}".format(percent_prob[1])}%')98 # Render game frame99 render_frame *= 256100 render_frame = cv2.resize(render_frame, (render_frame.shape[1] * self.IMAGE_UPSCALE, render_frame.shape[0] * self.IMAGE_UPSCALE))101 img = ImageTk.PhotoImage(image=Image.fromarray(render_frame))102 #self.base_ctx.itemconfig(self.img_id, image=img)103 self.base_ctx.create_image(self.IMAGE_X, self.canvas_height / 2, anchor="c", image=img)104 X = state_frame.reshape([1, state_frame.shape[0] * state_frame.shape[1]])105 # Render image weights106 image_activations = is_firing(state_frame.ravel())...
frame_building.py
Source: frame_building.py
...11 stats_frame: LabelFrame = LabelFrame(gui_root, text="Statistics", width=60, padx=5, pady=5)12 stats_frame.grid(row=0, column=0, padx=5, pady=5)13 for stat in range(len(STATISTIC_NAME)):14 settings[StatisticLink(stat)] = SettingField(stats_frame, STATISTIC_NAME[stat] + ":", row=stat, column=0)15def set_render_frame(gui_root: Tk, change_render_config: Callable, change_setting: Callable,16 render_config: RenderingConfig) -> RadioButtons:17 render_frame: LabelFrame = LabelFrame(gui_root, text="Render Settings", width=60, padx=5, pady=5)18 render_frame.grid(row=0, column=3, columnspan=2, rowspan=3, padx=5, pady=5)19 RenderSettings(render_frame, "Grid", change_render_config, render_config, "grid_render_mode", None, row=0, column=0)20 RenderSettings(render_frame, "Edge", change_render_config, render_config, "edge_render_mode", EDGE_SHADER_UNIFORM,21 row=1, column=0)22 RenderSettings(render_frame, "Node", change_render_config, render_config, "node_render_mode", NODE_SHADER_UNIFORM,23 row=2, column=0)24 class_setting_frame: LabelFrame = LabelFrame(render_frame, text="Class Visibility", width=60, padx=5, pady=5)25 class_setting_frame.grid(row=0, column=1, rowspan=3, padx=5, pady=5)26 class_show: IntVar = IntVar(value=0)27 show_class_names: List[str] = ["Independent", "All"]28 for class_id in range(9):29 show_class_names.append("Class " + str(class_id))...
render_setting.py
Source: render_setting.py
1from tkinter import LabelFrame, IntVar, Radiobutton, Button2from typing import List, Dict, Callable3from gui.general_setting import SettingEntry4from rendering.rendering_config import RenderingConfig5class RenderSettings:6 def __init__(self, root: LabelFrame, name: str, change_setting_func: Callable, config: RenderingConfig,7 render_mode: str, shader_settings: List[str] = None, row: int = 0, column: int = 0):8 self.name: str = name9 self.render_frame: LabelFrame = LabelFrame(root, text=self.name, width=60, padx=1, pady=1)10 self.render_mode: IntVar = IntVar(value=config[render_mode])11 self.render_radio_buttons: List[Radiobutton] = []12 self.shader_settings: Dict[str, SettingEntry] = dict()13 self.shader_setting_frame: LabelFrame = LabelFrame(self.render_frame, text="Shader Settings", padx=1, pady=1)14 def create_apply_func(function: Callable, inner_func: Callable) -> Callable:15 def command():16 function(inner_func)17 return command18 self.apply_settings: Button = Button(self.shader_setting_frame, text="Apply",19 command=create_apply_func(self.get_settings, change_setting_func))20 def create_radio_func(setting_value: int) -> Callable:21 def command():22 change_setting_func(render_mode, setting_value)23 return command24 for i, option in enumerate(config.selection_labels[render_mode]):25 self.render_radio_buttons.append(26 Radiobutton(self.render_frame, text=option, variable=self.render_mode, value=i,27 command=create_radio_func(i)))28 self.render_radio_buttons[i].grid(row=i, column=0)29 change_setting_func(self.name, config[render_mode])30 if shader_settings is not None:31 for i, setting in enumerate(shader_settings):32 self.shader_settings[setting] = SettingEntry(self.shader_setting_frame, config.shader_label[setting],33 config[setting], "float", i, 0)34 self.apply_settings.grid(row=len(self.shader_settings), column=0, columnspan=2)35 self.shader_setting_frame.grid(row=0, column=1, rowspan=len(self.render_radio_buttons), padx=1, pady=1)36 self.render_frame.grid(row=row, column=column, padx=1, pady=1)37 self.get_settings(change_setting_func)38 def get_settings(self, change_setting_func: Callable):39 for key, entry in self.shader_settings.items():...
Check out the latest blogs from LambdaTest on this topic:
I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.
The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).
Mobile devices and mobile applications – both are booming in the world today. The idea of having the power of a computer in your pocket is revolutionary. As per Statista, mobile accounts for more than half of the web traffic worldwide. Mobile devices (excluding tablets) contributed to 54.4 percent of global website traffic in the fourth quarter of 2021, increasing consistently over the past couple of years.
Even though several frameworks are available in the market for automation testing, Selenium is one of the most renowned open-source frameworks used by experts due to its numerous features and benefits.
JUnit is one of the most popular unit testing frameworks in the Java ecosystem. The JUnit 5 version (also known as Jupiter) contains many exciting innovations, including support for new features in Java 8 and above. However, many developers still prefer to use the JUnit 4 framework since certain features like parallel execution with JUnit 5 are still in the experimental phase.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!